lavfi: check all ff_get_video_buffer() calls for errors.

This commit is contained in:
Anton Khirnov 2012-07-15 11:16:53 +02:00
parent 1dc4205018
commit 8f3a3ce730
7 changed files with 23 additions and 0 deletions

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;

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;

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;

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;

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;

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;

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;