summaryrefslogtreecommitdiff
path: root/dxr3audiodecoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'dxr3audiodecoder.c')
-rw-r--r--dxr3audiodecoder.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c
index 25a5c8e..8ce0812 100644
--- a/dxr3audiodecoder.c
+++ b/dxr3audiodecoder.c
@@ -38,11 +38,14 @@ const int LPCM_HEADER_LENGTH = 7;
//! constructor
cDxr3AudioDecoder::cDxr3AudioDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf)
{
- decoderOpened = false;
audioSynched = false;
- volume = 255;
Codec.id = CODEC_ID_MP2;
+ // check if codec is available
+ if (!cDxr3Ffmpeg::Instance().FindCodec(Codec)) {
+ exit(-1);
+ }
+
Init();
lastHeader[0] = 0xFF;
@@ -63,22 +66,13 @@ void cDxr3AudioDecoder::Init()
{
// (re)init codec
cDxr3Ffmpeg::Instance().CloseCodec(Codec);
- if (cDxr3Ffmpeg::Instance().FindCodec(Codec))
- {
cDxr3Ffmpeg::Instance().OpenCodec(Codec);
rate = channels = -1;
- frameSize = Codec.codec_context.frame_size;
- decoderOpened = true;
foundHeader = false;
decodeAudio = true;
//lastHeader[0] = 0xFF;
//lastHeader[1] = lastHeader[2] = lastHeader[3] = 0;
- }
- else
- {
- decoderOpened = false;
- }
}
// ==================================
@@ -86,13 +80,6 @@ void cDxr3AudioDecoder::Init()
void cDxr3AudioDecoder::Decode(const uint8_t* buf, int length, uint32_t pts,
cDxr3SyncBuffer &aBuf)
{
- if (!decoderOpened)
- {
- // No decoder is open, so it
- // is better to stop here.
- return;
- }
-
int len;
int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;