(self, bus, message)
| 121 | return True |
| 122 | |
| 123 | def __on_bus_message (self, bus, message): |
| 124 | if message.type == gst.MESSAGE_ERROR: |
| 125 | error, debug = message.parse_error () |
| 126 | self.stop () # this looks neccessary here |
| 127 | self.emit ("error", (error, debug)) |
| 128 | |
| 129 | elif message.type == gst.MESSAGE_NEW_CLOCK: |
| 130 | # we connect the timeout handler here to be sure that further queries succeed |
| 131 | interval = int ((self.__stop_position - self.__start_position) / (2 * gst.SECOND) + 50) |
| 132 | self.__timeout_id = gobject.timeout_add (interval, self.__on_timeout) |
| 133 | |
| 134 | elif message.type == gst.MESSAGE_STATE_CHANGED: |
| 135 | old_state, new_state, pending = message.parse_state_changed () |
| 136 | if old_state == gst.STATE_READY and new_state == gst.STATE_PAUSED and message.src == self.__playbin: |
| 137 | self.__seek (self.__start_pos, self.__stop_pos, True) |
| 138 | |
| 139 | elif message.type == gst.MESSAGE_SEGMENT_DONE: |
| 140 | if self.__loop: |
| 141 | self.__seek (self.__start_pos, self.__stop_pos, False) |
| 142 | else: |
| 143 | src = self.__playbin.get_property ("source") |
| 144 | pad = src.get_pad ('src') |
| 145 | pad.push_event (gst.event_new_eos ()) |
| 146 | |
| 147 | # this is the good old way: |
| 148 | # |
| 149 | # pads = src.src_pads () |
| 150 | # while True: |
| 151 | # try: |
| 152 | # pad = pads.next () |
| 153 | # pad.push_event (gst.event_new_eos ()) |
| 154 | # except: |
| 155 | # break |
| 156 | |
| 157 | elif message.type == gst.MESSAGE_EOS: |
| 158 | self.stop () |
| 159 | |
| 160 | return True |
| 161 | |
| 162 | mainloop = gobject.MainLoop () |
| 163 |
nothing calls this directly
no test coverage detected