libdiscid  0.6.2
discid.h
Go to the documentation of this file.
1 /* --------------------------------------------------------------------------
2 
3  MusicBrainz -- The Internet music metadatabase
4 
5  Copyright (C) 2013 Johannes Dewender
6  Copyright (C) 2006-2010 Lukas Lalinsky
7  Copyright (C) 2006 Matthias Friedrich
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 
23 --------------------------------------------------------------------------- */
24 #ifndef MUSICBRAINZ_DISC_ID_H
25 #define MUSICBRAINZ_DISC_ID_H
26 
27 #if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__))
28 # ifdef libdiscid_EXPORTS
29 # define LIBDISCID_API __declspec(dllexport)
30 # else
31 # define LIBDISCID_API __declspec(dllimport)
32 # endif
33 # define LIBDISCID_INTERNAL
34 #elif (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)
35 # define LIBDISCID_API
36 # define LIBDISCID_INTERNAL __attribute__((visibility("hidden")))
37 #elif defined(__SUNPRO_C)
38 # define LIBDISCID_API __global
39 # define LIBDISCID_INTERNAL __hidden
40 #else
41 # define LIBDISCID_API
42 # define LIBDISCID_INTERNAL
43 #endif
44 
45 #if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__))
46 #define LIBDISCID_DEPRECATED __declspec(deprecated)
47 #elif (defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || defined(__clang__)
48 #define LIBDISCID_DEPRECATED __attribute__((deprecated))
49 #else
50 #define LIBDISCID_DEPRECATED
51 #endif
52 
53 #define DISCID_VERSION_MAJOR 0
54 #define DISCID_VERSION_MINOR 6
55 #define DISCID_VERSION_PATCH 2
56 #define DISCID_VERSION_NUM 602
57 
58 #ifdef __cplusplus
59  extern "C" {
60 #endif
61 
122 typedef void *DiscId;
123 
124 
133 LIBDISCID_API DiscId *discid_new();
134 
135 
141 LIBDISCID_API void discid_free(DiscId *d);
142 
143 
165 LIBDISCID_API int discid_read(DiscId *d, const char *device);
166 
167 
203 LIBDISCID_API int discid_read_sparse(DiscId *d, const char *device,
204  unsigned int features);
205 
206 #define DISCID_HAVE_SPARSE_READ
207 
239 LIBDISCID_API int discid_put(DiscId *d, int first, int last, int *offsets);
240 
241 
251 LIBDISCID_API char *discid_get_error_msg(DiscId *d);
252 
253 
262 LIBDISCID_API char *discid_get_id(DiscId *d);
263 
264 
273 LIBDISCID_API char *discid_get_freedb_id(DiscId *d);
274 
294 LIBDISCID_API char *discid_get_toc_string(DiscId *d);
295 
309 
325 
339 
340 
348 
349 
357 
358 
365 LIBDISCID_API int discid_get_sectors(DiscId *d);
366 
367 
378 LIBDISCID_API int discid_get_track_offset(DiscId *d, int track_num);
379 
380 
391 LIBDISCID_API int discid_get_track_length(DiscId *d, int track_num);
392 
403 LIBDISCID_API char* discid_get_mcn(DiscId *d);
404 
417 LIBDISCID_API char* discid_get_track_isrc(DiscId *d, int track_num);
418 
419 
440 };
452 
453 #define DISCID_FEATURE_STR_READ "read"
454 #define DISCID_FEATURE_STR_MCN "mcn"
455 #define DISCID_FEATURE_STR_ISRC "isrc"
456 #define DISCID_FEATURE_LENGTH 32
457 
468  char *features[DISCID_FEATURE_LENGTH]);
469 
480 
481 
482 #ifdef __cplusplus
483  }
484 #endif
485 
486 #endif /* MUSICBRAINZ_DISC_ID_H */
LIBDISCID_API DiscId * discid_new()
Return a handle for a new DiscId object.
Definition: discid.h:439
discid_feature
PLATFORM-DEPENDENT FEATURES.
Definition: discid.h:436
LIBDISCID_API int discid_get_sectors(DiscId *d)
Return the length of the disc in sectors.
LIBDISCID_API int discid_read(DiscId *d, const char *device)
Read all supported features of the disc in the given CD-ROM/DVD-ROM drive.
LIBDISCID_API char * discid_get_version_string(void)
Return the full version string of this library, including the name.
LIBDISCID_API char * discid_get_submission_url(DiscId *d)
Return an URL for submitting the DiscID to MusicBrainz.
#define LIBDISCID_DEPRECATED
Definition: discid.h:50
LIBDISCID_API char * discid_get_toc_string(DiscId *d)
Return a string representing CD Table Of Contents (TOC).
LIBDISCID_API int discid_get_track_length(DiscId *d, int track_num)
Return the length of a track in sectors.
#define LIBDISCID_API
Definition: discid.h:41
LIBDISCID_API void discid_get_feature_list(char *features[DISCID_FEATURE_LENGTH])
Return a list of features supported by the current platform.
Definition: discid.h:438
LIBDISCID_API int discid_put(DiscId *d, int first, int last, int *offsets)
Provides the TOC of a known CD.
void * DiscId
A transparent handle for an Audio CD.
Definition: discid.h:122
LIBDISCID_API char * discid_get_id(DiscId *d)
Return a MusicBrainz DiscID.
LIBDISCID_API void discid_free(DiscId *d)
Release the memory allocated for the DiscId object.
LIBDISCID_API int discid_read_sparse(DiscId *d, const char *device, unsigned int features)
Read the disc in the given CD-ROM/DVD-ROM drive extracting only the TOC and additionally specified fe...
LIBDISCID_API char * discid_get_mcn(DiscId *d)
Return the Media Catalogue Number (MCN) for the disc.
LIBDISCID_API int discid_get_track_offset(DiscId *d, int track_num)
Return the sector offset of a track.
LIBDISCID_API int discid_get_last_track_num(DiscId *d)
Return the number of the last audio track on this disc.
LIBDISCID_API char * discid_get_default_device(void)
Return the name of the default disc drive for this machine.
Definition: discid.h:437
LIBDISCID_API char * discid_get_track_isrc(DiscId *d, int track_num)
Return the ISRC for a track.
#define DISCID_FEATURE_LENGTH
Definition: discid.h:456
LIBDISCID_API LIBDISCID_DEPRECATED char * discid_get_webservice_url(DiscId *d)
Return an URL for retrieving CD information from MusicBrainz' web service.
LIBDISCID_API int discid_get_first_track_num(DiscId *d)
Return the number of the first track on this disc.
LIBDISCID_API int discid_has_feature(enum discid_feature feature)
Check if a certain feature is implemented on the current platform.
LIBDISCID_API char * discid_get_freedb_id(DiscId *d)
Return a FreeDB DiscID.
LIBDISCID_API char * discid_get_error_msg(DiscId *d)
Return a human-readable error message.