Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to add a timecode track in my movie import component.



Howdy all!

I am trying to create a timecode track for a movie, as it is being imported. When I run the code, it returns: -2050 badDataRefIndex.. It stops at AddMediaSample2, with this error. From reading what little I can find on Apple's site, the errors appear to be caused by NewTrackMedia not having a data reference. So.. if I supply a data reference from my video track, or an empty handle as a data ref, I get: -2043 dataNotOpenForWrite.

Here is a snippet of code, based upon Electric Image movie importer..

if ((tcTrack == NULL) && (doTimeCode)) {
// Create a new timecode track
tcTrack = NewMovieTrack (theMovie, // Specify the Movie
(**videoDesc).width << 16, // A fixed denoting width of the track, in pixels.
(**videoDesc).height << 16, // A fixed denoting height of the track, in pixels
kNoVolume); // Specifies the volume setting of the track, kNoVolume = 0


// Create a media for the track. The media refers to the actual data samples used by the track.

tcMedia = NewTrackMedia (tcTrack, // Specifies the track for this operation
TimeCodeMediaType, // Type of media to create
kTimeScale, // Set the time scale, this defines the media's time coordinate system
NULL, // Specifies the data reference
0); // Specifies the type of data reference
if (err = GetMoviesError()) goto bail;


                        tcHandler = GetMediaHandler(tcMedia);
                        if (tcHandler == NULL)
                                goto bail;

}
....
Get my timecode records and tc defs built.
....
SetTrackEnabled(tcTrack, TRUE);
err = TCTimeCodeToFrameNumber(tcHandler, & (**tcDesc).timeCodeDef, &tcRecord, *tcRecordHandle);
**tcRecordHandle = EndianS32_NtoB(**tcRecordHandle);


err = AddMediaSample2(tcMedia, // Specifies the media for this operation
(UInt8 *) *tcRecordHandle,
(ByteCount) GetHandleSize((Handle)tcRecordHandle),
frameDuration,
0,
(SampleDescriptionHandle)tcDesc, // Handle to a sample description
1, // Specifies the number of samples contained in the reference
0, // Contains flags that control the operation
NULL); // Returns the time to Decode sample. NULL for now.




I hope someone can point me in the right direction.

Bob..

_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.