[vlc-devel] Frame time information in vout module?
Simon Wilson
s.wilson5 at uq.edu.au
Tue Dec 8 01:43:41 CET 2009
On 8/12/09 9:44 AM, "Simon Wilson" <s.wilson5 at uq.edu.au> wrote:
> Hi all,
>
> I'm working on a new vout module that pushes data into an
> ICMDecompressionSession on OSX (so that I can pull the data out at the other
> end inside my application, which embeds VLC, using Core Video). So far, my
> code (based loosely on the opengllayer.m) can create the decompression
> session and perform the necessary initialization. In my module's display()
> method, however, I need to populate the following structure for each frame
> for the decompression session:
>
> struct ICMFrameTimeRecord {
> wide value; /* frame display time*/
> long scale; /* timescale of value/duration fields*/
> void * base; /* timebase*/
>
> long duration; /* duration frame is to be displayed (0 if unknown)*/
> Fixed rate; /* rate of timebase relative to wall-time*/
>
> long recordSize; /* total number of bytes in ICMFrameTimeRecord*/
>
> long frameNumber; /* number of frame, zero if not known*/
>
> long flags;
>
> wide virtualStartTime; /* conceptual start time*/
> long virtualDuration; /* conceptual duration*/
>
> /* The following fields only exist for QuickTime 7.0 and greater. */
> TimeValue64 decodeTime; /* suggested decode time, if
> icmFrameTimeHasDecodeTime is set in flags*/
> };
>
> The code eamples I've found use this method tend to only set the following:
>
> qt_frame_time.recordSize = sizeof(ICMFrameTimeRecord);
> *(TimeValue64 *) &qt_frame_time.value = display_time;
> qt_frame_time.scale = media_time_scale_;
> qt_frame_time.rate = fixed1; // 1.0
> qt_frame_time.flags = icmFrameTimeIsNonScheduledDisplayTime;
> qt_frame_time.frameNumber = fnum_to_decode+1;
>
> So, my question is -- where about could I find appropriate timing values for
> each frame (in order to compute 'value' and 'scale') from within the vout
> module to plug into this struct? Or should I be targeting a higher level
> within the chain? If it helps, I'm using VLC to play DVDs for image
> analysis.
So, as it turns out, I wasn't creating the decompression session correctly.
Once I did, I've discovered that setting the following works just fine
(though I'm not sure how correct it is):
qt_frame_time.recordSize = sizeof(ICMFrameTimeRecord);
*(TimeValue64*)&qt_frame_time.value = 0;
qt_frame_time.scale = _timeScale; // _timeScale = 1;
qt_frame_time.rate = fixed1;
qt_frame_time.frameNumber = p_sys->i_frameNumber++;
qt_frame_time.flags = icmFrameTimeIsNonScheduledDisplayTime;
Sorry for the noise, and I hope this helps somebody else out there.
Would the maintainers be interested in a cleaned-up version of this module?
Simon Wilson
More information about the vlc-devel
mailing list