History

avcodec/vdpau: Deprecate redundant allocators and getter/setter

The allocators have been superseded by av_vdpau_bind_context(). The latter have only been added "to allow multiple forks to add fields to the structure without breaking ABI" [1], but libav is no more, so this is not needed any longer. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2013-August/146954.html

Andreas Rheinhardt committed 2 years ago

Commit c9f5cea1 parent 2a873454 files · +32 −5Browse files

Unified · Split

4 files
  1. doc/APIchanges +6 −0
  2. libavcodec/vdpau.c +6 −0
  3. libavcodec/vdpau.h +19 −5
  4. libavcodec/version_major.h +1 −0
doc/APIchanges+6−0
@@ -2,6 +2,12 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line
2 2
3API changes, most recent first:3API changes, most recent first:
4 4
52024-03-08 - xxxxxxxxxx - lavc 61.0.100 - vdpau.h
6 Deprecate av_vdpau_alloc_context(), av_alloc_vdpaucontext(),
7 av_vdpau_hwaccel_get_render2() and av_vdpau_hwaccel_set_render2().
8 The former are superseded by av_vdpau_bind_context(), the latter
9 are unneeded as the relevant field is public and can be accessed directly.
10
52024-03-06 - xxxxxxxxxx - lavf 60.25.100 - avformat.h112024-03-06 - xxxxxxxxxx - lavf 60.25.100 - avformat.h
6 Deprecate av_fmt_ctx_get_duration_estimation_method().12 Deprecate av_fmt_ctx_get_duration_estimation_method().
7 The relevant field is public and needs no getter to access.13 The relevant field is public and needs no getter to access.
libavcodec/vdpau.c+6−0
@@ -64,15 +64,19 @@ static int vdpau_error(VdpStatus status) · 63 unmodified lines
64 }64 }
65}65}
66 66
67#if FF_API_VDPAU_ALLOC_GET_SET
67AVVDPAUContext *av_alloc_vdpaucontext(void)68AVVDPAUContext *av_alloc_vdpaucontext(void)
68{69{
70FF_DISABLE_DEPRECATION_WARNINGS
69 return av_vdpau_alloc_context();71 return av_vdpau_alloc_context();
72FF_ENABLE_DEPRECATION_WARNINGS
70}73}
71 74
72#define MAKE_ACCESSORS(str, name, type, field) \75#define MAKE_ACCESSORS(str, name, type, field) \
73 type av_##name##_get_##field(const str *s) { return s->field; } \76 type av_##name##_get_##field(const str *s) { return s->field; } \
74 void av_##name##_set_##field(str *s, type v) { s->field = v; }77 void av_##name##_set_##field(str *s, type v) { s->field = v; }
75MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)78MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
79#endif
76 80
77int av_vdpau_get_surface_parameters(AVCodecContext *avctx,81int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
78 VdpChromaType *type,82 VdpChromaType *type,
@@ -400,10 +404,12 @@ int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, · 321 unmodified lines
400 return 0;404 return 0;
401}405}
402 406
407#if FF_API_VDPAU_ALLOC_GET_SET
403AVVDPAUContext *av_vdpau_alloc_context(void)408AVVDPAUContext *av_vdpau_alloc_context(void)
404{409{
405 return av_mallocz(sizeof(VDPAUHWContext));410 return av_mallocz(sizeof(VDPAUHWContext));
406}411}
412#endif
407 413
408int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,414int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
409 VdpGetProcAddress *get_proc, unsigned flags)415 VdpGetProcAddress *get_proc, unsigned flags)
libavcodec/vdpau.h+19−5
@@ -66,16 +66,14 @@ typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, · 65 unmodified lines
66/**66/**
67 * This structure is used to share data between the libavcodec library and67 * This structure is used to share data between the libavcodec library and
68 * the client video application.68 * the client video application.
69 * The user shall allocate the structure via the av_alloc_vdpau_hwaccel69 * This structure will be allocated and stored in AVCodecContext.hwaccel_context
70 * function and make it available as70 * by av_vdpau_bind_context(). Members can be set by the user once
71 * AVCodecContext.hwaccel_context. Members can be set by the user once
72 * during initialization or through each AVCodecContext.get_buffer()71 * during initialization or through each AVCodecContext.get_buffer()
73 * function call. In any case, they must be valid prior to calling72 * function call. In any case, they must be valid prior to calling
74 * decoding functions.73 * decoding functions.
75 *74 *
76 * The size of this structure is not a part of the public ABI and must not75 * The size of this structure is not a part of the public ABI and must not
77 * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an76 * be used outside of libavcodec.
78 * AVVDPAUContext.
79 */77 */
80typedef struct AVVDPAUContext {78typedef struct AVVDPAUContext {
81 /**79 /**
@@ -95,15 +93,27 @@ typedef struct AVVDPAUContext { · 13 unmodified lines
95 AVVDPAU_Render2 render2;93 AVVDPAU_Render2 render2;
96} AVVDPAUContext;94} AVVDPAUContext;
97 95
96#if FF_API_VDPAU_ALLOC_GET_SET
98/**97/**
99 * @brief allocation function for AVVDPAUContext98 * @brief allocation function for AVVDPAUContext
100 *99 *
101 * Allows extending the struct without breaking API/ABI100 * Allows extending the struct without breaking API/ABI
101 * @deprecated use av_vdpau_bind_context() instead
102 */102 */
103attribute_deprecated
103AVVDPAUContext *av_alloc_vdpaucontext(void);104AVVDPAUContext *av_alloc_vdpaucontext(void);
104 105
106/**
107 * @deprecated render2 is public and can be accessed directly
108 */
109attribute_deprecated
105AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);110AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
111/**
112 * @deprecated render2 is public and can be accessed directly
113 */
114attribute_deprecated
106void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);115void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
116#endif
107 117
108/**118/**
109 * Associate a VDPAU device with a codec context for hardware acceleration.119 * Associate a VDPAU device with a codec context for hardware acceleration.
@@ -145,12 +155,16 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, · 35 unmodified lines
145int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,155int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
146 uint32_t *width, uint32_t *height);156 uint32_t *width, uint32_t *height);
147 157
158#if FF_API_VDPAU_ALLOC_GET_SET
148/**159/**
149 * Allocate an AVVDPAUContext.160 * Allocate an AVVDPAUContext.
150 *161 *
151 * @return Newly-allocated AVVDPAUContext or NULL on failure.162 * @return Newly-allocated AVVDPAUContext or NULL on failure.
163 * @deprecated use av_vdpau_bind_context() instead
152 */164 */
165attribute_deprecated
153AVVDPAUContext *av_vdpau_alloc_context(void);166AVVDPAUContext *av_vdpau_alloc_context(void);
167#endif
154 168
155/** @} */169/** @} */
156 170
libavcodec/version_major.h+1−0
@@ -46,5 +46,6 @@ · 45 unmodified lines
46#define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62)46#define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62)
47#define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62)47#define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62)
48#define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)48#define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)
49#define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
49 50
50#endif /* AVCODEC_VERSION_MAJOR_H */51#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