[FFmpeg-devel] [PATCH] Fix incorrect detection of badly interleaved avi

Michael Niedermayer michaelni at gmx.at
Thu Jul 4 20:53:50 CEST 2013


On Thu, Jul 04, 2013 at 04:51:32PM +0100, Nigel Touati-Evans wrote:
> The method guess_ni_flag needs to divide timestamps in the index
> by sample_size if it is set in order to compare different streams correctly.

commit message should start with "avidec:" or something like that


> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index f5c2345..a09bebd 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -1397,15 +1397,16 @@ static int guess_ni_flag(AVFormatContext *s){
>  
>          for (i=0; i<s->nb_streams; i++) {
>              AVStream *st = s->streams[i];
> +            AVIStream *ast = st->priv_data;
>              int n= st->nb_index_entries;
>              while (idx[i]<n && st->index_entries[idx[i]].pos < pos)
>                  idx[i]++;
>              if (idx[i] < n) {
> -                min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp, st->time_base, AV_TIME_BASE_Q));
> +                min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q));

the rounding looks wrong

(AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE}
is used elsewhere in the file instead of AV_TIME_BASE_Q for this
purpose

also do you have a file or testcase that needs this ? i wasnt able to
find one where this patch made a difference

Thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- 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/20130704/457efbbd/attachment.asc>


More information about the ffmpeg-devel mailing list