/* */ package quicktime.std.sg;
/* */
/* */ import java.security.AccessController;
/* */ import java.security.PrivilegedAction;
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTSession;
/* */ import quicktime.io.QTFile;
/* */ import quicktime.jdirect.QTNative;
/* */ import quicktime.qd.GDevice;
/* */ import quicktime.qd.Pict;
/* */ import quicktime.qd.QDGraphics;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.qd.Region;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.std.clocks.TimeBase;
/* */ import quicktime.std.comp.Component;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.movies.media.DataRef;
/* */ import quicktime.std.movies.media.UserData;
/* */
/* */ public final class SequenceGrabber extends Component
/* */ {
/* 34 */ private static boolean apriori = QTSession.apriori();
/* */ private SGDispatcher upp;
/* */ private boolean hasStarted;
/* */
/* */ public SequenceGrabber()
/* */ throws QTException
/* */ {
/* 45 */ this(0);
/* */ }
/* */
/* */ public SequenceGrabber(int paramInt)
/* */ throws QTException
/* */ {
/* 56 */ super(1650553447, paramInt);
/* 57 */ initialize();
/* */ }
/* */
/* */ public SequenceGrabber(int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 69 */ super(paramInt1, paramInt2);
/* 70 */ initialize();
/* */ }
/* */
/* */ private void initialize()
/* */ throws QTException
/* */ {
/* 88 */ if (QTSession.hasSecurityRestrictions()) {
/* 89 */ throw new SecurityException("Only able to capture media with security settings when class is signed");
/* */ }
/* */
/* 92 */ int i = 0;
/* 93 */ int[] arrayOfInt1 = { 0 };
/* 94 */ int[] arrayOfInt2 = { 0 };
/* 95 */ synchronized (QTNative.globalsLock) {
/* 96 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 97 */ GetGWorld(arrayOfInt1, arrayOfInt2);
/* 98 */ SetGWorld(QTObject.ID(QDGraphics.scratch), 0);
/* 99 */ setGWorld(QDGraphics.scratch, null);
/* 100 */ i = SGInitialize(_ID());
/* 101 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 102 */ SetGWorld(arrayOfInt1[0], arrayOfInt2[0]);
/* 103 */ this.hasStarted = false;
/* */ }
/* */
/* 106 */ if (i < 0) {
/* */ try {
/* 108 */ finalize(); } catch (Throwable localThrowable) {
/* */ }
/* 110 */ StdQTException.checkError(i);
/* */ }
/* */ }
/* */
/* */ public void setGWorld(QDGraphics paramQDGraphics, GDevice paramGDevice)
/* */ throws StdQTException
/* */ {
/* 127 */ if (paramQDGraphics == null) throw new StdQTException(-50);
/* 128 */ int i = 0;
/* 129 */ synchronized (QTNative.globalsLock) {
/* 130 */ i = SGSetGWorld(_ID(), QTObject.ID(paramQDGraphics), QTObject.ID(paramGDevice));
/* */ }
/* */
/* 134 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public QDGraphics getGWorld()
/* */ throws StdQTException
/* */ {
/* 143 */ return QDGraphics.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public GDevice getGWorldDevice()
/* */ throws StdQTException
/* */ {
/* 153 */ SequenceGrabber localSequenceGrabber = this;
/* */
/* 155 */ GDevice localGDevice = (GDevice)AccessController.doPrivileged(new PrivilegedAction() {
/* */ private final SequenceGrabber val$sg;
/* */
/* */ public Object run() { try { return GDevice.fromSequenceGrabber(this.val$sg); } catch (StdQTException localStdQTException) {
/* */ }
/* 160 */ return null;
/* */ }
/* */ });
/* 165 */ return localGDevice;
/* */ }
/* */
/* */ public void disposeChannel(SGChannel paramSGChannel)
/* */ throws StdQTException
/* */ {
/* 174 */ paramSGChannel.disposeChannel(this);
/* */ }
/* */
/* */ public SGOutput newOutput(DataRef paramDataRef, int paramInt)
/* */ throws StdQTException
/* */ {
/* 190 */ return new SGOutput(this, QTObject.ID(paramDataRef), paramDataRef.getType(), paramInt);
/* */ }
/* */
/* */ public void disposeOutput(SGOutput paramSGOutput)
/* */ throws QTException
/* */ {
/* 199 */ paramSGOutput.disposeQTObject();
/* */ }
/* */
/* */ boolean isValid() {
/* 203 */ return stillValid();
/* */ }
/* */
/* */ public void writeExtendedMovieData(SGChannel paramSGChannel, int paramInt1, int paramInt2, long paramLong, SGOutput paramSGOutput)
/* */ throws StdQTException
/* */ {
/* 217 */ byte[] arrayOfByte = new byte[8];
/* 218 */ setLongInArray(arrayOfByte, 0, paramLong);
/* */
/* 220 */ int i = SGWriteExtendedMovieData(_ID(), QTObject.ID(paramSGChannel), paramInt1, paramInt2, arrayOfByte, QTObject.ID(paramSGOutput));
/* 221 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void startPreview()
/* */ throws StdQTException
/* */ {
/* 230 */ int i = 0;
/* 231 */ synchronized (QTNative.globalsLock) {
/* 232 */ i = SGStartPreview(_ID());
/* 233 */ this.hasStarted = true;
/* */ }
/* 235 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void startRecord()
/* */ throws StdQTException
/* */ {
/* 243 */ synchronized (QTNative.globalsLock) {
/* 244 */ int i = SGStartRecord(_ID());
/* 245 */ StdQTException.checkError(i);
/* 246 */ this.hasStarted = true;
/* */ }
/* */ }
/* */
/* */ public void idle()
/* */ throws StdQTException
/* */ {
/* 258 */ int i = 0;
/* 259 */ int[] arrayOfInt1 = { 0 };
/* 260 */ int[] arrayOfInt2 = { 0 };
/* 261 */ if (this.hasStarted)
/* */ {
/* 263 */ synchronized (QTNative.globalsLock) {
/* 264 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 265 */ GetGWorld(arrayOfInt1, arrayOfInt2);
/* 266 */ i = SGIdle(_ID());
/* 267 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4))) {
/* 268 */ SetGWorld(arrayOfInt1[0], arrayOfInt2[0]);
/* */ }
/* */ }
/* */ }
/* 272 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public boolean idleMore()
/* */ throws StdQTException
/* */ {
/* 287 */ int i = 0;
/* 288 */ int[] arrayOfInt1 = { 0 };
/* 289 */ int[] arrayOfInt2 = { 0 };
/* 290 */ if (this.hasStarted)
/* */ {
/* 292 */ synchronized (QTNative.globalsLock) {
/* 293 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 294 */ GetGWorld(arrayOfInt1, arrayOfInt2);
/* 295 */ i = SGIdle(_ID());
/* 296 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4))) {
/* 297 */ SetGWorld(arrayOfInt1[0], arrayOfInt2[0]);
/* */ }
/* */ }
/* */
/* */ }
/* */
/* 303 */ if (i == -9401)
/* 304 */ return false;
/* 305 */ StdQTException.checkError(i);
/* 306 */ return true;
/* */ }
/* */
/* */ public void update(Region paramRegion)
/* */ throws StdQTException
/* */ {
/* 316 */ int i = 0;
/* 317 */ int[] arrayOfInt1 = { 0 };
/* 318 */ int[] arrayOfInt2 = { 0 };
/* 319 */ synchronized (QTNative.globalsLock) {
/* 320 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 321 */ GetGWorld(arrayOfInt1, arrayOfInt2);
/* 322 */ i = SGUpdate(_ID(), QTObject.ID(paramRegion));
/* 323 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4))) {
/* 324 */ SetGWorld(arrayOfInt1[0], arrayOfInt2[0]);
/* */ }
/* */ }
/* 327 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void stop()
/* */ throws StdQTException
/* */ {
/* 335 */ int i = 0;
/* 336 */ int[] arrayOfInt1 = { 0 };
/* 337 */ int[] arrayOfInt2 = { 0 };
/* 338 */ QDGraphics localQDGraphics = getGWorld();
/* 339 */ this.hasStarted = false;
/* 340 */ synchronized (QTNative.globalsLock) {
/* 341 */ i = SGStop(_ID());
/* */ }
/* 343 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void pause(int paramInt)
/* */ throws StdQTException
/* */ {
/* 354 */ int i = 0;
/* 355 */ synchronized (QTNative.globalsLock) {
/* 356 */ i = SGPause(_ID(), (byte)paramInt);
/* */ }
/* 358 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public int getPause()
/* */ throws StdQTException
/* */ {
/* 367 */ byte[] arrayOfByte = new byte[1];
/* 368 */ int i = SGGetPause(_ID(), arrayOfByte);
/* 369 */ StdQTException.checkError(i);
/* 370 */ return arrayOfByte[0];
/* */ }
/* */
/* */ public void prepare(boolean paramBoolean1, boolean paramBoolean2)
/* */ throws StdQTException
/* */ {
/* 382 */ int i = 0;
/* 383 */ byte b1 = (byte)(paramBoolean1 ? 1 : 0);
/* 384 */ byte b2 = (byte)(paramBoolean2 ? 1 : 0);
/* 385 */ synchronized (QTNative.globalsLock) {
/* 386 */ i = SGPrepare(_ID(), b1, b2);
/* */ }
/* 388 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void release()
/* */ throws StdQTException
/* */ {
/* 398 */ int i = 0;
/* 399 */ synchronized (QTNative.globalsLock) {
/* 400 */ i = SGRelease(_ID());
/* */ }
/* 402 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public Movie getMovie()
/* */ {
/* 412 */ return Movie.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public void setSettings(UserData paramUserData)
/* */ throws StdQTException
/* */ {
/* 427 */ int i = SGSetSettings(_ID(), QTObject.ID(paramUserData), 0);
/* */
/* 430 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public UserData getSettings()
/* */ throws StdQTException
/* */ {
/* 441 */ return UserData.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public Pict grabPict(QDRect paramQDRect, int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 459 */ return Pict.fromSequenceGrabber(this, paramQDRect, paramInt1, paramInt2);
/* */ }
/* */
/* */ public void setDataOutput(QTFile paramQTFile, int paramInt)
/* */ throws QTException
/* */ {
/* 472 */ int i = 0;
/* 473 */ if ((paramInt == 32) && (paramQTFile == null))
/* 474 */ synchronized (QTNative.globalsLock) {
/* 475 */ i = SGSetDataOutput(_ID(), null, paramInt);
/* */ }
/* */ else {
/* 478 */ synchronized (QTNative.globalsLock) {
/* 479 */ i = SGSetDataOutput(_ID(), paramQTFile.getFSSpec(false, 256), paramInt);
/* */ }
/* */ }
/* 482 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public QTFile getDataOutputFile()
/* */ throws QTException
/* */ {
/* 491 */ return QTFile.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public int getDataOutputFlags()
/* */ throws QTException
/* */ {
/* 500 */ byte[] arrayOfByte = new byte[(QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)) ? 70 : 262];
/* 501 */ int[] arrayOfInt = { 0 };
/* 502 */ int i = SGGetDataOutput(_ID(), arrayOfByte, arrayOfInt);
/* 503 */ StdQTException.checkError(i);
/* 504 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public void setDataRef(DataRef paramDataRef, int paramInt)
/* */ throws StdQTException
/* */ {
/* 514 */ int i = 0;
/* */
/* 516 */ if (paramDataRef != null) {
/* 517 */ synchronized (QTNative.globalsLock) {
/* 518 */ i = SGSetDataRef(_ID(), QTObject.ID(paramDataRef), paramDataRef.getType(), paramInt);
/* */ }
/* */
/* */ }
/* */ else
/* */ {
/* 524 */ synchronized (QTNative.globalsLock) {
/* 525 */ i = SGSetDataRef(_ID(), 0, 0, paramInt);
/* */ }
/* */
/* */ }
/* */
/* 532 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public DataRef getDataRef()
/* */ throws StdQTException
/* */ {
/* 541 */ return DataRef.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public int getDataRefFlags()
/* */ throws StdQTException
/* */ {
/* 550 */ int[] arrayOfInt1 = new int[1];
/* 551 */ int[] arrayOfInt2 = new int[1];
/* 552 */ int[] arrayOfInt3 = new int[1];
/* 553 */ int i = SGGetDataRef(_ID(), arrayOfInt1, arrayOfInt2, arrayOfInt3);
/* */
/* 557 */ StdQTException.checkError(i);
/* 558 */ return arrayOfInt3[0];
/* */ }
/* */
/* */ public void setMaximumRecordTime(int paramInt)
/* */ throws StdQTException
/* */ {
/* 567 */ StdQTException.checkError(SGSetMaximumRecordTime(_ID(), paramInt));
/* */ }
/* */
/* */ public int getMaximumRecordTime()
/* */ throws StdQTException
/* */ {
/* 576 */ int[] arrayOfInt = { 0 };
/* 577 */ StdQTException.checkError(SGGetMaximumRecordTime(_ID(), arrayOfInt));
/* 578 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public int getStorageSpaceRemaining()
/* */ throws StdQTException
/* */ {
/* 587 */ int[] arrayOfInt = { 0 };
/* 588 */ StdQTException.checkError(SGGetStorageSpaceRemaining(_ID(), arrayOfInt));
/* 589 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public int getTimeRemaining()
/* */ throws StdQTException
/* */ {
/* 599 */ int[] arrayOfInt = { 0 };
/* 600 */ StdQTException.checkError(SGGetTimeRemaining(_ID(), arrayOfInt));
/* 601 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public boolean isPreviewMode()
/* */ throws StdQTException
/* */ {
/* 612 */ byte[] arrayOfByte1 = new byte[1];
/* 613 */ byte[] arrayOfByte2 = new byte[1];
/* 614 */ int i = SGGetMode(_ID(), arrayOfByte1, arrayOfByte2);
/* 615 */ StdQTException.checkError(i);
/* 616 */ return arrayOfByte1[0] != 0;
/* */ }
/* */
/* */ public boolean isRecordMode()
/* */ throws StdQTException
/* */ {
/* 626 */ byte[] arrayOfByte1 = new byte[1];
/* 627 */ byte[] arrayOfByte2 = new byte[1];
/* 628 */ int i = SGGetMode(_ID(), arrayOfByte1, arrayOfByte2);
/* 629 */ StdQTException.checkError(i);
/* 630 */ return arrayOfByte2[0] != 0;
/* */ }
/* */
/* */ public TimeBase getTimeBase()
/* */ throws StdQTException
/* */ {
/* 639 */ return TimeBase.fromSequenceGrabber(this);
/* */ }
/* */
/* */ public int getIndChannelType(int paramInt)
/* */ throws StdQTException
/* */ {
/* 651 */ int[] arrayOfInt = { 0 };
/* 652 */ StdQTException.checkError(SGGetIndChannel(_ID(), (short)paramInt, 0, arrayOfInt));
/* 653 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public SGChannel getIndChannel(int paramInt)
/* */ throws QTException
/* */ {
/* 664 */ int[] arrayOfInt1 = { 0 };
/* 665 */ int[] arrayOfInt2 = { 0 };
/* 666 */ StdQTException.checkError(SGGetIndChannel(_ID(), (short)paramInt, arrayOfInt1, arrayOfInt2));
/* */
/* 669 */ switch (arrayOfInt2[0]) {
/* */ case 1936684398:
/* 671 */ return new SGSoundChannel(arrayOfInt1[0], this);
/* */ case 1952807028:
/* 673 */ return new SGTextChannel(arrayOfInt1[0], this);
/* */ case 1986618469:
/* 675 */ return new SGVideoChannel(arrayOfInt1[0], this);
/* */ case 1836413801:
/* 677 */ return new SGMusicChannel(arrayOfInt1[0], this);
/* */ }
/* 679 */ throw new QTException("Unknown SGChannel - please report bug");
/* */ }
/* */
/* */ public void setDataProc(SGDataProc paramSGDataProc)
/* */ throws StdQTException
/* */ {
/* 691 */ int i = 0;
/* 692 */ if (paramSGDataProc == null) {
/* 693 */ removeDataProc();
/* 694 */ return;
/* */ }
/* 696 */ if (this.upp != null) {
/* 697 */ removeDataProc();
/* */ }
/* 699 */ this.upp = new SGDispatcher(this, paramSGDataProc);
/* 700 */ synchronized (QTNative.globalsLock) {
/* 701 */ i = SGSetDataProc(_ID(), this.upp.ID(), 0);
/* */ }
/* 703 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public void removeDataProc()
/* */ throws StdQTException
/* */ {
/* 711 */ int i = 0;
/* 712 */ synchronized (QTNative.globalsLock) {
/* 713 */ i = SGSetDataProc(_ID(), 0, 0);
/* */ }
/* 715 */ StdQTException.checkError(i);
/* 716 */ if (this.upp != null) {
/* 717 */ this.upp.cleanup();
/* 718 */ this.upp = null;
/* */ }
/* */ }
/* */
/* */ private static native void GetGWorld(int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native void SetGWorld(int paramInt1, int paramInt2);
/* */
/* */ private static native int SGInitialize(int paramInt);
/* */
/* */ private static native int SGSetGWorld(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int SGWriteExtendedMovieData(int paramInt1, int paramInt2, int paramInt3, int paramInt4, byte[] paramArrayOfByte, int paramInt5);
/* */
/* */ private static native int SGStartPreview(int paramInt);
/* */
/* */ private static native int SGStartRecord(int paramInt);
/* */
/* */ private static native int SGIdle(int paramInt);
/* */
/* */ private static native int SGUpdate(int paramInt1, int paramInt2);
/* */
/* */ private static native int SGStop(int paramInt);
/* */
/* */ private static native int SGPause(int paramInt, byte paramByte);
/* */
/* */ private static native int SGGetPause(int paramInt, byte[] paramArrayOfByte);
/* */
/* */ private static native int SGPrepare(int paramInt, byte paramByte1, byte paramByte2);
/* */
/* */ private static native int SGRelease(int paramInt);
/* */
/* */ private static native int SGSetSettings(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int SGSetDataOutput(int paramInt1, byte[] paramArrayOfByte, int paramInt2);
/* */
/* */ private static native int SGGetDataOutput(int paramInt, byte[] paramArrayOfByte, int[] paramArrayOfInt);
/* */
/* */ private static native int SGSetDataRef(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native int SGGetDataRef(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3);
/* */
/* */ private static native int SGSetMaximumRecordTime(int paramInt1, int paramInt2);
/* */
/* */ private static native int SGGetMaximumRecordTime(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native int SGGetStorageSpaceRemaining(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native int SGGetTimeRemaining(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native int SGGetMode(int paramInt, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2);
/* */
/* */ private static native int SGGetGWorld(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int SGGrabPict(int paramInt1, int[] paramArrayOfInt, byte[] paramArrayOfByte, short paramShort, int paramInt2);
/* */
/* */ private static native int SGGetIndChannel(int paramInt1, short paramShort, int paramInt2, int[] paramArrayOfInt);
/* */
/* */ private static native int SGGetIndChannel(int paramInt, short paramShort, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int SGSetDataProc(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void setLongInArray(byte[] paramArrayOfByte, int paramInt, long paramLong);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.std.sg.SequenceGrabber
* JD-Core Version: 0.6.2
*/