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.
Unified · Split
| @@ -14,6 +14,11 @@ libavutil: 2021-04-27 · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | API changes, most recent first: |
| 16 | 16 | |
| 17 | +2022-09-26 - xxxxxxxxxx - lavc 59.48.100 - avcodec.h | |
| 18 | + Deprecate avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum(). | |
| 19 | + Use av_chroma_location_enum_to_pos() or av_chroma_location_pos_to_enum() | |
| 20 | + instead. | |
| 21 | + | |
| 17 | 22 | 2022-09-26 - xxxxxxxxxx - lavu 57.37.100 - pixdesc.h |
| 18 | 23 | Add av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum(). |
| 19 | 24 | |
| @@ -2496,6 +2496,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); · 2495 unmodified lines | ||
| 2496 | 2496 | void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, |
| 2497 | 2497 | int linesize_align[AV_NUM_DATA_POINTERS]); |
| 2498 | 2498 | |
| 2499 | +#ifdef FF_API_AVCODEC_CHROMA_POS | |
| 2499 | 2500 | /** |
| 2500 | 2501 | * Converts AVChromaLocation to swscale x/y chroma position. |
| 2501 | 2502 | * |
| @@ -2504,7 +2505,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 2 unmodified lines | ||
| 2504 | 2505 | * |
| 2505 | 2506 | * @param xpos horizontal chroma sample position |
| 2506 | 2507 | * @param ypos vertical chroma sample position |
| 2508 | + * @deprecated Use av_chroma_location_enum_to_pos() instead. | |
| 2507 | 2509 | */ |
| 2510 | + attribute_deprecated | |
| 2508 | 2511 | int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); |
| 2509 | 2512 | |
| 2510 | 2513 | /** |
| @@ -2515,8 +2518,11 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); · 4 unmodified lines | ||
| 2515 | 2518 | * |
| 2516 | 2519 | * @param xpos horizontal chroma sample position |
| 2517 | 2520 | * @param ypos vertical chroma sample position |
| 2521 | + * @deprecated Use av_chroma_location_pos_to_enum() instead. | |
| 2518 | 2522 | */ |
| 2523 | + attribute_deprecated | |
| 2519 | 2524 | enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); |
| 2525 | +#endif | |
| 2520 | 2526 | |
| 2521 | 2527 | /** |
| 2522 | 2528 | * Decode a subtitle message. |
| @@ -353,29 +353,17 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height) · 352 unmodified lines | ||
| 353 | 353 | align = FFMAX3(align, linesize_align[1], linesize_align[2]); |
| 354 | 354 | *width = FFALIGN(*width, align); |
| 355 | 355 | } |
| 356 | − | |
| 356 | +#if FF_API_AVCODEC_CHROMA_POS | |
| 357 | 357 | int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos) |
| 358 | 358 | { |
| 359 | − if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB) | |
| 360 | − return AVERROR(EINVAL); | |
| 361 | − pos--; | |
| 362 | − | |
| 363 | − *xpos = (pos&1) * 128; | |
| 364 | − *ypos = ((pos>>1)^(pos<4)) * 128; | |
| 365 | − | |
| 366 | − return 0; | |
| 359 | + return av_chroma_location_enum_to_pos(xpos, ypos, pos); | |
| 367 | 360 | } |
| 368 | 361 | |
| 369 | 362 | enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos) |
| 370 | 363 | { |
| 371 | − int pos, xout, yout; | |
| 372 | − | |
| 373 | − for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) { | |
| 374 | − if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos) | |
| 375 | − return pos; | |
| 376 | − } | |
| 377 | − return AVCHROMA_LOC_UNSPECIFIED; | |
| 364 | + return av_chroma_location_pos_to_enum(xpos, ypos); | |
| 378 | 365 | } |
| 366 | +#endif | |
| 379 | 367 | |
| 380 | 368 | int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, |
| 381 | 369 | enum AVSampleFormat sample_fmt, const uint8_t *buf, |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #include "version_major.h" |
| 31 | 31 | |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 47 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 48 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -52,5 +52,6 @@ · 51 unmodified lines | ||
| 52 | 52 | #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) |
| 53 | 53 | #define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 60) |
| 54 | 54 | #define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 60) |
| 55 | +#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 60) | |
| 55 | 56 | |
| 56 | 57 | #endif /* AVCODEC_VERSION_MAJOR_H */ |