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

@ -250,7 +250,7 @@ static bool file_init(struct file* file, int fd, int type, int remaining)
memset(file, 0, sizeof(*file));
file->fd = fd;
if (type == AFMT_OGG_VORBIS || type == AFMT_SPEEX)
if (type == AFMT_OGG_VORBIS || type == AFMT_SPEEX || type == AFMT_OPUS)
{
if (!file_read_page_header(file))
{
@ -276,6 +276,22 @@ static bool file_init(struct file* file, int fd, int type, int remaining)
return false;
}
}
else if (type == AFMT_OPUS)
{
char buffer[8];
/* Read comment header */
if (file_read(file, buffer, sizeof(buffer)) < (ssize_t) sizeof(buffer))
{
return false;
}
/* Should be equal to "OpusTags" */
if (memcmp(buffer, "OpusTags", 8) != 0)
{
return false;
}
}
else if (type == AFMT_FLAC)
{
file->packet_remaining = remaining;