aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/id3lib/60-add-c-wrapper-functions.patch
blob: d72e81c0ec7d5f8ed6dcc3218174e526abbfc137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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<ID3_Field *>(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<const ID3_Field *>(field)->GetEncoding());
+    }
+    return enc;
+  }
+
+  ID3_C_EXPORT bool CCONV
+  ID3Field_IsEncodable(const ID3Field *field)
+  {
+    bool isEncodable = false;
+    if (field)
+    {
+      ID3_CATCH(isEncodable = reinterpret_cast<const ID3_Field *>(field)->IsEncodable());
+    }
+    return isEncodable;
+  }
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */