Class MovieWriter

  • All Implemented Interfaces:
    java.lang.Cloneable, javax.media.ControllerListener, javax.media.datasink.DataSinkListener, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class MovieWriter
    extends Sink
    implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener
    This actor writes a video file (MPEG, AVI, or Quicktime). It receives JMFImageTokens at the input, and queues them up for writing.

    The file is specified by the fileName attribute using any form acceptable to FileParameter.

    If the confirmOverwrite parameter has value false, then this actor will overwrite the specified file if it exists without asking. If true (the default), then if the file exists, then this actor will ask for confirmation before overwriting.

    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    James Yeh
    See Also:
    FileParameter
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • confirmOverwrite

        public Parameter confirmOverwrite
        If false, then overwrite the specified file if it exists without asking. If true (the default), then if the file exists, ask for confirmation before overwriting.
      • fileOrURL

        public FileParameter fileOrURL
        The file name or URL from which to read. This is a string with any form accepted by File Attribute. The initial default value is the string "$TMPDIR/movieOut.mov";
        See Also:
        FileParameter
      • fileType

        public StringAttribute fileType
        The type of file to write. There are three different file types that this actor can write. They are AVI, MPEG, and QUICKTIME.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        An attempt is made to acquire the file name. If it is successful, create the DataSource that encapsulates the file.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the URL is null, or invalid.
      • controllerUpdate

        public void controllerUpdate​(javax.media.ControllerEvent event)
        The controller listener. This method controls the initializing of the processor.
        Specified by:
        controllerUpdate in interface javax.media.ControllerListener
        Parameters:
        event - The controller event.
      • dataSinkUpdate

        public void dataSinkUpdate​(javax.media.datasink.DataSinkEvent event)
        The data sink listener. This method controls the closing of the data sink. It closes the data sink when it detects that the stream has ended.
        Specified by:
        dataSinkUpdate in interface javax.media.datasink.DataSinkListener
        Parameters:
        event - The controller event.
      • _waitForFileDone

        protected boolean _waitForFileDone()
                                    throws IllegalActionException
        Wait for the file to be written.
        Returns:
        true if the file was successfully written.
        Throws:
        IllegalActionException - If there is a problem blocking the processor until the state transition is completed.
      • _waitForState

        protected boolean _waitForState​(javax.media.Processor processor,
                                        int state)
                                 throws IllegalActionException
        Block until the processor has transitioned to the given state.
        Parameters:
        processor - The processor .
        state - The state.
        Returns:
        false if the transition failed.
        Throws:
        IllegalActionException - If there is a problem blocking the processor until the state transition is completed.