开发者

Access to the contents of a QuickTime Movie Track's Edit Atom?

开发者 https://www.devze.com 2022-12-13 17:17 出处:网络
Is there any way to get hold of the contents of a QuickTime Movie Track\'s Edit Atom ( i.e. \'edts\' ) in general and the contents of its Edit List Atom ( i.e. \'elst\' ) in special using the QuickTim

Is there any way to get hold of the contents of a QuickTime Movie Track's Edit Atom ( i.e. 'edts' ) in general and the contents of its Edit List Atom ( i.e. 'elst' ) in special using the QuickTime (C) API?

The goal is to identify any edits in a given track along with their duration and start time.

I have been checking the QuickTime Reference Library (both legacy and current) for the last two hou开发者_如何学Gors and yet have not been able to identify any API to achieve this.

Any hints would be greatly appreciated.

Cheers,

\Bjoern


To answer my own question:

The contents of a track's edit list (if any), i.e. the edits/segments present in a track may be determined via the GetTrackNextInterestingTime() API function (code ripped from Movies.h):

/*
 *  GetTrackNextInterestingTime()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 */
EXTERN_API( void )
GetTrackNextInterestingTime(
  Track        theTrack,
  short        interestingTimeFlags,
  TimeValue    time,
  Fixed        rate,
  TimeValue *  interestingTime,
  TimeValue *  interestingDuration);

by passing nextTimeTrackEdit (to look for track edits) and nextTimeEdgeOK (to include borderline cases) in interestingTimeFlags.

For most cases in which you may be interested into the edits being present in a track you will have to map the returned interestingTime from track time to media time (f.e. if you've been examining the track's edits to determine a possible track offset).

This is accomplished via the TrackTimeToMediaTime() API function:

/*
 *  TrackTimeToMediaTime()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 */
EXTERN_API( TimeValue )
TrackTimeToMediaTime(
  TimeValue   value,
  Track       theTrack);

Edit

The state of the art way to convert track time to media time would be TrackTimeToMediaDisplayTime():

/*
 *  TrackTimeToMediaDisplayTime()
 *  
 *  Summary:
 *    Converts a track's time value to a display time value that is
 *    appropriate to the track's media, using the track's edit list.
 *    This is a 64-bit replacement for TrackTimeToMediaTime.
 *  
 *  Discussion:
 *    This function maps the track time through the track's edit list
 *    to come up with the media time. This time value contains the
 *    track's time value according to the media's time coordinate
 *    system. If the time you specified lies outside of the movie's
 *    active segment or corresponds to empty space in the track, this
 *    function returns a value of -1. Hence you can use it to determine
 *    whether a specified track edit is empty.
 *  
 *  Parameters:
 *    
 *    value:
 *      The track's time value; must be expressed in the time scale of
 *      the movie that contains the track.
 *    
 *    theTrack:
 *      The track for this operation.  Your application obtains this
 *      track identifier from such functions as NewMovieTrack and
 *      GetMovieTrack.
 *  
 *  Result:
 *    The corresponding time in media display time, in the media's time
 *    coordinate system. If the track time corresponds to empty space,
 *    this function returns a value of -1.
 *  
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.4 (or QuickTime 7.0) and later
 *    Windows:          in qtmlClient.lib version 10.4 (or QuickTime 7.0) and later
 */
EXTERN_API( TimeValue64 )
TrackTimeToMediaDisplayTime(
  TimeValue64   value,
  Track         theTrack);
0

精彩评论

暂无评论...
验证码 换一张
取 消