[FFmpeg-devel] [PATCH] avformat/mov: compute dts_shift with trun cts
Clément Bœsch
ubitux at gmail.com
Fri May 31 17:32:37 CEST 2013
On Fri, May 31, 2013 at 05:19:16PM +0200, Alexandre Sicard wrote:
> Some movies have negative composition time offsets in their trun, causing pts <
> dts errors. This patch makes use of dts_shift to handle them.
>
> Signed-off-by: Alexandre Sicard <alexandre.sicard at smartjog.com>
> ---
> libavformat/mov.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 1c03b15..c43e6e3 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2562,6 +2562,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> sc->ctts_data[sc->ctts_count].count = 1;
> sc->ctts_data[sc->ctts_count].duration = (flags & MOV_TRUN_SAMPLE_CTS) ?
> avio_rb32(pb) : 0;
> + if (sc->ctts_data[sc->ctts_count].duration < 0) {
> + sc->dts_shift = FFMAX(sc->dts_shift, -sc->ctts_data[sc->ctts_count].duration);
> + }
> sc->ctts_count++;
> if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
> keyframe = 1;
Do you have a sample for this?
This reminds me various issues we had with random samples. Check for
instance:
e74527219668b720aefb7ecb79a44a8137aafa60
be401448e51f209a13e95d30f17d85d0168e1b40
4093220029a4d77f272c491e9299680480a08c00
Such patch needs to be tested with the files mentioned in those
commits/associated tickets.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130531/938db85d/attachment.asc>
More information about the ffmpeg-devel
mailing list