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

Download this file

ID3_PropertyMap.h    125 lines (100 with data), 3.9 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
/*************************************************************************
ID3_PropertyMap.h - 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. *
* *
***************************************************************************/
#ifndef _ID3_PROPERTY_MAP_H_
#define _ID3_PROPERTY_MAP_H_
#include "config.h"
#include <QList>
#include <QPair>
#include <id3/globals.h>
#include "libkwave/FileInfo.h"
namespace Kwave {
class ID3_PropertyMap
{
public:
/** encoding of the ID3 tag */
typedef enum {
ENC_NONE = 0,
ENC_COMMENT, /**< comment frame */
ENC_GENRE_TYPE, /**< genre type, numeric or text */
ENC_TERMS_OF_USE, /**< terms of use */
ENC_TEXT, /**< text, appended by ';' */
ENC_TEXT_SLASH, /**< text list, seperated by slash '/' */
ENC_TEXT_LIST, /**< list of zero terminated strings */
ENC_TEXT_URL, /**< URL */
ENC_TEXT_PARTINSET, /**< part in set (x/y) */
ENC_TRACK_NUM /**< track/tracks (x/y) */
} Encoding;
/** Default constructor, with initializing */
ID3_PropertyMap();
/** Destructor */
virtual ~ID3_PropertyMap() {}
/**
* Returns the frame ID of a property or an empty string
* if nothing found (reverse lookup).
*/
ID3_FrameID findProperty(const FileProperty property) const;
/** Returns true if the map contains a given property */
bool containsProperty(const FileProperty property) const;
/**
* insert a new property / frame ID mapping
*
* @param property a Kwave FileProperty
* @param id a ID3 frame ID
* @param encoding the type of the encoding of the tag
*/
void insert(const FileProperty property, const ID3_FrameID id,
const Encoding encoding);
/**
* returns true if a given ID3 frame ID is in the map
*
* @param id a ID3 frame ID
* @return true if found, false if not
*/
bool containsID(const ID3_FrameID id) const;
/**
* returns the encoding of the ID3 frame
*
* @param id a ID3 frame ID
* @return the encoding of the content of the frame
*/
Encoding encoding(const ID3_FrameID id) const;
/** returns a list of all known ID3 frame IDs */
QList<ID3_FrameID> knownIDs() const;
/**
* Returns the first FileProperty that matches a given ID3 frame ID
*
* @param id a ID3 frame ID
* @return a FileProperty
*/
FileProperty property(const ID3_FrameID id) const;
/** Returns a list with all supported properties */
QList<FileProperty> properties() const;
private:
/** returns true if a frame is supported by id3lib */
bool supported(const ID3_FrameID id) const;
private:
/** container for one mapping */
typedef struct
{
FileProperty m_property; /**< the Kwave property */
ID3_FrameID m_frame_id; /**< ID3 frame ID */
Encoding m_encoding; /**< data encoding */
} Mapping;
/** list of mappings */
QList<Mapping> m_list;
};
}
#endif /* _ID3_PROPERTY_MAP_H_ */