Fix bug: audible glitch toggling AC-3 pass-through

This commit is contained in:
Johns 2012-02-12 17:50:10 +01:00
parent 6df970ca9e
commit 24a065e5de
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Fix bug: audible glitch when switching AC-3 pass-through <-> none.
Fix bug: mpeg stills not displayed. Fix bug: mpeg stills not displayed.
Detect audio stream type only after stream switch. Detect audio stream type only after stream switch.
Detect more h264 streams with leading zeros. Detect more h264 streams with leading zeros.

3
Todo
View File

@ -34,8 +34,6 @@ video:
subtitle could be asyncron subtitle could be asyncron
reduce warnings after channel switch reduce warnings after channel switch
grab image with hardware and better scaling support grab image with hardware and better scaling support
suspendoutput didn't show logo or black pictures
(must detect video format to show image)
hard channel switch hard channel switch
OSD can only be shown after some stream could be shown OSD can only be shown after some stream could be shown
yaepghd changed position is lost on channel switch yaepghd changed position is lost on channel switch
@ -86,7 +84,6 @@ audio:
add pause support for replay pause add pause support for replay pause
Mute should do a real mute and not only set volume to zero. Mute should do a real mute and not only set volume to zero.
Starting suspended and muted, didn't register the mute. Starting suspended and muted, didn't register the mute.
switching stero/dolby produces klick sound
audio/alsa: audio/alsa:
better downmix of >2 channels on 2 channel hardware better downmix of >2 channels on 2 channel hardware

13
codec.c
View File

@ -605,6 +605,7 @@ struct _audio_decoder_
/// audio parser to support insane dvb streaks /// audio parser to support insane dvb streaks
AVCodecParserContext *AudioParser; AVCodecParserContext *AudioParser;
int PassthroughAC3; ///< current ac-3 pass-through
int SampleRate; ///< current stream sample rate int SampleRate; ///< current stream sample rate
int Channels; ///< current stream channels int Channels; ///< current stream channels
@ -621,6 +622,9 @@ static char CodecPassthroughAC3; ///< pass ac3 through
//static char CodecPassthroughDTS; ///< pass dts through (unsupported) //static char CodecPassthroughDTS; ///< pass dts through (unsupported)
//static char CodecPassthroughMPA; ///< pass mpa through (unsupported) //static char CodecPassthroughMPA; ///< pass mpa through (unsupported)
#else
static const int CodecPassthroughAC3 = 0;
#endif #endif
/** /**
@ -872,11 +876,13 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
AudioSetClock(dpkt->pts); AudioSetClock(dpkt->pts);
} }
// FIXME: must first play remainings bytes, than change and play new. // FIXME: must first play remainings bytes, than change and play new.
if (audio_decoder->SampleRate != audio_ctx->sample_rate if (audio_decoder->PassthroughAC3 != CodecPassthroughAC3
|| audio_decoder->SampleRate != audio_ctx->sample_rate
|| audio_decoder->Channels != audio_ctx->channels) { || audio_decoder->Channels != audio_ctx->channels) {
int err; int err;
int isAC3; int isAC3;
audio_decoder->PassthroughAC3 = CodecPassthroughAC3;
// FIXME: use swr_convert from swresample (only in ffmpeg!) // FIXME: use swr_convert from swresample (only in ffmpeg!)
// FIXME: tell ac3 decoder to use downmix // FIXME: tell ac3 decoder to use downmix
if (audio_decoder->ReSample) { if (audio_decoder->ReSample) {
@ -887,14 +893,11 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
audio_decoder->SampleRate = audio_ctx->sample_rate; audio_decoder->SampleRate = audio_ctx->sample_rate;
audio_decoder->HwSampleRate = audio_ctx->sample_rate; audio_decoder->HwSampleRate = audio_ctx->sample_rate;
audio_decoder->Channels = audio_ctx->channels; audio_decoder->Channels = audio_ctx->channels;
#ifdef USE_PASSTHROUGH
// SPDIF/HDMI passthrough // SPDIF/HDMI passthrough
if (CodecPassthroughAC3 && audio_ctx->codec_id == CODEC_ID_AC3) { if (CodecPassthroughAC3 && audio_ctx->codec_id == CODEC_ID_AC3) {
audio_decoder->HwChannels = 2; audio_decoder->HwChannels = 2;
isAC3 = 1; isAC3 = 1;
} else } else {
#endif
{
audio_decoder->HwChannels = audio_ctx->channels; audio_decoder->HwChannels = audio_ctx->channels;
isAC3 = 0; isAC3 = 0;
} }