00001 // $Id: header.cpp,v 1.11 2002/07/31 13:20:49 t1mpy Exp $ 00002 00003 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags 00004 // Copyright 1999, 2000 Scott Thomas Haug 00005 // Copyright 2002 Thijmen Klok (thijmen@id3lib.org) 00006 00007 // This library is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU Library General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or (at your 00010 // option) any later version. 00011 // 00012 // This library is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00015 // License for more details. 00016 // 00017 // You should have received a copy of the GNU Library General Public License 00018 // along with this library; if not, write to the Free Software Foundation, 00019 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 // The id3lib authors encourage improvements and optimisations to be sent to 00022 // the id3lib coordinator. Please see the README file for details on where to 00023 // send such submissions. See the AUTHORS file for a list of people who have 00024 // contributed to id3lib. See the ChangeLog file for a list of changes to 00025 // id3lib. These files are distributed with id3lib at 00026 // http://download.sourceforge.net/id3lib/ 00027 00028 #include "header.h" 00029 00030 #if defined HAVE_CONFIG_H 00031 #include <config.h> 00032 #endif 00033 00034 bool ID3_Header::SetSpec(ID3_V2Spec spec) 00035 { 00036 static ID3_Header::Info _spec_info[] = 00037 { 00038 // Warning, EXT SIZE are minimum sizes, they can be bigger 00039 // SIZEOF SIZEOF SIZEOF IS EXT EXT EXPERIM 00040 // FRID FRSZ FRFL HEADER SIZE BIT 00041 { 3, 3, 0, false, 0, false }, // ID3V2_2_0 00042 { 3, 3, 0, true, 8, true }, // ID3V2_2_1 00043 { 4, 4, 2, false, 10, false }, // ID3V2_3_0 00044 { 4, 4, 2, false, 6, false } // ID3V2_4_0 00045 }; 00046 00047 bool changed = false; 00048 if (spec < ID3V2_EARLIEST || spec > ID3V2_LATEST) 00049 { 00050 changed = _spec != ID3V2_UNKNOWN; 00051 _spec = ID3V2_UNKNOWN; 00052 _info = NULL; 00053 } 00054 else 00055 { 00056 changed = _spec != spec; 00057 _spec = spec; 00058 _info = &_spec_info[_spec - ID3V2_EARLIEST]; 00059 } 00060 _changed = _changed || changed; 00061 return changed; 00062 } 00063