00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _ID3LIB_TAG_H_
00030 #define _ID3LIB_TAG_H_
00031
00032 #include <id3/id3lib_frame.h>
00033 #include <id3/field.h>
00034
00035 class ID3_Reader;
00036 class ID3_Writer;
00037 class ID3_TagImpl;
00038 class ID3_Tag;
00039
00040 class ID3_CPP_EXPORT ID3_Tag
00041 {
00042 ID3_TagImpl* _impl;
00043 char _tmp_filename[260];
00044 public:
00045
00046 class Iterator
00047 {
00048 public:
00049 virtual ID3_Frame* GetNext() = 0;
00050 };
00051
00052 class ConstIterator
00053 {
00054 public:
00055 virtual const ID3_Frame* GetNext() = 0;
00056 };
00057
00058 public:
00059
00060 ID3_Tag(const char *name = NULL);
00061 ID3_Tag(const ID3_Tag &tag);
00062 virtual ~ID3_Tag();
00063
00064 void Clear();
00065 bool HasChanged() const;
00066 size_t Size() const;
00067
00068 bool SetUnsync(bool);
00069 bool SetExtendedHeader(bool);
00070 bool SetExperimental(bool);
00071
00072 bool GetUnsync() const;
00073 bool GetExtendedHeader() const;
00074 bool GetExperimental() const;
00075
00076 bool SetPadding(bool);
00077
00078 void AddFrame(const ID3_Frame&);
00079 void AddFrame(const ID3_Frame*);
00080 bool AttachFrame(ID3_Frame*);
00081 ID3_Frame* RemoveFrame(const ID3_Frame *);
00082
00083 size_t Parse(const uchar*, size_t);
00084 bool Parse(ID3_Reader& reader);
00085 size_t Render(uchar*, ID3_TagType = ID3TT_ID3V2) const;
00086 size_t Render(ID3_Writer&, ID3_TagType = ID3TT_ID3V2) const;
00087
00088 size_t Link(const char *fileInfo, flags_t = (flags_t) ID3TT_ALL);
00089 size_t Link(ID3_Reader &reader, flags_t = (flags_t) ID3TT_ALL);
00090 flags_t Update(flags_t = (flags_t) ID3TT_ALL);
00091 flags_t Strip(flags_t = (flags_t) ID3TT_ALL);
00092
00093 size_t GetPrependedBytes() const;
00094 size_t GetAppendedBytes() const;
00095 size_t GetFileSize() const;
00096 const char* GetFileName() const;
00097
00098 ID3_Frame* Find(ID3_FrameID) const;
00099 ID3_Frame* Find(ID3_FrameID, ID3_FieldID, uint32) const;
00100 ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const char*) const;
00101 ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const unicode_t*) const;
00102
00103 size_t NumFrames() const;
00104
00105 const Mp3_Headerinfo* GetMp3HeaderInfo() const;
00106
00107 Iterator* CreateIterator();
00108 ConstIterator* CreateIterator() const;
00109
00110 ID3_Tag& operator=( const ID3_Tag & );
00111
00112 bool HasTagType(ID3_TagType tt) const;
00113 ID3_V2Spec GetSpec() const;
00114 bool SetSpec(ID3_V2Spec);
00115
00116 static size_t IsV2Tag(const uchar*);
00117 static size_t IsV2Tag(ID3_Reader&);
00118
00119
00120 void AddNewFrame(ID3_Frame* f);
00121 size_t Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3);
00122 void SetCompression(bool);
00123 void AddFrames(const ID3_Frame *, size_t);
00124 bool HasLyrics() const;
00125 bool HasV2Tag() const;
00126 bool HasV1Tag() const;
00127 size_t Parse(const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer);
00128
00129
00130
00131 ID3_Tag& operator<<(const ID3_Frame &);
00132 ID3_Tag& operator<<(const ID3_Frame *);
00133 };
00134
00135
00136 int32 ID3_C_EXPORT ID3_IsTagHeader(const uchar header[ID3_TAGHEADERSIZE]);
00137
00138
00139 #endif
00140