MCPcopy Index your code
hub / github.com/GStreamer/gst-python / main

Function main

old_examples/helloworld.py:23–51  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

21 return True
22
23def main(args):
24 if len(args) != 2:
25 sys.stderr.write("usage: %s <media file or uri>\n" % args[0])
26 sys.exit(1)
27
28 playbin = gst.element_factory_make("playbin2", None)
29 if not playbin:
30 sys.stderr.write("'playbin2' gstreamer plugin missing\n")
31 sys.exit(1)
32
33 # take the commandline argument and ensure that it is a uri
34 if gst.uri_is_valid(args[1]):
35 uri = args[1]
36 else:
37 uri = gst.filename_to_uri(args[1])
38 playbin.set_property('uri', uri)
39
40 # create and event loop and feed gstreamer bus mesages to it
41 loop = gobject.MainLoop()
42
43 bus = playbin.get_bus()
44 bus.add_watch(bus_call, loop)
45
46 # start play back and listed to events
47 playbin.set_state(gst.STATE_PLAYING)
48 loop.run()
49
50 # cleanup
51 playbin.set_state(gst.STATE_NULL)
52
53if __name__ == '__main__':
54 sys.exit(main(sys.argv))

Callers 1

helloworld.pyFile · 0.70

Calls 2

set_propertyMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected