and a timecode of: 01:03:02:00 for my start frame, Final Cut Pro
5.1.1 reports it to be: 04:21:41:08
Subsequent frames are sequential listed in the timecode track, which
is good. But the start time is completely wrong..
Here is how I build the TimeCodeDescription.. maybe something is
wrong, there..
if (tcNameHandle != NULL)
DisposeHandle(tcNameHandle);
DisposeUserData(tcUserData);
}
Beyond that.. I really can't see what the problem is..
More testing..
Again, if anyone sees something, let me know..
Thanks Sayli!!
bob..
On Sep 8, 2006, at 2:10 PM, Sayli Benadikar wrote:
Hi Bob,
BeginMediaEdits() definitely needs to be called before you call
AddMediaSample2() to add the timecode samples to the timecode media.
You mentioned that you tried passing in an empty handle dataref
when creating the new media but this didn't work...
Passing in an empty Handle Data Reference Handle to NewTrackMedia
(so that the timecode media is created in memory) should work.
Here's how you'd create the handle data reference handle and the
new media:
// create a Handle Data Reference Handle - see Tech Note 1195:
Tagging
// Handle and Pointer Data References in QuickTime for more
information
timeCodeDataRef = NewHandleClear(sizeof(Handle) + 1);
if (err = MemError()) goto bail;
atomHeader[0] = EndianU32_NtoB(8);
atomHeader[1] = EndianU32_NtoB(OSTypeConst('data'));
err = PtrAndHand(atomHeader, timeCodeDataRef, 8);
if ( err ) goto bail;
// create media for the timecode track
timeCodeMedia = NewTrackMedia(/* the timeCodeTrack*/,
TimeCodeMediaType, /* the timeCodeMediaTimeScale*/,
timeCodeDataRef, HandleDataHandlerSubType);
if (err = GetMoviesError()) goto bail;
DisposeHandle(timeCodeDataRef);
timeCodeDataRef = nil;
When filling out the TimeCodeDescription struct, you set the
dataRefIndex to 1 (indexes are 1-based), to indicate that the first
(and, in this case, the only) dataref in the timecode media is the
one that contains the required sample data.
HTH,
Sayli Benadikar
QuickTime Engineering
On Sep 7, 2006, at 10:53 PM, Robert Monaghan wrote:
Nope.. tried that..
This is what I found that might be the problem.. found this via
Google..
typedef struct TimeCodeDescription {
long descSize; /* size of the structure */
long dataFormat; /* sample type */
long resvd1; /* reserved--set to 0 */
short resvd2; /* reserved--set to 0 */
short dataRefIndex; /* data reference index */
long flags; /* reserved--set to 0 */
TimeCodeDef timeCodeDef; /* timecode format information */
long srcRef[1]; /* source information */
} TimeCodeDescription, *TimeCodeDescriptionPtr,
**TimeCodeDescriptionHandle;
dataRefIndex - Contains an index value indicating which of the
media's data references contains
the sample data for this sample description
So, when I set up my TimeCodeDescription, what should I put for a
dataRefIndex value? (And will this even matter?)
bob..
On Sep 7, 2006, at 10:42 PM, Steve Israelson wrote:
Call BeginMediaEdits (or whatever?)
On 7-Sep-06, at 10:43 PM, Robert Monaghan wrote:
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/sisraelson%
40mac.com
This email sent to email@hidden
_______________________________________________
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/sayli%
40apple.com
This email sent to email@hidden
_______________________________________________
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