Add support for AAC LATM audio streams.

This commit is contained in:
Johns 2012-02-08 15:19:18 +01:00
parent bc50f37c4d
commit 918170d00b
4 changed files with 16 additions and 2 deletions

View File

@ -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.

1
Todo
View File

@ -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

View File

@ -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;

View File

@ -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 };