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
22
33 API changes, most recent first:
44
5+2024-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+
511 2024-03-06 - xxxxxxxxxx - lavf 60.25.100 - avformat.h
612 Deprecate av_fmt_ctx_get_duration_estimation_method().
713 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
6464 }
6565 }
6666
67+#if FF_API_VDPAU_ALLOC_GET_SET
6768 AVVDPAUContext *av_alloc_vdpaucontext(void)
6869 {
70+FF_DISABLE_DEPRECATION_WARNINGS
6971 return av_vdpau_alloc_context();
72+FF_ENABLE_DEPRECATION_WARNINGS
7073 }
7174
7275 #define MAKE_ACCESSORS(str, name, type, field) \
7376 type av_##name##_get_##field(const str *s) { return s->field; } \
7477 void av_##name##_set_##field(str *s, type v) { s->field = v; }
7578 MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
79+#endif
7680
7781 int av_vdpau_get_surface_parameters(AVCodecContext *avctx,
7882 VdpChromaType *type,
@@ -400,10 +404,12 @@ int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, · 321 unmodified lines
400404 return 0;
401405 }
402406
407+#if FF_API_VDPAU_ALLOC_GET_SET
403408 AVVDPAUContext *av_vdpau_alloc_context(void)
404409 {
405410 return av_mallocz(sizeof(VDPAUHWContext));
406411 }
412+#endif
407413
408414 int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
409415 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
6666 /**
6767 * This structure is used to share data between the libavcodec library and
6868 * the client video application.
69− * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
70− * function and make it available as
71− * AVCodecContext.hwaccel_context. Members can be set by the user once
69+ * This structure will be allocated and stored in AVCodecContext.hwaccel_context
70+ * by av_vdpau_bind_context(). Members can be set by the user once
7271 * during initialization or through each AVCodecContext.get_buffer()
7372 * function call. In any case, they must be valid prior to calling
7473 * decoding functions.
7574 *
7675 * 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 an
78− * AVVDPAUContext.
76+ * be used outside of libavcodec.
7977 */
8078 typedef struct AVVDPAUContext {
8179 /**
@@ -95,15 +93,27 @@ typedef struct AVVDPAUContext { · 13 unmodified lines
9593 AVVDPAU_Render2 render2;
9694 } AVVDPAUContext;
9795
96+#if FF_API_VDPAU_ALLOC_GET_SET
9897 /**
9998 * @brief allocation function for AVVDPAUContext
10099 *
101100 * Allows extending the struct without breaking API/ABI
101+ * @deprecated use av_vdpau_bind_context() instead
102102 */
103+attribute_deprecated
103104 AVVDPAUContext *av_alloc_vdpaucontext(void);
104105
106+/**
107+ * @deprecated render2 is public and can be accessed directly
108+ */
109+attribute_deprecated
105110 AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
111+/**
112+ * @deprecated render2 is public and can be accessed directly
113+ */
114+attribute_deprecated
106115 void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
116+#endif
107117
108118 /**
109119 * 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
145155 int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
146156 uint32_t *width, uint32_t *height);
147157
158+#if FF_API_VDPAU_ALLOC_GET_SET
148159 /**
149160 * Allocate an AVVDPAUContext.
150161 *
151162 * @return Newly-allocated AVVDPAUContext or NULL on failure.
163+ * @deprecated use av_vdpau_bind_context() instead
152164 */
165+attribute_deprecated
153166 AVVDPAUContext *av_vdpau_alloc_context(void);
167+#endif
154168
155169 /** @} */
156170
libavcodec/version_major.h+1−0
@@ -46,5 +46,6 @@ · 45 unmodified lines
4646 #define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62)
4747 #define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62)
4848 #define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)
49+#define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
4950
5051 #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