[FFmpeg-devel] [PATCH] raw_read_header fix

Michael Niedermayer michaelni
Sat Jul 14 09:57:05 CEST 2007


Hi

On Sat, Jul 14, 2007 at 03:50:16AM +0200, Alex Beregszaszi wrote:
> Hi,
> 
> > > Well, if try_decode_frame fails, why shouldn't we give up? And ulaw/alaw
> > > decoder should fail if no sampling rate is specified as there is no way
> > > for storing such information in the format itself.
> > 
> > True, but how is the calling app to know that the format lacks this
> > information beforehand?
> 
> We can anyway make assumptions, but imho codec_init should reply an
> error like insufficient codec configuration.
> 
> The attached patch solves different problems, but now in the end this
> works nicely here.
> 
> av_valid_q might be wrong at assuming numerator should be >= 0, but imho
> in mathematics.c there were some assertions about this. We surely don't
> want a negative time_base, right?
> 
> av_valid_q is just a helper, might be of use.
> 
> pcm.diff adds checks into pcm.c to bail out when no sampling rate or
> channels are set, as itself cannot fill those fields out.

but decoding of pcm as well as alaw/ulaw should work fine without a sample
rate, so its wrong to fail ...


[...]

> Index: libavutil/rational.c
> ===================================================================
> --- libavutil/rational.c	(revision 9618)
> +++ libavutil/rational.c	(working copy)
> @@ -101,3 +101,7 @@
>  
>      return a;
>  }
> +
> +int av_valid_q(AVRational a){
> +    return a.num >= 0 && a.den > 0;
> +}

nonsense, theres nothing invalid on an AVRational if these are false



[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070714/7290128d/attachment.pgp>



More information about the ffmpeg-devel mailing list