kwave  18.07.70
Kwave::ID3_PropertyMap Class Reference

#include <ID3_PropertyMap.h>

Collaboration diagram for Kwave::ID3_PropertyMap:
Collaboration graph

Classes

struct  Mapping
 

Public Types

enum  Encoding {
  ENC_NONE = 0, ENC_COMMENT, ENC_GENRE_TYPE, ENC_LENGTH,
  ENC_TERMS_OF_USE, ENC_TEXT, ENC_TEXT_SLASH, ENC_TEXT_LIST,
  ENC_TEXT_URL, ENC_TEXT_PARTINSET, ENC_TEXT_TIMESTAMP, ENC_TRACK_NUM
}
 

Public Member Functions

 ID3_PropertyMap ()
 
virtual ~ID3_PropertyMap ()
 
ID3_FrameID findProperty (const Kwave::FileProperty property) const
 
bool containsProperty (const Kwave::FileProperty property) const
 
void insert (const Kwave::FileProperty property, const ID3_FrameID id, const Encoding encoding)
 
bool containsID (const ID3_FrameID id) const
 
Encoding encoding (const ID3_FrameID id) const
 
QList< ID3_FrameID > knownIDs () const
 
Kwave::FileProperty property (const ID3_FrameID id) const
 
QList< Kwave::FilePropertyproperties () const
 

Private Member Functions

bool supported (const ID3_FrameID id) const
 

Private Attributes

QList< Mappingm_list
 

Detailed Description

Definition at line 33 of file ID3_PropertyMap.h.

Member Enumeration Documentation

◆ Encoding

encoding of the ID3 tag

Enumerator
ENC_NONE 
ENC_COMMENT 

comment frame

ENC_GENRE_TYPE 

genre type, numeric or text

ENC_LENGTH 

string with length in ms

ENC_TERMS_OF_USE 

terms of use

ENC_TEXT 

text, appended by ';'

ENC_TEXT_SLASH 

text list, separated by slash '/'

ENC_TEXT_LIST 

list of zero terminated strings

ENC_TEXT_URL 

URL

ENC_TEXT_PARTINSET 

part in set (x/y)

ENC_TEXT_TIMESTAMP 

ISO 8601 timestamp

ENC_TRACK_NUM 

track/tracks (x/y)

Definition at line 38 of file ID3_PropertyMap.h.

Constructor & Destructor Documentation

◆ ID3_PropertyMap()

Kwave::ID3_PropertyMap::ID3_PropertyMap ( )

Default constructor, with initializing

Definition at line 25 of file ID3_PropertyMap.cpp.

References ENC_COMMENT, ENC_GENRE_TYPE, ENC_LENGTH, ENC_NONE, ENC_TERMS_OF_USE, ENC_TEXT, ENC_TEXT_LIST, ENC_TEXT_PARTINSET, ENC_TEXT_SLASH, ENC_TEXT_TIMESTAMP, ENC_TEXT_URL, ENC_TRACK_NUM, Kwave::INF_ALBUM, Kwave::INF_ANNOTATION, Kwave::INF_AUTHOR, Kwave::INF_CD, Kwave::INF_CDS, Kwave::INF_COMMENTS, Kwave::INF_COMMISSIONED, Kwave::INF_CONTACT, Kwave::INF_COPYRIGHT, Kwave::INF_CREATION_DATE, Kwave::INF_GENRE, Kwave::INF_ISRC, Kwave::INF_LENGTH, Kwave::INF_LICENSE, Kwave::INF_MEDIUM, Kwave::INF_NAME, Kwave::INF_ORGANIZATION, Kwave::INF_PERFORMER, Kwave::INF_SOFTWARE, Kwave::INF_TECHNICAN, Kwave::INF_TRACK, Kwave::INF_TRACKS, Kwave::INF_UNKNOWN, Kwave::INF_VERSION, and insert().

26  :m_list()
27 {
28  // NOTE #1: the left column is allowed to have multiple entries with the
29  // same property, when encoding the first one is used, when
30  // decoding, the other ones serve as alternatives
31  // NOTE #2: the ID3 tag names in the right column must be *unique* !
32 
33  // Album/Movie/Show title
34  insert(Kwave::INF_ALBUM, ID3FID_ALBUM , ENC_TEXT);
35  // Original album/movie/show title
36  insert(Kwave::INF_ALBUM, ID3FID_ORIGALBUM , ENC_TEXT);
37  // Subtitle/Description refinement
38  insert(Kwave::INF_ANNOTATION, ID3FID_SUBTITLE , ENC_TEXT);
39  // User defined text information
40  insert(Kwave::INF_ANNOTATION, ID3FID_USERTEXT , ENC_TEXT);
41  // Kwave::INF_ARCHIVAL
42  // Original artist(s)/performer(s)
43  insert(Kwave::INF_AUTHOR, ID3FID_ORIGARTIST , ENC_TEXT_SLASH);
44  // Involved people list
45  insert(Kwave::INF_AUTHOR, ID3FID_INVOLVEDPEOPLE , ENC_TEXT_LIST);
46  // Involved people list
47  insert(Kwave::INF_AUTHOR, ID3FID_INVOLVEDPEOPLE2 , ENC_TEXT_LIST);
48  // Band/orchestra/accompaniment
49  insert(Kwave::INF_AUTHOR, ID3FID_BAND , ENC_TEXT);
50  // Original lyricist(s)/text writer(s)
51  insert(Kwave::INF_AUTHOR, ID3FID_ORIGLYRICIST , ENC_TEXT_SLASH);
52  // Official artist/performer webpage
53  insert(Kwave::INF_AUTHOR, ID3FID_WWWARTIST , ENC_TEXT_URL);
54  // Official publisher webpage
55  insert(Kwave::INF_AUTHOR, ID3FID_WWWPUBLISHER , ENC_TEXT_URL);
56  // Kwave::INF_BITRATE_LOWER
57  // Kwave::INF_BITRATE_NOMINAL
58  // Kwave::INF_BITRATE_UPPER
59  // Kwave::INF_BITS_PER_SAMPLE
60  // Part of a set
61  insert(Kwave::INF_CD, ID3FID_PARTINSET , ENC_TEXT_PARTINSET);
62  insert(Kwave::INF_CDS, ID3FID_PARTINSET , ENC_TEXT_PARTINSET);
63  // Internet radio station name
64  insert(Kwave::INF_COMMISSIONED, ID3FID_NETRADIOSTATION , ENC_TEXT);
65  // Internet radio station owner
66  insert(Kwave::INF_COMMISSIONED, ID3FID_NETRADIOOWNER , ENC_TEXT);
67  // Comments
68  insert(Kwave::INF_COMMENTS, ID3FID_COMMENT , ENC_COMMENT);
69  // Official audio source webpage
70  insert(Kwave::INF_CONTACT, ID3FID_WWWAUDIOSOURCE , ENC_TEXT_SLASH);
71  // Official internet radio station homepage
72  insert(Kwave::INF_CONTACT, ID3FID_WWWRADIOPAGE , ENC_TEXT_SLASH);
73  // Official audio file webpage
74  insert(Kwave::INF_CONTACT, ID3FID_WWWAUDIOFILE , ENC_TEXT_SLASH);
75  // Ownership (not supported by id3lib)
76  // (Kwave::INF_CONTACT, ID3FID_OWNERSHIP , ENC_OWNERSHIP?);
77  // Copyright message.
78  insert(Kwave::INF_COPYRIGHT, ID3FID_COPYRIGHT , ENC_TEXT);
79  // Copyright/Legal infromation
80  insert(Kwave::INF_COPYRIGHT, ID3FID_WWWCOPYRIGHT , ENC_TEXT_URL);
81  // Terms of use
82  insert(Kwave::INF_COPYRIGHT, ID3FID_TERMSOFUSE , ENC_TERMS_OF_USE);
83  // Kwave::INF_COPYRIGHTED
84 
85  // Recording dates
86  insert(Kwave::INF_CREATION_DATE, ID3FID_RECORDINGDATES , ENC_TEXT_TIMESTAMP);
87  // Recording time (not supported by id3lib)
88  // (Kwave::INF_CREATION_DATE, ID3FID_RECORDINGTIME , ENC_TEXT_TIMESTAMP);
89  // Date
91  // Year
93  // Time
95  // Release time (not supported by id3lib)
96  // (Kwave::INF_CREATION_DATE, ID3FID_RELEASETIME , ENC_TEXT_TIMESTAMP);
97  // Original release year
99  // Original release time (not supported by id3lib)
100  // (Kwave::INF_CREATION_DATE, ID3FID_ORIGRELEASETIME , ENC_TEXT_TIMESTAMP);
101  // Tagging time (not supported by id3lib)
102  // (Kwave::INF_CREATION_DATE, ID3FID_TAGGINGTIME , ENC_TEXT_TIMESTAMP);
103  // Encoding time (not supported by id3lib)
104  // (Kwave::INF_CREATION_DATE, ID3FID_ENCODINGTIME , ENC_TEXT_TIMESTAMP);
105 
106  // Kwave::INF_ENGINEER
107  // Kwave::INF_FILENAME
108  // Kwave::INF_FILESIZE
109  // Content type (Genre)
110  insert(Kwave::INF_GENRE, ID3FID_CONTENTTYPE , ENC_GENRE_TYPE);
111  // ISRC
112  insert(Kwave::INF_ISRC, ID3FID_ISRC , ENC_TEXT);
113  // Kwave::INF_KEYWORDS
114  // Kwave::INF_LABELS
115  // Length
116  insert(Kwave::INF_LENGTH, ID3FID_SONGLEN , ENC_LENGTH);
117  // File owner/licensee
118  insert(Kwave::INF_LICENSE, ID3FID_FILEOWNER , ENC_TEXT);
119  // Medium type
120  insert(Kwave::INF_MEDIUM, ID3FID_MEDIATYPE , ENC_TEXT);
121  // Kwave::INF_MIMETYPE
122  // Kwave::INF_MPEG_EMPHASIS
123  // Kwave::INF_MPEG_LAYER
124  // Kwave::INF_MPEG_MODEEXT
125  // Kwave::INF_MPEG_VERSION
126  // Title/songname/content description
127  insert(Kwave::INF_NAME, ID3FID_TITLE , ENC_TEXT);
128  // Composer
129  insert(Kwave::INF_ORGANIZATION, ID3FID_COMPOSER , ENC_TEXT_SLASH);
130  // Publisher
131  insert(Kwave::INF_ORGANIZATION, ID3FID_PUBLISHER , ENC_TEXT_SLASH);
132  // Produced notice
133  insert(Kwave::INF_ORGANIZATION, ID3FID_PRODUCEDNOTICE , ENC_TEXT_SLASH);
134  // Kwave::INF_ORIGINAL
135  // Lyricist/Text writer
136  insert(Kwave::INF_PERFORMER, ID3FID_LYRICIST , ENC_TEXT_SLASH);
137  // Lead performer(s)/Soloist(s).
138  insert(Kwave::INF_PERFORMER, ID3FID_LEADARTIST , ENC_TEXT_SLASH);
139  // Musician credits list
140  insert(Kwave::INF_PERFORMER, ID3FID_MUSICIANCREDITLIST , ENC_TEXT_SLASH);
141  // Conductor/performer refinement
142  insert(Kwave::INF_PERFORMER, ID3FID_CONDUCTOR , ENC_TEXT);
143  // Private frame
144  // Kwave::INF_PRIVATE
145  // Kwave::INF_PRODUCT
146  // Kwave::INF_SAMPLE_FORMAT
147  // Kwave::INF_SAMPLE_RATE
148  insert(Kwave::INF_SOFTWARE, ID3FID_ENCODERSETTINGS , ENC_TEXT);
149  // Kwave::INF_SOURCE
150  // Kwave::INF_SOURCE_FORM
151  // Kwave::INF_SUBJECT
152  // Encoded by.
153  insert(Kwave::INF_TECHNICAN, ID3FID_ENCODEDBY , ENC_TEXT);
154  // Track number/Position in set
155  insert(Kwave::INF_TRACK, ID3FID_TRACKNUM , ENC_TRACK_NUM);
156  // Number of Tracks
157  insert(Kwave::INF_TRACKS, ID3FID_TRACKNUM , ENC_TRACK_NUM);
158  // Kwave::INF_VBR_QUALITY
159  // Interpreted, remixed / modified by
160  insert(Kwave::INF_VERSION, ID3FID_MIXARTIST , ENC_TEXT);
161  // Set subtitle
162  insert(Kwave::INF_VERSION, ID3FID_SETSUBTITLE , ENC_TEXT);
163  // ID3FID_PRIVATE => user defined data
164 
165  insert(Kwave::INF_UNKNOWN, ID3FID_NOFRAME , ENC_NONE);
166 }
void insert(const Kwave::FileProperty property, const ID3_FrameID id, const Encoding encoding)
QList< Mapping > m_list
Here is the call graph for this function:

◆ ~ID3_PropertyMap()

virtual Kwave::ID3_PropertyMap::~ID3_PropertyMap ( )
inlinevirtual

Destructor

Definition at line 57 of file ID3_PropertyMap.h.

References containsID(), containsProperty(), encoding(), findProperty(), insert(), knownIDs(), properties(), property(), and supported().

57 {}
Here is the call graph for this function:

Member Function Documentation

◆ containsID()

bool Kwave::ID3_PropertyMap::containsID ( const ID3_FrameID  id) const

returns true if a given ID3 frame ID is in the map

Parameters
ida ID3 frame ID
Returns
true if found, false if not

Definition at line 203 of file ID3_PropertyMap.cpp.

References Kwave::ID3_PropertyMap::Mapping::m_frame_id, m_list, and supported().

Referenced by ~ID3_PropertyMap().

204 {
205  if (!supported(id))
206  return false;
207 
208  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
209  if (m.m_frame_id == id)
210  return true;
211  }
212  return false;
213 }
QList< Mapping > m_list
bool supported(const ID3_FrameID id) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ containsProperty()

bool Kwave::ID3_PropertyMap::containsProperty ( const Kwave::FileProperty  property) const

Returns true if the map contains a given property

Definition at line 192 of file ID3_PropertyMap.cpp.

References Kwave::ID3_PropertyMap::Mapping::m_frame_id, m_list, Kwave::ID3_PropertyMap::Mapping::m_property, and supported().

Referenced by ~ID3_PropertyMap().

194 {
195  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
196  if ((m.m_property == property) && supported(m.m_frame_id))
197  return true;
198  }
199  return false;
200 }
QList< Mapping > m_list
Kwave::FileProperty property(const ID3_FrameID id) const
bool supported(const ID3_FrameID id) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encoding()

Kwave::ID3_PropertyMap::Encoding Kwave::ID3_PropertyMap::encoding ( const ID3_FrameID  id) const

returns the encoding of the ID3 frame

Parameters
ida ID3 frame ID
Returns
the encoding of the content of the frame

Definition at line 216 of file ID3_PropertyMap.cpp.

References ENC_NONE, Kwave::ID3_PropertyMap::Mapping::m_encoding, Kwave::ID3_PropertyMap::Mapping::m_frame_id, and m_list.

Referenced by Kwave::MP3Encoder::encodeID3Tags(), insert(), Kwave::MP3Decoder::parseID3Tags(), and ~ID3_PropertyMap().

Here is the caller graph for this function:

◆ findProperty()

ID3_FrameID Kwave::ID3_PropertyMap::findProperty ( const Kwave::FileProperty  property) const

Returns the frame ID of a property or an empty string if nothing found (reverse lookup).

Definition at line 181 of file ID3_PropertyMap.cpp.

References Kwave::ID3_PropertyMap::Mapping::m_frame_id, m_list, Kwave::ID3_PropertyMap::Mapping::m_property, and supported().

Referenced by Kwave::MP3Encoder::encodeID3Tags(), and ~ID3_PropertyMap().

183 {
184  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
185  if ((m.m_property == property) && supported(m.m_frame_id))
186  return m.m_frame_id;
187  }
188  return ID3FID_NOFRAME;
189 }
QList< Mapping > m_list
Kwave::FileProperty property(const ID3_FrameID id) const
bool supported(const ID3_FrameID id) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert()

void Kwave::ID3_PropertyMap::insert ( const Kwave::FileProperty  property,
const ID3_FrameID  id,
const Encoding  encoding 
)

insert a new property / frame ID mapping

Parameters
propertya Kwave FileProperty
ida ID3 frame ID
encodingthe type of the encoding of the tag

Definition at line 169 of file ID3_PropertyMap.cpp.

References encoding(), Kwave::ID3_PropertyMap::Mapping::m_encoding, Kwave::ID3_PropertyMap::Mapping::m_frame_id, m_list, Kwave::ID3_PropertyMap::Mapping::m_property, and property().

Referenced by ID3_PropertyMap(), and ~ID3_PropertyMap().

171 {
173 
174  mapping.m_property = property;
175  mapping.m_frame_id = id;
176  mapping.m_encoding = encoding;
177  m_list.append(mapping);
178 }
QList< Mapping > m_list
Encoding encoding(const ID3_FrameID id) const
Kwave::FileProperty property(const ID3_FrameID id) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ knownIDs()

QList< ID3_FrameID > Kwave::ID3_PropertyMap::knownIDs ( ) const

returns a list of all known ID3 frame IDs

Definition at line 227 of file ID3_PropertyMap.cpp.

References Kwave::ID3_PropertyMap::Mapping::m_frame_id, and m_list.

Referenced by ~ID3_PropertyMap().

228 {
229  QList<ID3_FrameID> list;
230  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
231  if (!list.contains(m.m_frame_id))
232  list.append(m.m_frame_id);
233  }
234  return list;
235 }
QList< Mapping > m_list
Here is the caller graph for this function:

◆ properties()

QList< Kwave::FileProperty > Kwave::ID3_PropertyMap::properties ( ) const

Returns a list with all supported properties

Definition at line 247 of file ID3_PropertyMap.cpp.

References m_list, and Kwave::ID3_PropertyMap::Mapping::m_property.

Referenced by Kwave::MP3Encoder::supportedProperties(), and ~ID3_PropertyMap().

248 {
249  QList<Kwave::FileProperty> list;
250  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
251  if (!list.contains(m.m_property))
252  list.append(m.m_property);
253  }
254  return list;
255 }
QList< Mapping > m_list
Here is the caller graph for this function:

◆ property()

Kwave::FileProperty Kwave::ID3_PropertyMap::property ( const ID3_FrameID  id) const

Returns the first FileProperty that matches a given ID3 frame ID

Parameters
ida ID3 frame ID
Returns
a FileProperty

Definition at line 238 of file ID3_PropertyMap.cpp.

References Kwave::INF_UNKNOWN, Kwave::ID3_PropertyMap::Mapping::m_frame_id, m_list, and Kwave::ID3_PropertyMap::Mapping::m_property.

Referenced by insert(), Kwave::MP3Decoder::parseID3Tags(), and ~ID3_PropertyMap().

239 {
240  foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
241  if (m.m_frame_id == id) return m.m_property;
242  }
243  return Kwave::INF_UNKNOWN;
244 }
QList< Mapping > m_list
Here is the caller graph for this function:

◆ supported()

bool Kwave::ID3_PropertyMap::supported ( const ID3_FrameID  id) const
private

returns true if a frame is supported by id3lib

Definition at line 258 of file ID3_PropertyMap.cpp.

Referenced by containsID(), containsProperty(), findProperty(), and ~ID3_PropertyMap().

259 {
260  ID3_FrameInfo frameInfo;
261  return (frameInfo.NumFields(id) != 0);
262 }
Here is the caller graph for this function:

Member Data Documentation

◆ m_list

QList<Mapping> Kwave::ID3_PropertyMap::m_list
private

list of mappings

Definition at line 123 of file ID3_PropertyMap.h.

Referenced by containsID(), containsProperty(), encoding(), findProperty(), insert(), knownIDs(), properties(), and property().


The documentation for this class was generated from the following files: