1 /* $Id: id3.h,v 1.21 2002/09/21 17:23:32 t1mpy Exp $
2  *
3  * id3lib: a software library for creating and manipulating id3v1/v2 tags
4  * Copyright 1999, 2000  Scott Thomas Haug
5  * Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Library General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or (at your
10  * option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
15  * License for more details.
16 
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 
21  * The id3lib authors encourage improvements and optimisations to be sent to
22  * the id3lib coordinator.  Please see the README file for details on where to
23  * send such submissions.  See the AUTHORS file for a list of people who have
24  * contributed to id3lib.  See the ChangeLog file for a list of changes to
25  * id3lib.  These files are distributed with id3lib at
26  * http://download.sourceforge.net/id3lib/
27  */
28 
29 #ifndef _ID3LIB_ID3_H_
30 #define _ID3LIB_ID3_H_
31 
32 #include "id3/globals.h" //has <stdlib.h> "id3/sized_types.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif /* __cplusplus */
38 
39   typedef struct { char _dummy; } ID3Tag;
40   typedef struct { char _dummy; } ID3TagIterator;
41   typedef struct { char _dummy; } ID3TagConstIterator;
42   typedef struct { char _dummy; } ID3Frame;
43   typedef struct { char _dummy; } ID3Field;
44   typedef struct { char _dummy; } ID3FrameInfo;
45 
46   /* tag wrappers */
47   ID3_C_EXPORT ID3Tag*              CCONV ID3Tag_New                  (void);
48   ID3_C_EXPORT void                 CCONV ID3Tag_Delete               (ID3Tag *tag);
49   ID3_C_EXPORT void                 CCONV ID3Tag_Clear                (ID3Tag *tag);
50   ID3_C_EXPORT bool                 CCONV ID3Tag_HasChanged           (const ID3Tag *tag);
51   ID3_C_EXPORT void                 CCONV ID3Tag_SetUnsync            (ID3Tag *tag, bool unsync);
52   ID3_C_EXPORT void                 CCONV ID3Tag_SetExtendedHeader    (ID3Tag *tag, bool ext);
53   ID3_C_EXPORT void                 CCONV ID3Tag_SetPadding           (ID3Tag *tag, bool pad);
54   ID3_C_EXPORT void                 CCONV ID3Tag_AddFrame             (ID3Tag *tag, const ID3Frame *frame);
55   ID3_C_EXPORT bool                 CCONV ID3Tag_AttachFrame          (ID3Tag *tag, ID3Frame *frame);
56   ID3_C_EXPORT void                 CCONV ID3Tag_AddFrames            (ID3Tag *tag, const ID3Frame *frames, size_t num);
57   ID3_C_EXPORT ID3Frame*            CCONV ID3Tag_RemoveFrame          (ID3Tag *tag, const ID3Frame *frame);
58   ID3_C_EXPORT ID3_Err              CCONV ID3Tag_Parse                (ID3Tag *tag, const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer);
59   ID3_C_EXPORT size_t               CCONV ID3Tag_Link                 (ID3Tag *tag, const char *fileName);
60   ID3_C_EXPORT size_t               CCONV ID3Tag_LinkWithFlags        (ID3Tag *tag, const char *fileName, flags_t flags);
61   ID3_C_EXPORT ID3_Err              CCONV ID3Tag_Update               (ID3Tag *tag);
62   ID3_C_EXPORT ID3_Err              CCONV ID3Tag_UpdateByTagType      (ID3Tag *tag, flags_t type);
63   ID3_C_EXPORT ID3_Err              CCONV ID3Tag_Strip                (ID3Tag *tag, flags_t ulTagFlags);
64   ID3_C_EXPORT ID3Frame*            CCONV ID3Tag_FindFrameWithID      (const ID3Tag *tag, ID3_FrameID id);
65   ID3_C_EXPORT ID3Frame*            CCONV ID3Tag_FindFrameWithINT     (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, uint32 data);
66   ID3_C_EXPORT ID3Frame*            CCONV ID3Tag_FindFrameWithASCII   (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const char *data);
67   ID3_C_EXPORT ID3Frame*            CCONV ID3Tag_FindFrameWithUNICODE (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const unicode_t *data);
68   ID3_C_EXPORT size_t               CCONV ID3Tag_NumFrames            (const ID3Tag *tag);
69   ID3_C_EXPORT bool                 CCONV ID3Tag_HasTagType           (const ID3Tag *tag, ID3_TagType);
70   ID3_C_EXPORT ID3TagIterator*      CCONV ID3Tag_CreateIterator       (ID3Tag *tag);
71   ID3_C_EXPORT ID3TagConstIterator* CCONV ID3Tag_CreateConstIterator  (const ID3Tag *tag);
72 
73   ID3_C_EXPORT void                 CCONV ID3TagIterator_Delete       (ID3TagIterator*);
74   ID3_C_EXPORT ID3Frame*            CCONV ID3TagIterator_GetNext      (ID3TagIterator*);
75   ID3_C_EXPORT void                 CCONV ID3TagConstIterator_Delete  (ID3TagConstIterator*);
76   ID3_C_EXPORT const ID3Frame*      CCONV ID3TagConstIterator_GetNext(ID3TagConstIterator*);
77 
78   /* frame wrappers */
79   ID3_C_EXPORT ID3Frame*            CCONV ID3Frame_New                (void);
80   ID3_C_EXPORT ID3Frame*            CCONV ID3Frame_NewID              (ID3_FrameID id);
81   ID3_C_EXPORT void                 CCONV ID3Frame_Delete             (ID3Frame *frame);
82   ID3_C_EXPORT void                 CCONV ID3Frame_Clear              (ID3Frame *frame);
83   ID3_C_EXPORT void                 CCONV ID3Frame_SetID              (ID3Frame *frame, ID3_FrameID id);
84   ID3_C_EXPORT ID3_FrameID          CCONV ID3Frame_GetID              (const ID3Frame *frame);
85   ID3_C_EXPORT ID3Field*            CCONV ID3Frame_GetField           (const ID3Frame *frame, ID3_FieldID name);
86   ID3_C_EXPORT void                 CCONV ID3Frame_SetCompression     (ID3Frame *frame, bool comp);
87   ID3_C_EXPORT bool                 CCONV ID3Frame_GetCompression     (const ID3Frame *frame);
88 
89   /* field wrappers */
90   ID3_C_EXPORT void                 CCONV ID3Field_Clear              (ID3Field *field);
91   ID3_C_EXPORT size_t               CCONV ID3Field_Size               (const ID3Field *field);
92   ID3_C_EXPORT size_t               CCONV ID3Field_GetNumTextItems    (const ID3Field *field);
93   ID3_C_EXPORT void                 CCONV ID3Field_SetINT             (ID3Field *field, uint32 data);
94   ID3_C_EXPORT uint32               CCONV ID3Field_GetINT             (const ID3Field *field);
95   ID3_C_EXPORT void                 CCONV ID3Field_SetUNICODE         (ID3Field *field, const unicode_t *string);
96   ID3_C_EXPORT size_t               CCONV ID3Field_GetUNICODE         (const ID3Field *field, unicode_t *buffer, size_t maxChars);
97   ID3_C_EXPORT size_t               CCONV ID3Field_GetUNICODEItem     (const ID3Field *field, unicode_t *buffer, size_t maxChars, size_t itemNum);
98   ID3_C_EXPORT void                 CCONV ID3Field_AddUNICODE         (ID3Field *field, const unicode_t *string);
99   ID3_C_EXPORT void                 CCONV ID3Field_SetASCII           (ID3Field *field, const char *string);
100   ID3_C_EXPORT size_t               CCONV ID3Field_GetASCII           (const ID3Field *field, char *buffer, size_t maxChars);
101   ID3_C_EXPORT size_t               CCONV ID3Field_GetASCIIItem       (const ID3Field *field, char *buffer, size_t maxChars, size_t itemNum);
102   ID3_C_EXPORT void                 CCONV ID3Field_AddASCII           (ID3Field *field, const char *string);
103   ID3_C_EXPORT void                 CCONV ID3Field_SetBINARY          (ID3Field *field, const uchar *data, size_t size);
104   ID3_C_EXPORT void                 CCONV ID3Field_GetBINARY          (const ID3Field *field, uchar *buffer, size_t buffLength);
105   ID3_C_EXPORT void                 CCONV ID3Field_FromFile           (ID3Field *field, const char *fileName);
106   ID3_C_EXPORT void                 CCONV ID3Field_ToFile             (const ID3Field *field, const char *fileName);
107 
108   /* field-info wrappers */
109   ID3_C_EXPORT char*                CCONV ID3FrameInfo_ShortName     (ID3_FrameID frameid);
110   ID3_C_EXPORT char*                CCONV ID3FrameInfo_LongName      (ID3_FrameID frameid);
111   ID3_C_EXPORT const char*          CCONV ID3FrameInfo_Description   (ID3_FrameID frameid);
112   ID3_C_EXPORT int                  CCONV ID3FrameInfo_MaxFrameID     (void);
113   ID3_C_EXPORT int                  CCONV ID3FrameInfo_NumFields      (ID3_FrameID frameid);
114   ID3_C_EXPORT ID3_FieldType        CCONV ID3FrameInfo_FieldType    (ID3_FrameID frameid, int fieldnum);
115   ID3_C_EXPORT size_t               CCONV ID3FrameInfo_FieldSize      (ID3_FrameID frameid, int fieldnum);
116   ID3_C_EXPORT flags_t              CCONV ID3FrameInfo_FieldFlags     (ID3_FrameID frameid, int fieldnum);
117 
118   /* Deprecated */
119   ID3_C_EXPORT void                 CCONV ID3Tag_SetCompression       (ID3Tag *tag, bool comp);
120 
121 #ifdef __cplusplus
122 }
123 #endif /*__cplusplus*/
124 
125 #endif /* _ID3LIB_ID3_H_ */
126