strawberry-audio-player-win.../3rdparty/taglib/mpeg/id3v1/id3v1tag.h

155 lines
5.1 KiB
C
Raw Normal View History

2018-05-10 15:29:28 +02:00
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ID3V1TAG_H
#define TAGLIB_ID3V1TAG_H
#include "tag.h"
#include "tbytevector.h"
2020-06-26 23:30:30 +02:00
#include "tstringhandler.h"
2018-05-10 15:29:28 +02:00
#include "taglib_export.h"
2019-04-26 01:12:42 +02:00
namespace Strawberry_TagLib {
namespace TagLib {
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
class File;
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
//! An ID3v1 implementation
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
namespace ID3v1 {
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
//! The main class in the ID3v1 implementation
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* This is an implementation of the ID3v1 format.
* ID3v1 is both the simplest and most common of tag formats but is rather limited.
* Because of its pervasiveness and the way that applications have been written around the
* fields that it provides, the generic TagLib::Tag API is a mirror of what is provided by ID3v1.
*
* ID3v1 tags should generally only contain Latin1 information.
* However because many applications do not follow this rule there is now support for overriding
* the ID3v1 string handling using the ID3v1::StringHandler class.
* Please see the documentation for that class for more information.
*
* \see StringHandler
*
* \note Most fields are truncated to a maximum of 28-30 bytes.
* The truncation happens automatically when the tag is rendered.
*/
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
class TAGLIB_EXPORT Tag : public Strawberry_TagLib::TagLib::Tag {
public:
/*!
* Create an ID3v1 tag with default values.
*/
explicit Tag();
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Create an ID3v1 tag and parse the data in \a file starting at \a tagOffset.
*/
2020-06-26 23:30:30 +02:00
explicit Tag(File *file, long long tagOffset);
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Destroys this Tag instance.
*/
2020-06-26 23:30:30 +02:00
~Tag() override;
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Renders the in memory values to a ByteVector suitable for writing to the file.
*/
2020-06-13 19:02:42 +02:00
ByteVector render() const;
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Returns the string "TAG" suitable for usage in locating the tag in a file.
*/
2020-06-13 19:02:42 +02:00
static ByteVector fileIdentifier();
// Reimplementations.
2020-06-26 23:30:30 +02:00
String title() const override;
String artist() const override;
String album() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
PictureMap pictures() const override;
void setTitle(const String &s) override;
void setArtist(const String &s) override;
void setAlbum(const String &s) override;
void setComment(const String &s) override;
void setGenre(const String &s) override;
void setYear(unsigned int i) override;
void setTrack(unsigned int i) override;
void setPictures(const PictureMap&) override;
2020-06-13 19:02:42 +02:00
/*!
* Returns the genre in number.
*
* \note Normally 255 indicates that this tag contains no genre.
*/
2020-06-13 19:02:42 +02:00
unsigned int genreNumber() const;
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Sets the genre in number to \a i.
*
* \note Valid value is from 0 up to 255. Normally 255 indicates that this tag contains no genre.
*/
2020-06-13 19:02:42 +02:00
void setGenreNumber(unsigned int i);
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
/*!
* Sets the string handler that decides how the ID3v1 data will be converted to and from binary data.
* If the parameter \a handler is null, the previous handler is released and default ISO-8859-1 handler is restored.
*
* \note The caller is responsible for deleting the previous handler as needed after it is released.
*
*/
2020-06-26 23:30:30 +02:00
static void setStringHandler(const Strawberry_TagLib::TagLib::StringHandler *handler);
2018-05-10 15:29:28 +02:00
2020-06-13 19:02:42 +02:00
protected:
/*!
* Reads from the file specified in the constructor.
*/
2020-06-13 19:02:42 +02:00
void read();
/*!
* Pareses the body of the tag in \a data.
*/
2020-06-13 19:02:42 +02:00
void parse(const ByteVector &data);
private:
2020-06-26 23:30:30 +02:00
Tag(const Tag&);
Tag &operator=(const Tag&);
2020-06-13 19:02:42 +02:00
class TagPrivate;
TagPrivate *d;
};
2020-06-13 19:02:42 +02:00
} // namespace ID3v1
} // namespace TagLib
} // namespace Strawberry_TagLib
2018-05-10 15:29:28 +02:00
#endif