def pause(self): self._wait_no_more_pads() gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PAUSED) if self.sound: self.sound.pause() else: self._start_time = time.time() - self._start_time self.playing = False
def __init__(self, filename, file): super(GstreamerOpenALStreamingMedium, self).__init__() self.filename = filename self.file = file # Set up a decoder pipeline just enough to determine if there's # sound/video in the medium. The pipeline is otherwise unused. self._pipeline = self._create_decoder_pipeline(filename, file) gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PLAYING)
def play(self): instances.append(self) self._wait_no_more_pads() gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PLAYING) if self.sound: self.sound.play() else: self._start_time = time.time() - self._start_time self.playing = True
def __init__(self, filename, file): super(GstreamerOpenALStreamingSound, self).__init__() self._pipeline = self._create_decoder_pipeline(filename, file) self.sink = gst.gst_element_factory_make('openalstreamingsink', 'sink') gst.gst_bin_add(self._pipeline, self.sink) gst.gst_element_link(self.convert, self.sink) gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PAUSED)
def __init__(self, filename, file=None): super(GstreamerOpenALStaticMedium, self).__init__() self._pipeline = self._create_decoder_pipeline(filename, file) self._sink = gst.gst_element_factory_make('openalstaticsink', 'sink') gst.gst_bin_add(self._pipeline, self._sink) gst.gst_element_link(self.convert, self._sink) self._element = OpenALStaticSinkElement.get_instance(self._sink) self._element.init() gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PLAYING)
def __init__(self, filename, file): super(GstreamerOpenALStreamingVideo, self).__init__() # Block frame format until width/height arrives self._frame_format_semaphore = threading.Semaphore(0) self._pipeline = self._create_decoder_pipeline(filename, file) self.sink = gst.gst_element_factory_make('openalstreamingsink', 'sink') gst.gst_bin_add(self._pipeline, self.sink) gst.gst_element_link(self.convert, self.sink) self.videoconvert = \ gst.gst_element_factory_make('ffmpegcolorspace', 'videoconvert') gst.gst_bin_add(self._pipeline, self.videoconvert) gst.gst_element_link(self.videoconvert, self.sink) gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PAUSED) self._frames = [] # queued upcoming video frames self._last_frame_timestamp = 0.
def _no_more_pads_deferred(self): gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_NULL) gst.gst_object_unref(self._pipeline)
def pause(self): super(GstreamerOpenALStreamingSound, self).pause() gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PAUSED)
def play(self): instances.append(self) super(GstreamerOpenALStreamingSound, self).play() gst.gst_element_set_state(self._pipeline, gstreamer.GST_STATE_PLAYING)
def _destroy_pipeline(self, pipeline): gst.gst_element_set_state(pipeline, gstreamer.GST_STATE_NULL) gst.gst_object_unref(pipeline) del self._no_more_pads_func del self._new_decoded_pad_func