Class VideoFileSource

  • All Implemented Interfaces:
    Pausable

    public class VideoFileSource
    extends Source
    implements Pausable
    A source for a video file input.
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from class: Source
        This is used by the GUI to distinguish different sources. For example, ImageFileSource returns the filename of the image.
        Specified by:
        getName in class Source
        Returns:
        The name of this source.
      • updateOutputSockets

        protected boolean updateOutputSockets()
        Description copied from class: Source
        This method will check if there are any pending updates to output sockets. If there are any, update the sockets and then return true. If there are no updates this function should return false.
        Specified by:
        updateOutputSockets in class Source
        Returns:
        true if there are updates ready to be moved into the socket.
      • getProperties

        public java.util.Properties getProperties()
        Description copied from class: Source
        This is used for serialization/deserialization.
        Specified by:
        getProperties in class Source
        Returns:
        A Properties containing data that can be used to re-create this source.
      • initialize

        public void initialize()
                        throws java.io.IOException
        Description copied from class: Source
        Initializes the source. This should not try to handle initialization exceptions. Instead, the Source.initializeSafely() should report the problem with initializing to the exception witness.
        Specified by:
        initialize in class Source
        Throws:
        java.io.IOException - if the source could not be initialized
      • currentFrameProperty

        public Observable<java.lang.Integer> currentFrameProperty()
        Gets an observable value for the current frame number of the video file this source is providing.
      • getFrameCount

        public int getFrameCount()
        Gets the number of frames in the video file. This is a best guess and may not always be accurate.
      • setFrame

        public void setFrame​(int frameNumber)
        Sets the frame grabber to the given frame number. This will pause frame grabber from reading successive frames; it can be resumed with Pausable.resume(). This runs asynchronously and will complete at some point in the future after this method is called.
        Parameters:
        frameNumber - the number of the frame to grab
        Throws:
        java.lang.IllegalArgumentException - if frameNumber is negative or exceeds the number of frames in the video file
      • getFramePosition

        public int getFramePosition()
        Gets the current frame number.
        Returns:
        the current frame number
      • pausedProperty

        public Observable<java.lang.Boolean> pausedProperty()
        Description copied from interface: Pausable
        Gets a property describing the current state of the pausable.
        Specified by:
        pausedProperty in interface Pausable
      • onSourceRemoved

        public void onSourceRemoved​(SourceRemovedEvent sourceRemovedEvent)