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

Anton Khirnov anton
Fri Jan 21 19:16:33 CET 2011


On Fri, Jan 21, 2011 at 02:35:41PM +0000, M?ns Rullg?rd wrote:
> 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.
done

On Fri, Jan 21, 2011 at 04:14:35PM +0100, Diego Biurrun wrote:
> On Fri, Jan 21, 2011 at 03:22:12PM +0100, Anton Khirnov wrote:
> > 
> > --- a/libavformat/id3v2.h
> > +++ b/libavformat/id3v2.h
> > @@ -38,6 +38,13 @@
> >  
> > +enum ID3v2Encoding {
> > +    ID3v2_ENCODING_ISO8859,
> > +    ID3v2_ENCODING_UTF16BOM,
> > +    ID3v2_ENCODING_UTF16BE,
> > +    ID3v2_ENCODING_UTF8,
> 
> Are these taken from a standard document or just local definitions?
> In the former case a reference would be good.
They come from the ID3 specs, like everything else in this file ;)
The to it is inserted further below, i don't really see a point in
duplicating it

-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-id3v2-use-an-enum-for-encodings-instead-of-magic-num.patch
Type: text/x-diff
Size: 2219 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110121/f1f03732/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110121/f1f03732/attachment.pgp>



More information about the ffmpeg-devel mailing list