All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.RecordMovie

java.lang.Object
   |
   +----quicktime.app.RecordMovie

public class RecordMovie
extends Object
This class is used to record a movie from a source QDGraphics. It provides a profiling mode so that the an estimate of the compression time for each frame captured. The use of this class can enable a movie to be recorded where the record rate is unrelated to the capture rate. That is, a recorded rate of 10 frames a second can be specified and each frame that is captured will have a duration of 1/10 of a second regardless of how long the compression process takes or how often the frameReady method is called.

Typically this class is used as a utility service by some other class that wants to provide recording capabilities. When a RecordMovie object is set in the target class, the target class notifies the RecordMovie object that it now has a source QDGraphics. Whenever appropriate, the target class then notifies the RecordMovie object that a frame is ready to be captured from the QDGraphics object and the RecordMovie object either captures that frame or profiles the compression based on its current mode of operation. When the frameReady method has been called the specified number of frames when recording it returns false to indicate that it is no longer interested and the target class can discard the RecordMovie object and ceases notification of frame readiness. In its turn the RecordMovie disavows any knowledge of the QDGraphics object it was compressing until the next time it receives notification that it has been added to a source.

Once a movie has completed recording the RecordMovie object will spawn a thread and call the RecordMovieCallback's finish method with the movie that has just been recorded. The recorded movie will have a video track added with all of the data captured and the application can at this point do whatever is appropriate with the movie - save it, play it back, etc. Each record operation will add a new video track with the specified compression and visual media characteristics.

An example usage of the RecordMovie class:

 	RecordMovie rm = new RecordMovie (myMovie, myRecordCallback);
 	rm.setCompressionSettings (...);
 	myRecordThis.setRecordMovie (rm);
 
An example definition of a Class that uses the RecordMovie object to capture its QDGraphics:
 	class RecordThis {
		QDGraphics g;
		RecordMovie rm;
 		public void setRecordMovie (RecordMovie rm) throws QTException {
			rm.addedToSource (g);
			this.rm = rm;
		}
			// some call in this object that is responsible for drawing
		void blitImage () {
			//do blit to g
			//....
			if (rm != null && rm.frameReady() == false) //capture current state of g
				rm = null;                              //no longer interested drop reference to rm
		}
	}
 

See Also:
Compositor

Constructor Index

 o RecordMovie()
Creates a default RecordMovie object.
 o RecordMovie(Movie, RecordMovieCallback)
Record the output of each composited image to a frame.
 o RecordMovie(Movie, RecordMovieCallback, QDRect)
Record the output of each composited image to a frame.

Method Index

 o abortRecording()
Aborts recording before it has completed.
 o addedToSource(QDGraphics)
This method is called by the target object that control the drawing and capturing of the image drawn in the QDGraphics.
 o frameReady()
The source of the record operation calls this method whether the RecordMovie object is preflighting or recording whenever it is appropriate for the RecordMovie object to capture the current state of the QDGraphics.
 o isPreflighting()
Returns true if the RecordMovie object is preflighting a compression operation.
 o recordMode(int)
Places a RecordMovie object in record mode.
 o setCompressionSettings(int, int, int, int, int, CodecComponent)
Establishes the type of compression that will be applied to the source QDGraphics when the recording or preflighting is done.
 o setMovie(Movie, RecordMovieCallback)
Sets the movie that a video track will be added to in any consequent record operation and the callback object that will be called when the movie is finished recording.
 o setPreflighting(boolean)
This call will do a preflight of the record and you will be able to asses the impact of compressing a single pass of the QDGraphics target.

Constructors

 o RecordMovie
 public RecordMovie() throws QTException
Creates a default RecordMovie object. No movie or callback object are specified so in this state the object can only be used for profiling. If a recording is desired the application must specify the movie with the setMovie method. In order for profiling to be enabled the application must also set the compression settings, describing the type of compression to be applied.

 o RecordMovie
 public RecordMovie(Movie theMovie,
                    RecordMovieCallback cBack) throws QTException
Record the output of each composited image to a frame. When the movie is finished recording the RecordMovieCallback's finish method is called with the resulting movie. In this case the compositor will continue to draw to the destination graphics and any changes as a result of user interaction will be recorded. By default the entire bounds of the target QDGraphics will be captured.

Parameters:
theMovie - the movie to which a video track will be added
cBack - when recording is finished the cBack.finish method is called with the resultant movie. If this value is null then no notification is given to the application when recording is completed.
 o RecordMovie
 public RecordMovie(Movie theMovie,
                    RecordMovieCallback cBack,
                    QDRect rectBounds) throws QTException
Record the output of each composited image to a frame. When the movie is finished recording the RecordMovieCallback's finish method is called with the resulting movie. In this case the compositor will continue to draw to the destination graphics and any changes as a result of user interaction will be recorded.

Parameters:
theMovie - the movie to which a video track will be added
cBack - when recording is finished the cBack.finish method is called with the resultant movie. If this value is null then no notification is given to the application when recording is completed.
rectBounds - if only some part of the QDGraphics is to be captured you can specify the rectangle here. A value of null means that the entire QDGraphics bounds will be captured

Methods

 o setMovie
 public void setMovie(Movie theMovie,
                      RecordMovieCallback cBack) throws QTException
Sets the movie that a video track will be added to in any consequent record operation and the callback object that will be called when the movie is finished recording. If no callback is specified the application receives no notification when recording is completed.

Parameters:
theMovie - to record
cBack - the call back object
 o setCompressionSettings
 public void setCompressionSettings(int scale,
                                    int spatialQuality,
                                    int temporalQuality,
                                    int keyFrameRate,
                                    int codecType,
                                    CodecComponent codec) throws QTException
Establishes the type of compression that will be applied to the source QDGraphics when the recording or preflighting is done.

Parameters:
scale - the time scale of the video track that is added
spatialQuality - the spatial compression quality that is to be applied when compressing each frame
temporalQuality - the temporal compression quality that is to be applied when compressing each frame
keyFrameRate - the key frame rate that is used if temporal compression is used. A value of zero lets QuickTime decide on the keyFrameRate. This is disregarded if no temporal compression is specified
codecType - the codec identifier that is used to specify which compressor is used to compress the images
codec - qualifies which type of codec of codecType is used, ex. bestSpeed, bestQuality, etc.
 o addedToSource
 public void addedToSource(QDGraphics g) throws QTException
This method is called by the target object that control the drawing and capturing of the image drawn in the QDGraphics. When a RecordMovie object is set to a target, the target calls this method with the QDGraphics object which is the source image. If an application is setting a record movie object to a target it is the target's responsibility to notify the RecordMovie object that it has a target graphics. Thus in general the application does not need to call this method specifically. If you are using this object to record drawing in a QDGraphics object then this method should be called and it then becomes the responsibility of the caller to notify the RecordMovie object when a frame is ready for capturing by calling the frameReady method. The applicatioin should ensure that the RecordMovie object has been set up with compression parameters (if in preflight mode) and also a target movie if in record mode before being set to a target ie. the target object can assume this requirement when it calls the addedToSource method. If in an inappropriate state this method will throw a QTAppException detailing the exceptional state.

Parameters:
g - the graphics object which is the source of the compression and capture operations of the RecordMovie class
See Also:
frameReady
 o setPreflighting
 public synchronized void setPreflighting(boolean flag) throws QTException
This call will do a preflight of the record and you will be able to asses the impact of compressing a single pass of the QDGraphics target. Preflighting will be stopped when recording is started.

Parameters:
flag - if true preflighting is enabled, if false preflighting is disabled.
 o isPreflighting
 public boolean isPreflighting()
Returns true if the RecordMovie object is preflighting a compression operation.

Returns:
boolean
 o recordMode
 public synchronized void recordMode(int numRecordFrames) throws QTException
Places a RecordMovie object in record mode. A movie must already have been specified for this method to succeed.

Parameters:
numRecordFrames - the number of frames the record activity should record
 o abortRecording
 public void abortRecording() throws QTException
Aborts recording before it has completed. Any captured images will be lost.

 o frameReady
 public synchronized boolean frameReady() throws QTException
The source of the record operation calls this method whether the RecordMovie object is preflighting or recording whenever it is appropriate for the RecordMovie object to capture the current state of the QDGraphics.

Returns:
true if interested in another frame, false will end the record or preflight operation

All Packages  Class Hierarchy  This Package  Previous  Next  Index