diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-21 02:42:48 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-26 03:02:49 +0200 |
commit | a02a0e8db492ae91672449ac3be8ff084a903402 (patch) | |
tree | c5b5421ec7902f3e0430fc8b2bdd134ec16b2461 /libavcodec/utils.c | |
parent | 832e6563df9bb6ca79b8a9b39c6a7e8dc28808e2 (diff) |
avcodec/avcodec: Deprecate lavc chroma pos API functions
avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum()
deal with enum AVChromaLocation which is defined in lavu.
These functions are therefore replaced by
av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
This commit provides the necessary deprecations. Also already make
these functions wrappers around the corresponding lavu functions
as not doing so would force one to disable deprecation warnings.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 18c7a1be14..2b63a498b9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -353,29 +353,17 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height) align = FFMAX3(align, linesize_align[1], linesize_align[2]); *width = FFALIGN(*width, align); } - +#if FF_API_AVCODEC_CHROMA_POS int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos) { - if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB) - return AVERROR(EINVAL); - pos--; - - *xpos = (pos&1) * 128; - *ypos = ((pos>>1)^(pos<4)) * 128; - - return 0; + return av_chroma_location_enum_to_pos(xpos, ypos, pos); } enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos) { - int pos, xout, yout; - - for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) { - if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos) - return pos; - } - return AVCHROMA_LOC_UNSPECIFIED; + return av_chroma_location_pos_to_enum(xpos, ypos); } +#endif int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, |