def _setup_item(self, iteminfo): self.stop() self.destroy_playbin() self.build_playbin() self.enabled_track = None self.iteminfo = iteminfo self.playbin.set_property("uri", gstutil._get_file_url(iteminfo.video_path))
def _setup_item(self, iteminfo): self.stop() self.destroy_playbin() self.build_playbin() self.enabled_track = None self.iteminfo = iteminfo self.playbin.set_property("uri", gstutil._get_file_url(iteminfo.video_path))
def paused_reached(self): self.saw_video_tag = False self.saw_audio_tag = False if not self.first_pause: return False self.first_pause = True current_video = self.pipeline.get_property("current-video") current_audio = self.pipeline.get_property("current-audio") if current_video == 0: self.saw_video_tag = True if current_audio == 0: self.saw_audio_tag = True if not self.saw_video_tag and self.saw_audio_tag: # audio only logging.info("audio only... calling done()") self.audio_only = True self.duration = self.get_duration(self.pipeline) self.success = True self.disconnect() self.done() return False if not self.saw_video_tag and not self.saw_audio_tag: logging.info("no audio or video... calling done()") # no audio and no video self.audio_only = False self.disconnect() self.done() return False self.duration = self.get_duration(self.pipeline) self.grabit = True self.buffer_probes = {} fileurl = gstutil._get_file_url(self.filename) self.thumbnail_pipeline = gst.parse_launch( 'filesrc location="%s" ! decodebin ! ' 'ffmpegcolorspace ! video/x-raw-rgb,depth=24,bpp=24 ! ' 'fakesink signal-handoffs=True' % fileurl) self.thumbnail_bus = self.thumbnail_pipeline.get_bus() self.thumbnail_bus.add_signal_watch() self.thumbnail_watch_id = self.thumbnail_bus.connect( "message", self.on_bus_message) self.thumbnail_pipeline.set_state(gst.STATE_PAUSED) return False
def __init__(self, filename): self.done = Event() self.success = False self.playbin = gst.element_factory_make('playbin') self.videosink = gst.element_factory_make("fakesink", "videosink") self.playbin.set_property("video-sink", self.videosink) self.audiosink = gst.element_factory_make("fakesink", "audiosink") self.playbin.set_property("audio-sink", self.audiosink) self.bus = self.playbin.get_bus() self.bus.add_signal_watch() self.watch_id = self.bus.connect("message", self.on_bus_message) self.playbin.set_property("uri", gstutil._get_file_url(filename)) self.playbin.set_state(gst.STATE_PAUSED)
def __init__(self, filename): self.done = Event() self.success = False self.playbin = gst.element_factory_make('playbin') self.videosink = gst.element_factory_make("fakesink", "videosink") self.playbin.set_property("video-sink", self.videosink) self.audiosink = gst.element_factory_make("fakesink", "audiosink") self.playbin.set_property("audio-sink", self.audiosink) self.bus = self.playbin.get_bus() self.bus.add_signal_watch() self.watch_id = self.bus.connect("message", self.on_bus_message) self.playbin.set_property("uri", gstutil._get_file_url(filename)) self.playbin.set_state(gst.STATE_PAUSED)
def _setup_initial_subtitles(self, sub_filename): sub_index = -1 if app.config.get(prefs.ENABLE_SUBTITLES) and self.supports_subtitles and not sub_filename: tracks = self.get_subtitles() if 100 in tracks: # Select default sidecar file sub_filename = tracks[100][1] sub_index = 0 self.enabled_track = 100 elif 0 in tracks: # Select default embedded subtitle track sub_index = 0 self.enabled_track = 0 if sub_filename and self.playbin: self.playbin.set_property("suburi", gstutil._get_file_url(sub_filename)) if sub_index > -1: flags = self.playbin.get_property("flags") self.playbin.set_properties(flags=flags | GST_PLAY_FLAG_TEXT, current_text=sub_index)
def _setup_initial_subtitles(self, sub_filename): sub_index = -1 if (app.config.get(prefs.ENABLE_SUBTITLES) and self.supports_subtitles and not sub_filename): tracks = self.get_subtitles() if 100 in tracks: # Select default sidecar file sub_filename = tracks[100][1] sub_index = 0 self.enabled_track = 100 elif 0 in tracks: # Select default embedded subtitle track sub_index = 0 self.enabled_track = 0 if sub_filename: self.playbin.set_property("suburi", gstutil._get_file_url(sub_filename)) if sub_index > -1: flags = self.playbin.get_property('flags') self.playbin.set_properties(flags=flags | GST_PLAY_FLAG_TEXT, current_text=sub_index)