From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/avcodec: Deprecate lavc chroma pos API functions Date: Wed, 21 Sep 2022 03:35:40 +0200 Message-ID: <GV1P250MB0737E8DBEAA9A359E8A4CF7C8F4F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <GV1P250MB0737CC466D153BBD200DF91D8F4F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> 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> --- doc/APIchanges | 5 +++++ libavcodec/avcodec.h | 6 ++++++ libavcodec/utils.c | 20 ++++---------------- libavcodec/version.h | 2 +- libavcodec/version_major.h | 1 + 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 8ead37dcbb..858a9c18bf 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,11 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-09-21 - xxxxxxxxxx - lavc 59.46.100 - avcodec.h + Deprecate avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum(). + Use av_chroma_location_enum_to_pos() or av_chroma_location_pos_to_enum() + instead. + 2022-09-21 - xxxxxxxxxx - lavu 57.xx.100 - pixdesc.h Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum(). diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 0769577338..7365eb5cc0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2496,6 +2496,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]); +#ifdef FF_API_AVCODEC_CHROMA_POS /** * Converts AVChromaLocation to swscale x/y chroma position. * @@ -2504,7 +2505,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, * * @param xpos horizontal chroma sample position * @param ypos vertical chroma sample position + * @deprecated Use av_chroma_location_enum_to_pos() instead. */ + attribute_deprecated int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); /** @@ -2515,8 +2518,11 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); * * @param xpos horizontal chroma sample position * @param ypos vertical chroma sample position + * @deprecated Use av_chroma_location_pos_to_enum() instead. */ + attribute_deprecated enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); +#endif /** * Decode a subtitle message. diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ba64aaf32d..0e01f18497 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, diff --git a/libavcodec/version.h b/libavcodec/version.h index a3441795e0..e973bb1c4d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 45 +#define LIBAVCODEC_VERSION_MINOR 46 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h index d9386792de..12f863deb7 100644 --- a/libavcodec/version_major.h +++ b/libavcodec/version_major.h @@ -52,5 +52,6 @@ #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_MAJOR_H */ -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-09-21 1:36 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-21 1:30 [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h Andreas Rheinhardt 2022-09-21 1:34 ` [FFmpeg-devel] [PATCH 2/5] avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum) Andreas Rheinhardt 2022-09-25 0:09 ` Andreas Rheinhardt 2022-09-21 1:35 ` [FFmpeg-devel] [PATCH 3/5] avformat/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos) Andreas Rheinhardt 2022-09-21 1:35 ` Andreas Rheinhardt [this message] 2022-09-21 1:35 ` [FFmpeg-devel] [PATCH 5/5] avformat/internal: Don't include avcodec.h Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=GV1P250MB0737E8DBEAA9A359E8A4CF7C8F4F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git