X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmp3decoder.cpp;h=00fc9181bd69a2a2d6318d7d13153c3a71fce363;hb=227da1e7a20432e056e7ab42444cb56f197c53d6;hp=a717cf4b3b4dde400cac7b234d4cecf6db822c1d;hpb=0e266d73f9aab89410c736e969eaa51ef914acf1;p=libs%2Fal.git diff --git a/source/mp3decoder.cpp b/source/mp3decoder.cpp index a717cf4..00fc918 100644 --- a/source/mp3decoder.cpp +++ b/source/mp3decoder.cpp @@ -55,7 +55,7 @@ Mp3Decoder::Mp3Decoder(IO::Seekable &io): try { decode_frame(); - format = (priv->frame.header.mode==MAD_MODE_SINGLE_CHANNEL ? MONO16 : STEREO16); + format = create_format(2, MAD_NCHANNELS(&priv->frame.header)); freq = priv->frame.header.samplerate; } catch(...) @@ -71,6 +71,7 @@ Mp3Decoder::~Mp3Decoder() mad_synth_finish(&priv->synth); mad_frame_finish(&priv->frame); mad_stream_finish(&priv->stream); + delete priv; } bool Mp3Decoder::detect(const string &sig) @@ -91,7 +92,7 @@ void Mp3Decoder::rewind() unsigned Mp3Decoder::read(char *buf, unsigned len) { - unsigned nchan = (format==STEREO16 ? 2 : 1); + unsigned nchan = get_n_channels(format); mad_pcm &pcm = priv->synth.pcm; unsigned pos = 0;