[FFmpeg-devel] [PATCH] Try to make new VDPAU usable by adding context to callback.
Michael Niedermayer
michaelni at gmx.at
Wed Aug 7 23:44:14 CEST 2013
On Wed, Aug 07, 2013 at 09:28:15PM +0200, Reimar Döffinger wrote:
> Using VDPAU correctly means checking for preemption
> and possibly regenerating the context all the time.
> With the current API there is no context or other
> user-defined pointer and thus this in not possible
> unless using some hack like global variables.
> This introduces a new decode function that gets
> both the AVCodecContext and AVFrame in addition,
> in both the user can store additional opaque data.
> Unfortunately the HWAccel API has no way of providing
> API/ABI compatibility, so a currently disallowed
> state (render pointer being NULL) is used to extend it.
> An alternative would be to add the new function pointer
> to the AVCodecContext.
> Strictly speaking this probably doesn't have to be under
> !INCOMPATIBLE condition.
> ---
> libavcodec/vdpau.c | 6 ++++++
> libavcodec/vdpau.h | 6 ++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
> index cf564a5..218d218 100644
> --- a/libavcodec/vdpau.c
> +++ b/libavcodec/vdpau.c
> @@ -61,6 +61,12 @@ int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
> struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
> VdpVideoSurface surf = ff_vdpau_get_surface_id(pic);
>
> +#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI
> + if (!hwctx->render) {
> + hwctx->render2(avctx, &pic->f, surf, (void *)&pic_ctx->info,
> + pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
> + } else
> +#endif
> hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
> pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
>
> diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
> index 08116bf..b77d988 100644
> --- a/libavcodec/vdpau.h
> +++ b/libavcodec/vdpau.h
> @@ -128,6 +128,12 @@ typedef struct AVVDPAUContext {
> attribute_deprecated
> VdpBitstreamBuffer *bitstream_buffers;
> #endif
> +#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI
> + int (*render2)(struct AVCodecContext *, struct AVFrame *, VdpVideoSurface,
> + const VdpPictureInfo *,
> + uint32_t,
> + const VdpBitstreamBuffer *);
> +#endif
> } AVVDPAUContext;
A function to allocate a AVVDPAUContext is needed to allow future
extension i think (arguable this is orthogonal to this patch)
A function to set/get the render2 field is needed so as to allow
multiple forks to add fields to the structure without breaking ABI
see MAKE_ACCESSORS()
and minor version should be bumped, and APIchanges updated
iam not sure if this or a function ptr in AVCodecContext is
simpler/better
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130807/870838a8/attachment.asc>
More information about the ffmpeg-devel
mailing list