History

lavfi: add error handling to draw_slice().

Anton Khirnov committed 14 years ago

Commit e9b992d1 parent ebc8d9730 files · +128 −72Browse files

Unified · Split

30 files
  1. libavfilter/avfilter.h +3 −1
  2. libavfilter/fifo.c +4 −1
  3. libavfilter/internal.h +3 −1
  4. libavfilter/split.c +8 −4
  5. libavfilter/vf_blackframe.c +2 −2
  6. libavfilter/vf_boxblur.c +2 −2
  7. libavfilter/vf_crop.c +3 −3
  8. libavfilter/vf_delogo.c +4 −1
  9. libavfilter/vf_drawbox.c +2 −2
  10. libavfilter/vf_drawtext.c +4 −1
  11. libavfilter/vf_fade.c +2 −2
  12. libavfilter/vf_fieldorder.c +3 −2
  13. libavfilter/vf_fps.c +2 −1
  14. libavfilter/vf_frei0r.c +4 −1
  15. libavfilter/vf_gradfun.c +4 −1
  16. libavfilter/vf_hflip.c +2 −2
  17. libavfilter/vf_hqdn3d.c +4 −1
  18. libavfilter/vf_libopencv.c +4 −1
  19. libavfilter/vf_lut.c +2 −2
  20. libavfilter/vf_overlay.c +6 −3
  21. libavfilter/vf_pad.c +11 −7
  22. libavfilter/vf_pixdesctest.c +2 −2
  23. libavfilter/vf_scale.c +5 −5
  24. libavfilter/vf_select.c +3 −2
  25. libavfilter/vf_slicify.c +15 −8
  26. libavfilter/vf_unsharp.c +2 −1
  27. libavfilter/vf_vflip.c +2 −2
  28. libavfilter/vf_yadif.c +4 −1
  29. libavfilter/video.c +12 −8
  30. libavfilter/video.h +4 −2
libavfilter/avfilter.h+3−1
@@ -295,8 +295,10 @@ struct AVFilterPad { · 294 unmodified lines
295295 * and should do its processing.
296296 *
297297 * Input video pads only.
298+ *
299+ * @return >= 0 on success, a negative AVERROR on error.
298300 */
299− void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
301+ int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
300302
301303 /**
302304 * Samples filtering callback. This is where a filter receives audio data
libavfilter/fifo.c+4−1
@@ -100,7 +100,10 @@ static void queue_pop(FifoContext *s) · 99 unmodified lines
100100
101101 static void end_frame(AVFilterLink *inlink) { }
102102
103−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
103+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
104+{
105+ return 0;
106+}
104107
105108 /**
106109 * Move data pointers and pts offset samples forward.
libavfilter/internal.h+3−1
@@ -106,8 +106,10 @@ struct AVFilterPad { · 105 unmodified lines
106106 * and should do its processing.
107107 *
108108 * Input video pads only.
109+ *
110+ * @return >= 0 on success, a negative AVERROR on error.
109111 */
110− void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
112+ int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
111113
112114 /**
113115 * Samples filtering callback. This is where a filter receives audio data
libavfilter/split.c+8−4
@@ -77,13 +77,17 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 76 unmodified lines
7777 return ret;
7878 }
7979
80−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
80+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
8181 {
8282 AVFilterContext *ctx = inlink->dst;
83− int i;
83+ int i, ret = 0;
8484
85− for (i = 0; i < ctx->nb_outputs; i++)
86− ff_draw_slice(ctx->outputs[i], y, h, slice_dir);
85+ for (i = 0; i < ctx->nb_outputs; i++) {
86+ ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir);
87+ if (ret < 0)
88+ break;
89+ }
90+ return ret;
8791 }
8892
8993 static void end_frame(AVFilterLink *inlink)
libavfilter/vf_blackframe.c+2−2
@@ -74,7 +74,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 73 unmodified lines
7474 return 0;
7575 }
7676
77−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
77+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
7878 {
7979 AVFilterContext *ctx = inlink->dst;
8080 BlackFrameContext *blackframe = ctx->priv;
@@ -88,7 +88,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 7 unmodified lines
8888 p += picref->linesize[0];
8989 }
9090
91− ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
91+ return ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
9292 }
9393
9494 static void end_frame(AVFilterLink *inlink)
libavfilter/vf_boxblur.c+2−2
@@ -306,7 +306,7 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li · 305 unmodified lines
306306 h, radius, power, temp);
307307 }
308308
309−static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
309+static int draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
310310 {
311311 AVFilterContext *ctx = inlink->dst;
312312 BoxBlurContext *boxblur = ctx->priv;
@@ -330,7 +330,7 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir) · 17 unmodified lines
330330 w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
331331 boxblur->temp);
332332
333− ff_draw_slice(outlink, y0, h0, slice_dir);
333+ return ff_draw_slice(outlink, y0, h0, slice_dir);
334334 }
335335
336336 AVFilter avfilter_vf_boxblur = {
libavfilter/vf_crop.c+3−3
@@ -297,13 +297,13 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 296 unmodified lines
297297 return ff_start_frame(link->dst->outputs[0], ref2);
298298 }
299299
300−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
300+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
301301 {
302302 AVFilterContext *ctx = link->dst;
303303 CropContext *crop = ctx->priv;
304304
305305 if (y >= crop->y + crop->h || y + h <= crop->y)
306− return;
306+ return 0;
307307
308308 if (y < crop->y) {
309309 h -= crop->y - y;
@@ -312,7 +312,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 2 unmodified lines
312312 if (y + h > crop->y + crop->h)
313313 h = crop->y + crop->h - y;
314314
315− ff_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir);
315+ return ff_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir);
316316 }
317317
318318 static void end_frame(AVFilterLink *link)
libavfilter/vf_delogo.c+4−1
@@ -245,7 +245,10 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 244 unmodified lines
245245 return 0;
246246 }
247247
248−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
248+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
249+{
250+ return 0;
251+}
249252
250253 static void end_frame(AVFilterLink *inlink)
251254 {
libavfilter/vf_drawbox.c+2−2
@@ -94,7 +94,7 @@ static int config_input(AVFilterLink *inlink) · 93 unmodified lines
9494 return 0;
9595 }
9696
97−static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
97+static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
9898 {
9999 DrawBoxContext *drawbox = inlink->dst->priv;
100100 int plane, x, y, xb = drawbox->x, yb = drawbox->y;
@@ -120,7 +120,7 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir) · 19 unmodified lines
120120 }
121121 }
122122
123− ff_draw_slice(inlink->dst->outputs[0], y0, h, 1);
123+ return ff_draw_slice(inlink->dst->outputs[0], y0, h, 1);
124124 }
125125
126126 AVFilter avfilter_vf_drawbox = {
libavfilter/vf_drawtext.c+4−1
@@ -791,7 +791,10 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, · 790 unmodified lines
791791 return 0;
792792 }
793793
794−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
794+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
795+{
796+ return 0;
797+}
795798
796799 static inline int normalize_double(int *n, double d)
797800 {
libavfilter/vf_fade.c+2−2
@@ -97,7 +97,7 @@ static int config_props(AVFilterLink *inlink) · 96 unmodified lines
9797 return 0;
9898 }
9999
100−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
100+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
101101 {
102102 FadeContext *fade = inlink->dst->priv;
103103 AVFilterBufferRef *outpic = inlink->cur_buf;
@@ -134,7 +134,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 30 unmodified lines
134134 }
135135 }
136136
137− ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
137+ return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
138138 }
139139
140140 static void end_frame(AVFilterLink *inlink)
libavfilter/vf_fieldorder.c+3−2
@@ -144,7 +144,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 143 unmodified lines
144144 return 0;
145145 }
146146
147−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
147+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
148148 {
149149 AVFilterContext *ctx = inlink->dst;
150150 FieldOrderContext *fieldorder = ctx->priv;
@@ -158,8 +158,9 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 7 unmodified lines
158158 * and that complexity will be added later */
159159 if ( !inpicref->video->interlaced
160160 || inpicref->video->top_field_first == fieldorder->dst_tff) {
161− ff_draw_slice(outlink, y, h, slice_dir);
161+ return ff_draw_slice(outlink, y, h, slice_dir);
162162 }
163+ return 0;
163164 }
164165
165166 static void end_frame(AVFilterLink *inlink)
libavfilter/vf_fps.c+2−1
@@ -248,8 +248,9 @@ static int null_start_frame(AVFilterLink *link, AVFilterBufferRef *buf) · 247 unmodified lines
248248 return 0;
249249 }
250250
251−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
251+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
252252 {
253+ return 0;
253254 }
254255
255256 AVFilter avfilter_vf_fps = {
libavfilter/vf_frei0r.c+4−1
@@ -340,7 +340,10 @@ static int query_formats(AVFilterContext *ctx) · 339 unmodified lines
340340 return 0;
341341 }
342342
343−static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
343+static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
344+{
345+ return 0;
346+}
344347
345348 static void end_frame(AVFilterLink *inlink)
346349 {
libavfilter/vf_gradfun.c+4−1
@@ -210,7 +210,10 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 209 unmodified lines
210210 return 0;
211211 }
212212
213−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
213+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
214+{
215+ return 0;
216+}
214217
215218 static void end_frame(AVFilterLink *inlink)
216219 {
libavfilter/vf_hflip.c+2−2
@@ -81,7 +81,7 @@ static int config_props(AVFilterLink *inlink) · 80 unmodified lines
8181 return 0;
8282 }
8383
84−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
84+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
8585 {
8686 FlipContext *flip = inlink->dst->priv;
8787 AVFilterBufferRef *inpic = inlink->cur_buf;
@@ -142,7 +142,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 54 unmodified lines
142142 }
143143 }
144144
145− ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
145+ return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
146146 }
147147
148148 AVFilter avfilter_vf_hflip = {
libavfilter/vf_hqdn3d.c+4−1
@@ -290,7 +290,10 @@ static int config_input(AVFilterLink *inlink) · 289 unmodified lines
290290 return 0;
291291 }
292292
293−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
293+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
294+{
295+ return 0;
296+}
294297
295298 static void end_frame(AVFilterLink *inlink)
296299 {
libavfilter/vf_libopencv.c+4−1
@@ -67,7 +67,10 @@ static int query_formats(AVFilterContext *ctx) · 66 unmodified lines
6767 return 0;
6868 }
6969
70−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
70+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
71+{
72+ return 0;
73+}
7174
7275 typedef struct {
7376 const char *name;
libavfilter/vf_lut.c+2−2
@@ -294,7 +294,7 @@ static int config_props(AVFilterLink *inlink) · 293 unmodified lines
294294 return 0;
295295 }
296296
297−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
297+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
298298 {
299299 AVFilterContext *ctx = inlink->dst;
300300 LutContext *lut = ctx->priv;
@@ -339,7 +339,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 38 unmodified lines
339339 }
340340 }
341341
342− ff_draw_slice(outlink, y, h, slice_dir);
342+ return ff_draw_slice(outlink, y, h, slice_dir);
343343 }
344344
345345 static const AVFilterPad inputs[] = {
libavfilter/vf_overlay.c+6−3
@@ -320,7 +320,7 @@ static void blend_slice(AVFilterContext *ctx, · 319 unmodified lines
320320 }
321321 }
322322
323−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
323+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
324324 {
325325 AVFilterContext *ctx = inlink->dst;
326326 AVFilterLink *outlink = ctx->outputs[0];
@@ -334,7 +334,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 7 unmodified lines
334334 over->overpicref->video->w, over->overpicref->video->h,
335335 y, outpicref->video->w, h);
336336 }
337− ff_draw_slice(outlink, y, h, slice_dir);
337+ return ff_draw_slice(outlink, y, h, slice_dir);
338338 }
339339
340340 static void end_frame(AVFilterLink *inlink)
@@ -342,7 +342,10 @@ static void end_frame(AVFilterLink *inlink) · 1 unmodified line
342342 ff_end_frame(inlink->dst->outputs[0]);
343343 }
344344
345−static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
345+static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
346+{
347+ return 0;
348+}
346349
347350 static void null_end_frame(AVFilterLink *inlink) { }
348351
libavfilter/vf_pad.c+11−7
@@ -367,10 +367,10 @@ static void end_frame(AVFilterLink *link) · 366 unmodified lines
367367 ff_end_frame(link->dst->outputs[0]);
368368 }
369369
370−static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
370+static int draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
371371 {
372372 PadContext *pad = link->dst->priv;
373− int bar_y, bar_h = 0;
373+ int bar_y, bar_h = 0, ret = 0;
374374
375375 if (slice_dir * before_slice == 1 && y == pad->y) {
376376 /* top bar */
@@ -387,15 +387,17 @@ static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, · 10 unmodified lines
387387 link->dst->outputs[0]->out_buf->linesize,
388388 pad->line, pad->line_step, pad->hsub, pad->vsub,
389389 0, bar_y, pad->w, bar_h);
390− ff_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir);
390+ ret = ff_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir);
391391 }
392+ return ret;
392393 }
393394
394−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
395+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
395396 {
396397 PadContext *pad = link->dst->priv;
397398 AVFilterBufferRef *outpic = link->dst->outputs[0]->out_buf;
398399 AVFilterBufferRef *inpic = link->cur_buf;
400+ int ret;
399401
400402 y += pad->y;
401403
@@ -403,7 +405,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 1 unmodified line
403405 h &= ~((1 << pad->vsub) - 1);
404406
405407 if (!h)
406− return;
408+ return 0;
407409 draw_send_bar_slice(link, y, h, slice_dir, 1);
408410
409411 /* left border */
@@ -421,9 +423,11 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 11 unmodified lines
421423 ff_draw_rectangle(outpic->data, outpic->linesize,
422424 pad->line, pad->line_step, pad->hsub, pad->vsub,
423425 pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h);
424− ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
426+ ret = ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
427+ if (ret < 0)
428+ return ret;
425429
426− draw_send_bar_slice(link, y, h, slice_dir, -1);
430+ return draw_send_bar_slice(link, y, h, slice_dir, -1);
427431 }
428432
429433 AVFilter avfilter_vf_pad = {
libavfilter/vf_pixdesctest.c+2−2
@@ -90,7 +90,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 89 unmodified lines
9090 return 0;
9191 }
9292
93−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
93+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
9494 {
9595 PixdescTestContext *priv = inlink->dst->priv;
9696 AVFilterBufferRef *inpic = inlink->cur_buf;
@@ -117,7 +117,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 20 unmodified lines
117117 }
118118 }
119119
120− ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
120+ return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
121121 }
122122
123123 AVFilter avfilter_vf_pixdesctest = {
libavfilter/vf_scale.c+5−5
@@ -291,16 +291,15 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 290 unmodified lines
291291 return 0;
292292 }
293293
294−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
294+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
295295 {
296296 ScaleContext *scale = link->dst->priv;
297− int out_h;
297+ int out_h, ret;
298298 AVFilterBufferRef *cur_pic = link->cur_buf;
299299 const uint8_t *data[4];
300300
301301 if (!scale->sws) {
302− ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
303− return;
302+ return ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
304303 }
305304
306305 if (scale->slice_y == 0 && slice_dir == -1)
@@ -319,9 +318,10 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 12 unmodified lines
319318
320319 if (slice_dir == -1)
321320 scale->slice_y -= out_h;
322− ff_draw_slice(link->dst->outputs[0], scale->slice_y, out_h, slice_dir);
321+ ret = ff_draw_slice(link->dst->outputs[0], scale->slice_y, out_h, slice_dir);
323322 if (slice_dir == 1)
324323 scale->slice_y += out_h;
324+ return ret;
325325 }
326326
327327 AVFilter avfilter_vf_scale = {
libavfilter/vf_select.c+3−2
@@ -249,12 +249,13 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 248 unmodified lines
249249 return 0;
250250 }
251251
252−static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
252+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
253253 {
254254 SelectContext *select = inlink->dst->priv;
255255
256256 if (select->select && !select->cache_frames)
257− ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
257+ return ff_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
258+ return 0;
258259 }
259260
260261 static void end_frame(AVFilterLink *inlink)
libavfilter/vf_slicify.c+15−8
@@ -78,24 +78,31 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 77 unmodified lines
7878 return ff_start_frame(link->dst->outputs[0], picref);
7979 }
8080
81−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
81+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
8282 {
8383 SliceContext *slice = link->dst->priv;
84− int y2;
84+ int y2, ret = 0;
8585
8686 if (slice_dir == 1) {
87− for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h)
88− ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);
87+ for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) {
88+ ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);
89+ if (ret < 0)
90+ return ret;
91+ }
8992
9093 if (y2 < y + h)
91− ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir);
94+ return ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir);
9295 } else if (slice_dir == -1) {
93− for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h)
94− ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);
96+ for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) {
97+ ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);
98+ if (ret < 0)
99+ return ret;
100+ }
95101
96102 if (y2 > y)
97− ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir);
103+ return ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir);
98104 }
105+ return 0;
99106 }
100107
101108 AVFilter avfilter_vf_slicify = {
libavfilter/vf_unsharp.c+2−1
@@ -229,8 +229,9 @@ static void end_frame(AVFilterLink *link) · 228 unmodified lines
229229 ff_end_frame(link->dst->outputs[0]);
230230 }
231231
232−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
232+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
233233 {
234+ return 0;
234235 }
235236
236237 AVFilter avfilter_vf_unsharp = {
libavfilter/vf_vflip.c+2−2
@@ -82,11 +82,11 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref) · 81 unmodified lines
8282 return ff_start_frame(link->dst->outputs[0], outpicref);
8383 }
8484
85−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
85+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
8686 {
8787 AVFilterContext *ctx = link->dst;
8888
89− ff_draw_slice(ctx->outputs[0], link->h - (y+h), h, -1 * slice_dir);
89+ return ff_draw_slice(ctx->outputs[0], link->h - (y+h), h, -1 * slice_dir);
9090 }
9191
9292 AVFilter avfilter_vf_vflip = {
libavfilter/vf_yadif.c+4−1
@@ -377,7 +377,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 376 unmodified lines
377377 return 0;
378378 }
379379
380−static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
380+static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
381+{
382+ return 0;
383+}
381384
382385 static int config_props(AVFilterLink *link)
383386 {
libavfilter/video.c+12−8
@@ -263,12 +263,12 @@ void ff_end_frame(AVFilterLink *link) · 262 unmodified lines
263263 clear_link(link);
264264 }
265265
266−void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
266+int ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
267267 {
268− ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
268+ return ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
269269 }
270270
271−static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
271+static int default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
272272 {
273273 AVFilterLink *outlink = NULL;
274274
@@ -276,14 +276,15 @@ static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir · 1 unmodified line
276276 outlink = inlink->dst->outputs[0];
277277
278278 if (outlink)
279− ff_draw_slice(outlink, y, h, slice_dir);
279+ return ff_draw_slice(outlink, y, h, slice_dir);
280+ return 0;
280281 }
281282
282−void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
283+int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
283284 {
284285 uint8_t *src[4], *dst[4];
285− int i, j, vsub;
286− void (*draw_slice)(AVFilterLink *, int, int, int);
286+ int i, j, vsub, ret;
287+ int (*draw_slice)(AVFilterLink *, int, int, int);
287288
288289 FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
289290
@@ -317,5 +318,8 @@ void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 27 unmodified lines
317318
318319 if (!(draw_slice = link->dstpad->draw_slice))
319320 draw_slice = default_draw_slice;
320− draw_slice(link, y, h, slice_dir);
321+ ret = draw_slice(link, y, h, slice_dir);
322+ if (ret < 0)
323+ clear_link(link);
324+ return ret;
321325 }
libavfilter/video.h+4−2
@@ -40,7 +40,7 @@ AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, · 39 unmodified lines
4040 int w, int h);
4141
4242 int ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
43−void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
43+int ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
4444 void ff_null_end_frame(AVFilterLink *link);
4545
4646 /**
@@ -78,7 +78,9 @@ void ff_end_frame(AVFilterLink *link); · 31 unmodified lines
7878 * from the top slice to the bottom slice if the value is 1,
7979 * from the bottom slice to the top slice if the value is -1,
8080 * for other values the behavior of the function is undefined.
81+ *
82+ * @return >= 0 on success, a negative AVERROR on error.
8183 */
82−void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
84+int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
8385
8486 #endif /* AVFILTER_VIDEO_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t