allow to include solo,mute buttons on meterbridge
[ardour.git] / libs / taglib / examples / framelist.cpp
1 /* Copyright (C) 2003 Scott Wheeler <wheeler@kde.org>
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions
5  * are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #include <iostream>
26 #include <stdlib.h>
27
28 #include <tbytevector.h>
29
30 #include <mpegfile.h>
31
32 #include <id3v2tag.h>
33 #include <id3v2frame.h>
34 #include <id3v2header.h>
35
36 #include <id3v1tag.h>
37
38 #include <apetag.h>
39
40 using namespace std;
41 using namespace TagLib;
42
43 int main(int argc, char *argv[])
44 {
45   // process the command line args
46
47
48   for(int i = 1; i < argc; i++) {
49
50     cout << "******************** \"" << argv[i] << "\"********************" << endl;
51
52     MPEG::File f(argv[i]);
53
54     ID3v2::Tag *id3v2tag = f.ID3v2Tag();
55
56     if(id3v2tag) {
57
58       cout << "ID3v2."
59            << id3v2tag->header()->majorVersion()
60            << "."
61            << id3v2tag->header()->revisionNumber()
62            << ", "
63            << id3v2tag->header()->tagSize()
64            << " bytes in tag"
65            << endl;
66
67       ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
68       for(; it != id3v2tag->frameList().end(); it++)
69         cout << (*it)->frameID() << " - \"" << (*it)->toString() << "\"" << endl;
70     }
71     else
72       cout << "file does not have a valid id3v2 tag" << endl;
73
74     cout << endl << "ID3v1" << endl;
75
76     ID3v1::Tag *id3v1tag = f.ID3v1Tag();
77
78     if(id3v1tag) {
79       cout << "title   - \"" << id3v1tag->title()   << "\"" << endl;
80       cout << "artist  - \"" << id3v1tag->artist()  << "\"" << endl;
81       cout << "album   - \"" << id3v1tag->album()   << "\"" << endl;
82       cout << "year    - \"" << id3v1tag->year()    << "\"" << endl;
83       cout << "comment - \"" << id3v1tag->comment() << "\"" << endl;
84       cout << "track   - \"" << id3v1tag->track()   << "\"" << endl;
85       cout << "genre   - \"" << id3v1tag->genre()   << "\"" << endl;
86     }
87     else
88       cout << "file does not have a valid id3v1 tag" << endl;
89
90     APE::Tag *ape = f.APETag();
91
92     cout << endl << "APE" << endl;
93
94     if(ape) {
95       for(APE::ItemListMap::ConstIterator it = ape->itemListMap().begin();
96           it != ape->itemListMap().end(); ++it)
97       {
98         cout << (*it).first << " - \"" << (*it).second.toString() << "\"" << endl;
99       }
100     }
101     else
102       cout << "file does not have a valid APE tag" << endl;
103
104     cout << endl;
105   }
106 }