com.flagstone.transform.video
Class VideoFrame

java.lang.Object
  extended by com.flagstone.transform.video.VideoFrame
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, MovieTag

public final class VideoFrame
extends Object
implements MovieTag

VideoFrame contains the video data displayed in a single frame of a Flash movie (.swf).

Each frame of video is displayed whenever display list is updated using the ShowFrame object - any timing information stored within the video data is ignored. Since the video is updated at the same time as the display list the frame rate of the video may be the same or less than the frame rate of the Flash movie but not higher.

See Also:
DefineVideo

Constructor Summary
VideoFrame(int uid, int frame, byte[] videoData)
          Constructs a new VideoFrame object which will display the specified frame of video data in the DefineVideo object that matches the identifier.
VideoFrame(SWFDecoder coder)
          Creates and initialises a VideoFrame object using values encoded in the Flash binary format.
VideoFrame(VideoFrame object)
          Creates and initialises a VideoFrame object using the values copied from another VideoFrame object.
 
Method Summary
 VideoFrame copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getData()
          Get a copy of the encoded video data.
 int getFrameNumber()
          Get the number of the frame.
 int getIdentifier()
          Get the identifier of the DefineVideo object where the frame will be displayed.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setData(byte[] frameData)
          Sets the encoded video data.
 void setFrameNumber(int number)
          Sets the number of the frame.
 void setIdentifier(int uid)
          Sets the identifier of the DefineVideo object where the frame will be displayed.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VideoFrame

public VideoFrame(SWFDecoder coder)
           throws IOException
Creates and initialises a VideoFrame object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

VideoFrame

public VideoFrame(int uid,
                  int frame,
                  byte[] videoData)
Constructs a new VideoFrame object which will display the specified frame of video data in the DefineVideo object that matches the identifier.

Parameters:
uid - the unique identifier of the DefineVideo object. Must be in the range 1..65535.
frame - the number of the frame. Must be in the range 1..65535.
videoData - the encoded video data. For Flash 6 this is encoded in the H263 format. In Flash 7 H263 and ScreenVideo is supported.

VideoFrame

public VideoFrame(VideoFrame object)
Creates and initialises a VideoFrame object using the values copied from another VideoFrame object.

Parameters:
object - a VideoFrame object from which the values will be copied.
Method Detail

getIdentifier

public int getIdentifier()
Get the identifier of the DefineVideo object where the frame will be displayed.

Returns:
the unique identifier of the video.

setIdentifier

public void setIdentifier(int uid)
Sets the identifier of the DefineVideo object where the frame will be displayed.

Parameters:
uid - the unique identifier of the DefineVideo object. Must be in the range 1..65535.

getFrameNumber

public int getFrameNumber()
Get the number of the frame.

Returns:
the frame number.

setFrameNumber

public void setFrameNumber(int number)
Sets the number of the frame.

Parameters:
number - the frame number. Must be in the range 1..65535.

getData

public byte[] getData()
Get a copy of the encoded video data. In Flash 6 modified H263 encoded video is supported. Flash 7 supports both modified H263 and ScreenVideo.

Returns:
a copy of the video data.

setData

public void setData(byte[] frameData)
Sets the encoded video data. In Flash 6 modified H263 encoded video is supported. Flash 7 supports both modified H263 and ScreenVideo,

Parameters:
frameData - the encoded video data. Must not be null.

copy

public VideoFrame copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<MovieTag>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()

Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.