[FFmpeg-devel] [PATCH 3/3] lavc: adjust timestamp in case of skiping initial samples
Michael Niedermayer
michaelni at gmx.at
Fri Jul 13 20:12:56 CEST 2012
On Fri, Jul 13, 2012 at 12:18:54AM +0200, Nicolas George wrote:
> Le quintidi 25 messidor, an CCXX, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavcodec/utils.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > index e435c05..db0d870 100644
> > --- a/libavcodec/utils.c
> > +++ b/libavcodec/utils.c
> > @@ -1656,6 +1656,12 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
> > } else {
> > av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
> > frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
> > + if(avctx->pkt_timebase.num && avctx->sample_rate) {
> > + if(frame->pkt_pts!=AV_NOPTS_VALUE)
> > + frame->pkt_pts += av_rescale_q(avctx->internal->skip_samples,(AVRational){1, avctx->sample_rate}, avctx->pkt_timebase);
> > + if(frame->pkt_dts!=AV_NOPTS_VALUE)
> > + frame->pkt_dts += av_rescale_q(avctx->internal->skip_samples,(AVRational){1, avctx->sample_rate}, avctx->pkt_timebase);
> > + }
> > frame->nb_samples -= avctx->internal->skip_samples;
> > avctx->internal->skip_samples = 0;
> > }
>
> Altering the pkt_?ts fields feels a bit like lying: the packet did not have
> that altered timestamp. Maybe best_effort_timestamp would be a better
> choice:
the concern i have with best_effort_timestamp is that it was intended
to be a optional thing for applications not the one and only way to get
timestamps but if the initial sample skip just modifies it then
it becomes pretty much mandatory to be used
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No great genius has ever existed without some touch of madness. -- Aristotle
-------------- 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/20120713/40805c8a/attachment.asc>
More information about the ffmpeg-devel
mailing list