Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / June 2007



Tip: Looking for answers? Try searching our database.

Mystery behind SetMediaDataRef and AddMediaDataRef

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mg - 19 Jun 2007 14:13 GMT
Does anyone know the precise meaning of 'Handle dataRef' and 'OSType
dataRefType' parameters of QuickTime SDK's SetMediaDataRef and
AddMediaDataRef. Apple's QT framework reference mentions that the type
of information stored in the handle depends on the value in
dataRefType parameter but does not go into allowed types and the
correponding data.

My goal is set media data reference such that after new samples are
added to the media and then the movie is flattened - the added samples
end up in the same file as the move. What would be the proper way to
call SetMediaDataRef/AddMediaDataRef to accomplish that?
Gregory Weston - 19 Jun 2007 16:25 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.