123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- // The authors have released ID3Lib as Public Domain (PD) and claim no copyright,
- // patent or other intellectual property protection in this work. This means that
- // it may be modified, redistributed and used in commercial and non-commercial
- // software and hardware without restrictions. ID3Lib is distributed on an "AS IS"
- // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
- //
- // The ID3Lib authors encourage improvements and optimisations to be sent to the
- // ID3Lib coordinator, currently Dirk Mahoney ([email protected]). Approved
- // submissions may be altered, and will be included and released under these terms.
- //
- // Mon Nov 23 18:34:01 1998
- #include "id3_tag.h"
- #ifdef __DLL
- #include <string.h>
- struct ID3_VerInfo
- {
- char name [ 30 ];
- luint version,
- revision;
- };
- // misc wrappers
- CDLLEXPORT
- void ID3_GetVersion ( ID3_VerInfo *info )
- {
- info->version = ID3LIB_VER;
- info->revision = ID3LIB_REV;
- strcpy ( info->name, ID3LIB_NAME );
- return;
- }
- // tag wrappers
- CDLLEXPORT
- ID3_Tag *ID3Tag_New ( void )
- {
- return new ID3_Tag;
- }
- CDLLEXPORT
- void ID3Tag_Delete ( ID3_Tag *tag )
- {
- if ( tag )
- delete tag;
- return;
- }
- CDLLEXPORT
- void ID3Tag_Clear ( ID3_Tag *tag )
- {
- if ( tag )
- tag->Clear();
- return;
- }
- CDLLEXPORT
- bool ID3Tag_HasChanged ( ID3_Tag *tag )
- {
- bool changed = false;
- if ( tag )
- changed = tag->HasChanged();
- return changed;
- }
- CDLLEXPORT
- void ID3Tag_SetUnsync ( ID3_Tag *tag, bool unsync )
- {
- if ( tag )
- tag->SetUnsync ( unsync );
- return;
- }
- CDLLEXPORT
- void ID3Tag_SetExtendedHeader ( ID3_Tag *tag, bool ext )
- {
- if ( tag )
- tag->SetExtendedHeader ( ext );
- return;
- }
- CDLLEXPORT
- void ID3Tag_SetCompression ( ID3_Tag *tag, bool comp )
- {
- if ( tag )
- tag->SetCompression ( comp );
- return;
- }
- CDLLEXPORT
- void ID3Tag_SetPadding ( ID3_Tag *tag, bool pad )
- {
- if ( tag )
- tag->SetPadding ( pad );
- return;
- }
- CDLLEXPORT
- void ID3Tag_AddFrame ( ID3_Tag *tag, ID3_Frame *frame )
- {
- if ( tag )
- tag->AddFrame ( frame );
- return;
- }
- CDLLEXPORT
- void ID3Tag_AddFrames ( ID3_Tag *tag, ID3_Frame *frames, luint num )
- {
- if ( tag )
- tag->AddFrames ( frames, num );
- return;
- }
- CDLLEXPORT
- void ID3Tag_RemoveFrame ( ID3_Tag *tag, ID3_Frame *frame )
- {
- if ( tag )
- tag->RemoveFrame ( frame );
- return;
- }
- CDLLEXPORT
- void ID3Tag_Parse ( ID3_Tag *tag, uchar header[ ID3_TAGHEADERSIZE ], uchar *buffer )
- {
- if ( tag )
- tag->Parse ( header, buffer );
- return;
- }
- CDLLEXPORT
- luint ID3Tag_Link ( ID3_Tag *tag, char *fileName )
- {
- luint offset = 0;
- if ( tag )
- offset = tag->Link ( fileName );
- return offset;
- }
- CDLLEXPORT
- void ID3Tag_Update ( ID3_Tag *tag )
- {
- if ( tag )
- tag->Update();
- return;
- }
- CDLLEXPORT
- void ID3Tag_Strip ( ID3_Tag *tag, bool v1Also )
- {
- if ( tag )
- tag->Strip ( v1Also );
- return;
- }
- CDLLEXPORT
- ID3_Frame *ID3Tag_FindFrameWithID ( ID3_Tag *tag, ID3_FrameID id )
- {
- ID3_Frame *frame = NULL;
- if ( tag )
- frame = tag->Find ( id );
- return frame;
- }
- CDLLEXPORT
- ID3_Frame *ID3Tag_FindFrameWithINT ( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, luint data )
- {
- ID3_Frame *frame = NULL;
- if ( tag )
- frame = tag->Find ( id, fld, data );
- return frame;
- }
- CDLLEXPORT
- ID3_Frame *ID3Tag_FindFrameWithASCII ( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, char *data )
- {
- ID3_Frame *frame = NULL;
- if ( tag )
- frame = tag->Find ( id, fld, data );
- return frame;
- }
- CDLLEXPORT
- ID3_Frame *ID3Tag_FindFrameWithUNICODE ( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, wchar_t *data )
- {
- ID3_Frame *frame = NULL;
- if ( tag )
- frame = tag->Find ( id, fld, data );
- return frame;
- }
- CDLLEXPORT
- luint ID3Tag_NumFrames ( ID3_Tag *tag )
- {
- luint num = 0;
- if ( tag )
- num = tag->NumFrames();
- return num;
- }
- CDLLEXPORT
- ID3_Frame *ID3Tag_GetFrameNum ( ID3_Tag *tag, luint num )
- {
- ID3_Frame *frame = NULL;
- if ( tag )
- frame = tag->GetFrameNum ( num );
- return frame;
- }
- // frame wrappers
- CDLLEXPORT
- void ID3Frame_Clear ( ID3_Frame *frame )
- {
- if ( frame )
- frame->Clear();
- return;
- }
- CDLLEXPORT
- void ID3Frame_SetID ( ID3_Frame *frame, ID3_FrameID id )
- {
- if ( frame )
- frame->SetID ( id );
- return;
- }
- CDLLEXPORT
- ID3_FrameID ID3Frame_GetID ( ID3_Frame *frame )
- {
- ID3_FrameID id = ID3FID_NOFRAME;
- if ( frame )
- id = frame->GetID();
- return id;
- }
- CDLLEXPORT
- ID3_Field *ID3Frame_GetField ( ID3_Frame *frame, ID3_FieldID name )
- {
- ID3_Field *field = NULL;
- if ( frame )
- field = &( frame->Field ( name ) );
- return field;
- }
- // field wrappers
- CDLLEXPORT
- void ID3Field_Clear ( ID3_Field *field )
- {
- if ( field )
- field->Clear();
- return;
- }
- CDLLEXPORT
- luint ID3Field_Size ( ID3_Field *field )
- {
- luint size = 0;
- if ( field )
- size = field->Size();
- return size;
- }
- CDLLEXPORT
- luint ID3Field_GetNumTextItems ( ID3_Field *field )
- {
- luint items = 0;
- if ( field )
- items = field->GetNumTextItems();
- return items;
- }
- CDLLEXPORT
- void ID3Field_SetINT ( ID3_Field *field, luint data )
- {
- if ( field )
- field->Set ( data );
- return;
- }
- CDLLEXPORT
- luint ID3Field_GetINT ( ID3_Field *field )
- {
- luint value = 0;
- if ( field )
- value = field->Get();
- return value;
- }
- CDLLEXPORT
- void ID3Field_SetUNICODE ( ID3_Field *field, wchar_t *string )
- {
- if ( field )
- field->Set ( string );
- return;
- }
- CDLLEXPORT
- luint ID3Field_GetUNICODE ( ID3_Field *field, wchar_t *buffer, luint maxChars, luint itemNum )
- {
- luint numChars = 0;
- if ( field )
- numChars = field->Get ( buffer, maxChars, itemNum );
- return numChars;
- }
- CDLLEXPORT
- void ID3Field_AddUNICODE ( ID3_Field *field, wchar_t *string )
- {
- if ( field )
- field->Add ( string );
- return;
- }
- CDLLEXPORT
- void ID3Field_SetASCII ( ID3_Field *field, char *string )
- {
- if ( field )
- field->Set ( string );
- return;
- }
- CDLLEXPORT
- luint ID3Field_GetASCII ( ID3_Field *field, char *buffer, luint maxChars, luint itemNum )
- {
- luint numChars = 0;
- if ( field )
- numChars = field->Get ( buffer, maxChars, itemNum );
- return numChars;
- }
- CDLLEXPORT
- void ID3Field_AddASCII ( ID3_Field *field, char *string )
- {
- if ( field )
- field->Add ( string );
- return;
- }
- CDLLEXPORT
- void ID3Field_SetBINARY ( ID3_Field *field, uchar *data, luint size )
- {
- if ( field )
- field->Set ( data, size );
- return;
- }
- CDLLEXPORT
- void ID3Field_GetBINARY ( ID3_Field *field, uchar *buffer, luint buffLength )
- {
- if ( field )
- field->Get ( buffer, buffLength );
- return;
- }
- CDLLEXPORT
- void ID3Field_FromFile ( ID3_Field *field, char *fileName )
- {
- if ( field )
- field->FromFile ( fileName );
- return;
- }
- CDLLEXPORT
- void ID3Field_ToFile ( ID3_Field *field, char *fileName )
- {
- if ( field )
- field->ToFile ( fileName );
- return;
- }
- #endif
|