Browse Source

lavfi: check all ff_get_video_buffer() calls for errors.

tags/n1.0
Anton Khirnov 13 years ago
parent
commit
8f3a3ce730
7 changed files with 23 additions and 0 deletions
  1. +3
    -0
      libavfilter/buffersrc.c
  2. +3
    -0
      libavfilter/vf_frei0r.c
  3. +3
    -0
      libavfilter/vf_pad.c
  4. +3
    -0
      libavfilter/vf_vflip.c
  5. +5
    -0
      libavfilter/vf_yadif.c
  6. +3
    -0
      libavfilter/vsrc_color.c
  7. +3
    -0
      libavfilter/vsrc_testsrc.c

+ 3
- 0
libavfilter/buffersrc.c View File

@@ -92,6 +92,9 @@ int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame)
frame->format);
buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
c->w, c->h);
if (!buf)
return AVERROR(ENOMEM);

av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize,
c->pix_fmt, c->w, c->h);
break;


+ 3
- 0
libavfilter/vf_frei0r.c View File

@@ -441,6 +441,9 @@ static int source_request_frame(AVFilterLink *outlink)
AVFilterBufferRef *buf_out;
int ret;

if (!picref)
return AVERROR(ENOMEM);

picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;


+ 3
- 0
libavfilter/vf_pad.c View File

@@ -262,6 +262,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int
h + (pad->h - pad->in_h));
int plane;

if (!picref)
return NULL;

picref->video->w = w;
picref->video->h = h;



+ 3
- 0
libavfilter/vf_vflip.c View File

@@ -52,6 +52,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
return ff_default_get_video_buffer(link, perms, w, h);

picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
if (!picref)
return NULL;

for (i = 0; i < 4; i ++) {
int vsub = i == 1 || i == 2 ? flip->vsub : 0;



+ 5
- 0
libavfilter/vf_yadif.c View File

@@ -173,6 +173,9 @@ static int return_frame(AVFilterContext *ctx, int is_second)
if (is_second) {
yadif->out = ff_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
AV_PERM_REUSE, link->w, link->h);
if (!yadif->out)
return AVERROR(ENOMEM);

avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
yadif->out->video->interlaced = 0;
}
@@ -239,6 +242,8 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)

yadif->out = ff_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE |
AV_PERM_REUSE, link->w, link->h);
if (!yadif->out)
return AVERROR(ENOMEM);

avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
yadif->out->video->interlaced = 0;


+ 3
- 0
libavfilter/vsrc_color.c View File

@@ -145,6 +145,9 @@ static int color_request_frame(AVFilterLink *link)
AVFilterBufferRef *buf_out;
int ret;

if (!picref)
return AVERROR(ENOMEM);

picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = color->pts++;
picref->pos = -1;


+ 3
- 0
libavfilter/vsrc_testsrc.c View File

@@ -135,6 +135,9 @@ static int request_frame(AVFilterLink *outlink)
if (test->max_pts >= 0 && test->pts > test->max_pts)
return AVERROR_EOF;
picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h);
if (!picref)
return AVERROR(ENOMEM);

picref->pts = test->pts++;
picref->pos = -1;
picref->video->key_frame = 1;


Loading…
Cancel
Save