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

Class Looper

old_examples/segments.py:18–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16import gobject
17
18class Looper (gobject.GObject):
19 __gproperties__ = {
20 "loop": (gobject.TYPE_BOOLEAN,
21 "loop",
22 "Whether to loop the segment",
23 False,
24 gobject.PARAM_READWRITE),
25 "start-pos": (gobject.TYPE_UINT64,
26 "start position",
27 "The segment start marker",
28 0,
29 0xfffffffffffffff, # max long possible
30 0,
31 gobject.PARAM_READWRITE),
32 "stop-pos": (gobject.TYPE_UINT64,
33 "stop position",
34 "The segment stop marker",
35 0,
36 0xfffffffffffffff, # max long possible
37 0,
38 gobject.PARAM_READWRITE),
39 } # __gproperties__
40
41 __gsignals__ = {
42 "stopped": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
43 "position-updated": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_FLOAT,)),
44 "error": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
45 } # __gsignals__
46
47 def __init__ (self, location = None):
48 gobject.GObject.__init__ (self)
49
50 self.__playbin = gst.element_factory_make ("playbin")
51 self.__playbin.props.video_sink = gst.element_factory_make ("fakesink")
52
53 bus = self.__playbin.get_bus ()
54 bus.add_watch (self.__on_bus_message)
55
56 self.__loop = False
57 self.__start_pos = 0
58 self.__stop_pos = 0
59
60 self.__timeout_id = 0
61
62 if location:
63 self.load (location)
64
65 def load (self, location):
66 self.__playbin.props.uri = location
67 self.__start_position = 0
68 self.__stop_position = 0
69
70 def set_segment (self, start, stop):
71 self.props.start_pos = start
72 self.props.stop_pos = stop
73
74 def play (self):
75 if not (self.__start_pos or self.__stop_pos):

Callers 1

segments.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected