static int color_request_frame(AVFilterLink *link) { ColorContext *color = link->src->priv; AVFrame *frame = ff_get_video_buffer(link, color->w, color->h); if (!frame) return AVERROR(ENOMEM); frame->sample_aspect_ratio = (AVRational) {1, 1}; frame->pts = color->pts++; ff_draw_rectangle(frame->data, frame->linesize, color->line, color->line_step, color->hsub, color->vsub, 0, 0, color->w, color->h); return ff_filter_frame(link, frame); }
static int color_request_frame(AVFilterLink *link) { ColorContext *color = link->src->priv; AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); picref->video->pixel_aspect = (AVRational) {1, 1}; picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); picref->pos = 0; avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); ff_draw_rectangle(picref->data, picref->linesize, color->line, color->line_step, color->hsub, color->vsub, 0, 0, color->w, color->h); avfilter_draw_slice(link, 0, color->h, 1); avfilter_end_frame(link); avfilter_unref_buffer(picref); return 0; }
static int color_request_frame(AVFilterLink *link) { ColorContext *color = link->src->priv; AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); AVFilterBufferRef *buf_out; int ret; if (!picref) return AVERROR(ENOMEM); picref->video->pixel_aspect = (AVRational) {1, 1}; picref->pts = color->pts++; picref->pos = -1; buf_out = avfilter_ref_buffer(picref, ~0); if (!buf_out) { ret = AVERROR(ENOMEM); goto fail; } ret = ff_start_frame(link, buf_out); if (ret < 0) goto fail; ff_draw_rectangle(picref->data, picref->linesize, color->line, color->line_step, color->hsub, color->vsub, 0, 0, color->w, color->h); ret = ff_draw_slice(link, 0, color->h, 1); if (ret < 0) goto fail; ret = ff_end_frame(link); fail: avfilter_unref_buffer(picref); return ret; }