| 171 | }; |
| 172 | |
| 173 | static int activate(AVFilterContext *ctx) |
| 174 | { |
| 175 | AVFilterLink *outlink = ctx->outputs[0]; |
| 176 | TestSourceContext *test = ctx->priv; |
| 177 | AVFrame *frame; |
| 178 | |
| 179 | if (!ff_outlink_frame_wanted(outlink)) |
| 180 | return FFERROR_NOT_READY; |
| 181 | if (test->duration >= 0 && |
| 182 | av_rescale_q(test->pts, test->time_base, AV_TIME_BASE_Q) >= test->duration) { |
| 183 | ff_outlink_set_status(outlink, AVERROR_EOF, test->pts); |
| 184 | return 0; |
| 185 | } |
| 186 | |
| 187 | if (test->draw_once) { |
| 188 | if (test->draw_once_reset) { |
| 189 | av_frame_free(&test->picref); |
| 190 | test->draw_once_reset = 0; |
| 191 | } |
| 192 | if (!test->picref) { |
| 193 | test->picref = |
| 194 | ff_get_video_buffer(outlink, test->w, test->h); |
| 195 | if (!test->picref) |
| 196 | return AVERROR(ENOMEM); |
| 197 | test->fill_picture_fn(outlink->src, test->picref); |
| 198 | } |
| 199 | frame = av_frame_clone(test->picref); |
| 200 | } else |
| 201 | frame = ff_get_video_buffer(outlink, test->w, test->h); |
| 202 | |
| 203 | if (!frame) |
| 204 | return AVERROR(ENOMEM); |
| 205 | frame->pts = test->pts; |
| 206 | frame->duration = 1; |
| 207 | frame->flags |= AV_FRAME_FLAG_KEY; |
| 208 | frame->flags &= ~AV_FRAME_FLAG_INTERLACED; |
| 209 | frame->pict_type = AV_PICTURE_TYPE_I; |
| 210 | frame->sample_aspect_ratio = test->sar; |
| 211 | if (!test->draw_once) |
| 212 | test->fill_picture_fn(outlink->src, frame); |
| 213 | |
| 214 | test->pts++; |
| 215 | test->nb_frame++; |
| 216 | |
| 217 | return ff_filter_frame(outlink, frame); |
| 218 | } |
| 219 | |
| 220 | #if CONFIG_COLOR_FILTER |
| 221 |
nothing calls this directly
no test coverage detected