id3lib  3.8.3
header.cpp
Go to the documentation of this file.
1 // $Id: header.cpp,v 1.11 2002/07/31 13:20:49 t1mpy Exp $
2 
3 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags
4 // Copyright 1999, 2000 Scott Thomas Haug
5 // Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
6 
7 // This library is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU Library General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or (at your
10 // option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public License
18 // along with this library; if not, write to the Free Software Foundation,
19 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 
21 // The id3lib authors encourage improvements and optimisations to be sent to
22 // the id3lib coordinator. Please see the README file for details on where to
23 // send such submissions. See the AUTHORS file for a list of people who have
24 // contributed to id3lib. See the ChangeLog file for a list of changes to
25 // id3lib. These files are distributed with id3lib at
26 // http://download.sourceforge.net/id3lib/
27 
28 #include "header.h"
29 
30 #if defined HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
35 {
36  static ID3_Header::Info _spec_info[] =
37  {
38  // Warning, EXT SIZE are minimum sizes, they can be bigger
39  // SIZEOF SIZEOF SIZEOF IS EXT EXT EXPERIM
40  // FRID FRSZ FRFL HEADER SIZE BIT
41  { 3, 3, 0, false, 0, false }, // ID3V2_2_0
42  { 3, 3, 0, true, 8, true }, // ID3V2_2_1
43  { 4, 4, 2, false, 10, false }, // ID3V2_3_0
44  { 4, 4, 2, false, 6, false } // ID3V2_4_0
45  };
46 
47  bool changed = false;
48  if (spec < ID3V2_EARLIEST || spec > ID3V2_LATEST)
49  {
50  changed = _spec != ID3V2_UNKNOWN;
52  _info = NULL;
53  }
54  else
55  {
56  changed = _spec != spec;
57  _spec = spec;
58  _info = &_spec_info[_spec - ID3V2_EARLIEST];
59  }
60  _changed = _changed || changed;
61  return changed;
62 }
63 
ID3_V2Spec _spec
Definition: header.h:102
bool _changed
Definition: header.h:106
Info * _info
Definition: header.h:105
virtual bool SetSpec(ID3_V2Spec)
Definition: header.cpp:34
#define NULL
Definition: globals.h:743
ID3_V2Spec
Definition: globals.h:162
@ ID3V2_LATEST
Definition: globals.h:169
@ ID3V2_UNKNOWN
Definition: globals.h:163
@ ID3V2_EARLIEST
Definition: globals.h:168