This patch adds C wrapper functions for field encoding. It was first introduced in version 3.8.3-8 and fixes http://bugs.debian.org/281292 --- a/include/id3.h +++ b/include/id3.h @@ -104,6 +104,9 @@ ID3_C_EXPORT void CCONV ID3Field_GetBINARY (const ID3Field *field, uchar *buffer, size_t buffLength); ID3_C_EXPORT void CCONV ID3Field_FromFile (ID3Field *field, const char *fileName); ID3_C_EXPORT void CCONV ID3Field_ToFile (const ID3Field *field, const char *fileName); + ID3_C_EXPORT bool CCONV ID3Field_SetEncoding (ID3Field *field, ID3_TextEnc enc); + ID3_C_EXPORT ID3_TextEnc CCONV ID3Field_GetEncoding (const ID3Field *field); + ID3_C_EXPORT bool CCONV ID3Field_IsEncodable (const ID3Field *field); /* field-info wrappers */ ID3_C_EXPORT char* CCONV ID3FrameInfo_ShortName (ID3_FrameID frameid); --- a/src/c_wrapper.cpp +++ b/src/c_wrapper.cpp @@ -681,6 +681,39 @@ } } + ID3_C_EXPORT bool CCONV + ID3Field_SetEncoding(ID3Field *field, ID3_TextEnc enc) + { + bool changed = false; + if (field) + { + ID3_CATCH(changed = reinterpret_cast(field)->SetEncoding(enc)); + } + return changed; + } + + ID3_C_EXPORT ID3_TextEnc CCONV + ID3Field_GetEncoding(const ID3Field *field) + { + ID3_TextEnc enc = ID3TE_NONE; + if (field) + { + ID3_CATCH(enc = reinterpret_cast(field)->GetEncoding()); + } + return enc; + } + + ID3_C_EXPORT bool CCONV + ID3Field_IsEncodable(const ID3Field *field) + { + bool isEncodable = false; + if (field) + { + ID3_CATCH(isEncodable = reinterpret_cast(field)->IsEncodable()); + } + return isEncodable; + } + #ifdef __cplusplus } #endif /* __cplusplus */