summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata/vorbis.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/metadata/vorbis.c')
-rw-r--r--lib/rbcodec/metadata/vorbis.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/rbcodec/metadata/vorbis.c b/lib/rbcodec/metadata/vorbis.c
index d020808c56..66aa85022f 100644
--- a/lib/rbcodec/metadata/vorbis.c
+++ b/lib/rbcodec/metadata/vorbis.c
@@ -250,7 +250,7 @@ static bool file_init(struct file* file, int fd, int type, int remaining)
250 memset(file, 0, sizeof(*file)); 250 memset(file, 0, sizeof(*file));
251 file->fd = fd; 251 file->fd = fd;
252 252
253 if (type == AFMT_OGG_VORBIS || type == AFMT_SPEEX) 253 if (type == AFMT_OGG_VORBIS || type == AFMT_SPEEX || type == AFMT_OPUS)
254 { 254 {
255 if (!file_read_page_header(file)) 255 if (!file_read_page_header(file))
256 { 256 {
@@ -276,6 +276,22 @@ static bool file_init(struct file* file, int fd, int type, int remaining)
276 return false; 276 return false;
277 } 277 }
278 } 278 }
279 else if (type == AFMT_OPUS)
280 {
281 char buffer[8];
282
283 /* Read comment header */
284 if (file_read(file, buffer, sizeof(buffer)) < (ssize_t) sizeof(buffer))
285 {
286 return false;
287 }
288
289 /* Should be equal to "OpusTags" */
290 if (memcmp(buffer, "OpusTags", 8) != 0)
291 {
292 return false;
293 }
294 }
279 else if (type == AFMT_FLAC) 295 else if (type == AFMT_FLAC)
280 { 296 {
281 file->packet_remaining = remaining; 297 file->packet_remaining = remaining;