Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix AC3 encoder when re-encoding non 5.1 audio

AC3 encoder would have failed with AC3 5.0 ; issue would have been seen doing timestretch on 5.0 audio like seen on Australia's ONE HD channel
  • Loading branch information...
commit f7fc68c843027e8f5d945445ffbda8a2a55c4859 1 parent f92639f
@jyavenard jyavenard authored
Showing with 21 additions and 6 deletions.
  1. +21 −6 mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp
View
27 mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp
@@ -117,13 +117,28 @@ bool AudioOutputDigitalEncoder::Init(
av_context->bit_rate = bitrate;
av_context->sample_rate = samplerate;
av_context->channels = channels;
-#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT( 52, 113, 0 )
- av_context->channel_layout = AV_CH_LAYOUT_5POINT1;
+ switch (channels)
+ {
+ case 1:
+ av_context->channel_layout = AV_CH_LAYOUT_MONO;
+ break;
+ case 2:
+ av_context->channel_layout = AV_CH_LAYOUT_STEREO;
+ break;
+ case 3:
+ av_context->channel_layout = AV_CH_LAYOUT_SURROUND;
+ break;
+ case 4:
+ av_context->channel_layout = AV_CH_LAYOUT_4POINT0;
+ break;
+ case 5:
+ av_context->channel_layout = AV_CH_LAYOUT_5POINT0;
+ break;
+ default:
+ av_context->channel_layout = AV_CH_LAYOUT_5POINT1;
+ break;
+ }
av_context->sample_fmt = AV_SAMPLE_FMT_S16;
-#else
- av_context->channel_layout = CH_LAYOUT_5POINT1;
- av_context->sample_fmt = SAMPLE_FMT_S16;
-#endif
// open it
ret = avcodec_open(av_context, codec);
Please sign in to comment.
Something went wrong with that request. Please try again.