Esempio n. 1
0
    def __init__(self):
        self.xid = None
        self.mute_volume = None
        self.rate = 1.0
        # fullscreen Gtk.Window
        self.fullscreen_window = None
        self.fullscreen_drawable = None

        # Fullscreen timestamp display - cache data
        self.last_timestamp = 0
        self.last_timestamp_update = 0

        try:
            self.snapshotter = Snapshotter(
                self.snapshot_taken,
                width=config.data.player['snapshot-width'])
        except Exception as e:
            self.log("Could not initialize snapshotter:" + str(e))
            self.snapshotter = None

        self.fullres_snapshotter = None
        # This method has the following signature:
        # self.fullres_snapshot_callback(snapshot=None, message=None)
        # If snapshot is None, then there should be an explanation (string) in msg.
        self.fullres_snapshot_callback = None

        #self.snapshotter.start()

        # This method should be set by caller:
        self.snapshot_notify = None
        self.build_pipeline()

        self.caption = Caption()
        self.caption.text = ""
        self.caption.begin = -1
        self.caption.end = -1

        self.overlay = Caption()
        self.overlay.data = ''
        self.overlay.begin = -1
        self.overlay.end = -1

        self.videofile = None
        self.status = Player.UndefinedStatus
        self.current_position_value = 0
        self.stream_duration = 0
        self.position_update()
Esempio n. 2
0
    def async_fullres_snapshot(self, position, callback):
        """Take full-resolution snapshots.

        This method is not reentrant: as long as there is a call
        pending, it is not available for another position.
        """
        if self.fullres_snapshot_callback is not None:
            callback(message=_(
                "Cannot capture full-resolution snapshot, another capture is ongoing."
            ))
            return
        if self.fullres_snapshotter is None:
            # Initialise it.
            self.fullres_snapshotter = Snapshotter(self.fullres_snapshot_taken)
            self.fullres_snapshotter.set_uri(self.player.get_property('uri'))
        self.fullres_snapshot_callback = callback
        if not self.fullres_snapshotter.thread_running:
            self.fullres_snapshotter.start()
        self.fullres_snapshotter.enqueue(position)