diff --git a/ChangeLog b/ChangeLog index 6ce31ea..eb9d781 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Add support for AAC LATM audio streams. Fix bug: alsa and ffmpeg use different channel layout. Support more LPCM sample rates and number of channels. Quick&dirty support for mpeg LPCM streams. diff --git a/Todo b/Todo index 199fcda..120d928 100644 --- a/Todo +++ b/Todo @@ -39,6 +39,7 @@ video: hard channel switch OSD can only be shown after some stream could be shown yaepghd changed position is lost on channel switch + use x11 screen size without geometry configuration vdpau: software decoder path not working diff --git a/codec.c b/codec.c index a514a33..434203a 100644 --- a/codec.c +++ b/codec.c @@ -852,6 +852,10 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt) dpkt->dts = audio_decoder->AudioParser->dts; buf_sz = sizeof(buf); l = avcodec_decode_audio3(audio_ctx, buf, &buf_sz, dpkt); + if (l == AVERROR(EAGAIN)) { + index += n; // this is needed for aac latm + continue; + } if (l < 0) { // no audio frame could be decompressed Error(_("codec: error audio data at %d\n"), index); break; diff --git a/softhddev.c b/softhddev.c index 1473171..33ed15b 100644 --- a/softhddev.c +++ b/softhddev.c @@ -261,7 +261,7 @@ int PlayAudio(const uint8_t * data, int size, return osize; } // Detect audio code - // MPEG-PS mp2 MPEG1, MPEG2, AC3, LPCM + // MPEG-PS mp2 MPEG1, MPEG2, AC3, LPCM, AAC LATM // Syncword - 0x0B77 if (data[0] == 0x0B && data[1] == 0x77) { @@ -279,7 +279,15 @@ int PlayAudio(const uint8_t * data, int size, CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_MP2); AudioCodecID = CODEC_ID_MP2; } - // Private stram + LPCM ID + // latm header 0x56E0 11bits: 0x2B7 + } else if (data[0] == 0x56 && (data[1] & 0xE0) == 0xE0) { + if (AudioCodecID != CODEC_ID_AAC_LATM) { + Debug(3, "[softhddev]%s: AAC LATM %d\n", __FUNCTION__, id); + CodecAudioClose(MyAudioDecoder); + CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_AAC_LATM); + AudioCodecID = CODEC_ID_AAC_LATM; + } + // Private stream + LPCM ID } else if (data[-n - 9 + 3] == 0xBD && data[0] == 0xA0) { if (AudioCodecID != CODEC_ID_PCM_DVD) { static int samplerates[] = { 48000, 96000, 44100, 32000 };