[FFmpeg-devel] [PATCH 1/5] id3v2: use an enum for encodings instead of magic numbers.

Måns Rullgård mans
Fri Jan 21 15:35:41 CET 2011


Anton Khirnov <anton at khirnov.net> writes:

> ---
>  libavformat/id3v2.c |   10 +++++-----
>  libavformat/id3v2.h |    7 +++++++
>  2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h
> index 25ee53e..3f89aca 100644
> --- a/libavformat/id3v2.h
> +++ b/libavformat/id3v2.h
> @@ -38,6 +38,13 @@
>  #define ID3v2_FLAG_ENCRYPTION  0x0004
>  #define ID3v2_FLAG_COMPRESSION 0x0008
>
> +enum ID3v2Encoding {
> +    ID3v2_ENCODING_ISO8859,
> +    ID3v2_ENCODING_UTF16BOM,
> +    ID3v2_ENCODING_UTF16BE,
> +    ID3v2_ENCODING_UTF8,
> +};

Since the values are defined by the id3v2 spec, I'd prefer if they
were assigned explicitly here.  It helps others understand the code in
relation to the spec.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list