/usr/include/musicbrainz3/disc.h is in libmusicbrainz3-dev 3.0.2-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | /*
* MusicBrainz -- The Internet music metadatabase
*
* Copyright (C) 2006 Lukas Lalinsky
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
*
* $Id: disc.h 8466 2006-09-05 08:59:44Z luks $
*/
#ifndef __MUSICBRAINZ3_DISC_H__
#define __MUSICBRAINZ3_DISC_H__
#include <string>
#include <vector>
#include <utility>
#include <musicbrainz3/musicbrainz.h>
namespace MusicBrainz
{
/**
* Represents an Audio CD.
*
* This class represents an Audio CD. A disc can have an ID (the
* MusicBrainz DiscID), which is calculated from the CD's table of
* contents (TOC). There may also be data from the TOC like the length
* of the disc in sectors, as well as position and length of the tracks.
*
* Note that different TOCs, maybe due to different pressings, lead to
* different DiscIDs. Conversely, if two different discs have the same
* TOC, they also have the same DiscID (which is unlikely but not
* impossible). DiscIDs are always 28 characters long and look like this:
* \a 'J68I_CDcUFdCRCIbHSEbTBCbooA-'. Sometimes they are also referred
* to as CDIndex IDs.
*
* The MusicBrainz web service (WebService) only returns
* the DiscID and the number of sectors. The DiscID calculation function
* readDisc, however, can retrieve the other
* attributes of Disc from an Audio CD in the disc drive.
*/
class MB_API Disc
{
public:
typedef std::pair<int, int> Track;
typedef std::vector<Disc::Track> TrackList;
/**
* Constructor.
*
* @param id a string containing a 28-character DiscID
*/
Disc(const std::string &id = std::string());
/**
* Destructor.
*/
virtual ~Disc();
/**
* Returns the MusicBrainz DiscID.
*
* @return a string containing a 28-character DiscID
*/
std::string getId() const;
/**
* Sets the MusicBrainz DiscId.
*
* @param value a string containing a 28-character DiscID
*/
void setId(const std::string &value);
/**
* Returns the length of the disc in sectors.
*
* @return the length in sectors as an integer
*/
int getSectors() const;
/**
* Sets the length of the disc in sectors.
*
* @param sectors the length in sectors as an integer
*/
void setSectors(const int sectors);
/**
* Returns the number of the first track on this disc.
*
* @return an int containing the track number
*/
int getFirstTrackNum() const;
/**
* Sets the number of the first track on this disc.
*
* @param trackNum an int containing the track number
*/
void setFirstTrackNum(const int trackNum);
/**
* Returns the number of the last track on this disc.
*
* @return an int containing the track number
*/
int getLastTrackNum() const;
/**
* Sets the number of the last track on this disc.
*
* @param trackNum an int containing the track number
*/
void setLastTrackNum(const int trackNum);
/**
* Returns the sector offset and length of this disc.
*
* This method returns a list of tuples containing the track
* offset and length in sectors for all tracks on this disc.
* The track offset is measured from the beginning of the disc,
* the length is relative to the track's offset. Note that the
* leadout track is \e not included.
*
* @return a vector of (offset, length) pairs (values are ints)
*/
Disc::TrackList &getTracks();
/**
* Adds a track to the list.
*
* This method adds an (offset, length) pair to the list of
* tracks. The leadout track must \e not be added. The total
* length of the disc can be set using setSectors.
*
* @param track an (offset, length) pair (values are ints)
*
* @see getTracks
*/
void addTrack(Disc::Track track);
private:
class DiscPrivate;
DiscPrivate *d;
};
/**
* The Audio CD could not be read.
*
* This may be simply because no disc was in the drive, the device name
* was wrong or the disc can't be read. Reading errors can occur in case
* of a damaged disc or a copy protection mechanism, for example.
*/
class MB_API DiscError : public Exception
{
public:
DiscError(const std::string &msg = std::string()) : Exception(msg) {}
};
/**
* Reads an Audio CD in the disc drive.
*
* This reads a CD's table of contents (TOC) and calculates the MusicBrainz
* DiscID, which is a 28 character ASCII string. This DiscID can be used
* to retrieve a list of matching releases from the web service (see
* MusicBrainz::Query).
*
* Note that an Audio CD has to be in drive for this to work. The
* \a deviceName argument may be used to set the device. The default
* depends on the operating system (on linux, it's \c "/dev/cdrom").
* No network connection is needed for this function.
*
* If the device doesn't exist or there's no valid Audio CD in the drive,
* a DiscError exception is raised.
*
* @param deviceName a string containing the CD drive's device name
*
* @return a pointer to Disc object
*
* @throw DiscError if there was a problem reading the disc
*/
MB_API Disc *readDisc(const std::string &deviceName = std::string());
/**
* Returns a URL for adding a disc to the MusicBrainz database.
*
* A fully initialized Disc object is needed, as
* returned by readDisc. A disc object returned by the web service
* doesn't provide the necessary information.
*
* Note that the created URL is intended for interactive use and points
* to the MusicBrainz disc submission wizard by default. This method
* just returns a URL, no network connection is needed. The disc drive
* isn't used.
*
* @param disc a fully initialized Disc object
* @param host a string containing a host name
* @param port an integer containing a port number
*
* @return a string containing the submission URL
*
* @see readDisc
*/
MB_API std::string getSubmissionUrl(Disc *disc,
const std::string &host = "mm.musicbrainz.org",
int port = 80);
}
#endif
|