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

Stefano Sabatini stefano.sabatini-lala
Fri Nov 9 10:07:12 CET 2007


On date Friday 2007-11-09 04:17:08 +0100, Michael Niedermayer encoded:
> 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)

Hi to all and thanks for your reviews, I took into account every
comment and this is the resulting patch.

Best regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-avcodec-type-string-function-03.patch
Type: text/x-diff
Size: 2078 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071109/959cb1c0/attachment.patch>



More information about the ffmpeg-devel mailing list