[FFmpeg-devel] [PATCH 5/6] lavc: update pkt_duration for skipped samples.
Michael Niedermayer
michaelni at gmx.at
Mon Jul 16 04:06:36 CEST 2012
On Sun, Jul 15, 2012 at 05:53:05PM +0200, Nicolas George wrote:
> Also: factor the the computation of the timestamp difference.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavcodec/utils.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index dd9c0d1..ead7944 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1664,10 +1664,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
> 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) {
> + int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
> + (AVRational){1, avctx->sample_rate},
> + avctx->pkt_timebase);
> 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);
> + frame->pkt_pts += diff_ts;
> 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->pkt_dts += diff_ts;
> + if (frame->pkt_duration > 0)
> + frame->pkt_duration -= diff_ts;
this should check that pkt_duration stays >= 0
otherwise LGTM
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- 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/20120716/e4c72ad6/attachment.asc>
More information about the ffmpeg-devel
mailing list