src/spec.cpp

Go to the documentation of this file.
00001 // $Id: spec.cpp,v 1.2 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 #if defined HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 #include "spec.h"
00033 
00034 ID3_V2Spec ID3_VerRevToV2Spec(uchar ver, uchar rev)
00035 {
00036   ID3_V2Spec spec = ID3V2_UNKNOWN;
00037   if (2 == ver)
00038   {
00039     if (0 == rev)
00040     {
00041       spec = ID3V2_2_0;
00042     }
00043     else if (1 == rev)
00044     {
00045       spec = ID3V2_2_1;
00046     }
00047   } 
00048   else if (3 == ver)
00049   {
00050     if (0 == rev)
00051     {
00052       spec = ID3V2_3_0;
00053     }
00054   }
00055   else if (4 == ver)
00056   {
00057     if (0 == rev)
00058     {
00059       spec = ID3V2_4_0;
00060     }
00061   }
00062 
00063   return spec;
00064 }
00065 
00066 uchar ID3_V2SpecToVer(ID3_V2Spec spec)
00067 {
00068   uchar ver = 0;
00069   switch (spec)
00070   {
00071     case ID3V2_2_0:
00072     case ID3V2_2_1:
00073       ver = 2;
00074       break;
00075     case ID3V2_3_0:
00076       ver = 3;
00077       break;
00078     case ID3V2_4_0:
00079       ver = 4;
00080       break;
00081     default:
00082       break;
00083   }
00084   return ver;
00085 }
00086 
00087 uchar ID3_V2SpecToRev(ID3_V2Spec spec)
00088 {
00089   uchar rev = 0;
00090   switch (spec)
00091   {
00092     case ID3V2_4_0:
00093       rev = 0;
00094       break;
00095     case ID3V2_3_0:
00096       rev = 0;
00097       break;
00098     case ID3V2_2_1:
00099       rev = 1;
00100       break;
00101     case ID3V2_2_0:
00102       rev = 0;
00103       break;
00104     default:
00105       break;
00106   }
00107   return rev;
00108 }
00109 

Generated on Mon Aug 20 17:48:46 2007 for id3lib by  doxygen 1.5.2