---
actually not fully sure how to use hw_device_ctx here, and obviously
it violates the API. but for now it's modeled after the preliminary
avconv_vaapi patch for the same thing.
---
avconv_vdpau.c | 39 +--------------------------------------
1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/avconv_vdpau.c b/avconv_vdpau.c
index 5fedceef95..ec2d4a9c95 100644
--- a/avconv_vdpau.c
+++ b/avconv_vdpau.c
@@ -29,7 +29,6 @@
#include "libavutil/pixfmt.h"
typedef struct VDPAUContext {
- AVBufferRef *hw_frames_ctx;
AVFrame *tmp_frame;
} VDPAUContext;
@@ -39,22 +38,11 @@ static void vdpau_uninit(AVCodecContext *s)
VDPAUContext *ctx = ist->hwaccel_ctx;
ist->hwaccel_uninit = NULL;
- ist->hwaccel_get_buffer = NULL;
ist->hwaccel_retrieve_data = NULL;
- av_buffer_unref(&ctx->hw_frames_ctx);
av_frame_free(&ctx->tmp_frame);
av_freep(&ist->hwaccel_ctx);
- av_freep(&s->hwaccel_context);
-}
-
-static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
-{
- InputStream *ist = s->opaque;
- VDPAUContext *ctx = ist->hwaccel_ctx;
-
- return av_hwframe_get_buffer(ctx->hw_frames_ctx, frame, 0);
}
static int vdpau_retrieve_data(AVCodecContext *s, AVFrame *frame)
@@ -87,9 +75,6 @@ static int vdpau_alloc(AVCodecContext *s)
int ret;
AVBufferRef *device_ref = NULL;
- AVHWDeviceContext *device_ctx;
- AVVDPAUDeviceContext *device_hwctx;
- AVHWFramesContext *frames_ctx;
ctx = av_mallocz(sizeof(*ctx));
if (!ctx)
@@ -97,37 +82,16 @@ static int vdpau_alloc(AVCodecContext *s)
ist->hwaccel_ctx = ctx;
ist->hwaccel_uninit = vdpau_uninit;
- ist->hwaccel_get_buffer = vdpau_get_buffer;
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
ctx->tmp_frame = av_frame_alloc();
if (!ctx->tmp_frame)
goto fail;
- ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VDPAU,
+ ret = av_hwdevice_ctx_create(&s->hw_device_ctx, AV_HWDEVICE_TYPE_VDPAU,
ist->hwaccel_device, NULL, 0);
if (ret < 0)
goto fail;
- device_ctx = (AVHWDeviceContext*)device_ref->data;
- device_hwctx = device_ctx->hwctx;
-
- ctx->hw_frames_ctx = av_hwframe_ctx_alloc(device_ref);
- if (!ctx->hw_frames_ctx)
- goto fail;
- av_buffer_unref(&device_ref);
-
- frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
- frames_ctx->format = AV_PIX_FMT_VDPAU;
- frames_ctx->sw_format = s->sw_pix_fmt;
- frames_ctx->width = s->coded_width;
- frames_ctx->height = s->coded_height;
-
- ret = av_hwframe_ctx_init(ctx->hw_frames_ctx);
- if (ret < 0)
- goto fail;
-
- if (av_vdpau_bind_context(s, device_hwctx->device,
device_hwctx->get_proc_address, 0))
- goto fail;
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU to decode input stream
#%d:%d.\n",
ist->file_index, ist->st->index);
@@ -152,7 +116,6 @@ int vdpau_init(AVCodecContext *s)
return ret;
}
- ist->hwaccel_get_buffer = vdpau_get_buffer;
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
return 0;
--
2.11.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel