/* */ package quicktime.std.movies.media;
/* */
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTSession;
/* */ import quicktime.io.AliasHandle;
/* */ import quicktime.io.QTFile;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.std.image.GraphicsExporter;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.sg.SGOutput;
/* */ import quicktime.std.sg.SequenceGrabber;
/* */ import quicktime.util.EndianOrder;
/* */ import quicktime.util.QTHandle;
/* */ import quicktime.util.QTHandleRef;
/* */ import quicktime.util.QTUtils;
/* */ import quicktime.util.StringHandle;
/* */
/* */ public final class DataRef extends QTHandle
/* */ {
/* 32 */ private static boolean apriori = QTSession.apriori();
/* */ private int dataRefType;
/* 256 */ private int dataRefAttributes = 0;
/* 257 */ private QTHandleRef hdl = null;
/* */
/* */ public static DataRef fromGraphicsExporterInputDataRef(GraphicsExporter paramGraphicsExporter)
/* */ throws QTException
/* */ {
/* 43 */ int[] arrayOfInt1 = new int[1];
/* 44 */ int[] arrayOfInt2 = new int[1];
/* 45 */ int i = GraphicsExportGetInputDataReference(QTObject.ID(paramGraphicsExporter), arrayOfInt1, arrayOfInt2);
/* 46 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0);
/* */ }
/* */
/* */ public static DataRef fromGraphicsExporterOutputDataRef(GraphicsExporter paramGraphicsExporter)
/* */ throws QTException
/* */ {
/* 56 */ int[] arrayOfInt1 = new int[1];
/* 57 */ int[] arrayOfInt2 = new int[1];
/* 58 */ int i = GraphicsExportGetOutputDataReference(QTObject.ID(paramGraphicsExporter), arrayOfInt1, arrayOfInt2);
/* 59 */ StdQTException.checkError(i);
/* 60 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0);
/* */ }
/* */
/* */ public static DataRef fromMovie(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 70 */ int[] arrayOfInt1 = new int[1];
/* 71 */ int[] arrayOfInt2 = new int[1];
/* 72 */ int i = GetMovieDefaultDataRef(QTObject.ID(paramMovie), arrayOfInt1, arrayOfInt2);
/* 73 */ StdQTException.checkError(i);
/* 74 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0);
/* */ }
/* */
/* */ public static DataRef fromSequenceGrabber(SequenceGrabber paramSequenceGrabber)
/* */ throws StdQTException
/* */ {
/* 84 */ int[] arrayOfInt1 = new int[1];
/* 85 */ int[] arrayOfInt2 = new int[1];
/* 86 */ int[] arrayOfInt3 = new int[1];
/* 87 */ int i = SGGetDataRef(QTObject.ID(paramSequenceGrabber), arrayOfInt1, arrayOfInt2, arrayOfInt3);
/* */
/* 91 */ StdQTException.checkError(i);
/* 92 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0, paramSequenceGrabber);
/* */ }
/* */
/* */ public static DataRef fromMedia(Media paramMedia, int paramInt)
/* */ throws QTException
/* */ {
/* 103 */ int[] arrayOfInt1 = new int[1];
/* 104 */ int[] arrayOfInt2 = new int[1];
/* 105 */ int[] arrayOfInt3 = new int[1];
/* 106 */ StdQTException.checkError(GetMediaDataRef(QTObject.ID(paramMedia), (short)paramInt, arrayOfInt1, arrayOfInt2, arrayOfInt3));
/* 107 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], arrayOfInt3[0]);
/* */ }
/* */
/* */ public static DataRef fromSGOutput(SequenceGrabber paramSequenceGrabber, SGOutput paramSGOutput)
/* */ throws StdQTException
/* */ {
/* 117 */ int[] arrayOfInt1 = { 0 };
/* 118 */ int[] arrayOfInt2 = { 0 };
/* */
/* 120 */ int i = SGGetOutputDataReference(QTObject.ID(paramSequenceGrabber), QTObject.ID(paramSGOutput), arrayOfInt1, arrayOfInt2);
/* 121 */ StdQTException.checkError(i);
/* 122 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0);
/* */ }
/* */
/* */ public DataRef(String paramString)
/* */ throws QTException
/* */ {
/* 131 */ super(4, false);
/* 132 */ if (paramString.startsWith("file")) {
/* 133 */ QTFile localQTFile = new QTFile(paramString.substring(7).replace('/', File.separatorChar));
/* 134 */ setAliasHandle(localQTFile.newAlias(true));
/* */ } else {
/* 136 */ setURLDataRef(QTUtils.String2CString(paramString));
/* */ }
/* */ }
/* */
/* */ public DataRef(QTFile paramQTFile)
/* */ throws QTException
/* */ {
/* 144 */ super(4, false);
/* 145 */ setAliasHandle(paramQTFile.newAlias(true));
/* */ }
/* */
/* */ public DataRef(AliasHandle paramAliasHandle)
/* */ throws IOException, QTException
/* */ {
/* 153 */ super(4, false);
/* 154 */ setAliasHandle(paramAliasHandle);
/* */ }
/* */
/* */ public DataRef(QTHandleRef paramQTHandleRef)
/* */ throws QTException
/* */ {
/* 164 */ super(4, true);
/* 165 */ this.dataRefType = 1752065132;
/* 166 */ this.hdl = paramQTHandleRef;
/* 167 */ setIntAt(0, QTObject.ID(paramQTHandleRef));
/* */ }
/* */
/* */ public DataRef(QTHandleRef paramQTHandleRef, int paramInt, String paramString)
/* */ throws QTException
/* */ {
/* 188 */ super(4, true);
/* 189 */ this.dataRefType = 1752065132;
/* 190 */ this.hdl = paramQTHandleRef;
/* 191 */ setIntAt(0, QTObject.ID(paramQTHandleRef));
/* */
/* 193 */ switch (paramInt) {
/* */ case 1718909296:
/* 195 */ if (QTSession.getQTVersion() == 3)
/* 196 */ throw new QTException(-50);
/* 197 */ setSize(17);
/* 198 */ setByteAt(4, (byte)0);
/* 199 */ setIntAt(5, EndianOrder.flipNativeToBigEndian32(12));
/* 200 */ setIntAt(9, EndianOrder.flipNativeToBigEndian32(1718909296));
/* 201 */ setIntAt(13, EndianOrder.flipNativeToBigEndian32(QTUtils.toOSType(paramString)));
/* 202 */ break;
/* */ case 1835625829:
/* 204 */ if (QTSession.getQTVersion() == 3)
/* 205 */ throw new QTException(-50);
/* 206 */ byte[] arrayOfByte = QTUtils.String2PString(paramString, 255);
/* 207 */ setSize(13 + arrayOfByte.length);
/* 208 */ setByteAt(4, (byte)0);
/* 209 */ setIntAt(5, EndianOrder.flipNativeToBigEndian32(8 + arrayOfByte.length));
/* 210 */ setIntAt(9, EndianOrder.flipNativeToBigEndian32(1835625829));
/* 211 */ setBytesAt(13, arrayOfByte.length, arrayOfByte, 0);
/* 212 */ break;
/* */ case 1702392864:
/* 214 */ concatenate(new StringHandle("X." + paramString, 2));
/* 215 */ break;
/* */ default:
/* 217 */ throw new QTException(-50);
/* */ }
/* */ }
/* */
/* */ private DataRef(int paramInt1, int paramInt2, int paramInt3, Object paramObject)
/* */ {
/* 237 */ super(paramInt1, paramObject, false);
/* 238 */ this.dataRefType = paramInt2;
/* 239 */ this.dataRefAttributes = paramInt3;
/* */ }
/* */
/* */ private DataRef(int paramInt1, int paramInt2, int paramInt3)
/* */ {
/* 249 */ super(paramInt1, null, false);
/* 250 */ this.dataRefType = paramInt2;
/* 251 */ this.dataRefAttributes = paramInt3;
/* */ }
/* */
/* */ private void setAliasHandle(AliasHandle paramAliasHandle)
/* */ throws QTException
/* */ {
/* 261 */ copyFromHandle(paramAliasHandle);
/* 262 */ this.dataRefType = 1634494835;
/* */ }
/* */
/* */ private void setURLDataRef(byte[] paramArrayOfByte) throws QTException {
/* 266 */ setSize(paramArrayOfByte.length);
/* 267 */ copyFromArray(0, paramArrayOfByte, 0, paramArrayOfByte.length);
/* 268 */ this.dataRefType = 1970433056;
/* 269 */ int i = GetDataHandler(_ID(), getType(), 1);
/* 270 */ if (i == 0)
/* 271 */ throw new QTException(-2012);
/* */ }
/* */
/* */ private void copyFromHandle(QTHandleRef paramQTHandleRef) throws QTException {
/* 275 */ setSize(paramQTHandleRef.getSize());
/* 276 */ copyFromHandle(0, paramQTHandleRef, 0, paramQTHandleRef.getSize());
/* */ }
/* */
/* */ public int getType()
/* */ {
/* 284 */ return this.dataRefType;
/* */ }
/* */
/* */ public int getAttributes()
/* */ {
/* 291 */ return this.dataRefAttributes;
/* */ }
/* */
/* */ public String getUniversalResourceLocator()
/* */ throws QTException
/* */ {
/* 298 */ if (this.dataRefType == 1970433056) {
/* 299 */ return getCStringAt(0);
/* */ }
/* 301 */ if (this.dataRefType == 1634494835) {
/* 302 */ AliasHandle localAliasHandle = AliasHandle.fromDataRef(this);
/* 303 */ QTFile localQTFile = QTFile.resolveAlias(localAliasHandle);
/* 304 */ return localQTFile.getPath();
/* */ }
/* 306 */ return null;
/* */ }
/* */
/* */ public DataRef fromMovieAnchor(Movie paramMovie)
/* */ throws StdQTException
/* */ {
/* 321 */ int i = 0;
/* 322 */ int[] arrayOfInt1 = { 0 }; int[] arrayOfInt2 = { 0 }; int[] arrayOfInt3 = { 0 };
/* 323 */ i = GetMovieAnchorDataRef(QTObject.ID(paramMovie), arrayOfInt1, arrayOfInt2, arrayOfInt3);
/* 324 */ StdQTException.checkError(i);
/* */
/* 326 */ if (arrayOfInt1[0] == 0) {
/* 327 */ return null;
/* */ }
/* 329 */ return new DataRef(arrayOfInt1[0], arrayOfInt2[0], 0);
/* */ }
/* */
/* */ private static native short GetMediaDataRef(int paramInt, short paramShort, int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3);
/* */
/* */ private static native short GetMovieDefaultDataRef(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int SGGetDataRef(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3);
/* */
/* */ private static native int GraphicsExportGetInputDataReference(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int GraphicsExportGetOutputDataReference(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int GetDataHandler(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int SGGetOutputDataReference(int paramInt1, int paramInt2, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native short GetMovieAnchorDataRef(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.std.movies.media.DataRef
* JD-Core Version: 0.6.2
*/