[FFmpeg-devel] [PATCH] mov hacks: Fix ulaw-in-mov sample.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Mar 24 23:59:22 CET 2012


On Sat, Mar 24, 2012 at 07:38:09PM +0100, Reimar Döffinger wrote:
> This patch fixes the sample from trac issue #522.
> One issue is that the size of the trak elements is coded
> too large, so that the next trak element would be parsed
> as part of the first and truncated incorrectly.
> The second issue is that the mov demuxer insists on using its
> calculated sample_size (which is nonsense) instead of the one
> encoded in the track.
> I have no idea what the correct behaviour is, a special-case
> for ulaw is one way that works for this case.
> 
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
>  libavformat/mov.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 4f79196..e1a8d87 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -319,6 +319,16 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>          if (atom.size >= 8) {
>              a.size = avio_rb32(pb);
>              a.type = avio_rl32(pb);
> +            if (atom.type != MKTAG('r','o','o','t') &&
> +                atom.type != MKTAG('m','o','o','v'))
> +            {
> +                if (a.type == MKTAG('t','r','a','k') || a.type == MKTAG('m','d','a','t'))
> +                {
> +                    av_log(c->fc, AV_LOG_ERROR, "Broken file, trak/mdat not at top-level\n");
> +                    avio_skip(pb, -8);
> +                    return 0;
> +                }
> +            }

This part also fixes issue #733, so I'll split that up before applying,
though I want an ok before actually doing the work since I admit it
is quite ugly as-is :-)
And 733 seems to confirm that Vivotek stuff produces consistently broken
files.


More information about the ffmpeg-devel mailing list