discid.h
Go to the documentation of this file.
/* --------------------------------------------------------------------------
MusicBrainz -- The Internet music metadatabase
Copyright (C) 2013 Johannes Dewender
Copyright (C) 2006-2010 Lukas Lalinsky
Copyright (C) 2006 Matthias Friedrich
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
--------------------------------------------------------------------------- */
#ifndef MUSICBRAINZ_DISC_ID_H
#define MUSICBRAINZ_DISC_ID_H
#if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__))
# ifdef libdiscid_EXPORTS
# define LIBDISCID_API __declspec(dllexport)
# else
# define LIBDISCID_API __declspec(dllimport)
# endif
# define LIBDISCID_INTERNAL
#elif (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)
# define LIBDISCID_API
# define LIBDISCID_INTERNAL __attribute__((visibility("hidden")))
#elif defined(__SUNPRO_C)
# define LIBDISCID_API __global
# define LIBDISCID_INTERNAL __hidden
#else
# define LIBDISCID_API
# define LIBDISCID_INTERNAL
#endif
#if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__))
#define LIBDISCID_DEPRECATED __declspec(deprecated)
#elif (defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || defined(__clang__)
#define LIBDISCID_DEPRECATED __attribute__((deprecated))
#else
#define LIBDISCID_DEPRECATED
#endif
#define DISCID_VERSION_MAJOR 0
#define DISCID_VERSION_MINOR 6
#define DISCID_VERSION_PATCH 1
#define DISCID_VERSION_NUM 601
#ifdef __cplusplus
extern "C" {
#endif
typedef void *DiscId;
LIBDISCID_API DiscId *discid_new();
LIBDISCID_API void discid_free(DiscId *d);
LIBDISCID_API int discid_read(DiscId *d, const char *device);
LIBDISCID_API int discid_read_sparse(DiscId *d, const char *device,
unsigned int features);
#define DISCID_HAVE_SPARSE_READ
LIBDISCID_API int discid_put(DiscId *d, int first, int last, int *offsets);
LIBDISCID_API char *discid_get_error_msg(DiscId *d);
LIBDISCID_API char *discid_get_id(DiscId *d);
LIBDISCID_API char *discid_get_freedb_id(DiscId *d);
LIBDISCID_API char *discid_get_toc_string(DiscId *d);
LIBDISCID_API char *discid_get_submission_url(DiscId *d);
LIBDISCID_API LIBDISCID_DEPRECATED char *discid_get_webservice_url(DiscId *d);
LIBDISCID_API char *discid_get_default_device(void);
LIBDISCID_API int discid_get_first_track_num(DiscId *d);
LIBDISCID_API int discid_get_last_track_num(DiscId *d);
LIBDISCID_API int discid_get_sectors(DiscId *d);
LIBDISCID_API int discid_get_track_offset(DiscId *d, int track_num);
LIBDISCID_API int discid_get_track_length(DiscId *d, int track_num);
LIBDISCID_API char* discid_get_mcn(DiscId *d);
LIBDISCID_API char* discid_get_track_isrc(DiscId *d, int track_num);
enum discid_feature {
DISCID_FEATURE_READ = 1 << 0,
DISCID_FEATURE_MCN = 1 << 1,
DISCID_FEATURE_ISRC = 1 << 2,
};
LIBDISCID_API int discid_has_feature(enum discid_feature feature);
#define DISCID_FEATURE_STR_READ "read"
#define DISCID_FEATURE_STR_MCN "mcn"
#define DISCID_FEATURE_STR_ISRC "isrc"
#define DISCID_FEATURE_LENGTH 32
LIBDISCID_API void discid_get_feature_list(
char *features[DISCID_FEATURE_LENGTH]);
LIBDISCID_API char *discid_get_version_string(void);
#ifdef __cplusplus
}
#endif
#endif /* MUSICBRAINZ_DISC_ID_H */
discid_new
LIBDISCID_API DiscId * discid_new()
Return a handle for a new DiscId object.
DISCID_FEATURE_ISRC
Definition: discid.h:439
discid_feature
discid_feature
PLATFORM-DEPENDENT FEATURES.
Definition: discid.h:436
discid_get_sectors
LIBDISCID_API int discid_get_sectors(DiscId *d)
Return the length of the disc in sectors.
discid_read
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.
discid_get_version_string
LIBDISCID_API char * discid_get_version_string(void)
Return the full version string of this library, including the name.
discid_get_submission_url
LIBDISCID_API char * discid_get_submission_url(DiscId *d)
Return an URL for submitting the DiscID to MusicBrainz.
LIBDISCID_DEPRECATED
#define LIBDISCID_DEPRECATED
Definition: discid.h:50
discid_get_toc_string
LIBDISCID_API char * discid_get_toc_string(DiscId *d)
Return a string representing CD Table Of Contents (TOC).
discid_get_track_length
LIBDISCID_API int discid_get_track_length(DiscId *d, int track_num)
Return the length of a track in sectors.
LIBDISCID_API
#define LIBDISCID_API
Definition: discid.h:41
discid_get_feature_list
LIBDISCID_API void discid_get_feature_list(char *features[DISCID_FEATURE_LENGTH])
Return a list of features supported by the current platform.
DISCID_FEATURE_MCN
Definition: discid.h:438
discid_put
LIBDISCID_API int discid_put(DiscId *d, int first, int last, int *offsets)
Provides the TOC of a known CD.
DiscId
void * DiscId
A transparent handle for an Audio CD.
Definition: discid.h:122
discid_get_id
LIBDISCID_API char * discid_get_id(DiscId *d)
Return a MusicBrainz DiscID.
discid_free
LIBDISCID_API void discid_free(DiscId *d)
Release the memory allocated for the DiscId object.
discid_read_sparse
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...
discid_get_mcn
LIBDISCID_API char * discid_get_mcn(DiscId *d)
Return the Media Catalogue Number (MCN) for the disc.
discid_get_track_offset
LIBDISCID_API int discid_get_track_offset(DiscId *d, int track_num)
Return the sector offset of a track.
discid_get_last_track_num
LIBDISCID_API int discid_get_last_track_num(DiscId *d)
Return the number of the last audio track on this disc.
discid_get_default_device
LIBDISCID_API char * discid_get_default_device(void)
Return the name of the default disc drive for this machine.
DISCID_FEATURE_READ
Definition: discid.h:437
discid_get_track_isrc
LIBDISCID_API char * discid_get_track_isrc(DiscId *d, int track_num)
Return the ISRC for a track.
DISCID_FEATURE_LENGTH
#define DISCID_FEATURE_LENGTH
Definition: discid.h:456
discid_get_webservice_url
LIBDISCID_API LIBDISCID_DEPRECATED char * discid_get_webservice_url(DiscId *d)
Return an URL for retrieving CD information from MusicBrainz' web service.
discid_get_first_track_num
LIBDISCID_API int discid_get_first_track_num(DiscId *d)
Return the number of the first track on this disc.
discid_has_feature
LIBDISCID_API int discid_has_feature(enum discid_feature feature)
Check if a certain feature is implemented on the current platform.
discid_get_freedb_id
LIBDISCID_API char * discid_get_freedb_id(DiscId *d)
Return a FreeDB DiscID.
discid_get_error_msg
LIBDISCID_API char * discid_get_error_msg(DiscId *d)
Return a human-readable error message.