ADC Home > Reference Library > Technical Q&As > QuickTime > Movie Basics >

Saving playback hints in a Movie


Q: I'm calling the SetMoviePlayHints function with the hintsHighQuality flag set as described in "Letters from the Ice Floe" Dispatch 11 to tell QuickTime to render my movie at the best possible quality. However, it seems this is a runtime property so the hints are not actually saved with the movie. How can I save these hints with the movie?

A: Use the SetTrackLoadSettings function, and specify the track you'd like to have the playback hints applied to (note: if you have more than one video track in your movie and you want the hints applied to each track you will need to loop and call SetTrackLoadSettings for each track).

Note:
You can only set the playback hints in this manner for movie files. You cannot set the playback hints for non-movie files such as raw DV stream files.

Here's a short code snippet which locates the first video track in a movie and applies the high-quality playback hint to this track:

 void SavePlaybackHintsToMovie(FSSpecPtr movieFile)
{
    Movie movie     = NULL;
    Track track     = NULL;
    short resRefNum = 0;
    short resId     = movieInDataForkResID;
    Str255          resName;
    OSErr           err;


    err = OpenMovieFile( movieFile, &resRefNum, fsWrPerm );
    if (err != noErr) goto bailError;

    err = NewMovieFromFile( &movie, resRefNum,
        &resId, resName, newMovieActive, NULL );
    if (err != noErr) goto bailError;

        /* get the first video track */
    track = GetMovieIndTrackType( movie, 1,
        VisualMediaCharacteristic,
        movieTrackCharacteristic | movieTrackEnabledOnly );
    if ( track == NULL ) goto bailError;

        /* save the play hints with the movie */
    SetTrackLoadSettings( track, 0, 0, 0, hintsHighQuality );
    err = GetMoviesError();
    if (err != noErr) goto bailError;

        /* save our changes to the movie */
    err = UpdateMovieResource( movie,
        resRefNum, movieInDataForkResID, resName );
    if ( movie != NULL )
    {
        DisposeMovie( movie );
    }
    if ( resRefNum != 0 )
    {
        CloseMovieFile( resRefNum );
    }

bailError:
    ;
}

Listing 1. Using SetTrackLoadSettings to save high quality hints



 


[Sep 04 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.