[FFmpeg-devel] [PATCH] Add the function libavcodec/utils.c:avcodec_type_string
Diego Biurrun
diego
Fri Nov 9 00:21:44 CET 2007
On Thu, Nov 08, 2007 at 06:02:30PM +0100, Stefano Sabatini wrote:
>
> Seconded and new patch attached.
Sorry for the piecemeal review, more comments below.
> --- libavcodec/avcodec.h (revision 10959)
> +++ libavcodec/avcodec.h (working copy)
> @@ -2477,6 +2477,19 @@
> void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
>
> /**
> + * Print in \p buf a string corresponding to the type of the codec \p
> + * codec_type.
Write a string corresponding to the codec type into a buffer.
> + * @param codec_type[in] Code of the codec type. Currently supported
> + * values are: CODEC_TYPE_VIDEO, CODEC_TYPE_AUDIO, CODEC_TYPE_DATA,
> + * CODEC_TYPE_SUBTITLE.
codec type, currently supported are:
> + * @return Pointer to the buffer \p buf where it has printed the string.
"pointer to \p buf" should be enough.
> --- libavcodec/utils.c (revision 10959)
> +++ libavcodec/utils.c (working copy)
> @@ -1230,6 +1230,33 @@
> }
> }
>
> +char *avcodec_type_string (char *buf, int buf_size, int codec_type)
> +{
> + switch (codec_type) {
> + case CODEC_TYPE_VIDEO:
> + snprintf(buf, buf_size, "video");
> + break;
> +
> + case CODEC_TYPE_AUDIO:
> + snprintf(buf, buf_size, "audio");
> + break;
> +
> + case CODEC_TYPE_DATA:
> + snprintf(buf, buf_size, "data");
> + break;
> +
> + case CODEC_TYPE_SUBTITLE:
> + snprintf(buf, buf_size, "subtitle");
> + break;
> +
> + default:
> + snprintf(buf, buf_size, "unknown");
> + break;
> + }
> +
> + return buf;
> +}
I think this should rather be data_type, codec_type is not a good
variable name here.
Diego
More information about the ffmpeg-devel
mailing list