[FFmpeg-devel] [PATCH 03/11] Implement av_get_codec_tag_string() and use it in ffprobe.
Michael Niedermayer
michaelni
Sun May 23 11:19:31 CEST 2010
On Sat, May 22, 2010 at 05:58:07PM +0200, Stefano Sabatini wrote:
> ---
[...]
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3088,6 +3088,15 @@ attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
> */
> unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
>
> +/**
> + * Returns a string representing a codec tag, NULL if the codec_tag is
> + * unknown.
> + *
> + * @param buf buffer with size buf_size where the function puts the
> + * codec tag string
doesnt match code
> + */
> +const char *av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
> +
> #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
> #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
> #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 56d4dbd..8d8826a 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -798,6 +798,22 @@ static int get_bit_rate(AVCodecContext *ctx)
> return bit_rate;
> }
>
> +const char *av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
const?
> +{
> + int i, fourcc[4];
> + fourcc[0] = codec_tag & 0xff;
> + fourcc[1] = codec_tag>>8 & 0xff;
> + fourcc[2] = codec_tag>>16 & 0xff;
> + fourcc[3] = codec_tag>>24 & 0xff;
> +
> + buf[0] = 0;
> + for (i = 0; i < 4; i++) {
> + if (isprint(fourcc[i])) av_strlcatf(buf, buf_size, "%c" , fourcc[i]);
> + else av_strlcatf(buf, buf_size, "[%d]", fourcc[i]);
snprintf()
codec_tag&0xFF
codec_tag>>=8;
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- 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/20100523/25e785ba/attachment.pgp>
More information about the ffmpeg-devel
mailing list