Ejemplo n.º 1
0
 def stop_playback(self):
     """
     Stops playback from current producer
     """
     self.ticker.stop_ticker()
     self.producer.set_speed(0)
     updater.update_frame_displayers(self.producer.frame())
Ejemplo n.º 2
0
    def seek_and_get_rgb_frame(self, frame, update_gui=True):
        # Force range
        length = self.get_active_length()
        if frame < 0:
            frame = 0
        elif frame >= length:
            frame = length - 1

        self.producer.set_speed(0)
        self.producer.seek(frame)

        # GUI update path starts here.
        # All user or program initiated seeks go through this method.
        if update_gui:
            updater.update_frame_displayers(frame)

        frame = self.producer.get_frame()
        # And make sure we deinterlace if input is interlaced
        frame.set("consumer_deinterlace", 1)

        # Now we are ready to get the image and save it.
        rgb = frame.get_image(int(mlt.mlt_image_rgb24a),
                              int(self.profile.width()),
                              int(self.profile.height()))
        return rgb
Ejemplo n.º 3
0
 def stop_playback(self):
     """
     Stops playback from current producer
     """
     self.ticker.stop_ticker()
     self.producer.set_speed(0)
     updater.update_frame_displayers(self.producer.frame())
Ejemplo n.º 4
0
    def stop_playback(self):
        """
        Stops playback from current producer
        """
        self.loop_start = -1  # User possibly goes into marks looping but stops without Control key.
        self.loop_end = -1
        self.is_looping = False

        self.ticker.stop_ticker()
        self.producer.set_speed(0)
        updater.update_frame_displayers(self.producer.frame())
Ejemplo n.º 5
0
    def _ticker_event(self):

        # Stop ticker if playback has stopped.
        if (self.consumer.is_stopped() or self.producer.get_speed() == 0):
            self.ticker.stop_ticker()

        current_frame = self.producer.frame()

        # Stop rendering if last frame reached.
        if self.is_rendering == True and current_frame >= self.render_stop_frame:
            self.stop_rendering()
            return

        # If we're currently rendering, set progress bar and exit event handler.
        if self.is_rendering:
            if (self.producer.get_length() - 1) < 1:
                render_fraction = 1.0
            else:
                render_fraction = (
                    (float(current_frame - self.render_start_frame)) /
                    (float(self.render_stop_frame - self.render_start_frame)))
            self.render_gui_update_count = self.render_gui_update_count + 1
            if self.render_gui_update_count % 8 == 0:  # we need quick updates for stop accuracy, but slower gui updating
                self.render_gui_update_count = 1
                Gdk.threads_enter()
                self.render_callbacks.set_render_progress_gui(render_fraction)
                Gdk.threads_leave()
            return

        # If we're out of active range seek end.
        if current_frame >= self.get_active_length():
            Gdk.threads_enter()
            self.seek_frame(current_frame)
            Gdk.threads_leave()
            return

        # If trim looping and past loop end, start from loop start
        if ((not (self.loop_start == -1))
                and ((current_frame >= self.loop_end) or
                     (current_frame >= self.get_active_length()))):
            self.seek_frame(self.loop_start,
                            False)  #NOTE: False==GUI not updated
            self.producer.set_speed(1)

        Gdk.threads_enter()
        # If prefs set and frame out tline view, move tline view
        range_moved = updater.maybe_move_playback_tline_range(
            current_frame)  # range_moved given just to avoid two updates
        if range_moved == False:
            # Just display tline
            updater.update_frame_displayers(current_frame)
        Gdk.threads_leave()
Ejemplo n.º 6
0
    def _ticker_event(self):
            
        # Stop ticker if playback has stopped.
        if (self.consumer.is_stopped() or self.producer.get_speed() == 0):
            self.ticker.stop_ticker()

        current_frame = self.producer.frame()
        
        # Stop rendering if last frame reached.
        if self.is_rendering == True and current_frame >= self.render_stop_frame:
            self.stop_rendering()
            return

        # If we're currently rendering, set progress bar and exit event handler.
        if self.is_rendering:
            if (self.producer.get_length() - 1) < 1:
                render_fraction = 1.0
            else:
                render_fraction = ((float(current_frame - self.render_start_frame)) / 
                  (float(self.render_stop_frame - self.render_start_frame)))
            self.render_gui_update_count = self.render_gui_update_count + 1
            if self.render_gui_update_count % 8 == 0: # we need quick updates for stop accuracy, but slower gui updating
                self.render_gui_update_count = 1
                Gdk.threads_enter()
                self.render_callbacks.set_render_progress_gui(render_fraction)
                Gdk.threads_leave()
            return 

        # If we're out of active range seek end.
        if current_frame >= self.get_active_length():
            Gdk.threads_enter()
            self.seek_frame(current_frame)
            Gdk.threads_leave()
            return

        # If trim looping and past loop end, start from loop start
        if ((not(self.loop_start == -1)) and 
            ((current_frame >= self.loop_end)
            or (current_frame >= self.get_active_length()))):
            self.seek_frame(self.loop_start, False) #NOTE: False==GUI not updated
            self.producer.set_speed(1)
        
        Gdk.threads_enter()
        # If prefs set and frame out tline view, move tline view
        range_moved = updater.maybe_move_playback_tline_range(current_frame) # range_moved given just to avoid two updates
        if range_moved == False:
            # Just display tline
            updater.update_frame_displayers(current_frame)
        Gdk.threads_leave()
Ejemplo n.º 7
0
    def seek_frame(self, frame, update_gui=True):
        # Force range
        length = self.get_active_length()
        if frame < 0:
            frame = 0
        elif frame >= length:
            frame = length - 1

        self.producer.set_speed(0)
        self.producer.seek(frame) 

        # GUI update path starts here.
        # All user or program initiated seeks go through this method.
        if update_gui:
            updater.update_frame_displayers(frame)
Ejemplo n.º 8
0
    def seek_frame(self, frame, update_gui=True):
        # Force range
        length = self.get_active_length()
        if frame < 0:
            frame = 0
        elif frame >= length:
            frame = length - 1

        self.producer.set_speed(0)
        self.producer.seek(frame) 

        # GUI update path starts here.
        # All user or program initiated seeks go through this method.
        if update_gui:
            updater.update_frame_displayers(frame)
Ejemplo n.º 9
0
    def seek_and_get_rgb_frame(self, frame, update_gui=True):
        # Force range
        length = self.get_active_length()
        if frame < 0:
            frame = 0
        elif frame >= length:
            frame = length - 1

        self.producer.set_speed(0)
        self.producer.seek(frame) 

        # GUI update path starts here.
        # All user or program initiated seeks go through this method.
        if update_gui:
            updater.update_frame_displayers(frame)
            
        frame = self.producer.get_frame()
        # And make sure we deinterlace if input is interlaced
        frame.set("consumer_deinterlace", 1)

        # Now we are ready to get the image and save it.
        size = (self.profile.width(), self.profile.height())
        rgb = frame.get_image(mlt.mlt_image_rgb24a, *size) 
        return rgb