mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
vf_libopencv: switch to filter_frame, this filter did not support slices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
5d170b09d3
commit
1f94f86ab5
@ -32,6 +32,7 @@
|
||||
#include "libavutil/file.h"
|
||||
#include "avfilter.h"
|
||||
#include "formats.h"
|
||||
#include "internal.h"
|
||||
#include "video.h"
|
||||
|
||||
static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *picref, enum AVPixelFormat pixfmt)
|
||||
@ -68,11 +69,6 @@ static int query_formats(AVFilterContext *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int (*init)(AVFilterContext *ctx, const char *args);
|
||||
@ -355,33 +351,36 @@ static av_cold void uninit(AVFilterContext *ctx)
|
||||
memset(ocv, 0, sizeof(*ocv));
|
||||
}
|
||||
|
||||
static int end_frame(AVFilterLink *inlink)
|
||||
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
|
||||
{
|
||||
AVFilterContext *ctx = inlink->dst;
|
||||
OCVContext *ocv = ctx->priv;
|
||||
AVFilterLink *outlink= inlink->dst->outputs[0];
|
||||
AVFilterBufferRef *inpicref = inlink ->cur_buf;
|
||||
AVFilterBufferRef *outpicref = outlink->out_buf;
|
||||
AVFilterBufferRef *out;
|
||||
IplImage inimg, outimg;
|
||||
int ret;
|
||||
|
||||
fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
|
||||
fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
|
||||
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
|
||||
if (!out) {
|
||||
avfilter_unref_bufferp(&in);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
avfilter_copy_buffer_ref_props(out, in);
|
||||
|
||||
fill_iplimage_from_picref(&inimg , in , inlink->format);
|
||||
fill_iplimage_from_picref(&outimg, out, inlink->format);
|
||||
ocv->end_frame_filter(ctx, &inimg, &outimg);
|
||||
fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
|
||||
fill_picref_from_iplimage(out, &outimg, inlink->format);
|
||||
|
||||
if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
|
||||
(ret = ff_end_frame(outlink)) < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
avfilter_unref_bufferp(&in);
|
||||
|
||||
return ff_filter_frame(outlink, out);
|
||||
}
|
||||
|
||||
static const AVFilterPad avfilter_vf_ocv_inputs[] = {
|
||||
{
|
||||
.name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.draw_slice = null_draw_slice,
|
||||
.end_frame = end_frame,
|
||||
.filter_frame = filter_frame,
|
||||
.min_perms = AV_PERM_READ
|
||||
},
|
||||
{ NULL }
|
||||
|
Loading…
Reference in New Issue
Block a user