Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[f65bc5]: plugins / codec_mp3 / ID3_PropertyMap.cpp Maximize Restore History

Download this file

ID3_PropertyMap.cpp    265 lines (243 with data), 10.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/*************************************************************************
ID3_PropertyMap.cpp - map for translating properties to ID3 frame tags
-------------------
begin : Sat Jul 30 2012
copyright : (C) 2012 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "config.h"
#include <id3/field.h>
#include "ID3_PropertyMap.h"
//***************************************************************************
Kwave::ID3_PropertyMap::ID3_PropertyMap()
:m_list()
{
// NOTE #1: the left column is allowed to have multiple entries with the
// same property, when encoding the first one is used, when
// decoding, the other ones serve as alternatives
// NOTE #2: the ID3 tag names in the right column must be *unique* !
// Album/Movie/Show title
insert(INF_ALBUM, ID3FID_ALBUM , ENC_TEXT);
// Original album/movie/show title
insert(INF_ALBUM, ID3FID_ORIGALBUM , ENC_TEXT);
// Subtitle/Description refinement
insert(INF_ANNOTATION, ID3FID_SUBTITLE , ENC_TEXT);
// User defined text information
insert(INF_ANNOTATION, ID3FID_USERTEXT , ENC_TEXT);
// INF_ARCHIVAL
// Original artist(s)/performer(s)
insert(INF_AUTHOR, ID3FID_ORIGARTIST , ENC_TEXT_SLASH);
// Involved people list
insert(INF_AUTHOR, ID3FID_INVOLVEDPEOPLE , ENC_TEXT_LIST);
// Involved people list
insert(INF_AUTHOR, ID3FID_INVOLVEDPEOPLE2 , ENC_TEXT_LIST);
// Band/orchestra/accompaniment
insert(INF_AUTHOR, ID3FID_BAND , ENC_TEXT);
// Original lyricist(s)/text writer(s)
insert(INF_AUTHOR, ID3FID_ORIGLYRICIST , ENC_TEXT_SLASH);
// Official artist/performer webpage
insert(INF_AUTHOR, ID3FID_WWWARTIST , ENC_TEXT_URL);
// Official publisher webpage
insert(INF_AUTHOR, ID3FID_WWWPUBLISHER , ENC_TEXT_URL);
// INF_BITRATE_LOWER
// INF_BITRATE_NOMINAL
// INF_BITRATE_UPPER
// INF_BITS_PER_SAMPLE
// Part of a set
insert(INF_CD, ID3FID_PARTINSET , ENC_TEXT_PARTINSET);
insert(INF_CDS, ID3FID_PARTINSET , ENC_TEXT_PARTINSET);
// Internet radio station name
insert(INF_COMMISSIONED, ID3FID_NETRADIOSTATION , ENC_TEXT);
// Internet radio station owner
insert(INF_COMMISSIONED, ID3FID_NETRADIOOWNER , ENC_TEXT);
// Comments
insert(INF_COMMENTS, ID3FID_COMMENT , ENC_COMMENT);
// Official audio source webpage
insert(INF_CONTACT, ID3FID_WWWAUDIOSOURCE , ENC_TEXT_SLASH);
// Official internet radio station homepage
insert(INF_CONTACT, ID3FID_WWWRADIOPAGE , ENC_TEXT_SLASH);
// Official audio file webpage
insert(INF_CONTACT, ID3FID_WWWAUDIOFILE , ENC_TEXT_SLASH);
// Ownership (not supported by id3lib)
// ert(INF_CONTACT, ID3FID_OWNERSHIP , ENC_OWNERSHIP?);
// Copyright message.
insert(INF_COPYRIGHT, ID3FID_COPYRIGHT , ENC_TEXT);
// Copyright/Legal infromation
insert(INF_COPYRIGHT, ID3FID_WWWCOPYRIGHT , ENC_TEXT_URL);
// Terms of use
insert(INF_COPYRIGHT, ID3FID_TERMSOFUSE , ENC_TERMS_OF_USE);
// INF_COPYRIGHTED
// Recording dates
insert(INF_CREATION_DATE, ID3FID_RECORDINGDATES , ENC_TEXT); // ### TODO ### TRDA
// Recording time
insert(INF_CREATION_DATE, ID3FID_RECORDINGTIME , ENC_TEXT); // ### TODO ### TDRC
// Date
insert(INF_CREATION_DATE, ID3FID_DATE , ENC_TEXT); // ### TODO ### TDAT
// Year
insert(INF_CREATION_DATE, ID3FID_YEAR , ENC_TEXT); // ### TODO ### TYER
// Time
insert(INF_CREATION_DATE, ID3FID_TIME , ENC_TEXT); // ### TODO ### TIME
// Release time
insert(INF_CREATION_DATE, ID3FID_RELEASETIME , ENC_TEXT); // ### TODO ### TDRL
// Original release year
insert(INF_CREATION_DATE, ID3FID_ORIGYEAR , ENC_TEXT); // ### TODO ### TORY
// Original release time
insert(INF_CREATION_DATE, ID3FID_ORIGRELEASETIME , ENC_TEXT); // ### TODO ### TDOR
// Tagging time
insert(INF_CREATION_DATE, ID3FID_TAGGINGTIME , ENC_TEXT); // ### TODO ### TDTG
// Encoding time
insert(INF_CREATION_DATE, ID3FID_ENCODINGTIME , ENC_TEXT); // ### TODO ### TDEN
// INF_ENGINEER
// INF_FILENAME
// INF_FILESIZE
// Content type (Genre)
insert(INF_GENRE, ID3FID_CONTENTTYPE , ENC_GENRE_TYPE);
// ISRC
insert(INF_ISRC, ID3FID_ISRC , ENC_TEXT);
// INF_KEYWORDS
// INF_LABELS
// Length
insert(INF_LENGTH, ID3FID_SONGLEN , ENC_TEXT); // ### TODO ### TLEN
// File owner/licensee
insert(INF_LICENSE, ID3FID_FILEOWNER , ENC_TEXT);
// Medium type
insert(INF_MEDIUM, ID3FID_MEDIATYPE , ENC_TEXT); // ### TODO ### TMED
// INF_MIMETYPE
// INF_MPEG_EMPHASIS
// INF_MPEG_LAYER
// INF_MPEG_MODEEXT
// INF_MPEG_VERSION
// Title/songname/content description
insert(INF_NAME, ID3FID_TITLE , ENC_TEXT);
// Composer
insert(INF_ORGANIZATION, ID3FID_COMPOSER , ENC_TEXT_SLASH);
// Publisher
insert(INF_ORGANIZATION, ID3FID_PUBLISHER , ENC_TEXT_SLASH);
// Produced notice
insert(INF_ORGANIZATION, ID3FID_PRODUCEDNOTICE , ENC_TEXT_SLASH);
// INF_ORIGINAL
// Lyricist/Text writer
insert(INF_PERFORMER, ID3FID_LYRICIST , ENC_TEXT_SLASH);
// Lead performer(s)/Soloist(s).
insert(INF_PERFORMER, ID3FID_LEADARTIST , ENC_TEXT_SLASH);
// Musician credits list
insert(INF_PERFORMER, ID3FID_MUSICIANCREDITLIST , ENC_TEXT); // ### TODO ### TMCL
// Conductor/performer refinement
insert(INF_PERFORMER, ID3FID_CONDUCTOR , ENC_TEXT);
// Private frame
// INF_PRIVATE
// INF_PRODUCT
// INF_SAMPLE_FORMAT
// INF_SAMPLE_RATE
// INF_SOFTWARE
// INF_SOURCE
// INF_SOURCE_FORM
// INF_SUBJECT
// Encoded by.
insert(INF_TECHNICAN, ID3FID_ENCODEDBY , ENC_TEXT);
// Track number/Position in set
insert(INF_TRACK, ID3FID_TRACKNUM , ENC_TRACK_NUM);
// Number of Tracks
insert(INF_TRACKS, ID3FID_TRACKNUM , ENC_TRACK_NUM);
// INF_VBR_QUALITY
// Interpreted, remixed / modified by
insert(INF_VERSION, ID3FID_MIXARTIST , ENC_TEXT);
// Set subtitle
insert(INF_VERSION, ID3FID_SETSUBTITLE , ENC_TEXT); // ### TODO ### TSST
// ID3FID_PRIVATE => user defined data
insert(INF_UNKNOWN, ID3FID_NOFRAME , ENC_NONE);
}
//***************************************************************************
void Kwave::ID3_PropertyMap::insert(const FileProperty property,
const ID3_FrameID id, const Kwave::ID3_PropertyMap::Encoding encoding)
{
Kwave::ID3_PropertyMap::Mapping mapping;
mapping.m_property = property;
mapping.m_frame_id = id;
mapping.m_encoding = encoding;
m_list.append(mapping);
}
//***************************************************************************
ID3_FrameID Kwave::ID3_PropertyMap::findProperty(
const FileProperty property) const
{
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if ((m.m_property == property) && supported(m.m_frame_id))
return m.m_frame_id;
}
return ID3FID_NOFRAME;
}
//***************************************************************************
bool Kwave::ID3_PropertyMap::containsProperty(const FileProperty property) const
{
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if ((m.m_property == property) && supported(m.m_frame_id))
return true;
}
return false;
}
//***************************************************************************
bool Kwave::ID3_PropertyMap::containsID(const ID3_FrameID id) const
{
if (!supported(id))
return false;
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if (m.m_frame_id == id)
return true;
}
return false;
}
//***************************************************************************
Kwave::ID3_PropertyMap::Encoding Kwave::ID3_PropertyMap::encoding(
const ID3_FrameID id) const
{
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if (m.m_frame_id == id)
return m.m_encoding;
}
return ID3_PropertyMap::ENC_NONE;
}
//***************************************************************************
QList<ID3_FrameID> Kwave::ID3_PropertyMap::knownIDs() const
{
QList<ID3_FrameID> list;
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if (!list.contains(m.m_frame_id))
list.append(m.m_frame_id);
}
return list;
}
//***************************************************************************
FileProperty Kwave::ID3_PropertyMap::property(const ID3_FrameID id) const
{
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if (m.m_frame_id == id) return m.m_property;
}
return INF_UNKNOWN;
}
//***************************************************************************
QList<FileProperty> Kwave::ID3_PropertyMap::properties() const
{
QList<FileProperty> list;
foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
if (!list.contains(m.m_property))
list.append(m.m_property);
}
return list;
}
//***************************************************************************
bool Kwave::ID3_PropertyMap::supported(const ID3_FrameID id) const
{
ID3_FrameInfo frameInfo;
return (frameInfo.NumFields(id) != 0);
}
//***************************************************************************
//***************************************************************************