Initial opus codec support

Synchronised with opus repo on github (https://github.com/freqmod/rockbox-opus)

Status:
* Seeking ported from speex, but fails on some cases (e.g. seek to granule 0)
* ReplayGain parsing needs to be reworked, we do vorbis-style replaygain now.
  http://wiki.xiph.org/OggOpus#Comment_Header explicitly forbids these in
  favour of R128_TRACK_GAIN tag.
* No optimisation yet, source files still nearly identical to opus upstream
* Multi-stream opus files may not be parsed correctly

Change-Id: Ia66f1027dc1d288083e3c57b2816700078376f9a
Reviewed-on: http://gerrit.rockbox.org/300
Reviewed-by: Bertrik Sikken <bertrik@sikken.nl>
Tested-by: Bertrik Sikken <bertrik@sikken.nl>
This commit is contained in:
Frederik M J Vestre 2012-07-26 14:38:32 +02:00 committed by Bertrik Sikken
parent 72ebcbf73b
commit 1b8e3801b2
127 changed files with 28373 additions and 2 deletions

View file

@ -102,6 +102,20 @@ bool get_ogg_metadata(int fd, struct mp3entry* id3)
return false;
}
}
else if (memcmp(&buf[28], "OpusHead", 8) == 0)
{
id3->codectype = AFMT_OPUS;
id3->frequency = 48000;
id3->vbr = true;
// FIXME handle an actual channel mapping table
/* Comments are in second Ogg page (byte 108 onwards for Speex) */
if (lseek(fd, 47, SEEK_SET) < 0)
{
DEBUGF("Couldnotseektoogg");
return false;
}
}
else
{
/* Unsupported format, try to print the marker, catches Ogg/FLAC at least */