[FFmpeg-devel] [PATCH] Add the function libavcodec/utils.c:avcodec_type_string

Michael Niedermayer michaelni
Fri Nov 9 04:17:08 CET 2007


Hi

On Fri, Nov 09, 2007 at 12:41:38AM +0100, Aurelien Jacobs wrote:
> Stefano Sabatini wrote:
> 
> > Hi to all,
> > 
> > suggested log: $subject.
> > 
> > Well, I know it's stupid, nonetheless I find myself writing this
> > little function again and again in applications (especially when
> > I'm trying to do some debugging).
> > 
> > Also bumps micro version since it adds a function to the external api.
> 
> Adding public API requires an minor version bump.
> 
> Also, I would simplify avcodec_type_string() using a table:
> 
> static const char *codec_type_string[] = {
>     [CODEC_TYPE_VIDEO]    = "video",
>     [CODEC_TYPE_AUDIO]    = "audio",
>     [CODEC_TYPE_DATA]     = "data",
>     [CODEC_TYPE_SUBTITLE] = "subtitle",
>     [CODEC_TYPE_NB]       = "unknown",
> }
> 
> char *avcodec_type_string (char *buf, int buf_size, enum CodecType codec_type)
> {
>     if (codec_type<0 || codec_type>CODEC_TYPE_NB)

this can be simplified to 1 check with (unsigned)


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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20071109/c22caac3/attachment.pgp>



More information about the ffmpeg-devel mailing list