From 1e38c7514d8f428a1311935529cba16b5716373b Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 18 Mar 2010 13:10:26 +0100 Subject: a small cleanup --- dxr3audiodecoder.c | 60 ------------------------------------------------------ 1 file changed, 60 deletions(-) (limited to 'dxr3audiodecoder.c') diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c index e338ce3..8f9da64 100644 --- a/dxr3audiodecoder.c +++ b/dxr3audiodecoder.c @@ -143,66 +143,6 @@ void cDxr3AudioDecoder::decode(cDxr3PesFrame *frame, iAudio *audio) } #if 0 -// ================================== -//! decode given buffer -void cDxr3AudioDecoder::Decode(cDxr3PesFrame *frame, uint32_t pts, cDxr3SyncBuffer &aBuf) -{ - int len, out_size; - - const uint8_t *buf = frame->GetPayload(); - int length = frame->GetPayloadLength(); - - if (checkMpegAudioHdr(buf)) { - - // look if Bitrate has changed - if ((buf[2] & 0xf0) != (lastBitrate & 0xf0)) { - dsyslog("[dxr3-audiodecoder] found new audio header"); - - // recalculate used framesize - frameSize = calcFrameSize(buf); - dsyslog("[dxr3-audiodecoder] calculated frame size %d", frameSize); - - // we need now to reinit the deocder and to store the new - // part from the audio header - Init(); - lastBitrate = buf[2]; - } - } - - // setup AVPacket - avpkt.data = const_cast(buf); - avpkt.size = frameSize; - - while (length > 0) { - out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; - -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(51, 29, 0) - len = avcodec_decode_audio(contextAudio, (short *)(&pcmbuf), &out_size, avpkt.data, frameSize); -#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 26, 0) - len = avcodec_decode_audio2(contextAudio, (short *)(&pcmbuf), &out_size, avpkt.data, frameSize); -#else - len = avcodec_decode_audio3(contextAudio, (short *)(&pcmbuf), &out_size, &avpkt); -#endif - - if (len < 0) { - esyslog("[dxr3-decoder] failed to decode audio"); - return; - } - - if (out_size) { - cFixedLengthFrame* pTempFrame = aBuf.Push(pcmbuf, - out_size, pts); - if (pTempFrame) { - pTempFrame->channels(contextAudio->channels); - pTempFrame->samplerate(contextAudio->sample_rate); - } - } - - length -= len; - avpkt.data += len; - } -} - // ================================== //! decode lpcm void cDxr3AudioDecoder::DecodeLpcm(cDxr3PesFrame *frame, uint32_t pts, cDxr3SyncBuffer &aBuf) -- cgit v1.2.3