[FFmpeg-devel] [PATCH] av_get_delay

Michael Niedermayer michaelni at gmx.at
Tue Jun 28 21:03:33 CEST 2011


On Tue, Jun 21, 2011 at 08:14:09PM +0200, Nicolas George wrote:
> Hi.
> 
> The attached patches implement an API to get the delay of an output format.
> The delay is the amount of time between when a frame is fed to the format
> with av_write_frame and when it is actually processed by the output format.
> 
> This is especially useful for devices, where this information is necessary
> if there is need to maintain some kind of synchronization, for example
> between audio and video output.

with the current API audio/video output "muxers" should "present"
the data to the user at the pts of the given packet.

your get_delay() would still be usefull for them and more so for muxers
incapable of presenting at a given pts.

[...]
> @@ -1518,6 +1520,18 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
>   */
>  int av_write_trailer(AVFormatContext *s);
>  
> +/**
> + * Get the delay for the selected stream.
> + * The delay is the difference between the PTS of the data currently
> + * processed by the output format and the PTS of the last data fed to the
> + * muxer, assuming there was no timestamp discontinuity.
> + * The exact meaning of that depends on the muxer.
> + * It is mostly relevant for live streams, like devices or network
> + * protocols.

Maybe something along the following lines is clearer:
the delay is the duration in timebase units of all buffered data.
buffered in the sense of between what goes into the muxer and what
is presented to the user or transmitted over the net.


> + * If the format does not support delay measurement, the return value is 0.
> + */

some value that is not a valid delay would allow distinguishing it from
valid delays. some error code representing "Not implemented" maybe


also the code should consider the buffering required for interleaving
(by dts for example)


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110628/1173d1e1/attachment.asc>


More information about the ffmpeg-devel mailing list