diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-06-05 08:39:51 +0200 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-06-05 08:39:51 +0200 |
commit | eecd8d6b5fc35cd39b53f6c2642ccbc388d47044 (patch) | |
tree | 20d44f04ea0e456b2d8d297fc0a5d8c03ee1e055 /dxr3audiodecoder.c | |
parent | 718b8a4ab3e5e39cede1a58babbb18b27d2c55da (diff) | |
download | vdr-plugin-dxr3-eecd8d6b5fc35cd39b53f6c2642ccbc388d47044.tar.gz vdr-plugin-dxr3-eecd8d6b5fc35cd39b53f6c2642ccbc388d47044.tar.bz2 |
prepare parts of the audio pipline to work directly with cDxr3PesFrame
Diffstat (limited to 'dxr3audiodecoder.c')
-rw-r--r-- | dxr3audiodecoder.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c index 11bd066..7892777 100644 --- a/dxr3audiodecoder.c +++ b/dxr3audiodecoder.c @@ -246,6 +246,40 @@ void cDxr3AudioDecoder::DecodeAc3Dts(const uint8_t* pPes, const uint8_t* buf, } } +/** + * \brief decoded payload of frame + */ +void cDxr3AudioDecoder::decode(cDxr3PesFrame *frame) +{ + int len; + int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; + + const uint8_t *buf = frame->GetPayload(); + int length = frame->GetPayloadLength(); + +#if LIBAVCODEC_VERSION_INT < ((51<<16)+(29<<8)+0) + len = avcodec_decode_audio( +#else + len = avcodec_decode_audio2( +#endif + contextAudio, frame->decoded, &out_size, const_cast<uint8_t *>(buf), length); + + if (len < 0) { + esyslog("[dxr3-decoder] failed to decode audio"); + frame->decodedSize = 0; + return; + } + + // can this happen? + if ((length - len) > 0) { + esyslog("[dxr3-decoder] TODO: more to decode"); + } + + frame->decodedSize = len; + frame->ctx.channels = contextAudio->channels; + frame->ctx.samplerate = contextAudio->sample_rate; +} + // ================================== //! checking routine bool cDxr3AudioDecoder::HeadCheck(unsigned long head) |