X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Foggdecoder.cpp;h=78a2b5ac158d20a857db455f7ee7e1e969b12922;hb=227da1e7a20432e056e7ab42444cb56f197c53d6;hp=5462b79bb4d8c6c0cdd0c3871cf9e91d1bafdb81;hpb=35b092aaa718dcb12933effd33324bda5d3b5cce;p=libs%2Fal.git diff --git a/source/oggdecoder.cpp b/source/oggdecoder.cpp index 5462b79..78a2b5a 100644 --- a/source/oggdecoder.cpp +++ b/source/oggdecoder.cpp @@ -1,4 +1,7 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" #include +#pragma GCC diagnostic pop #include #include "oggdecoder.h" @@ -86,15 +89,9 @@ OggDecoder::OggDecoder(IO::Seekable &io): vorbis_info *info = ov_info(&priv->ovfile, -1); freq = info->rate; + format = create_format(2, info->channels); - size = ov_pcm_total(&priv->ovfile, 0)*info->channels*2; - - switch(info->channels) - { - case 1: format = MONO16; break; - case 2: format = STEREO16; break; - default: throw unsupported_sound(Msp::format("%d channels", info->channels)); - } + size = ov_pcm_total(&priv->ovfile, 0)*get_unit_size(format); } OggDecoder::~OggDecoder() @@ -104,6 +101,14 @@ OggDecoder::~OggDecoder() delete priv; } +bool OggDecoder::detect(const std::string &sig) +{ + static const char ogg_sig[] = { 'O', 'g', 'g', 'S' }; + if(sig.size()ovfile, 0);