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
295 * and should do its processing.295 * and should do its processing.
296 *296 *
297 * Input video pads only.297 * Input video pads only.
298 *
299 * @return >= 0 on success, a negative AVERROR on error.
298 */300 */
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);
300 302
301 /**303 /**
302 * Samples filtering callback. This is where a filter receives audio data304 * 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
100 100
101static void end_frame(AVFilterLink *inlink) { }101static void end_frame(AVFilterLink *inlink) { }
102 102
103static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }103static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
104{
105 return 0;
106}
104 107
105/**108/**
106 * Move data pointers and pts offset samples forward.109 * Move data pointers and pts offset samples forward.
libavfilter/internal.h+3−1
@@ -106,8 +106,10 @@ struct AVFilterPad { · 105 unmodified lines
106 * and should do its processing.106 * and should do its processing.
107 *107 *
108 * Input video pads only.108 * Input video pads only.
109 *
110 * @return >= 0 on success, a negative AVERROR on error.
109 */111 */
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);
111 113
112 /**114 /**
113 * Samples filtering callback. This is where a filter receives audio data115 * 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
77 return ret;77 return ret;
78}78}
79 79
80static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)80static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
81{81{
82 AVFilterContext *ctx = inlink->dst;82 AVFilterContext *ctx = inlink->dst;
83 int i;83 int i, ret = 0;
84 84
85 for (i = 0; i < ctx->nb_outputs; i++)85 for (i = 0; i < ctx->nb_outputs; i++) {
86 ff_draw_slice(ctx->outputs[i], y, h, slice_dir);86 ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir);
87 if (ret < 0)
88 break;
89 }
90 return ret;
87}91}
88 92
89static void end_frame(AVFilterLink *inlink)93static 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
74 return 0;74 return 0;
75}75}
76 76
77static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)77static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
78{78{
79 AVFilterContext *ctx = inlink->dst;79 AVFilterContext *ctx = inlink->dst;
80 BlackFrameContext *blackframe = ctx->priv;80 BlackFrameContext *blackframe = ctx->priv;
@@ -88,7 +88,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 7 unmodified lines
88 p += picref->linesize[0];88 p += picref->linesize[0];
89 }89 }
90 90
91 ff_draw_slice(ctx->outputs[0], y, h, slice_dir);91 return ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
92}92}
93 93
94static void end_frame(AVFilterLink *inlink)94static 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
306 h, radius, power, temp);306 h, radius, power, temp);
307}307}
308 308
309static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)309static int draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
310{310{
311 AVFilterContext *ctx = inlink->dst;311 AVFilterContext *ctx = inlink->dst;
312 BoxBlurContext *boxblur = ctx->priv;312 BoxBlurContext *boxblur = ctx->priv;
@@ -330,7 +330,7 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir) · 17 unmodified lines
330 w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],330 w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
331 boxblur->temp);331 boxblur->temp);
332 332
333 ff_draw_slice(outlink, y0, h0, slice_dir);333 return ff_draw_slice(outlink, y0, h0, slice_dir);
334}334}
335 335
336AVFilter avfilter_vf_boxblur = {336AVFilter avfilter_vf_boxblur = {
libavfilter/vf_crop.c+3−3
@@ -297,13 +297,13 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 296 unmodified lines
297 return ff_start_frame(link->dst->outputs[0], ref2);297 return ff_start_frame(link->dst->outputs[0], ref2);
298}298}
299 299
300static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)300static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
301{301{
302 AVFilterContext *ctx = link->dst;302 AVFilterContext *ctx = link->dst;
303 CropContext *crop = ctx->priv;303 CropContext *crop = ctx->priv;
304 304
305 if (y >= crop->y + crop->h || y + h <= crop->y)305 if (y >= crop->y + crop->h || y + h <= crop->y)
306 return;306 return 0;
307 307
308 if (y < crop->y) {308 if (y < crop->y) {
309 h -= crop->y - y;309 h -= crop->y - y;
@@ -312,7 +312,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 2 unmodified lines
312 if (y + h > crop->y + crop->h)312 if (y + h > crop->y + crop->h)
313 h = crop->y + crop->h - y;313 h = crop->y + crop->h - y;
314 314
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);
316}316}
317 317
318static void end_frame(AVFilterLink *link)318static 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
245 return 0;245 return 0;
246}246}
247 247
248static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }248static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
249{
250 return 0;
251}
249 252
250static void end_frame(AVFilterLink *inlink)253static void end_frame(AVFilterLink *inlink)
251{254{
libavfilter/vf_drawbox.c+2−2
@@ -94,7 +94,7 @@ static int config_input(AVFilterLink *inlink) · 93 unmodified lines
94 return 0;94 return 0;
95}95}
96 96
97static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)97static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
98{98{
99 DrawBoxContext *drawbox = inlink->dst->priv;99 DrawBoxContext *drawbox = inlink->dst->priv;
100 int plane, x, y, xb = drawbox->x, yb = drawbox->y;100 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
120 }120 }
121 }121 }
122 122
123 ff_draw_slice(inlink->dst->outputs[0], y0, h, 1);123 return ff_draw_slice(inlink->dst->outputs[0], y0, h, 1);
124}124}
125 125
126AVFilter avfilter_vf_drawbox = {126AVFilter avfilter_vf_drawbox = {
libavfilter/vf_drawtext.c+4−1
@@ -791,7 +791,10 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, · 790 unmodified lines
791 return 0;791 return 0;
792}792}
793 793
794static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }794static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
795{
796 return 0;
797}
795 798
796static inline int normalize_double(int *n, double d)799static inline int normalize_double(int *n, double d)
797{800{
libavfilter/vf_fade.c+2−2
@@ -97,7 +97,7 @@ static int config_props(AVFilterLink *inlink) · 96 unmodified lines
97 return 0;97 return 0;
98}98}
99 99
100static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)100static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
101{101{
102 FadeContext *fade = inlink->dst->priv;102 FadeContext *fade = inlink->dst->priv;
103 AVFilterBufferRef *outpic = inlink->cur_buf;103 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
134 }134 }
135 }135 }
136 136
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);
138}138}
139 139
140static void end_frame(AVFilterLink *inlink)140static 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
144 return 0;144 return 0;
145}145}
146 146
147static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)147static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
148{148{
149 AVFilterContext *ctx = inlink->dst;149 AVFilterContext *ctx = inlink->dst;
150 FieldOrderContext *fieldorder = ctx->priv;150 FieldOrderContext *fieldorder = ctx->priv;
@@ -158,8 +158,9 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 7 unmodified lines
158 * and that complexity will be added later */158 * and that complexity will be added later */
159 if ( !inpicref->video->interlaced159 if ( !inpicref->video->interlaced
160 || inpicref->video->top_field_first == fieldorder->dst_tff) {160 || 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);
162 }162 }
163 return 0;
163}164}
164 165
165static void end_frame(AVFilterLink *inlink)166static 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
248 return 0;248 return 0;
249}249}
250 250
251static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)251static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
252{252{
253 return 0;
253}254}
254 255
255AVFilter avfilter_vf_fps = {256AVFilter avfilter_vf_fps = {
libavfilter/vf_frei0r.c+4−1
@@ -340,7 +340,10 @@ static int query_formats(AVFilterContext *ctx) · 339 unmodified lines
340 return 0;340 return 0;
341}341}
342 342
343static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }343static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
344{
345 return 0;
346}
344 347
345static void end_frame(AVFilterLink *inlink)348static void end_frame(AVFilterLink *inlink)
346{349{
libavfilter/vf_gradfun.c+4−1
@@ -210,7 +210,10 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 209 unmodified lines
210 return 0;210 return 0;
211}211}
212 212
213static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }213static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
214{
215 return 0;
216}
214 217
215static void end_frame(AVFilterLink *inlink)218static void end_frame(AVFilterLink *inlink)
216{219{
libavfilter/vf_hflip.c+2−2
@@ -81,7 +81,7 @@ static int config_props(AVFilterLink *inlink) · 80 unmodified lines
81 return 0;81 return 0;
82}82}
83 83
84static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)84static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
85{85{
86 FlipContext *flip = inlink->dst->priv;86 FlipContext *flip = inlink->dst->priv;
87 AVFilterBufferRef *inpic = inlink->cur_buf;87 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
142 }142 }
143 }143 }
144 144
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);
146}146}
147 147
148AVFilter avfilter_vf_hflip = {148AVFilter avfilter_vf_hflip = {
libavfilter/vf_hqdn3d.c+4−1
@@ -290,7 +290,10 @@ static int config_input(AVFilterLink *inlink) · 289 unmodified lines
290 return 0;290 return 0;
291}291}
292 292
293static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }293static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
294{
295 return 0;
296}
294 297
295static void end_frame(AVFilterLink *inlink)298static void end_frame(AVFilterLink *inlink)
296{299{
libavfilter/vf_libopencv.c+4−1
@@ -67,7 +67,10 @@ static int query_formats(AVFilterContext *ctx) · 66 unmodified lines
67 return 0;67 return 0;
68}68}
69 69
70static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }70static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
71{
72 return 0;
73}
71 74
72typedef struct {75typedef struct {
73 const char *name;76 const char *name;
libavfilter/vf_lut.c+2−2
@@ -294,7 +294,7 @@ static int config_props(AVFilterLink *inlink) · 293 unmodified lines
294 return 0;294 return 0;
295}295}
296 296
297static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)297static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
298{298{
299 AVFilterContext *ctx = inlink->dst;299 AVFilterContext *ctx = inlink->dst;
300 LutContext *lut = ctx->priv;300 LutContext *lut = ctx->priv;
@@ -339,7 +339,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 38 unmodified lines
339 }339 }
340 }340 }
341 341
342 ff_draw_slice(outlink, y, h, slice_dir);342 return ff_draw_slice(outlink, y, h, slice_dir);
343}343}
344 344
345static const AVFilterPad inputs[] = {345static const AVFilterPad inputs[] = {
libavfilter/vf_overlay.c+6−3
@@ -320,7 +320,7 @@ static void blend_slice(AVFilterContext *ctx, · 319 unmodified lines
320 }320 }
321}321}
322 322
323static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)323static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
324{324{
325 AVFilterContext *ctx = inlink->dst;325 AVFilterContext *ctx = inlink->dst;
326 AVFilterLink *outlink = ctx->outputs[0];326 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
334 over->overpicref->video->w, over->overpicref->video->h,334 over->overpicref->video->w, over->overpicref->video->h,
335 y, outpicref->video->w, h);335 y, outpicref->video->w, h);
336 }336 }
337 ff_draw_slice(outlink, y, h, slice_dir);337 return ff_draw_slice(outlink, y, h, slice_dir);
338}338}
339 339
340static void end_frame(AVFilterLink *inlink)340static void end_frame(AVFilterLink *inlink)
@@ -342,7 +342,10 @@ static void end_frame(AVFilterLink *inlink) · 1 unmodified line
342 ff_end_frame(inlink->dst->outputs[0]);342 ff_end_frame(inlink->dst->outputs[0]);
343}343}
344 344
345static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }345static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
346{
347 return 0;
348}
346 349
347static void null_end_frame(AVFilterLink *inlink) { }350static void null_end_frame(AVFilterLink *inlink) { }
348 351
libavfilter/vf_pad.c+11−7
@@ -367,10 +367,10 @@ static void end_frame(AVFilterLink *link) · 366 unmodified lines
367 ff_end_frame(link->dst->outputs[0]);367 ff_end_frame(link->dst->outputs[0]);
368}368}
369 369
370static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)370static int draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
371{371{
372 PadContext *pad = link->dst->priv;372 PadContext *pad = link->dst->priv;
373 int bar_y, bar_h = 0;373 int bar_y, bar_h = 0, ret = 0;
374 374
375 if (slice_dir * before_slice == 1 && y == pad->y) {375 if (slice_dir * before_slice == 1 && y == pad->y) {
376 /* top bar */376 /* top bar */
@@ -387,15 +387,17 @@ static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, · 10 unmodified lines
387 link->dst->outputs[0]->out_buf->linesize,387 link->dst->outputs[0]->out_buf->linesize,
388 pad->line, pad->line_step, pad->hsub, pad->vsub,388 pad->line, pad->line_step, pad->hsub, pad->vsub,
389 0, bar_y, pad->w, bar_h);389 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);
391 }391 }
392 return ret;
392}393}
393 394
394static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)395static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
395{396{
396 PadContext *pad = link->dst->priv;397 PadContext *pad = link->dst->priv;
397 AVFilterBufferRef *outpic = link->dst->outputs[0]->out_buf;398 AVFilterBufferRef *outpic = link->dst->outputs[0]->out_buf;
398 AVFilterBufferRef *inpic = link->cur_buf;399 AVFilterBufferRef *inpic = link->cur_buf;
400 int ret;
399 401
400 y += pad->y;402 y += pad->y;
401 403
@@ -403,7 +405,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 1 unmodified line
403 h &= ~((1 << pad->vsub) - 1);405 h &= ~((1 << pad->vsub) - 1);
404 406
405 if (!h)407 if (!h)
406 return;408 return 0;
407 draw_send_bar_slice(link, y, h, slice_dir, 1);409 draw_send_bar_slice(link, y, h, slice_dir, 1);
408 410
409 /* left border */411 /* left border */
@@ -421,9 +423,11 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 11 unmodified lines
421 ff_draw_rectangle(outpic->data, outpic->linesize,423 ff_draw_rectangle(outpic->data, outpic->linesize,
422 pad->line, pad->line_step, pad->hsub, pad->vsub,424 pad->line, pad->line_step, pad->hsub, pad->vsub,
423 pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h);425 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;
425 429
426 draw_send_bar_slice(link, y, h, slice_dir, -1);430 return draw_send_bar_slice(link, y, h, slice_dir, -1);
427}431}
428 432
429AVFilter avfilter_vf_pad = {433AVFilter avfilter_vf_pad = {
libavfilter/vf_pixdesctest.c+2−2
@@ -90,7 +90,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 89 unmodified lines
90 return 0;90 return 0;
91}91}
92 92
93static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)93static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
94{94{
95 PixdescTestContext *priv = inlink->dst->priv;95 PixdescTestContext *priv = inlink->dst->priv;
96 AVFilterBufferRef *inpic = inlink->cur_buf;96 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
117 }117 }
118 }118 }
119 119
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);
121}121}
122 122
123AVFilter avfilter_vf_pixdesctest = {123AVFilter avfilter_vf_pixdesctest = {
libavfilter/vf_scale.c+5−5
@@ -291,16 +291,15 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 290 unmodified lines
291 return 0;291 return 0;
292}292}
293 293
294static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)294static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
295{295{
296 ScaleContext *scale = link->dst->priv;296 ScaleContext *scale = link->dst->priv;
297 int out_h;297 int out_h, ret;
298 AVFilterBufferRef *cur_pic = link->cur_buf;298 AVFilterBufferRef *cur_pic = link->cur_buf;
299 const uint8_t *data[4];299 const uint8_t *data[4];
300 300
301 if (!scale->sws) {301 if (!scale->sws) {
302 ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);302 return ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
303 return;
304 }303 }
305 304
306 if (scale->slice_y == 0 && slice_dir == -1)305 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
319 318
320 if (slice_dir == -1)319 if (slice_dir == -1)
321 scale->slice_y -= out_h;320 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);
323 if (slice_dir == 1)322 if (slice_dir == 1)
324 scale->slice_y += out_h;323 scale->slice_y += out_h;
324 return ret;
325}325}
326 326
327AVFilter avfilter_vf_scale = {327AVFilter avfilter_vf_scale = {
libavfilter/vf_select.c+3−2
@@ -249,12 +249,13 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 248 unmodified lines
249 return 0;249 return 0;
250}250}
251 251
252static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)252static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
253{253{
254 SelectContext *select = inlink->dst->priv;254 SelectContext *select = inlink->dst->priv;
255 255
256 if (select->select && !select->cache_frames)256 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;
258}259}
259 260
260static void end_frame(AVFilterLink *inlink)261static 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
78 return ff_start_frame(link->dst->outputs[0], picref);78 return ff_start_frame(link->dst->outputs[0], picref);
79}79}
80 80
81static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)81static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
82{82{
83 SliceContext *slice = link->dst->priv;83 SliceContext *slice = link->dst->priv;
84 int y2;84 int y2, ret = 0;
85 85
86 if (slice_dir == 1) {86 if (slice_dir == 1) {
87 for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h)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);88 ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);
89 if (ret < 0)
90 return ret;
91 }
89 92
90 if (y2 < y + h)93 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);
92 } else if (slice_dir == -1) {95 } else if (slice_dir == -1) {
93 for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h)96 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);97 ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);
98 if (ret < 0)
99 return ret;
100 }
95 101
96 if (y2 > y)102 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);
98 }104 }
105 return 0;
99}106}
100 107
101AVFilter avfilter_vf_slicify = {108AVFilter avfilter_vf_slicify = {
libavfilter/vf_unsharp.c+2−1
@@ -229,8 +229,9 @@ static void end_frame(AVFilterLink *link) · 228 unmodified lines
229 ff_end_frame(link->dst->outputs[0]);229 ff_end_frame(link->dst->outputs[0]);
230}230}
231 231
232static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)232static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
233{233{
234 return 0;
234}235}
235 236
236AVFilter avfilter_vf_unsharp = {237AVFilter avfilter_vf_unsharp = {
libavfilter/vf_vflip.c+2−2
@@ -82,11 +82,11 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref) · 81 unmodified lines
82 return ff_start_frame(link->dst->outputs[0], outpicref);82 return ff_start_frame(link->dst->outputs[0], outpicref);
83}83}
84 84
85static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)85static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
86{86{
87 AVFilterContext *ctx = link->dst;87 AVFilterContext *ctx = link->dst;
88 88
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);
90}90}
91 91
92AVFilter avfilter_vf_vflip = {92AVFilter 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
377 return 0;377 return 0;
378}378}
379 379
380static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }380static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
381{
382 return 0;
383}
381 384
382static int config_props(AVFilterLink *link)385static int config_props(AVFilterLink *link)
383{386{
libavfilter/video.c+12−8
@@ -263,12 +263,12 @@ void ff_end_frame(AVFilterLink *link) · 262 unmodified lines
263 clear_link(link);263 clear_link(link);
264}264}
265 265
266void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)266int ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
267{267{
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);
269}269}
270 270
271static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)271static int default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
272{272{
273 AVFilterLink *outlink = NULL;273 AVFilterLink *outlink = NULL;
274 274
@@ -276,14 +276,15 @@ static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir · 1 unmodified line
276 outlink = inlink->dst->outputs[0];276 outlink = inlink->dst->outputs[0];
277 277
278 if (outlink)278 if (outlink)
279 ff_draw_slice(outlink, y, h, slice_dir);279 return ff_draw_slice(outlink, y, h, slice_dir);
280 return 0;
280}281}
281 282
282void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)283int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
283{284{
284 uint8_t *src[4], *dst[4];285 uint8_t *src[4], *dst[4];
285 int i, j, vsub;286 int i, j, vsub, ret;
286 void (*draw_slice)(AVFilterLink *, int, int, int);287 int (*draw_slice)(AVFilterLink *, int, int, int);
287 288
288 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);289 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);
289 290
@@ -317,5 +318,8 @@ void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 27 unmodified lines
317 318
318 if (!(draw_slice = link->dstpad->draw_slice))319 if (!(draw_slice = link->dstpad->draw_slice))
319 draw_slice = default_draw_slice;320 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;
321}325}
libavfilter/video.h+4−2
@@ -40,7 +40,7 @@ AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, · 39 unmodified lines
40 int w, int h);40 int w, int h);
41 41
42int ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);42int ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
43void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);43int ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
44void ff_null_end_frame(AVFilterLink *link);44void ff_null_end_frame(AVFilterLink *link);
45 45
46/**46/**
@@ -78,7 +78,9 @@ void ff_end_frame(AVFilterLink *link); · 31 unmodified lines
78 * from the top slice to the bottom slice if the value is 1,78 * from the top slice to the bottom slice if the value is 1,
79 * from the bottom slice to the top slice if the value is -1,79 * from the bottom slice to the top slice if the value is -1,
80 * for other values the behavior of the function is undefined.80 * for other values the behavior of the function is undefined.
81 *
82 * @return >= 0 on success, a negative AVERROR on error.
81 */83 */
82void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);84int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
83 85
84#endif /* AVFILTER_VIDEO_H */86#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