Start Code/QTFlatten.c

#include <Movies.h>
 
#include "QTUtilities.h"
#include "QTFlatten.h"
#include "CreateMovie.h"
#include "ComFramework.h"
 
/************************************************************
*                                                           *
*                                                           *
*  QTSave_FlattenMovie                                      *                   
*  Save and flatten a movie resource into a file.           *
*                                                           *
*                                                           *
*************************************************************/
 
OSErr QTSave_FlattenMovie (Movie theMovie, FSSpec *myFile)
{
    Movie   aMovie = NULL;
    OSErr   myErr = noErr;
 
    // The FlattenMovieData function creates a new movie file and creates a new movie
    // that contains all of its movie data.
    // NOTE: Unlike the FlattenMovie, this function does not add the new movie resource
    // to the new movie file. Instead, the FlattenMovieData function returns the new
    // movie to your application. Your application must dispose of the returned movie.
            
// Step 1.
// Insert FlattenMovieData.clp here...
        
        myErr = GetMoviesError();
        CheckError( myErr, "FlattenMovie error" );
        
        // Dispose the returned movie because we don't need it. Our sample uses NewMovieFromFile
        // to open the newly flattened movie.
        if (aMovie == NULL)
            CheckError( invalidMovie, "FlattenMovie error" );
        else
            DisposeMovie(aMovie);
            
    return myErr;
}