/* */ package quicktime.app;
/* */
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.jdirect.QTNative;
/* */ import quicktime.qd.PixMap;
/* */ import quicktime.qd.QDGraphics;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.std.image.CSequence;
/* */ import quicktime.std.image.CodecComponent;
/* */ import quicktime.std.image.CompressedFrameInfo;
/* */ import quicktime.std.image.ImageDescription;
/* */ import quicktime.std.image.QTImage;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.movies.Track;
/* */ import quicktime.std.movies.media.VideoMedia;
/* */ import quicktime.util.QTHandle;
/* */ import quicktime.util.RawEncodedImage;
/* */
/* */ /** @deprecated */
/* */ public class RecordMovie
/* */ {
/* */ private QTHandle imageHandle;
/* */ private RawEncodedImage compressedImage;
/* */ private VideoMedia vidMedia;
/* */ private int recordFrames;
/* */ private int currentRecordFrame;
/* */ private CSequence seq;
/* */ private ImageDescription recDesc;
/* */ private Track vidTrack;
/* */ private RecordMovieCallback cb;
/* */ private boolean doAsync;
/* */ private Movie mov;
/* */ private Thread cbThread;
/* 150 */ private boolean inPreflightMode = false;
/* 151 */ private boolean recording = false;
/* */ private QDGraphics gw;
/* */ private QDRect gwRect;
/* */ private int scale;
/* */ private int spatialQuality;
/* */ private int temporalQuality;
/* */ private int keyFrameRate;
/* */ private int codecType;
/* */ private CodecComponent codec;
/* */
/* */ /** @deprecated */
/* */ public RecordMovie()
/* */ throws QTException
/* */ {
/* 99 */ this(null, null, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public RecordMovie(Movie paramMovie, RecordMovieCallback paramRecordMovieCallback)
/* */ throws QTException
/* */ {
/* 114 */ this(paramMovie, paramRecordMovieCallback, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public RecordMovie(Movie paramMovie, RecordMovieCallback paramRecordMovieCallback, QDRect paramQDRect)
/* */ throws QTException
/* */ {
/* 131 */ this.gwRect = paramQDRect;
/* 132 */ setMovie(paramMovie, paramRecordMovieCallback);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setMovie(Movie paramMovie, RecordMovieCallback paramRecordMovieCallback)
/* */ throws QTException
/* */ {
/* 172 */ if (this.recording)
/* 173 */ throw new QTAppException("Can't reset movie whilst recording");
/* 174 */ this.mov = paramMovie;
/* 175 */ this.cb = paramRecordMovieCallback;
/* 176 */ if (this.cb != null)
/* 177 */ this.cbThread = new Thread(new Runnable() {
/* */ public void run() {
/* 179 */ if (RecordMovie.this.cb != null) RecordMovie.this.cb.finish(RecordMovie.this.mov);
/* */ }
/* */ });
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setCompressionSettings(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, CodecComponent paramCodecComponent)
/* */ throws QTException
/* */ {
/* 203 */ this.scale = paramInt1;
/* 204 */ this.spatialQuality = paramInt2;
/* 205 */ this.temporalQuality = paramInt3;
/* 206 */ this.keyFrameRate = paramInt4;
/* 207 */ this.codecType = paramInt5;
/* 208 */ this.codec = paramCodecComponent;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void addedToSource(QDGraphics paramQDGraphics)
/* */ throws QTException
/* */ {
/* 229 */ if (this.recording) {
/* 230 */ throw new QTAppException("Can't reset parameters once recording has begun");
/* */ }
/* 232 */ if ((!this.inPreflightMode) && ((this.mov == null) || (this.cb == null))) {
/* 233 */ throw new QTAppException("Must specify a movie and the callback class before recording");
/* */ }
/* 235 */ if (this.codec == null) {
/* 236 */ throw new QTAppException("Must set compression settings before record or preflight can be done");
/* */ }
/* 238 */ if (this.gwRect == null)
/* 239 */ this.gwRect = paramQDGraphics.getPortRect();
/* 240 */ this.gw = paramQDGraphics;
/* */
/* 242 */ if ((this.vidTrack == null) && (!this.inPreflightMode)) {
/* 243 */ addNewTrack();
/* */ }
/* 245 */ this.seq = new CSequence(this.gw, this.gwRect, this.gw.getPixMap().getPixelSize(), this.codecType, this.codec, this.spatialQuality, this.temporalQuality, this.keyFrameRate, null, 0);
/* */
/* 255 */ this.recDesc = this.seq.getDescription();
/* 256 */ int i = QTImage.getMaxCompressionSize(this.gw, this.gwRect, this.gw.getPixMap().getPixelSize(), this.spatialQuality, this.codecType, this.codec);
/* */
/* 262 */ this.imageHandle = new QTHandle(i, true);
/* 263 */ this.imageHandle.lock();
/* 264 */ this.compressedImage = RawEncodedImage.fromQTHandle(this.imageHandle);
/* 265 */ if (!this.inPreflightMode) {
/* 266 */ this.vidMedia.beginEdits();
/* */ }
/* 268 */ this.recording = (!this.inPreflightMode);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void setPreflighting(boolean paramBoolean)
/* */ throws QTException
/* */ {
/* 278 */ if (this.recording)
/* 279 */ throw new QTAppException("Can't set preflighting whilst recording");
/* 280 */ this.inPreflightMode = paramBoolean;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isPreflighting()
/* */ {
/* 288 */ return this.inPreflightMode;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void recordMode(int paramInt)
/* */ throws QTException
/* */ {
/* 297 */ if (this.mov == null)
/* 298 */ throw new QTAppException("Can't go to record mode without first specifying a movie");
/* 299 */ this.currentRecordFrame = 1;
/* 300 */ this.inPreflightMode = false;
/* 301 */ this.recordFrames = paramInt;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void abortRecording()
/* */ throws QTException
/* */ {
/* 309 */ if (this.recording) {
/* 310 */ this.vidMedia.endEdits();
/* 311 */ cleanup();
/* 312 */ this.recording = false;
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean frameReady()
/* */ throws QTException
/* */ {
/* 327 */ synchronized (QTNative.globalsLock) {
/* 328 */ synchronized (this)
/* */ {
/* */ CompressedFrameInfo localCompressedFrameInfo;
/* 329 */ if (this.inPreflightMode) {
/* 330 */ localCompressedFrameInfo = this.seq.compressFrame(this.gw, this.gwRect, 4, this.compressedImage);
/* */
/* 334 */ return true;
/* */ }
/* 336 */ if ((this.recording) && (this.currentRecordFrame++ <= this.recordFrames)) {
/* 337 */ localCompressedFrameInfo = this.seq.compressFrame(this.gw, this.gwRect, 4, this.compressedImage);
/* */
/* 341 */ int i = localCompressedFrameInfo.getSimilarity() == 0 ? 1 : 0;
/* 342 */ this.vidMedia.addSample(this.imageHandle, 0, localCompressedFrameInfo.getDataSize(), 600 / this.scale, this.recDesc, 1, i != 0 ? 0 : 1);
/* */
/* 350 */ if (this.currentRecordFrame > this.recordFrames) {
/* 351 */ cleanupMovie();
/* 352 */ this.recording = false;
/* 353 */ this.cbThread.start();
/* 354 */ return false;
/* */ }
/* 356 */ return true;
/* */ }
/* */ }
/* */ }
/* */
/* 361 */ cleanup();
/* 362 */ return false;
/* */ }
/* */
/* */ private void cleanupMovie() throws QTException {
/* 366 */ this.vidMedia.endEdits();
/* 367 */ this.vidTrack.insertMedia(0, 0, this.vidMedia.getDuration(), 1.0F);
/* 368 */ cleanup();
/* */ }
/* */
/* */ private void cleanup() {
/* 372 */ this.vidTrack = null;
/* 373 */ this.vidMedia = null;
/* 374 */ this.compressedImage = null;
/* 375 */ this.imageHandle = null;
/* 376 */ this.gw = null;
/* */ }
/* */
/* */ private void addNewTrack() throws QTException {
/* 380 */ if (this.mov == null)
/* 381 */ throw new QTAppException("Can't add a Track without movie being specified");
/* 382 */ if (this.vidTrack != null)
/* 383 */ throw new QTAppException("Can't alter movie while current movie is being recorded");
/* 384 */ this.vidTrack = this.mov.addTrack(this.gwRect.getWidth(), this.gwRect.getHeight(), 0.0F);
/* 385 */ this.vidMedia = new VideoMedia(this.vidTrack, 600);
/* */ }
/* */
/* */ static
/* */ {
/* 84 */ if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/* 85 */ throw new QTRuntimeException("Unsupported on Mac OS X and Java 1.4 and higher.");
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.app.RecordMovie
* JD-Core Version: 0.6.2
*/