Miam-Player  0.8.0
A nice music player
tag_c.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2003 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
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. *
10  * *
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. *
15  * *
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 *
19  * USA *
20  ***************************************************************************/
21 
22 #ifndef TAGLIB_TAG_C
23 #define TAGLIB_TAG_C
24 
25 /* Do not include this in the main TagLib documentation. */
26 #ifndef DO_NOT_DOCUMENT
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #if defined(TAGLIB_STATIC)
33 #define TAGLIB_C_EXPORT
34 #elif defined(_WIN32) || defined(_WIN64)
35 #ifdef MAKE_TAGLIB_C_LIB
36 #define TAGLIB_C_EXPORT __declspec(dllexport)
37 #else
38 #define TAGLIB_C_EXPORT __declspec(dllimport)
39 #endif
40 #elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1)
41 #define TAGLIB_C_EXPORT __attribute__ ((visibility("default")))
42 #else
43 #define TAGLIB_C_EXPORT
44 #endif
45 
46 #ifndef BOOL
47 #define BOOL int
48 #endif
49 
50 /*******************************************************************************
51  * [ TagLib C Binding ]
52  *
53  * This is an interface to TagLib's "simple" API, meaning that you can read and
54  * modify media files in a generic, but not specialized way. This is a rough
55  * representation of TagLib::File and TagLib::Tag, for which the documentation
56  * is somewhat more complete and worth consulting.
57  *******************************************************************************/
58 
59 /*
60  * These are used for type provide some type safety to the C API (as opposed to
61  * using void *, but pointers to them are simply cast to the corresponding C++
62  * types in the implementation.
63  */
64 
65 typedef struct { int dummy; } TagLib_File;
66 typedef struct { int dummy; } TagLib_Tag;
67 typedef struct { int dummy; } TagLib_AudioProperties;
68 
75 
83 
87 TAGLIB_C_EXPORT void taglib_free(void* pointer);
88 
89 /*******************************************************************************
90  * File API
91  ******************************************************************************/
92 
93 typedef enum {
105 
113 TAGLIB_C_EXPORT TagLib_File *taglib_file_new(const char *filename);
114 
119 TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type);
120 
125 
132 
138 
144 
149 
150 /******************************************************************************
151  * Tag API
152  ******************************************************************************/
153 
161 
169 
177 
185 
193 
197 TAGLIB_C_EXPORT unsigned int taglib_tag_year(const TagLib_Tag *tag);
198 
202 TAGLIB_C_EXPORT unsigned int taglib_tag_track(const TagLib_Tag *tag);
203 
209 TAGLIB_C_EXPORT void taglib_tag_set_title(TagLib_Tag *tag, const char *title);
210 
216 TAGLIB_C_EXPORT void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist);
217 
223 TAGLIB_C_EXPORT void taglib_tag_set_album(TagLib_Tag *tag, const char *album);
224 
230 TAGLIB_C_EXPORT void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment);
231 
237 TAGLIB_C_EXPORT void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre);
238 
242 TAGLIB_C_EXPORT void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year);
243 
247 TAGLIB_C_EXPORT void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track);
248 
253 
254 /******************************************************************************
255  * Audio Properties API
256  ******************************************************************************/
257 
262 
267 
272 
277 
278 /*******************************************************************************
279  * Special convenience ID3v2 functions
280  *******************************************************************************/
281 
282 typedef enum {
288 
293 TAGLIB_C_EXPORT void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding);
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 #endif /* DO_NOT_DOCUMENT */
299 #endif
#define TAGLIB_C_EXPORT
Definition: tag_c.h:43
TAGLIB_C_EXPORT void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding)
This sets the default encoding for ID3v2 frames that are written to tags.
Definition: tag_c.h:66
TAGLIB_C_EXPORT TagLib_File * taglib_file_new(const char *filename)
Creates a TagLib file based on filename.
TAGLIB_C_EXPORT void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist)
Sets the tag's artist.
TAGLIB_C_EXPORT int taglib_audioproperties_bitrate(const TagLib_AudioProperties *audioProperties)
Returns the bitrate of the file in kb/s.
Definition: tag_c.h:103
TAGLIB_C_EXPORT void taglib_set_strings_unicode(BOOL unicode)
By default all strings coming into or out of TagLib's C API are in UTF8.
TAGLIB_C_EXPORT char * taglib_tag_genre(const TagLib_Tag *tag)
Returns a string with this tag's genre.
Definition: tag_c.h:283
Definition: tag_c.h:94
TAGLIB_C_EXPORT BOOL taglib_file_save(TagLib_File *file)
Saves the file to disk.
int dummy
Definition: tag_c.h:67
TAGLIB_C_EXPORT BOOL taglib_file_is_valid(const TagLib_File *file)
Returns true if the file is open and readable and valid information for the Tag and / or AudioPropert...
Definition: tag_c.h:284
Definition: tag_c.h:99
int dummy
Definition: tag_c.h:66
String TAGLIB_EXPORT genre(int index)
Returns the name of the genre at index in the ID3v1 genre list.
TAGLIB_C_EXPORT char * taglib_tag_album(const TagLib_Tag *tag)
Returns a string with this tag's album name.
TAGLIB_C_EXPORT int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties)
Returns the number of channels in the audio stream.
TagLib_File_Type
Definition: tag_c.h:93
TAGLIB_C_EXPORT int taglib_audioproperties_length(const TagLib_AudioProperties *audioProperties)
Returns the length of the file in seconds.
TAGLIB_C_EXPORT char * taglib_tag_comment(const TagLib_Tag *tag)
Returns a string with this tag's comment.
TAGLIB_C_EXPORT void taglib_file_free(TagLib_File *file)
Frees and closes the file.
TAGLIB_C_EXPORT char * taglib_tag_title(const TagLib_Tag *tag)
Returns a string with this tag's title.
Definition: tag_c.h:102
#define BOOL
Definition: tag_c.h:47
TAGLIB_C_EXPORT void taglib_tag_set_album(TagLib_Tag *tag, const char *album)
Sets the tag's album.
TAGLIB_C_EXPORT void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track)
Sets the tag's track number.
Definition: tag_c.h:286
Definition: tag_c.h:98
TAGLIB_C_EXPORT void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre)
Sets the tag's genre.
TAGLIB_C_EXPORT TagLib_File * taglib_file_new_type(const char *filename, TagLib_File_Type type)
Creates a TagLib file based on filename.
Definition: tag_c.h:67
Definition: tag_c.h:95
Definition: tag_c.h:100
TAGLIB_C_EXPORT unsigned int taglib_tag_year(const TagLib_Tag *tag)
Returns the tag's year or 0 if year is not set.
Definition: tag_c.h:101
TAGLIB_C_EXPORT void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment)
Sets the tag's comment.
Definition: tag_c.h:285
TAGLIB_C_EXPORT TagLib_Tag * taglib_file_tag(const TagLib_File *file)
Returns a pointer to the tag associated with this file.
TAGLIB_C_EXPORT char * taglib_tag_artist(const TagLib_Tag *tag)
Returns a string with this tag's artist.
TAGLIB_C_EXPORT unsigned int taglib_tag_track(const TagLib_Tag *tag)
Returns the tag's track number or 0 if track number is not set.
TAGLIB_C_EXPORT void taglib_set_string_management_enabled(BOOL management)
TagLib can keep track of strings that are created when outputting tag values and clear them using tag...
Definition: tag_c.h:65
TAGLIB_C_EXPORT void taglib_free(void *pointer)
Explicitly free a string returned from TagLib.
Definition: tag_c.h:96
TAGLIB_C_EXPORT void taglib_tag_set_title(TagLib_Tag *tag, const char *title)
Sets the tag's title.
int dummy
Definition: tag_c.h:65
TAGLIB_C_EXPORT void taglib_tag_free_strings(void)
Frees all of the strings that have been created by the tag.
Definition: tag_c.h:97
TAGLIB_C_EXPORT int taglib_audioproperties_samplerate(const TagLib_AudioProperties *audioProperties)
Returns the sample rate of the file in Hz.
TagLib_ID3v2_Encoding
Definition: tag_c.h:282
TAGLIB_C_EXPORT const TagLib_AudioProperties * taglib_file_audioproperties(const TagLib_File *file)
Returns a pointer to the audio properties associated with this file.
TAGLIB_C_EXPORT void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year)
Sets the tag's year.