diff options
Diffstat (limited to 'src/plugins/ogg_extractor.c')
-rw-r--r-- | src/plugins/ogg_extractor.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/plugins/ogg_extractor.c b/src/plugins/ogg_extractor.c index d7005ef..4c773aa 100644 --- a/src/plugins/ogg_extractor.c +++ b/src/plugins/ogg_extractor.c | |||
@@ -52,15 +52,15 @@ read_ogg (void *ptr, size_t size, size_t nmemb, void *datasource) | |||
52 | 52 | ||
53 | data = NULL; | 53 | data = NULL; |
54 | ret = ec->read (ec->cls, | 54 | ret = ec->read (ec->cls, |
55 | &data, | 55 | &data, |
56 | size * nmemb); | 56 | size * nmemb); |
57 | if (-1 == ret) | 57 | if (-1 == ret) |
58 | return 0; | 58 | return 0; |
59 | if (0 == ret) | 59 | if (0 == ret) |
60 | { | 60 | { |
61 | errno = 0; | 61 | errno = 0; |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | memcpy (ptr, data, ret); | 64 | memcpy (ptr, data, ret); |
65 | errno = 0; | 65 | errno = 0; |
66 | return ret; | 66 | return ret; |
@@ -77,8 +77,8 @@ read_ogg (void *ptr, size_t size, size_t nmemb, void *datasource) | |||
77 | */ | 77 | */ |
78 | static int | 78 | static int |
79 | seek_ogg (void *datasource, | 79 | seek_ogg (void *datasource, |
80 | ogg_int64_t offset, | 80 | ogg_int64_t offset, |
81 | int whence) | 81 | int whence) |
82 | { | 82 | { |
83 | struct EXTRACTOR_ExtractContext *ec = datasource; | 83 | struct EXTRACTOR_ExtractContext *ec = datasource; |
84 | int64_t new_position; | 84 | int64_t new_position; |
@@ -100,12 +100,11 @@ tell_ogg (void *datasource) | |||
100 | struct EXTRACTOR_ExtractContext *ec = datasource; | 100 | struct EXTRACTOR_ExtractContext *ec = datasource; |
101 | 101 | ||
102 | return (long) ec->seek (ec->cls, | 102 | return (long) ec->seek (ec->cls, |
103 | 0, | 103 | 0, |
104 | SEEK_CUR); | 104 | SEEK_CUR); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | |||
109 | /** | 108 | /** |
110 | * Extract the associated meta data for a given label from vorbis. | 109 | * Extract the associated meta data for a given label from vorbis. |
111 | * | 110 | * |
@@ -115,7 +114,7 @@ tell_ogg (void *datasource) | |||
115 | */ | 114 | */ |
116 | static char * | 115 | static char * |
117 | get_comment (vorbis_comment *vc, | 116 | get_comment (vorbis_comment *vc, |
118 | const char *label) | 117 | const char *label) |
119 | { | 118 | { |
120 | if (NULL == vc) | 119 | if (NULL == vc) |
121 | return NULL; | 120 | return NULL; |
@@ -129,7 +128,11 @@ get_comment (vorbis_comment *vc, | |||
129 | * @param t LE meta data type | 128 | * @param t LE meta data type |
130 | * @param s meta data to add | 129 | * @param s meta data to add |
131 | */ | 130 | */ |
132 | #define ADD(t,s) do { if (0 != (ret = ec->proc (ec->cls, "ogg", t, EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1))) goto FINISH; } while (0) | 131 | #define ADD(t,s) do { if (0 != (ret = ec->proc (ec->cls, "ogg", t, \ |
132 | EXTRACTOR_METAFORMAT_UTF8, \ | ||
133 | "text/plain", s, strlen (s) \ | ||
134 | + 1))) goto FINISH; \ | ||
135 | } while (0) | ||
133 | 136 | ||
134 | 137 | ||
135 | /** | 138 | /** |
@@ -138,7 +141,8 @@ get_comment (vorbis_comment *vc, | |||
138 | * @param t LE meta data type | 141 | * @param t LE meta data type |
139 | * @param d vorbis meta data label | 142 | * @param d vorbis meta data label |
140 | */ | 143 | */ |
141 | #define ADDG(t,d) do { m = get_comment (comments, d); if (NULL != m) ADD(t,m); } while (0) | 144 | #define ADDG(t,d) do { m = get_comment (comments, d); if (NULL != m) ADD (t,m); \ |
145 | } while (0) | ||
142 | 146 | ||
143 | 147 | ||
144 | /** | 148 | /** |
@@ -200,4 +204,5 @@ FINISH: | |||
200 | ov_clear (&vf); | 204 | ov_clear (&vf); |
201 | } | 205 | } |
202 | 206 | ||
207 | |||
203 | /* end of ogg_extractor.c */ | 208 | /* end of ogg_extractor.c */ |