Skip to content

Commit 8238bc0

Browse files
committed
avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* defines
These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent 0c6e5f3 commit 8238bc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+879
-727
lines changed

doc/APIchanges

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09
22

33
API changes, most recent first:
44

5+
2023-09-07 - xxxxxxxxxx - lavc 60.26.100 - defs.h
6+
Add AV_PROFILE_* and AV_LEVEL_* replacements in defs.h for the
7+
defines from avcodec.h. The latter are deprecated.
8+
59
2023-09-06 - xxxxxxxxxx - lavc 60.25.101 - avcodec.h
610
AVCodecContext.rc_buffer_size may now be set by decoders.
711

fftools/ffprobe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
30203020
if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile)))
30213021
print_str("profile", profile);
30223022
else {
3023-
if (par->profile != FF_PROFILE_UNKNOWN) {
3023+
if (par->profile != AV_PROFILE_UNKNOWN) {
30243024
char profile_num[12];
30253025
snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
30263026
print_str("profile", profile_num);

libavcodec/aacdec_template.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,12 +2486,12 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
24862486
ac->avctx->ch_layout.nb_channels == 1) {
24872487
ac->oc[1].m4ac.sbr = 1;
24882488
ac->oc[1].m4ac.ps = 1;
2489-
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
2489+
ac->avctx->profile = AV_PROFILE_AAC_HE_V2;
24902490
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
24912491
ac->oc[1].status, 1);
24922492
} else {
24932493
ac->oc[1].m4ac.sbr = 1;
2494-
ac->avctx->profile = FF_PROFILE_AAC_HE;
2494+
ac->avctx->profile = AV_PROFILE_AAC_HE;
24952495
}
24962496
res = AAC_RENAME(ff_decode_sbr_extension)(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
24972497
if (ac->oc[1].m4ac.ps == 1 && !ac->warned_he_aac_mono) {
@@ -3080,7 +3080,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
30803080
if ((err = frame_configure_elements(avctx)) < 0)
30813081
return err;
30823082

3083-
// The FF_PROFILE_AAC_* defines are all object_type - 1
3083+
// The AV_PROFILE_AAC_* defines are all object_type - 1
30843084
// This may lead to an undefined profile being signaled
30853085
ac->avctx->profile = aot - 1;
30863086

@@ -3163,7 +3163,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
31633163
if ((err = frame_configure_elements(avctx)) < 0)
31643164
goto fail;
31653165

3166-
// The FF_PROFILE_AAC_* defines are all object_type - 1
3166+
// The AV_PROFILE_AAC_* defines are all object_type - 1
31673167
// This may lead to an undefined profile being signaled
31683168
ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
31693169

libavcodec/aacenc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,36 +1307,36 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
13071307
avctx->bit_rate);
13081308

13091309
/* Profile and option setting */
1310-
avctx->profile = avctx->profile == FF_PROFILE_UNKNOWN ? FF_PROFILE_AAC_LOW :
1310+
avctx->profile = avctx->profile == AV_PROFILE_UNKNOWN ? AV_PROFILE_AAC_LOW :
13111311
avctx->profile;
13121312
for (i = 0; i < FF_ARRAY_ELEMS(aacenc_profiles); i++)
13131313
if (avctx->profile == aacenc_profiles[i])
13141314
break;
1315-
if (avctx->profile == FF_PROFILE_MPEG2_AAC_LOW) {
1316-
avctx->profile = FF_PROFILE_AAC_LOW;
1315+
if (avctx->profile == AV_PROFILE_MPEG2_AAC_LOW) {
1316+
avctx->profile = AV_PROFILE_AAC_LOW;
13171317
ERROR_IF(s->options.pred,
13181318
"Main prediction unavailable in the \"mpeg2_aac_low\" profile\n");
13191319
ERROR_IF(s->options.ltp,
13201320
"LTP prediction unavailable in the \"mpeg2_aac_low\" profile\n");
13211321
WARN_IF(s->options.pns,
13221322
"PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n");
13231323
s->options.pns = 0;
1324-
} else if (avctx->profile == FF_PROFILE_AAC_LTP) {
1324+
} else if (avctx->profile == AV_PROFILE_AAC_LTP) {
13251325
s->options.ltp = 1;
13261326
ERROR_IF(s->options.pred,
13271327
"Main prediction unavailable in the \"aac_ltp\" profile\n");
1328-
} else if (avctx->profile == FF_PROFILE_AAC_MAIN) {
1328+
} else if (avctx->profile == AV_PROFILE_AAC_MAIN) {
13291329
s->options.pred = 1;
13301330
ERROR_IF(s->options.ltp,
13311331
"LTP prediction unavailable in the \"aac_main\" profile\n");
13321332
} else if (s->options.ltp) {
1333-
avctx->profile = FF_PROFILE_AAC_LTP;
1333+
avctx->profile = AV_PROFILE_AAC_LTP;
13341334
WARN_IF(1,
13351335
"Chainging profile to \"aac_ltp\"\n");
13361336
ERROR_IF(s->options.pred,
13371337
"Main prediction unavailable in the \"aac_ltp\" profile\n");
13381338
} else if (s->options.pred) {
1339-
avctx->profile = FF_PROFILE_AAC_MAIN;
1339+
avctx->profile = AV_PROFILE_AAC_MAIN;
13401340
WARN_IF(1,
13411341
"Chainging profile to \"aac_main\"\n");
13421342
ERROR_IF(s->options.ltp,

libavcodec/aacenc_ltp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void ff_aac_encode_ltp_info(AACEncContext *s, SingleChannelElement *sce,
3737
{
3838
int i;
3939
IndividualChannelStream *ics = &sce->ics;
40-
if (s->profile != FF_PROFILE_AAC_LTP || !ics->predictor_present)
40+
if (s->profile != AV_PROFILE_AAC_LTP || !ics->predictor_present)
4141
return;
4242
if (common_window)
4343
put_bits(&s->pb, 1, 0);
@@ -119,7 +119,7 @@ void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce)
119119
float *pred_signal = &sce->ltp_state[0];
120120
const float *samples = &s->planar_samples[s->cur_channel][1024];
121121

122-
if (s->profile != FF_PROFILE_AAC_LTP)
122+
if (s->profile != AV_PROFILE_AAC_LTP)
123123
return;
124124

125125
/* Calculate lag */

libavcodec/aacenc_pred.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void ff_aac_encode_main_pred(AACEncContext *s, SingleChannelElement *sce)
335335
IndividualChannelStream *ics = &sce->ics;
336336
const int pmax = FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]);
337337

338-
if (s->profile != FF_PROFILE_AAC_MAIN ||
338+
if (s->profile != AV_PROFILE_AAC_MAIN ||
339339
!ics->predictor_present)
340340
return;
341341

libavcodec/aacenc_tns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
167167
const int c_bits = is8 ? TNS_Q_BITS_IS8 == 4 : TNS_Q_BITS == 4;
168168
const int sfb_start = av_clip(tns_min_sfb[is8][s->samplerate_index], 0, mmm);
169169
const int sfb_end = av_clip(sce->ics.num_swb, 0, mmm);
170-
const int order = is8 ? 7 : s->profile == FF_PROFILE_AAC_LOW ? 12 : TNS_MAX_ORDER;
170+
const int order = is8 ? 7 : s->profile == AV_PROFILE_AAC_LOW ? 12 : TNS_MAX_ORDER;
171171
const int slant = sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE ? 1 :
172172
sce->ics.window_sequence[0] == LONG_START_SEQUENCE ? 0 : 2;
173173
const int sfb_len = sfb_end - sfb_start;

libavcodec/aacenctab.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ static const unsigned char aac_maxval_cb[] = {
124124
};
125125

126126
static const int aacenc_profiles[] = {
127-
FF_PROFILE_AAC_MAIN,
128-
FF_PROFILE_AAC_LOW,
129-
FF_PROFILE_AAC_LTP,
130-
FF_PROFILE_MPEG2_AAC_LOW,
127+
AV_PROFILE_AAC_MAIN,
128+
AV_PROFILE_AAC_LOW,
129+
AV_PROFILE_AAC_LTP,
130+
AV_PROFILE_MPEG2_AAC_LOW,
131131
};
132132

133133
#endif /* AVCODEC_AACENCTAB_H */

libavcodec/aacsbr_template.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
973973
*num_bits_left = 0;
974974
} else {
975975
*num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps.common, *num_bits_left);
976-
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
976+
ac->avctx->profile = AV_PROFILE_AAC_HE_V2;
977977
// ensure the warning is not printed if PS extension is present
978978
ac->warned_he_aac_mono = 1;
979979
}

libavcodec/ac3dec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ static int ac3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
17141714
if (!err) {
17151715
avctx->sample_rate = s->sample_rate;
17161716
avctx->bit_rate = s->bit_rate + s->prev_bit_rate;
1717-
avctx->profile = s->eac3_extension_type_a == 1 ? FF_PROFILE_EAC3_DDP_ATMOS : FF_PROFILE_UNKNOWN;
1717+
avctx->profile = s->eac3_extension_type_a == 1 ? AV_PROFILE_EAC3_DDP_ATMOS : AV_PROFILE_UNKNOWN;
17181718
}
17191719

17201720
if (!avctx->sample_rate) {

0 commit comments

Comments
 (0)