vf_cuda_grid: fix #include cuda_check.h + mixed decl warnings (-Werror)
This commit is contained in:
+19
-11
@@ -19,6 +19,7 @@
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/cuda_check.h"
|
||||
#include "libavutil/hwcontext.h"
|
||||
#include "libavutil/hwcontext_cuda_internal.h"
|
||||
#include "libavutil/log.h"
|
||||
@@ -201,8 +202,8 @@ static int cuda_grid_config_input(AVFilterLink *inlink)
|
||||
FilterLink *inl = ff_filter_link(inlink);
|
||||
|
||||
if (!inl->hw_frames_ctx || !inl->hw_frames_ctx->data) {
|
||||
av_log(ctx, AV_LOG_ERROR, "input %d: software pixel format не поддерживается\n",
|
||||
FF_INLINK_IDX(inlink));
|
||||
av_log(ctx, AV_LOG_ERROR, "input %s: software pixel format не поддерживается\n",
|
||||
inlink->dstpad->name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
@@ -216,6 +217,9 @@ static int cuda_grid_config_output(AVFilterLink *outlink)
|
||||
FilterLink *inl0 = ff_filter_link(in0);
|
||||
FilterLink *outl = ff_filter_link(outlink);
|
||||
AVHWFramesContext *hwfc0;
|
||||
AVHWDeviceContext *hwdev;
|
||||
AVBufferRef *out_ref;
|
||||
AVHWFramesContext *out_hwfc;
|
||||
int W, H, ret;
|
||||
|
||||
if (!inl0->hw_frames_ctx)
|
||||
@@ -269,16 +273,16 @@ static int cuda_grid_config_output(AVFilterLink *outlink)
|
||||
s->cells[3].x = W; s->cells[3].y = H; s->cells[3].w = W; s->cells[3].h = H;
|
||||
|
||||
/* Setup CUDA device + stream context из input 0 */
|
||||
AVHWDeviceContext *hwdev = hwfc0->device_ctx;
|
||||
hwdev = hwfc0->device_ctx;
|
||||
s->hwctx = (AVCUDADeviceContext *)hwdev->hwctx;
|
||||
s->cu_ctx = s->hwctx->cuda_ctx;
|
||||
s->cu_stream = s->hwctx->stream;
|
||||
|
||||
/* Аллокация output hw_frames_ctx — copy от input #0 с обновлёнными размерами */
|
||||
AVBufferRef *out_ref = av_hwframe_ctx_alloc(hwfc0->device_ref);
|
||||
out_ref = av_hwframe_ctx_alloc(hwfc0->device_ref);
|
||||
if (!out_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
AVHWFramesContext *out_hwfc = (AVHWFramesContext *)out_ref->data;
|
||||
out_hwfc = (AVHWFramesContext *)out_ref->data;
|
||||
out_hwfc->format = AV_PIX_FMT_CUDA;
|
||||
out_hwfc->sw_format = AV_PIX_FMT_NV12;
|
||||
out_hwfc->width = s->out_width;
|
||||
@@ -296,12 +300,16 @@ static int cuda_grid_config_output(AVFilterLink *outlink)
|
||||
ret = ff_framesync_init(&s->fs, ctx, CUDA_GRID_INPUTS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
for (int i = 0; i < CUDA_GRID_INPUTS; i++) {
|
||||
FFFrameSyncIn *fs_in = &s->fs.in[i];
|
||||
fs_in->time_base = ctx->inputs[i]->time_base;
|
||||
fs_in->sync = 1;
|
||||
fs_in->before = EXT_STOP;
|
||||
fs_in->after = EXT_INFINITY;
|
||||
{
|
||||
int i;
|
||||
FFFrameSyncIn *fs_in;
|
||||
for (i = 0; i < CUDA_GRID_INPUTS; i++) {
|
||||
fs_in = &s->fs.in[i];
|
||||
fs_in->time_base = ctx->inputs[i]->time_base;
|
||||
fs_in->sync = 1;
|
||||
fs_in->before = EXT_STOP;
|
||||
fs_in->after = EXT_INFINITY;
|
||||
}
|
||||
}
|
||||
s->fs.opaque = s;
|
||||
s->fs.on_event = cuda_grid_compose;
|
||||
|
||||
Reference in New Issue
Block a user