Commit d4f89906 authored by Anton Khirnov's avatar Anton Khirnov

lavfi: add error handling to end_frame().

parent e9b992d0
...@@ -287,8 +287,10 @@ struct AVFilterPad { ...@@ -287,8 +287,10 @@ struct AVFilterPad {
* in the link structure during start_frame(). * in the link structure during start_frame().
* *
* Input video pads only. * Input video pads only.
*
* @return >= 0 on success, a negative AVERROR on error.
*/ */
void (*end_frame)(AVFilterLink *link); int (*end_frame)(AVFilterLink *link);
/** /**
* Slice drawing callback. This is where a filter receives video data * Slice drawing callback. This is where a filter receives video data
......
...@@ -98,7 +98,10 @@ static void queue_pop(FifoContext *s) ...@@ -98,7 +98,10 @@ static void queue_pop(FifoContext *s)
s->root.next = tmp; s->root.next = tmp;
} }
static void end_frame(AVFilterLink *inlink) { } static int end_frame(AVFilterLink *inlink)
{
return 0;
}
static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{ {
......
...@@ -98,8 +98,10 @@ struct AVFilterPad { ...@@ -98,8 +98,10 @@ struct AVFilterPad {
* in the link structure during start_frame(). * in the link structure during start_frame().
* *
* Input video pads only. * Input video pads only.
*
* @return >= 0 on success, a negative AVERROR on error.
*/ */
void (*end_frame)(AVFilterLink *link); int (*end_frame)(AVFilterLink *link);
/** /**
* Slice drawing callback. This is where a filter receives video data * Slice drawing callback. This is where a filter receives video data
......
...@@ -90,13 +90,17 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -90,13 +90,17 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return ret; return ret;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
int i; int i, ret = 0;
for (i = 0; i < ctx->nb_outputs; i++) for (i = 0; i < ctx->nb_outputs; i++) {
ff_end_frame(ctx->outputs[i]); ret = ff_end_frame(ctx->outputs[i]);
if (ret < 0)
break;
}
return ret;
} }
AVFilter avfilter_vf_split = { AVFilter avfilter_vf_split = {
......
...@@ -91,7 +91,7 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -91,7 +91,7 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return ff_draw_slice(ctx->outputs[0], y, h, slice_dir); return ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
BlackFrameContext *blackframe = ctx->priv; BlackFrameContext *blackframe = ctx->priv;
...@@ -106,7 +106,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -106,7 +106,7 @@ static void end_frame(AVFilterLink *inlink)
blackframe->frame++; blackframe->frame++;
blackframe->nblack = 0; blackframe->nblack = 0;
ff_end_frame(inlink->dst->outputs[0]); return ff_end_frame(inlink->dst->outputs[0]);
} }
AVFilter avfilter_vf_blackframe = { AVFilter avfilter_vf_blackframe = {
......
...@@ -315,12 +315,12 @@ static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) ...@@ -315,12 +315,12 @@ static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
return ff_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir); return ff_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir);
} }
static void end_frame(AVFilterLink *link) static int end_frame(AVFilterLink *link)
{ {
CropContext *crop = link->dst->priv; CropContext *crop = link->dst->priv;
crop->var_values[VAR_N] += 1.0; crop->var_values[VAR_N] += 1.0;
ff_end_frame(link->dst->outputs[0]); return ff_end_frame(link->dst->outputs[0]);
} }
AVFilter avfilter_vf_crop = { AVFilter avfilter_vf_crop = {
......
...@@ -114,7 +114,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -114,7 +114,7 @@ static int config_input(AVFilterLink *inlink)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
CropDetectContext *cd = ctx->priv; CropDetectContext *cd = ctx->priv;
...@@ -191,7 +191,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -191,7 +191,7 @@ static void end_frame(AVFilterLink *inlink)
w, h, x, y); w, h, x, y);
} }
ff_end_frame(inlink->dst->outputs[0]); return ff_end_frame(inlink->dst->outputs[0]);
} }
AVFilter avfilter_vf_cropdetect = { AVFilter avfilter_vf_cropdetect = {
......
...@@ -250,7 +250,7 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) ...@@ -250,7 +250,7 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
DelogoContext *delogo = inlink->dst->priv; DelogoContext *delogo = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
...@@ -260,6 +260,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -260,6 +260,7 @@ static void end_frame(AVFilterLink *inlink)
int hsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_w; int hsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
int vsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_h; int vsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
int plane; int plane;
int ret;
for (plane = 0; plane < 4 && inpicref->data[plane]; plane++) { for (plane = 0; plane < 4 && inpicref->data[plane]; plane++) {
int hsub = plane == 1 || plane == 2 ? hsub0 : 0; int hsub = plane == 1 || plane == 2 ? hsub0 : 0;
...@@ -274,8 +275,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -274,8 +275,10 @@ static void end_frame(AVFilterLink *inlink)
delogo->show, direct); delogo->show, direct);
} }
ff_draw_slice(outlink, 0, inlink->h, 1); if ((ret = ff_draw_slice(outlink, 0, inlink->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_delogo = { AVFilter avfilter_vf_delogo = {
......
...@@ -860,19 +860,22 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) ...@@ -860,19 +860,22 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
return ff_start_frame(inlink->dst->outputs[0], buf_out); return ff_start_frame(inlink->dst->outputs[0], buf_out);
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *picref = inlink->cur_buf; AVFilterBufferRef *picref = inlink->cur_buf;
DrawTextContext *dtext = inlink->dst->priv; DrawTextContext *dtext = inlink->dst->priv;
int ret;
if (dtext->draw) if (dtext->draw)
draw_text(inlink->dst, picref, picref->video->w, picref->video->h); draw_text(inlink->dst, picref, picref->video->w, picref->video->h);
dtext->var_values[VAR_N] += 1.0; dtext->var_values[VAR_N] += 1.0;
ff_draw_slice(outlink, 0, picref->video->h, 1); if ((ret = ff_draw_slice(outlink, 0, picref->video->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_drawtext = { AVFilter avfilter_vf_drawtext = {
......
...@@ -137,17 +137,20 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -137,17 +137,20 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir); return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
FadeContext *fade = inlink->dst->priv; FadeContext *fade = inlink->dst->priv;
int ret;
ff_end_frame(inlink->dst->outputs[0]); ret = ff_end_frame(inlink->dst->outputs[0]);
if (fade->frame_index >= fade->start_frame && if (fade->frame_index >= fade->start_frame &&
fade->frame_index <= fade->stop_frame) fade->frame_index <= fade->stop_frame)
fade->factor += fade->fade_per_frame; fade->factor += fade->fade_per_frame;
fade->factor = av_clip_uint16(fade->factor); fade->factor = av_clip_uint16(fade->factor);
fade->frame_index++; fade->frame_index++;
return ret;
} }
AVFilter avfilter_vf_fade = { AVFilter avfilter_vf_fade = {
......
...@@ -163,7 +163,7 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -163,7 +163,7 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
FieldOrderContext *fieldorder = ctx->priv; FieldOrderContext *fieldorder = ctx->priv;
...@@ -227,7 +227,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -227,7 +227,7 @@ static void end_frame(AVFilterLink *inlink)
"not interlaced or field order already correct\n"); "not interlaced or field order already correct\n");
} }
ff_end_frame(outlink); return ff_end_frame(outlink);
} }
AVFilter avfilter_vf_fieldorder = { AVFilter avfilter_vf_fieldorder = {
......
...@@ -166,14 +166,14 @@ static int write_to_fifo(AVFifoBuffer *fifo, AVFilterBufferRef *buf) ...@@ -166,14 +166,14 @@ static int write_to_fifo(AVFifoBuffer *fifo, AVFilterBufferRef *buf)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
FPSContext *s = ctx->priv; FPSContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *buf = inlink->cur_buf; AVFilterBufferRef *buf = inlink->cur_buf;
int64_t delta; int64_t delta;
int i; int i, ret;
inlink->cur_buf = NULL; inlink->cur_buf = NULL;
s->frames_in++; s->frames_in++;
...@@ -188,13 +188,12 @@ static void end_frame(AVFilterLink *inlink) ...@@ -188,13 +188,12 @@ static void end_frame(AVFilterLink *inlink)
avfilter_unref_buffer(buf); avfilter_unref_buffer(buf);
s->drop++; s->drop++;
} }
return; return 0;
} }
/* now wait for the next timestamp */ /* now wait for the next timestamp */
if (buf->pts == AV_NOPTS_VALUE) { if (buf->pts == AV_NOPTS_VALUE) {
write_to_fifo(s->fifo, buf); return write_to_fifo(s->fifo, buf);
return;
} }
/* number of output frames */ /* number of output frames */
...@@ -211,10 +210,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -211,10 +210,10 @@ static void end_frame(AVFilterLink *inlink)
av_fifo_generic_read(s->fifo, &tmp, sizeof(tmp), NULL); av_fifo_generic_read(s->fifo, &tmp, sizeof(tmp), NULL);
flush_fifo(s->fifo); flush_fifo(s->fifo);
write_to_fifo(s->fifo, tmp); ret = write_to_fifo(s->fifo, tmp);
avfilter_unref_buffer(buf); avfilter_unref_buffer(buf);
return; return ret;
} }
/* can output >= 1 frames */ /* can output >= 1 frames */
...@@ -239,8 +238,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -239,8 +238,10 @@ static void end_frame(AVFilterLink *inlink)
} }
flush_fifo(s->fifo); flush_fifo(s->fifo);
write_to_fifo(s->fifo, buf); ret = write_to_fifo(s->fifo, buf);
s->pts = s->first_pts + av_rescale_q(s->frames_out, outlink->time_base, inlink->time_base); s->pts = s->first_pts + av_rescale_q(s->frames_out, outlink->time_base, inlink->time_base);
return ret;
} }
static int null_start_frame(AVFilterLink *link, AVFilterBufferRef *buf) static int null_start_frame(AVFilterLink *link, AVFilterBufferRef *buf)
......
...@@ -345,18 +345,21 @@ static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -345,18 +345,21 @@ static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
Frei0rContext *frei0r = inlink->dst->priv; Frei0rContext *frei0r = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *inpicref = inlink->cur_buf; AVFilterBufferRef *inpicref = inlink->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf; AVFilterBufferRef *outpicref = outlink->out_buf;
int ret;
frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000, frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000,
(const uint32_t *)inpicref->data[0], (const uint32_t *)inpicref->data[0],
(uint32_t *)outpicref->data[0]); (uint32_t *)outpicref->data[0]);
ff_draw_slice(outlink, 0, outlink->h, 1); if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_frei0r = { AVFilter avfilter_vf_frei0r = {
......
...@@ -215,13 +215,13 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) ...@@ -215,13 +215,13 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
GradFunContext *gf = inlink->dst->priv; GradFunContext *gf = inlink->dst->priv;
AVFilterBufferRef *inpic = inlink->cur_buf; AVFilterBufferRef *inpic = inlink->cur_buf;
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *outpic = outlink->out_buf; AVFilterBufferRef *outpic = outlink->out_buf;
int p; int p, ret;
for (p = 0; p < 4 && inpic->data[p]; p++) { for (p = 0; p < 4 && inpic->data[p]; p++) {
int w = inlink->w; int w = inlink->w;
...@@ -239,8 +239,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -239,8 +239,10 @@ static void end_frame(AVFilterLink *inlink)
av_image_copy_plane(outpic->data[p], outpic->linesize[p], inpic->data[p], inpic->linesize[p], w, h); av_image_copy_plane(outpic->data[p], outpic->linesize[p], inpic->data[p], inpic->linesize[p], w, h);
} }
ff_draw_slice(outlink, 0, inlink->h, 1); if ((ret = ff_draw_slice(outlink, 0, inlink->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_gradfun = { AVFilter avfilter_vf_gradfun = {
......
...@@ -295,7 +295,7 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) ...@@ -295,7 +295,7 @@ static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
HQDN3DContext *hqdn3d = inlink->dst->priv; HQDN3DContext *hqdn3d = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
...@@ -303,6 +303,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -303,6 +303,7 @@ static void end_frame(AVFilterLink *inlink)
AVFilterBufferRef *outpic = outlink->out_buf; AVFilterBufferRef *outpic = outlink->out_buf;
int cw = inpic->video->w >> hqdn3d->hsub; int cw = inpic->video->w >> hqdn3d->hsub;
int ch = inpic->video->h >> hqdn3d->vsub; int ch = inpic->video->h >> hqdn3d->vsub;
int ret;
deNoise(inpic->data[0], outpic->data[0], deNoise(inpic->data[0], outpic->data[0],
hqdn3d->Line, &hqdn3d->Frame[0], inpic->video->w, inpic->video->h, hqdn3d->Line, &hqdn3d->Frame[0], inpic->video->w, inpic->video->h,
...@@ -323,8 +324,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -323,8 +324,10 @@ static void end_frame(AVFilterLink *inlink)
hqdn3d->Coefs[2], hqdn3d->Coefs[2],
hqdn3d->Coefs[3]); hqdn3d->Coefs[3]);
ff_draw_slice(outlink, 0, inpic->video->h, 1); if ((ret = ff_draw_slice(outlink, 0, inpic->video->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_hqdn3d = { AVFilter avfilter_vf_hqdn3d = {
......
...@@ -354,7 +354,7 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -354,7 +354,7 @@ static av_cold void uninit(AVFilterContext *ctx)
memset(ocv, 0, sizeof(*ocv)); memset(ocv, 0, sizeof(*ocv));
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
OCVContext *ocv = ctx->priv; OCVContext *ocv = ctx->priv;
...@@ -362,14 +362,17 @@ static void end_frame(AVFilterLink *inlink) ...@@ -362,14 +362,17 @@ static void end_frame(AVFilterLink *inlink)
AVFilterBufferRef *inpicref = inlink ->cur_buf; AVFilterBufferRef *inpicref = inlink ->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf; AVFilterBufferRef *outpicref = outlink->out_buf;
IplImage inimg, outimg; IplImage inimg, outimg;
int ret;
fill_iplimage_from_picref(&inimg , inpicref , inlink->format); fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
fill_iplimage_from_picref(&outimg, outpicref, inlink->format); fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
ocv->end_frame_filter(ctx, &inimg, &outimg); ocv->end_frame_filter(ctx, &inimg, &outimg);
fill_picref_from_iplimage(outpicref, &outimg, inlink->format); fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
ff_draw_slice(outlink, 0, outlink->h, 1); if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_ocv = { AVFilter avfilter_vf_ocv = {
......
...@@ -337,9 +337,9 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -337,9 +337,9 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return ff_draw_slice(outlink, y, h, slice_dir); return ff_draw_slice(outlink, y, h, slice_dir);
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
ff_end_frame(inlink->dst->outputs[0]); return ff_end_frame(inlink->dst->outputs[0]);
} }
static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
...@@ -347,7 +347,10 @@ static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -347,7 +347,10 @@ static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return 0; return 0;
} }
static void null_end_frame(AVFilterLink *inlink) { } static int null_end_frame(AVFilterLink *inlink)
{
return 0;
}
static int poll_frame(AVFilterLink *link) static int poll_frame(AVFilterLink *link)
{ {
......
...@@ -362,9 +362,9 @@ fail: ...@@ -362,9 +362,9 @@ fail:
return ret; return ret;
} }
static void end_frame(AVFilterLink *link) static int end_frame(AVFilterLink *link)
{ {
ff_end_frame(link->dst->outputs[0]); return ff_end_frame(link->dst->outputs[0]);
} }
static int draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice) static int draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
......
...@@ -258,15 +258,16 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -258,15 +258,16 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
SelectContext *select = inlink->dst->priv; SelectContext *select = inlink->dst->priv;
if (select->select) { if (select->select) {
if (select->cache_frames) if (select->cache_frames)
return; return 0;
ff_end_frame(inlink->dst->outputs[0]); return ff_end_frame(inlink->dst->outputs[0]);
} }
return 0;
} }
static int request_frame(AVFilterLink *outlink) static int request_frame(AVFilterLink *outlink)
......
...@@ -40,7 +40,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -40,7 +40,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return 0; return 0;
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
ShowInfoContext *showinfo = ctx->priv; ShowInfoContext *showinfo = ctx->priv;
...@@ -76,7 +76,7 @@ static void end_frame(AVFilterLink *inlink) ...@@ -76,7 +76,7 @@ static void end_frame(AVFilterLink *inlink)
checksum, plane_checksum[0], plane_checksum[1], plane_checksum[2], plane_checksum[3]); checksum, plane_checksum[0], plane_checksum[1], plane_checksum[2], plane_checksum[3]);
showinfo->frame++; showinfo->frame++;
ff_end_frame(inlink->dst->outputs[0]); return ff_end_frame(inlink->dst->outputs[0]);
} }
AVFilter avfilter_vf_showinfo = { AVFilter avfilter_vf_showinfo = {
......
...@@ -138,13 +138,13 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) ...@@ -138,13 +138,13 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
} }
static void end_frame(AVFilterLink *inlink) static int end_frame(AVFilterLink *inlink)
{ {
TransContext *trans = inlink->dst->priv; TransContext *trans = inlink->dst->priv;
AVFilterBufferRef *inpic = inlink->cur_buf; AVFilterBufferRef *inpic = inlink->cur_buf;
AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf; AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf;
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
int plane; int plane, ret;
for (plane = 0; outpic->data[plane]; plane++) { for (plane = 0; outpic->data[plane]; plane++) {
int hsub = plane == 1 || plane == 2 ? trans->hsub : 0; int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
...@@ -195,8 +195,10 @@ static void end_frame(AVFilterLink *inlink) ...@@ -195,8 +195,10 @@ static void end_frame(AVFilterLink *inlink)
} }
} }
ff_draw_slice(outlink, 0, outpic->video->h, 1); if ((ret = ff_draw_slice(outlink, 0, outpic->video->h, 1)) < 0 ||
ff_end_frame(outlink); (ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
} }
AVFilter avfilter_vf_transpose = { AVFilter avfilter_vf_transpose = {
......
...@@ -213,20 +213,23 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -213,20 +213,23 @@ static av_cold void uninit(AVFilterContext *ctx)
free_filter_param(&unsharp->chroma); free_filter_param(&unsharp->chroma);
} }
static void end_frame(AVFilterLink *link) static int end_frame(AVFilterLink *link)
{ {