[Ffmpeg-devel] [PATCH] accept only existing bitrates in amr.c

Michael Niedermayer michaelni
Mon Mar 5 19:24:14 CET 2007


Hi

On Mon, Mar 05, 2007 at 01:18:07PM +0100, Benoit Fouet wrote:
> Michael Niedermayer wrote:
> > Hi
> >
> > On Mon, Mar 05, 2007 at 11:18:32AM +0100, Benoit Fouet wrote:
> >   
> >> Hi,
> >>
> >> now that audio bitrate is handled the same way as video bitrate, we can
> >> get rid of the workaround in amr codecs.
> >>     
> >
> > [...]
> >
> > [...]
> >   
> >> -            return(rates[i].mode);
> >> +            *mode=rates[i].mode;
> >> +            return 0;
> >>     
> >
> > why not return the mode like before?
> >
> > [...]
> >   
> >   
> well, in the amr nb case, it's an enum, and so we cannot do it (wel, we
> can, but i don't think it's clean) so i changed it for the amr wb case
> too...
> of course, this can be changed to something like:
> 
> int getMode(int bitrate) /* or enum Mode getMode(int bitrate) for amr nb */
> {
>     if mode exists
>         return(mode);
>     else
>         return -1;
> }
> ...
> {
>     if((mode=getMode(bitrate))<0)
> ...
> }
> 
> i don't really care, i'll do as you wish...

i prefer using the return value for both enum and -1 error yes, enum==int
anyway
or if you recently have been brainwashed by some CS teachers then just add
a enum entry for error and give it the value -1

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20070305/3790e6b4/attachment.pgp>



More information about the ffmpeg-devel mailing list