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