[FFmpeg-devel] [PATCH] ffmpeg2theora ogg_duration.patch

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat May 7 09:44:26 CEST 2011


On Sun, May 01, 2011 at 07:33:21PM +0200, Michael Niedermayer wrote:
> This is one of 2 changes that ffmpeg2theora applies to ffmpeg
> AUTHORS in ffmpeg2theora says jan gerber <j at v2v.cc> so he is possibly
> the author of this patch
> 
> Index: libavformat/oggdec.c
> ===================================================================
> --- libavformat/oggdec.c        (revision 19439)
> +++ libavformat/oggdec.c        (working copy)
> @@ -469,6 +469,18 @@
>      ogg->size = size;
>      ogg_restore (s, 0);
> 
> +    ogg_save (s);
> +    url_fseek (s->pb, 0, SEEK_SET);
> +    while (!ogg_read_page (s, &i)){
> +        if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
> +            ogg->streams[i].codec) {
> +            s->streams[i]->duration -=
> +                ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
> +            break;
> +        }
> +    }
> +    ogg_restore (s, 0);
> +

I think it is ok, it fixes the concern I had with the alternative
to my patch (might potentially loop over the whole file for some files).
I wouldn't mind if you mentioned it is based on a patch by me, but
it's not important (it clearly has been improved).


More information about the ffmpeg-devel mailing list