summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/metadata')
-rw-r--r--lib/rbcodec/metadata/metadata.c3
-rw-r--r--lib/rbcodec/metadata/metadata.h1
-rw-r--r--lib/rbcodec/metadata/ogg.c14
-rw-r--r--lib/rbcodec/metadata/vorbis.c18
4 files changed, 35 insertions, 1 deletions
diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c
index 668ece97cf..5caf933b55 100644
--- a/lib/rbcodec/metadata/metadata.c
+++ b/lib/rbcodec/metadata/metadata.c
@@ -233,6 +233,9 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
233 /* KSS (MSX computer KSS Music File) */ 233 /* KSS (MSX computer KSS Music File) */
234 [AFMT_KSS] = 234 [AFMT_KSS] =
235 AFMT_ENTRY("KSS", "kss", NULL, get_kss_metadata, "kss\0"), 235 AFMT_ENTRY("KSS", "kss", NULL, get_kss_metadata, "kss\0"),
236 /* Opus */
237 [AFMT_OPUS] =
238 AFMT_ENTRY("Opus", "opus", NULL, get_ogg_metadata, "opus\0"),
236#endif 239#endif
237}; 240};
238 241
diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h
index 4b4a8337fb..18cfce7523 100644
--- a/lib/rbcodec/metadata/metadata.h
+++ b/lib/rbcodec/metadata/metadata.h
@@ -89,6 +89,7 @@ enum
89 AFMT_SGC, /* SGC (Sega Master System, Game Gear, Coleco Vision Sound Format) */ 89 AFMT_SGC, /* SGC (Sega Master System, Game Gear, Coleco Vision Sound Format) */
90 AFMT_VGM, /* VGM (Video Game Music Format) */ 90 AFMT_VGM, /* VGM (Video Game Music Format) */
91 AFMT_KSS, /* KSS (MSX computer KSS Music File) */ 91 AFMT_KSS, /* KSS (MSX computer KSS Music File) */
92 AFMT_OPUS, /* Opus (see http://www.opus-codec.org ) */
92#endif 93#endif
93 94
94 /* add new formats at any index above this line to have a sensible order - 95 /* add new formats at any index above this line to have a sensible order -
diff --git a/lib/rbcodec/metadata/ogg.c b/lib/rbcodec/metadata/ogg.c
index f3231c6f8a..5d302442ed 100644
--- a/lib/rbcodec/metadata/ogg.c
+++ b/lib/rbcodec/metadata/ogg.c
@@ -102,6 +102,20 @@ bool get_ogg_metadata(int fd, struct mp3entry* id3)
102 return false; 102 return false;
103 } 103 }
104 } 104 }
105 else if (memcmp(&buf[28], "OpusHead", 8) == 0)
106 {
107 id3->codectype = AFMT_OPUS;
108 id3->frequency = 48000;
109 id3->vbr = true;
110
111// FIXME handle an actual channel mapping table
112 /* Comments are in second Ogg page (byte 108 onwards for Speex) */
113 if (lseek(fd, 47, SEEK_SET) < 0)
114 {
115 DEBUGF("Couldnotseektoogg");
116 return false;
117 }
118 }
105 else 119 else
106 { 120 {
107 /* Unsupported format, try to print the marker, catches Ogg/FLAC at least */ 121 /* Unsupported format, try to print the marker, catches Ogg/FLAC at least */
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;