com.flagstone.transform.video
Class DefineVideo

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

public final class DefineVideo
extends Object
implements DefineTag

The DefineVideo class is used to define a video stream within a Flash file.

Video objects contain a unique identifier and are treated in the same way as shapes, buttons, images, etc. The video data displayed is define using the VideoFrame class. 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. The actual video data is encoded using the VideoFrame class.


Constructor Summary
DefineVideo(DefineVideo object)
          Creates and initialises an DefineVideo object using the values copied from another DefineVideo object.
DefineVideo(int uid, int count, int frameWidth, int frameHeight, Deblocking deblock, boolean smoothing, VideoFormat videoCodec)
          Creates a DefineVideo object with the specified parameters.
DefineVideo(SWFDecoder coder)
          Creates and initialises a DefineVideo object using values encoded in the Flash binary format.
 
Method Summary
 DefineVideo copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 VideoFormat getCodec()
          Get the format used to encode the video data.
 Deblocking getDeblocking()
          Get the method used to control the Flash Player's deblocking filter, either OFF, ON or USE_VIDEO.
 int getFrameCount()
          Get the number of frames in the video.
 int getHeight()
          Get the height of each frame in pixels.
 int getIdentifier()
          Get the unique identifier assigned to this object.
 int getWidth()
          Get the width of each frame in pixels.
 boolean isSmoothed()
          Will the Flash Player will apply smoothing to the video when it is played.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setCodec(VideoFormat format)
          Set the format used to encode the video data.
 void setDeblocking(Deblocking value)
          Sets the method used to control the Flash Player's deblocking filter.
 void setFrameCount(int count)
          Sets the number of frames in the video.
 void setHeight(int size)
          Sets the height of each frame in pixels.
 void setIdentifier(int uid)
          Sets the unique identifier for an object within a given Movie.
 void setSmoothed(boolean smoothing)
          Sets whether Flash Player's smoothing filter is on or off when the video is played.
 void setWidth(int size)
          Sets the width of each frame in pixels.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefineVideo

public DefineVideo(SWFDecoder coder)
            throws IOException
Creates and initialises a DefineVideo 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.

DefineVideo

public DefineVideo(int uid,
                   int count,
                   int frameWidth,
                   int frameHeight,
                   Deblocking deblock,
                   boolean smoothing,
                   VideoFormat videoCodec)
Creates a DefineVideo object with the specified parameters.

Parameters:
uid - the unique identifier for this object. Must be in the range 1..65535.
count - the number of video frames. Must be in the range 0..65535.
frameWidth - the width of each frame in pixels. Must be in the range 0..65535.
frameHeight - the height of each frame in pixels. Must be in the range 0..65535.
deblock - controls whether the Flash Player's deblocking filter is used, either Off, On or UseVideo to allow the video data to specify whether the deblocking filter is used.
smoothing - turns smoothing on or off to improve the quality of the displayed image.
videoCodec - the format of the video data. Flash 6 supports H263. Support for Macromedia's ScreenVideo format was added in Flash 7.

DefineVideo

public DefineVideo(DefineVideo object)
Creates and initialises an DefineVideo object using the values copied from another DefineVideo object.

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

getIdentifier

public int getIdentifier()
Get the unique identifier assigned to this object.

Specified by:
getIdentifier in interface DefineTag
Returns:
the unique identifier used by the Flash Player to reference this definition.

setIdentifier

public void setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie.

Specified by:
setIdentifier in interface DefineTag
Parameters:
uid - a unique identifier for the object. Must be in the range 1..65535.

getFrameCount

public int getFrameCount()
Get the number of frames in the video.

Returns:
the number of frames.

setFrameCount

public void setFrameCount(int count)
Sets the number of frames in the video.

Parameters:
count - the number of video frames. Must be in the range 0..65535.

getWidth

public int getWidth()
Get the width of each frame in pixels.

Returns:
the frame width.

setWidth

public void setWidth(int size)
Sets the width of each frame in pixels.

Parameters:
size - the width of the frame. Must be in the range 0..65535.

getHeight

public int getHeight()
Get the height of each frame in pixels.

Returns:
the frame height.

setHeight

public void setHeight(int size)
Sets the height of each frame in pixels.

Parameters:
size - the height of the frame. Must be in the range 0..65535.

getDeblocking

public Deblocking getDeblocking()
Get the method used to control the Flash Player's deblocking filter, either OFF, ON or USE_VIDEO.

Returns:
the deblocking applied to the frame.

setDeblocking

public void setDeblocking(Deblocking value)
Sets the method used to control the Flash Player's deblocking filter.

Parameters:
value - the deblocking filter control, either OFF, ON or USE_VIDEO to allow the video data to specify whether the deblocking filter is used.

isSmoothed

public boolean isSmoothed()
Will the Flash Player will apply smoothing to the video when it is played.

Returns:
true if smoothing is applied.

setSmoothed

public void setSmoothed(boolean smoothing)
Sets whether Flash Player's smoothing filter is on or off when the video is played.

Parameters:
smoothing - true if smoothing is turned on, false if it is turned off.

getCodec

public VideoFormat getCodec()
Get the format used to encode the video data.

Returns:
the format used to encode the video.

setCodec

public void setCodec(VideoFormat format)
Set the format used to encode the video data.

Parameters:
format - the format used encode the video, either VideoFormat.H263, VideoFormat.SCREEN, VideoFormat.VP6 or VideoFormat.VP6ALPHA.

copy

public DefineVideo 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.