[FFmpeg-devel] [PATCH] Add the function libavcodec/utils.c:avcodec_type_string
Aurelien Jacobs
aurel
Fri Nov 9 00:41:38 CET 2007
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)
codec_type = CODEC_TYPE_NB;
av_strlcpy(buf, codec_type_string[codec_type], buf_size);
return buf;
}
Aurel
More information about the ffmpeg-devel
mailing list