Skip to content

Commit 5e94e9a

Browse files
committed
Update AC3 encoder following ffmpeg resync.
AC3 encoder by default now use float ; use the older fixed S16 one. To do: check if working with float is any faster as most of the time will be already working internally with floats. Fixes #9755.
1 parent 10d681c commit 5e94e9a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,24 @@ bool AudioOutputDigitalEncoder::Init(
6666
// We need to do this when called from mythmusic
6767
avcodec_init();
6868
avcodec_register_all();
69-
codec = avcodec_find_encoder(CODEC_ID_AC3);
69+
codec = avcodec_find_encoder_by_name("ac3_fixed");
70+
//codec = avcodec_find_encoder(CODEC_ID_AC3);
7071
if (!codec)
7172
{
7273
VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not find codec");
7374
return false;
7475
}
7576

76-
av_context = avcodec_alloc_context();
77-
av_context->bit_rate = bitrate;
78-
av_context->sample_rate = samplerate;
79-
av_context->channels = channels;
77+
av_context = avcodec_alloc_context();
78+
avcodec_get_context_defaults3(av_context, codec);
8079

81-
// open it */
80+
av_context->bit_rate = bitrate;
81+
av_context->sample_rate = samplerate;
82+
av_context->channels = channels;
83+
av_context->channel_layout = CH_LAYOUT_5POINT1;
84+
av_context->sample_fmt = AV_SAMPLE_FMT_S16;
85+
86+
// open it
8287
ret = avcodec_open(av_context, codec);
8388
if (ret < 0)
8489
{

0 commit comments

Comments
 (0)