1
/***************************************************************************
2
copyright : (C) 2002 - 2008 by Scott Wheeler
3
email : wheeler@kde.org
4
***************************************************************************/
6
/***************************************************************************
7
* This library is free software; you can redistribute it and/or modify *
8
* it under the terms of the GNU Lesser General Public License version *
9
* 2.1 as published by the Free Software Foundation. *
11
* This library is distributed in the hope that it will be useful, but *
12
* WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14
* Lesser General Public License for more details. *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with this library; if not, write to the Free Software *
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
21
* Alternatively, this file is available under the Mozilla Public *
22
* License Version 1.1. You may obtain a copy of the License at *
23
* http://www.mozilla.org/MPL/ *
24
***************************************************************************/
26
#ifndef TAGLIB_ID3V2HEADER_H
27
#define TAGLIB_ID3V2HEADER_H
29
#include "tbytevector.h"
30
#include "taglib_export.h"
36
//! An implementation of ID3v2 headers
39
* This class implements ID3v2 headers. It attempts to follow, both
40
* semantically and programatically, the structure specified in
41
* the ID3v2 standard. The API is based on the properties of ID3v2 headers
42
* specified there. If any of the terms used in this documentation are
43
* unclear please check the specification in the linked section.
44
* (Structure, <a href="id3v2-structure.html#3.1">3.1</a>)
47
class TAGLIB_EXPORT Header
51
* Constructs an empty ID3v2 header.
56
* Constructs an ID3v2 header based on \a data. parse() is called
59
Header(const ByteVector &data);
62
* Destroys the header.
67
* Returns the major version number. (Note: This is the 4, not the 2 in
68
* ID3v2.4.0. The 2 is implied.)
70
uint majorVersion() const;
73
* Set the the major version number to \a version. (Note: This is
74
* the 4, not the 2 in ID3v2.4.0. The 2 is implied.)
77
* \note This is used by the internal parser; this will not change the
78
* version which is written and in general should not be called by API
81
void setMajorVersion(uint version);
84
* Returns the revision number. (Note: This is the 0, not the 4 in
85
* ID3v2.4.0. The 2 is implied.)
87
uint revisionNumber() const;
90
* Returns true if unsynchronisation has been applied to all frames.
92
bool unsynchronisation() const;
95
* Returns true if an extended header is present in the tag.
97
bool extendedHeader() const;
100
* Returns true if the experimental indicator flag is set.
102
bool experimentalIndicator() const;
105
* Returns true if a footer is present in the tag.
107
bool footerPresent() const;
109
* Returns the tag size in bytes. This is the size of the frame content.
110
* The size of the \e entire tag will be this plus the header size (10
111
* bytes) and, if present, the footer size (potentially another 10 bytes).
113
* \note This is the value as read from the header to which TagLib attempts
114
* to provide an API to; it was not a design decision on the part of TagLib
115
* to not include the mentioned portions of the tag in the \e size.
117
* \see completeTagSize()
119
uint tagSize() const;
122
* Returns the tag size, including the header and, if present, the footer
127
uint completeTagSize() const;
130
* Set the tag size to \a s.
133
void setTagSize(uint s);
136
* Returns the size of the header. Presently this is always 10 bytes.
141
* Returns the string used to identify and ID3v2 tag inside of a file.
142
* Presently this is always "ID3".
144
static ByteVector fileIdentifier();
147
* Sets the data that will be used as the header. 10 bytes, starting from
148
* the beginning of \a data are used.
150
void setData(const ByteVector &data);
153
* Renders the Header back to binary format.
155
ByteVector render() const;
159
* Called by setData() to parse the header data. It makes this information
160
* available through the public API.
162
void parse(const ByteVector &data);
165
Header(const Header &);
166
Header &operator=(const Header &);