Ask a Question related to Mac Programming, Design and Development.
-
Terry #1
Self-contained Movie Handle?
I want to put a movie file into a single self-contained handle that I can
store and retrieve and play back. PutMovieIntoHandle wont work because it
does not put the movie *data* into the handle.
I tried flattening the movie into a handle with FlattenMovieData as shown in
<[url]http://developer.apple.com/samplecode/Sample_Code/QuickTime/Importers_and_E[/url]
xporters/qtflattentohandle.htm>
It appears to make a flat movie handle, but then I can't seem to make a
movie from it. NewMovieFromDataRef returns noMovieFound.
How can I turn the handle back into a movie?
Or, how else should I make the handle?
Thanks.
Handle TestMovieFileToHandle(FSSpec* spec)
{
OSErr err = noErr;
Movie movie = NULL;
Movie flatMovie = NULL;
Movie newMovie = NULL;
short refnum = 0;
short resID = 0;
Boolean changed = false;
Str255 movieName = "\p";
Handle h = NULL;
DataReferenceRecord dataRefRec;
err = OpenMovieFile(spec, &refnum, fsRdPerm);
err = NewMovieFromFile( &movie,
refnum,
&resID,
movieName,
newMovieActive,
&changed);
dataRefRec.dataRefType = HandleDataHandlerSubType;
dataRefRec.dataRef = NewHandle(sizeof(Handle));
h = NewHandle(0);
*((Handle*)(*dataRefRec.dataRef)) = h;
flatMovie = FlattenMovieData( movie,
flattenFSSpecPtrIsDataRefRecordPtr,
(FSSpec *)&dataRefRec,
0,
smSystemScript,
0);
// flatMovie looks OK
// Verify there is data in our handle
long hSize = GetHandleSize(h);
// Yep, about 14KB
// Now, see if we can create a movie from our h handle
err = NewMovieFromDataRef( &newMovie,
newMovieActive,
NULL,
h,
HandleDataHandlerSubType);
// Nope, err is -2048 (noMovieFound) :-(
return h;
}
Terry Guest
-
Handle 3D Quicktime Movie
Hi, I have couple of 3D quicktime movies (.mov) and wanted to know how to plug them inside director movie (either by importing them inside director... -
ViewState of Contained Controls?
I've built my tab control, and it works great. Except for one problem. Any controls which are contained in any of the tabs lose state. The tab... -
Self-Contained Movie-Clip as Menu?
hi all, wondering if anyone has any advice: i've created a menu for my project that basically rolls on-screen from the left with 6... -
value contained within a variable contained within another variable
I may be way off track with what I am trying to do, but here is my scenario and I sure appreciate any insights. There is a string stored in... -
Accessing Assemblies not contained in the Web App
Hello, I created a simple C# library assembly that exposes general facilities I would like to use in my ASP.NET web applications. If I added the... -
David Phillip Oster #2
Re: Self-contained Movie Handle?
In article <BB970129.1F844%a@b.com>, Terry <a@b.com> wrote:
> It appears to make a flat movie handle, but then I can't seem to make a
> movie from it. NewMovieFromDataRef returns noMovieFound.
>
> How can I turn the handle back into a movie?
> Or, how else should I make the handle?I've pointed you at your bug, above.> dataRefRec.dataRefType = HandleDataHandlerSubType;
> dataRefRec.dataRef = NewHandle(sizeof(Handle));
>
> h = NewHandle(0);
> *((Handle*)(*dataRefRec.dataRef)) = h;
>
> flatMovie = FlattenMovieData( movie,
> flattenFSSpecPtrIsDataRefRecordPtr,
> (FSSpec *)&dataRefRec,
> 0,
> smSystemScript,
> 0);
>
> // flatMovie looks OK
> // Verify there is data in our handle
> long hSize = GetHandleSize(h);
> // Yep, about 14KB
> // Now, see if we can create a movie from our h handle
>
> err = NewMovieFromDataRef( &newMovie,
> newMovieActive,
> NULL,
> h, // <-- bug
> HandleDataHandlerSubType);
>
h is not a data ref. dataRefRec.dataRef is. NewMovieFromDataRef wants a
data ref.
David Phillip Oster Guest
-
Terry #3
Re: Self-contained Movie Handle?
Thanks David. That was indeed a problem. I also needed to use the flag
flattenAddMovieToDataFork. And, if I ever try to use a saved copy of the
handle, I have to do this:
long trackCount = GetMovieTrackCount(newMovie);
long track;
for (track=1;track<=trackCount;track++) {
Media media = GetTrackMedia(GetMovieIndTrack(newMovie, track));
short dataRefCount = 0;
GetMediaDataRefCount(media, &dataRefCount);
long dref;
for (dref=1;dref<=dataRefCount;dref++) {
err = SetMediaDataRef( media,
dref,
dataReferenceHandle,
HandleDataHandlerSubType );
} }
Now, this all works in my app. But, I would like it if I could put the
handle data on the clipboard as a 'moov' and paste it into QT Player, or the
scrapbook. I can almost get it to work if I include the flag
flattenForceMovieResourceBeforeMovieData. The scrapbook and QT Player know
the size and number of frames and act like they can play it, but there are
no images -- everything is blank.
IF I use the original handle (not a copy) made by FlattenMovieData, then the
movies draw and play in QT Player, but only until my app disposes of ITS
handle.
Is there any way to fix this?
Thanks.
> In article <BB970129.1F844%a@b.com>, Terry <a@b.com> wrote:
>>>> It appears to make a flat movie handle, but then I can't seem to make a
>> movie from it. NewMovieFromDataRef returns noMovieFound.
>>
>> How can I turn the handle back into a movie?
>> Or, how else should I make the handle?>>> dataRefRec.dataRefType = HandleDataHandlerSubType;
>> dataRefRec.dataRef = NewHandle(sizeof(Handle));
>>
>> h = NewHandle(0);
>> *((Handle*)(*dataRefRec.dataRef)) = h;
>>
>> flatMovie = FlattenMovieData( movie,
>> flattenFSSpecPtrIsDataRefRecordPtr,
>> (FSSpec *)&dataRefRec,
>> 0,
>> smSystemScript,
>> 0);
>>
>> // flatMovie looks OK
>> // Verify there is data in our handle
>> long hSize = GetHandleSize(h);
>> // Yep, about 14KB
>> // Now, see if we can create a movie from our h handle
>>
>> err = NewMovieFromDataRef( &newMovie,
>> newMovieActive,
>> NULL,
>> h, // <-- bug
>> HandleDataHandlerSubType);
>>
> I've pointed you at your bug, above.
>
> h is not a data ref. dataRefRec.dataRef is. NewMovieFromDataRef wants a
> data ref.Terry Guest



Reply With Quote

