> Does anyone know the precise meaning of 'Handle dataRef' and 'OSType
> dataRefType' parameters of QuickTime SDK's SetMediaDataRef and
[quoted text clipped - 7 lines]
> end up in the same file as the move. What would be the proper way to
> call SetMediaDataRef/AddMediaDataRef to accomplish that?
Your question really doesn't have anything to do with your goal, at
least for the functions you've referenced. The dataRef is an arbitrary
handle, and the dataRefType tells the function what kind of information
to expect to find at that handle.
You want this function, which I found at
<http://developer.apple.com/technotes/tn2005/tn2140.html>.
OSStatus WriteFlattenedMovieToFile(Movie inMovie, CFStringRef inPath)
{
Handle dataRef = NULL;
OSType dataRefType;
OSStatus err;
// create the data reference
err = QTNewDataReferenceFromFullPathCFString(inPath,
kQTNativeDefaultPathStyle, 0,
&dataRef, &dataRefType);
if (noErr == err) {
// flatten the movie
Movie newMovie = FlattenMovieDataToDataRef(inMovie,
flattenAddMovieToDataFork,
dataRef, dataRefType,
FOUR_CHAR_CODE('TVOD'),
smSystemScript,
createMovieFileDeleteCurFile);
if (NULL != newMovie) {
// we choose not to do anything with the returned movie
DisposeMovie(newMovie);
} else {
err = invalidMovie;
}
// remember to dispose the data reference handle
DisposeHandle(dataRef);
}
return err;
}
mg - 19 Jun 2007 19:40 GMT
> In article <1182258822.218677.141...@o61g2000hsh.googlegroups.com>,
>
[quoted text clipped - 53 lines]
>
> - Show quoted text -
I found that WriteFlattenedMovieToFile function worked well when I
started with a pristine 'inMovie' that I got from a movie file. What I
need flatten is a movie that I've created from scratch to resemble the
source movie in the number and types of tracks and media but that,
initially, does not contain any samples. I use a bunch of low level
calls such as CopyMovieSettings, CopyTrackSettings, etc. to generate
this empty destination movie. (That is why I asked about
SetMediaDataRef.) In my code, I step through the samples of the source
movie and add the samples to the destination movie, modifying the
samples if necessary. After finishing copying all the samples, I try
to flatten the destination movie but only the movie resource gets into
the file - no sample data at all. Perhaps I am not creating the empty
destination movie correctly. Is there a simple way to create a movie
that the same as the source but without any samples?
mg - 19 Jun 2007 21:16 GMT
> > In article <1182258822.218677.141...@o61g2000hsh.googlegroups.com>,
>
[quoted text clipped - 70 lines]
>
> - Show quoted text -
I just found a problem in my code. It seems that added samples get
lost unless AddNewSample sequence is follow by a call to
InsertMediaIntoTrack.
Jan E. Schotsman - 19 Jun 2007 22:21 GMT
> I just found a problem in my code. It seems that added samples get
> lost unless AddNewSample sequence is follow by a call to
> InsertMediaIntoTrack.
They aren't lost, just not viewable/audible etc until you use the
media in a track.
The exception being when all tracks are empty because then you probably
get the "no movie found" error when you try to open the movie.
BTW did you come across AddEmptyTrackToMovie? This is the right tool
for copying tracks without copying data (adding new or modified samples
instead).
Jan E.