diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2017-03-29 23:31:20 +0200 |
---|---|---|
committer | Matthieu Bouron <matthieu.bouron@gmail.com> | 2017-03-29 23:33:20 +0200 |
commit | 78e871ebbcc6f3c877e7292c4dda0c9979f8ede4 (patch) | |
tree | dde035107feb68839a074828a4c9f4c36e27fa3d /libavfilter | |
parent | b4016ef31a6ea007e481427ade35ac35d1519170 (diff) | |
parent | 7e2561fa8313982aa21f7657953eedeeb33b210d (diff) | |
download | ffmpeg-78e871ebbcc6f3c877e7292c4dda0c9979f8ede4.tar.gz |
Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d'
* commit '7e2561fa8313982aa21f7657953eedeeb33b210d':
lavfi: Use ff_get_video_buffer in all filters using hwframes
vf_hwupload_cuda: Fix build error
Merged-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_deinterlace_qsv.c | 10 | ||||
-rw-r--r-- | libavfilter/vf_hwupload.c | 9 | ||||
-rw-r--r-- | libavfilter/vf_hwupload_cuda.c | 8 | ||||
-rw-r--r-- | libavfilter/vf_scale_qsv.c | 6 | ||||
-rw-r--r-- | libavfilter/vf_scale_vaapi.c | 11 |
5 files changed, 12 insertions, 32 deletions
diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index e7491e10df..2fe74c1a75 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -434,13 +434,11 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, mfxStatus err; int ret, again = 0; - out = av_frame_alloc(); - if (!out) - return AVERROR(ENOMEM); - - ret = av_hwframe_get_buffer(s->hw_frames_ctx, out, 0); - if (ret < 0) + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); + if (!out) { + ret = AVERROR(ENOMEM); goto fail; + } surf_out = (mfxFrameSurface1*)out->data[3]; surf_out->Info.CropW = outlink->w; diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index f54ce9faa7..9237253f23 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -159,15 +159,10 @@ static int hwupload_filter_frame(AVFilterLink *link, AVFrame *input) if (input->format == outlink->format) return ff_filter_frame(outlink, input); - output = av_frame_alloc(); + output = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!output) { - err = AVERROR(ENOMEM); - goto fail; - } - - err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0); - if (err < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n"); + err = AVERROR(ENOMEM); goto fail; } diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index 49f34b6c52..1e47ada242 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -113,21 +113,17 @@ static int cudaupload_config_output(AVFilterLink *outlink) static int cudaupload_filter_frame(AVFilterLink *link, AVFrame *in) { AVFilterContext *ctx = link->dst; - CudaUploadContext *s = ctx->priv; + AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = NULL; int ret; - out = av_frame_alloc(); + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } - ret = av_hwframe_get_buffer(s->hwframe, out, 0); - if (ret < 0) - goto fail; - out->width = in->width; out->height = in->height; diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 88fca8b461..52e3ef9c95 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -530,16 +530,12 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out = NULL; int ret = 0; - out = av_frame_alloc(); + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } - ret = av_hwframe_get_buffer(s->out_frames_ref, out, 0); - if (ret < 0) - goto fail; - do { err = MFXVideoVPP_RunFrameVPPAsync(s->session, (mfxFrameSurface1*)in->data[3], diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 8221849ee0..c4334c7664 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -32,6 +32,7 @@ #include "formats.h" #include "internal.h" #include "scale.h" +#include "video.h" typedef struct ScaleVAAPIContext { const AVClass *class; @@ -288,19 +289,13 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n", input_surface); - output_frame = av_frame_alloc(); + output_frame = ff_get_video_buffer(outlink, ctx->output_width, + ctx->output_height); if (!output_frame) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate output frame."); err = AVERROR(ENOMEM); goto fail; } - err = av_hwframe_get_buffer(ctx->output_frames_ref, output_frame, 0); - if (err < 0) { - av_log(ctx, AV_LOG_ERROR, "Failed to get surface for " - "output: %d\n.", err); - } - output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3]; av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale output.\n", output_surface); |