id3lib
3.8.3
src
spec.cpp
Go to the documentation of this file.
1
// $Id: spec.cpp,v 1.2 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
#if defined HAVE_CONFIG_H
29
#include <config.h>
30
#endif
31
32
#include "
spec.h
"
33
34
ID3_V2Spec
ID3_VerRevToV2Spec
(
uchar
ver,
uchar
rev)
35
{
36
ID3_V2Spec
spec =
ID3V2_UNKNOWN
;
37
if
(2 == ver)
38
{
39
if
(0 == rev)
40
{
41
spec =
ID3V2_2_0
;
42
}
43
else
if
(1 == rev)
44
{
45
spec =
ID3V2_2_1
;
46
}
47
}
48
else
if
(3 == ver)
49
{
50
if
(0 == rev)
51
{
52
spec =
ID3V2_3_0
;
53
}
54
}
55
else
if
(4 == ver)
56
{
57
if
(0 == rev)
58
{
59
spec =
ID3V2_4_0
;
60
}
61
}
62
63
return
spec;
64
}
65
66
uchar
ID3_V2SpecToVer
(
ID3_V2Spec
spec)
67
{
68
uchar
ver = 0;
69
switch
(spec)
70
{
71
case
ID3V2_2_0
:
72
case
ID3V2_2_1
:
73
ver = 2;
74
break
;
75
case
ID3V2_3_0
:
76
ver = 3;
77
break
;
78
case
ID3V2_4_0
:
79
ver = 4;
80
break
;
81
default
:
82
break
;
83
}
84
return
ver;
85
}
86
87
uchar
ID3_V2SpecToRev
(
ID3_V2Spec
spec)
88
{
89
uchar
rev = 0;
90
switch
(spec)
91
{
92
case
ID3V2_4_0
:
93
rev = 0;
94
break
;
95
case
ID3V2_3_0
:
96
rev = 0;
97
break
;
98
case
ID3V2_2_1
:
99
rev = 1;
100
break
;
101
case
ID3V2_2_0
:
102
rev = 0;
103
break
;
104
default
:
105
break
;
106
}
107
return
rev;
108
}
109
ID3_V2Spec
ID3_V2Spec
Definition:
globals.h:162
ID3V2_4_0
@ ID3V2_4_0
Definition:
globals.h:167
ID3V2_2_1
@ ID3V2_2_1
Definition:
globals.h:165
ID3V2_UNKNOWN
@ ID3V2_UNKNOWN
Definition:
globals.h:163
ID3V2_2_0
@ ID3V2_2_0
Definition:
globals.h:164
ID3V2_3_0
@ ID3V2_3_0
Definition:
globals.h:166
uchar
unsigned char uchar
Definition:
globals.h:114
ID3_V2SpecToRev
uchar ID3_V2SpecToRev(ID3_V2Spec spec)
Definition:
spec.cpp:87
ID3_VerRevToV2Spec
ID3_V2Spec ID3_VerRevToV2Spec(uchar ver, uchar rev)
Definition:
spec.cpp:34
ID3_V2SpecToVer
uchar ID3_V2SpecToVer(ID3_V2Spec spec)
Definition:
spec.cpp:66
spec.h
Generated by
1.9.1