[FFmpeg-devel] [PATCH] Ensure sample_aspect_ratio.den is nonzero

Michael Niedermayer michaelni
Wed Apr 21 15:11:58 CEST 2010

On Wed, Apr 21, 2010 at 06:32:58AM -0400, David Conrad wrote:
> Hi,
> Currently no decoders check for validity of sample_aspect_ratio, specifically, whether sample_aspect_ratio.den is nonzero. This leads to an issue with theora files, which have 0/0 written a lot of the time, causing ffmpeg to calculate an aspect ratio of 4/1 after some math involving NaNs.

elaborate please

> Since "unknown" is the only valid interpretation of a denominator of zero, this adds a check to both avcodec_open() and avcodec_decode_video2() to set {0,1} which is a safer value to give to user applications.
> Alternatively, I could put the check in each codec that sets it directly from the bitstream, or clarify the API that a zero denominator is allowed and fix ffmpeg.

I would have assumed that 0/0 is allowed and meant unknown aspect but i
need to first know where the problem you are working on is to be able
to decide what would be the best approuch to fix that or if we should
avoid 0/0

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100421/bb2823a2/attachment.pgp>

More information about the ffmpeg-devel mailing list