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
|
/*************************************************************************
WavPropertyMap.cpp - map for translating properties to chunk names
-------------------
begin : Sat Jul 06 2002
copyright : (C) 2002 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 "WavPropertyMap.h"
//***************************************************************************
Kwave::WavPropertyMap::WavPropertyMap()
{
// 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 chunk names in the right column must be *unique* !
// well-known tags
insert(Kwave::INF_AUTHOR ,"AUTH"); // author's name
insert(Kwave::INF_ANNOTATION ,"ANNO"); // annotations
insert(Kwave::INF_ARCHIVAL ,"IARL"); // archival location (EXIF 2.3)
insert(Kwave::INF_PERFORMER ,"IART"); // performer (EXIF 2.3)
insert(Kwave::INF_COMMISSIONED ,"ICMS"); // commissioned (EXIF 2.3)
insert(Kwave::INF_COMMENTS ,"ICMT"); // comments (EXIF 2.3)
insert(Kwave::INF_COPYRIGHT ,"ICOP"); // copyright (EXIF 2.3)
insert(Kwave::INF_CREATION_DATE ,"ICRD"); // creation date (iso) (EXIF 2.3)
insert(Kwave::INF_ENGINEER ,"IENG"); // engineer (EXIF 2.3)
insert(Kwave::INF_GENRE ,"IGNR"); // genre (EXIF 2.3)
insert(Kwave::INF_KEYWORDS ,"IKEY"); // keywords (EXIF 2.3)
insert(Kwave::INF_MEDIUM ,"IMED"); // medium (EXIF 2.3)
insert(Kwave::INF_NAME ,"INAM"); // name (EXIF 2.3)
insert(Kwave::INF_PRODUCT ,"IPRD"); // product (EXIF 2.3)
insert(Kwave::INF_SOFTWARE ,"ISFT"); // software (EXIF 2.3)
insert(Kwave::INF_SOURCE ,"ISRC"); // source (EXIF 2.3)
insert(Kwave::INF_SOURCE_FORM ,"ISRF"); // source form (EXIF 2.3)
insert(Kwave::INF_TECHNICAN ,"ITCH"); // technician (EXIF 2.3)
insert(Kwave::INF_SUBJECT ,"ISBJ"); // subject (EXIF 2.3)
// tags from SoundForge Pro
insert(Kwave::INF_TRACK ,"TRCK"); // track number
insert(Kwave::INF_VERSION ,"TVER"); // version/remix
insert(Kwave::INF_ORGANIZATION ,"TORG"); // organization/label
// some others, alternatives
insert(Kwave::INF_ALBUM ,"IALB"); // name of the album
insert(Kwave::INF_COPYRIGHT ,"(c) "); // copyright
insert(Kwave::INF_CREATION_DATE ,"DTIM"); // date/time original
insert(Kwave::INF_CREATION_DATE ,"YEAR"); // year (MovieID ref12)
insert(Kwave::INF_GENRE ,"GENR"); // genre (MovieID ref12)
insert(Kwave::INF_GENRE ,"ISGN"); // second genre (IMDB)
insert(Kwave::INF_AUTHOR ,"IWRI"); // written by (IMDB)
insert(Kwave::INF_ENGINEER ,"IEDT"); // edited by (IMDB)
insert(Kwave::INF_CD ,"IPTR"); // part (?)
// non-standard, probably only known by Kwave
insert(Kwave::INF_CONTACT ,"cnt "); // contact inf. for creator
insert(Kwave::INF_ISRC ,"isrc"); // Int. Standard Recording Code
insert(Kwave::INF_LICENSE ,"lic "); // license information
}
//***************************************************************************
void Kwave::WavPropertyMap::insert(const Kwave::FileProperty property,
const QByteArray &chunk)
{
Pair p(property, chunk);
append(p);
}
//***************************************************************************
QByteArray Kwave::WavPropertyMap::findProperty(
const Kwave::FileProperty property) const
{
foreach(const Pair &p, QList<Pair>(*this)) {
if (p.first == property)
return p.second;
}
return "";
}
//***************************************************************************
bool Kwave::WavPropertyMap::containsProperty(
const Kwave::FileProperty property) const
{
foreach(const Pair &p, QList<Pair>(*this)) {
if (p.first == property)
return true;
}
return false;
}
//***************************************************************************
bool Kwave::WavPropertyMap::containsChunk(const QByteArray &chunk) const
{
foreach(const Pair &p, QList<Pair>(*this)) {
if (p.second == chunk)
return true;
}
return false;
}
//***************************************************************************
QList<QByteArray> Kwave::WavPropertyMap::chunks() const
{
QList<QByteArray> list;
foreach(const Pair &p, QList<Pair>(*this)) {
if (!list.contains(p.second))
list.append(p.second);
}
return list;
}
//***************************************************************************
Kwave::FileProperty Kwave::WavPropertyMap::property(
const QByteArray &chunk) const
{
foreach(const Pair &p, QList<Pair>(*this)) {
if (p.second == chunk) return p.first;
}
return static_cast<Kwave::FileProperty>(-1);
}
//***************************************************************************
QList<Kwave::FileProperty> Kwave::WavPropertyMap::properties() const
{
QList<Kwave::FileProperty> list;
foreach(const Pair &p, QList<Pair>(*this)) {
if (!list.contains(p.first))
list.append(p.first);
}
return list;
}
//***************************************************************************
//***************************************************************************
|