diff mbox series

[FFmpeg-devel] lavc: Use supported_samplerates for Dolby Digital encoders

Message ID CAB0OVGo+g01f3dGK-TWtmUp-6E1Si2XOMU1yTbbsXbQ55w2n6w@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavc: Use supported_samplerates for Dolby Digital encoders | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Carl Eugen Hoyos Feb. 10, 2020, 11:24 p.m. UTC
Hi!

Attached patch probably fixes ticket #8518 and definitely simplifies
*ac3* encoding usage.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos Feb. 28, 2020, 9:14 a.m. UTC | #1
Am Di., 11. Feb. 2020 um 00:24 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:

> Attached patch probably fixes ticket #8518 and definitely simplifies
> *ac3* encoding usage.

Ping.

Carl Eugen
Carl Eugen Hoyos April 4, 2020, 9:15 p.m. UTC | #2
Am Di., 11. Feb. 2020 um 00:24 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:

> Attached patch probably fixes ticket #8518 and definitely simplifies
> *ac3* encoding usage.

Patch applied.

Carl Eugen
diff mbox series

Patch

From 6ddde8224f48e9a0648018934ff12961c5d30892 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Tue, 11 Feb 2020 00:20:52 +0100
Subject: [PATCH] lavc: Use supported_samplerates for Dolby Digital encoders.

Fixes ticket #8518.
---
 libavcodec/ac3enc_fixed.c | 1 +
 libavcodec/ac3enc_float.c | 1 +
 libavcodec/ac3tab.c       | 2 +-
 libavcodec/ac3tab.h       | 2 +-
 libavcodec/eac3enc.c      | 1 +
 5 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index b23fc64776..e57d035294 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -155,6 +155,7 @@  AVCodec ff_ac3_fixed_encoder = {
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P,
                                                       AV_SAMPLE_FMT_NONE },
     .priv_class      = &ac3enc_class,
+    .supported_samplerates = ff_ac3_sample_rate_tab,
     .channel_layouts = ff_ac3_channel_layouts,
     .defaults        = ac3_defaults,
 };
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index d6e658b2b4..1f3111af0e 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -150,6 +150,7 @@  AVCodec ff_ac3_encoder = {
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
     .priv_class      = &ac3enc_class,
+    .supported_samplerates = ff_ac3_sample_rate_tab,
     .channel_layouts = ff_ac3_channel_layouts,
     .defaults        = ac3_defaults,
 };
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index bd88f32d92..96ef8ebaeb 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -126,7 +126,7 @@  const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
 };
 
 /* possible frequencies */
-const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
+const int ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
 
 /* possible bitrates */
 const uint16_t ff_ac3_bitrate_tab[19] = {
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index aa71acbce1..f0f6e6ccc4 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -33,7 +33,7 @@  extern const uint8_t  ff_ac3_channels_tab[8];
 extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
 extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
 extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
-extern const uint16_t ff_ac3_sample_rate_tab[3];
+extern const int      ff_ac3_sample_rate_tab[3];
 extern const uint16_t ff_ac3_bitrate_tab[19];
 extern const uint8_t  ff_ac3_rematrix_band_tab[5];
 extern const uint8_t  ff_eac3_default_cpl_band_struct[18];
diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c
index e1d61f68bf..6a90571e56 100644
--- a/libavcodec/eac3enc.c
+++ b/libavcodec/eac3enc.c
@@ -263,6 +263,7 @@  AVCodec ff_eac3_encoder = {
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
     .priv_class      = &eac3enc_class,
+    .supported_samplerates = ff_ac3_sample_rate_tab,
     .channel_layouts = ff_ac3_channel_layouts,
     .defaults        = ac3_defaults,
 };
-- 
2.24.1