History

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.

Andreas Rheinhardt committed 4 years ago

Commit a02a0e81 parent 832e6565 files · +17 −17Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t