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