[FFmpeg-devel] [PATCH 2/2] libavcodec/ac3tab: rename ff_ac3_sample_rate_tab to avpriv_ac3_sample_rate_tab so that it can be used in libavformat

James Almer jamrial at gmail.com
Sun Oct 4 23:52:15 EEST 2020


On 10/4/2020 11:35 AM, Nachiket Tarate wrote:
> This will be used by HLS demuxer to parse EC3SpecificBox (dec3) during SAMPLE-AES decryption.
> 
> Signed-off-by: Nachiket Tarate <nachiket.tarate at outlook.com>
> ---
>  libavcodec/ac3_parser.c   | 6 +++---
>  libavcodec/ac3enc.c       | 2 +-
>  libavcodec/ac3enc_fixed.c | 2 +-
>  libavcodec/ac3enc_float.c | 2 +-
>  libavcodec/ac3tab.c       | 2 +-
>  libavcodec/ac3tab.h       | 2 +-
>  libavcodec/eac3enc.c      | 2 +-
>  7 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
> index ba171653ef..1c08c5f2b5 100644
> --- a/libavcodec/ac3_parser.c
> +++ b/libavcodec/ac3_parser.c
> @@ -102,7 +102,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
>          hdr->lfe_on = get_bits1(gbc);
>  
>          hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
> -        hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
> +        hdr->sample_rate = avpriv_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
>          hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
>          hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
>          hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
> @@ -126,11 +126,11 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
>              int sr_code2 = get_bits(gbc, 2);
>              if(sr_code2 == 3)
>                  return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
> -            hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
> +            hdr->sample_rate = avpriv_ac3_sample_rate_tab[sr_code2] / 2;
>              hdr->sr_shift = 1;
>          } else {
>              hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
> -            hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
> +            hdr->sample_rate = avpriv_ac3_sample_rate_tab[hdr->sr_code];
>              hdr->sr_shift = 0;
>          }
>  
> diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
> index 37dc0fb2ef..914fc5e5be 100644
> --- a/libavcodec/ac3enc.c
> +++ b/libavcodec/ac3enc.c
> @@ -2128,7 +2128,7 @@ static av_cold int validate_options(AC3EncodeContext *s)
>               the generated files are correct. */
>      max_sr = s->eac3 ? 2 : 8;
>      for (i = 0; i <= max_sr; i++) {
> -        if ((ff_ac3_sample_rate_tab[i % 3] >> (i / 3)) == avctx->sample_rate)
> +        if ((avpriv_ac3_sample_rate_tab[i % 3] >> (i / 3)) == avctx->sample_rate)
>              break;
>      }
>      if (i > max_sr) {
> diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
> index 428bbfb3c5..82829c12dc 100644
> --- a/libavcodec/ac3enc_fixed.c
> +++ b/libavcodec/ac3enc_fixed.c
> @@ -156,7 +156,7 @@ AVCodec ff_ac3_fixed_encoder = {
>                                                        AV_SAMPLE_FMT_NONE },
>      .priv_class      = &ac3enc_class,
>      .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
> -    .supported_samplerates = ff_ac3_sample_rate_tab,
> +    .supported_samplerates = avpriv_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 99863a9722..80478878f7 100644
> --- a/libavcodec/ac3enc_float.c
> +++ b/libavcodec/ac3enc_float.c
> @@ -150,7 +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,
> +    .supported_samplerates = avpriv_ac3_sample_rate_tab,
>      .channel_layouts = ff_ac3_channel_layouts,
>      .defaults        = ac3_defaults,
>      .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
> diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
> index ef2a41bc59..215fd18000 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 int ff_ac3_sample_rate_tab[] = { 48000, 44100, 32000, 0 };
> +const int avpriv_ac3_sample_rate_tab[] = { 48000, 44100, 32000, 0 };
>  
>  /* possible bitrates */
>  const uint16_t ff_ac3_bitrate_tab[19] = {
> diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
> index 1d1264e3fc..b656d7e39b 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 int      ff_ac3_sample_rate_tab[];
> +extern const int      avpriv_ac3_sample_rate_tab[];

You probably need to use av_export_avcodec here, same as with
avpriv_ac3_channel_layout_tab above.

>  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 8e1032f268..7cf7d62fab 100644
> --- a/libavcodec/eac3enc.c
> +++ b/libavcodec/eac3enc.c
> @@ -263,7 +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,
> +    .supported_samplerates = avpriv_ac3_sample_rate_tab,
>      .channel_layouts = ff_ac3_channel_layouts,
>      .defaults        = ac3_defaults,
>      .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
> 



More information about the ffmpeg-devel mailing list