Loading...

quicktime-api@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: NewMovieFromStorageOffset() replacement with NewMovieFromProperties() seems broken Tim Monroe Wed Nov 28 18:04:12 2007


On Nov 14, 2007, at 12:07 PM, Matthew Veenstra:

I am trying to update my NewMovieFromStorageOffset to NewMovieFromProperties so I can use visual contexts as necessary etc. But I cannot seem to get this to work. I get the standard -50 paramErr on with NewMovieFromProperties. Below is the old that works and new code that does not.

// Here is the OLD code which works perfect.
wide *anOffset;
DataHandler aDataHandler = NULL;
Movie aMovie = NULL;

// keyTo... are just internal macros
aDataHandler = keyToHandle(keyArgument(1));
keyIfNULL(aDataHandler);
anOffset = keyToPointer(keyArgument(2));
keyIfError(NewMovieFromStorageOffset(&aMovie, aDataHandler, (wide *) anOffset, newMovieActive | newMovieAsyncOK, NULL));


// Here is the NEW code that _FAILS_.
wide *anOffset;
DataHandler aDataHandler = NULL;
Movie aMovie = NULL;

Boolean isActive = true;
Boolean isAsync = true;
Boolean dontResolve = true;
Boolean ratePitch = true;
QTAudioContextRef aAudioContextRef = NULL;
QTVisualContextRef aVisualContext = NULL;

QTNewMoviePropertyElement aMovieProperties[] = {
{kQTPropertyClass_DataLocation, kQTDataLocationPropertyID_QTDataHandler, sizeof(aDataHandler), &aDataHandler, 0}, {kQTPropertyClass_MovieResourceLocator, kQTMovieResourceLocatorPropertyID_FileOffset, sizeof(anOffset), &anOffset, 0}, {kQTPropertyClass_NewMovieProperty, kQTNewMoviePropertyID_Active, sizeof(isActive), &isActive, 0}, {kQTPropertyClass_MovieInstantiation, kQTMovieInstantiationPropertyID_AsyncOK, sizeof(isAsync), &isAsync, 0}, {kQTPropertyClass_MovieInstantiation, kQTMovieInstantiationPropertyID_DontAskUnresolvedDataRefs, sizeof (dontResolve), &dontResolve, 0}, {kQTPropertyClass_Audio, kQTAudioPropertyID_RateChangesPreservePitch, sizeof(ratePitch), &ratePitch, 0}, {kQTPropertyClass_Context, kQTContextPropertyID_AudioContext, sizeof (aAudioContextRef), &aAudioContextRef, 0}, {kQTPropertyClass_Context, kQTContextPropertyID_VisualContext, sizeof (aVisualContext), &aVisualContext, 0}
};

// keyTo... are just internal macros
aDataHandler = keyToHandle(keyArgument(1));
keyIfNULL(aDataHandler);
anOffset = keyToPointer(keyArgument(2));
keyIfError(NewMovieFromProperties(sizeof(aMovieProperties) / sizeof (QTNewMoviePropertyElement), aMovieProperties, 0, NULL, &aMovie));

Has anyone tried this?
The movie I am retrieve was added to the file with PutMovieIntoStorage (). The headers say kQTMovieResourceLocatorPropertyID_FileOffset is for NewMovieFromDataFork but there is no other attribute I could find that made sense.

I think your code is fine but you may be missing a step. It's hard to tell, since I don't know what keyToHandle(keyArgument(1)) is. I have used very similar code, with the difference that I have this additional line of code:

status = OpenMovieStorage(dataReferenceRecord.dataRef, dataReferenceRecord.dataRefType, kDataHCanRead, &handler);

Are you doing anything like that? Does adding that line help?


Tim Monroe
QuickTime Engineering



_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]