-
Notifications
You must be signed in to change notification settings - Fork 1
/
id3lib_enc_wrapper.cpp
executable file
·66 lines (56 loc) · 1.23 KB
/
id3lib_enc_wrapper.cpp
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
59
60
61
62
63
64
65
66
/*
* No idea why the authors didn't export this important functions
*/
#include <id3.h>
#include <id3/field.h>
#include <id3/tag.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define ID3_CATCH(code) try { code; } catch (...) { }
ID3_C_EXPORT void CCONV
ID3Field_SetEncoding(ID3Field *field, ID3_TextEnc enc)
{
if (field) {
ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->SetEncoding(enc));
}
}
ID3_C_EXPORT size_t CCONV
ID3Tag_GetPrependedBytes(ID3Tag *tag)
{
size_t s = 0;
if (tag) {
ID3_CATCH(s = reinterpret_cast<ID3_Tag *>(tag)->GetPrependedBytes());
}
return s;
}
ID3_C_EXPORT size_t CCONV
ID3Tag_GetAppendedBytes(ID3Tag *tag)
{
size_t s = 0;
if (tag) {
ID3_CATCH(s = reinterpret_cast<ID3_Tag *>(tag)->GetAppendedBytes());
}
return s;
}
ID3_C_EXPORT size_t CCONV
ID3Tag_GetFileSize(ID3Tag *tag)
{
size_t s = 0;
if (tag) {
ID3_CATCH(s = reinterpret_cast<ID3_Tag *>(tag)->GetFileSize());
}
return s;
}
ID3_C_EXPORT size_t CCONV
ID3Tag_GetDataSize(ID3Tag *tag)
{
size_t s = ID3Tag_GetFileSize(tag) - ID3Tag_GetPrependedBytes(tag)
- ID3Tag_GetAppendedBytes(tag);
return (s < 0) ? 0 : s;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */