Professional Web Applications Themes

Self-contained Movie Handle? - Mac Programming

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 ...

  1. #1

    Default 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

  2. #2

    Default Re: Self-contained Movie Handle?

    In article <BB970129.1F844%ab.com>, Terry <ab.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.
    David Phillip Oster Guest

  3. #3

    Default 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%ab.com>, Terry <ab.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

Similar Threads

  1. Handle 3D Quicktime Movie
    By Ajay Vyas in forum Macromedia Director 3D
    Replies: 3
    Last Post: September 25th, 05:41 PM
  2. ViewState of Contained Controls?
    By lisa@starways.net in forum ASP.NET Building Controls
    Replies: 5
    Last Post: December 14th, 05:08 PM
  3. Self-Contained Movie-Clip as Menu?
    By Greg Vickers in forum Macromedia Flash
    Replies: 0
    Last Post: November 13th, 03:56 PM
  4. Replies: 1
    Last Post: September 17th, 06:59 PM
  5. Accessing Assemblies not contained in the Web App
    By Mike M in forum ASP.NET General
    Replies: 2
    Last Post: July 22nd, 05:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139