MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / activate

Function activate

libavfilter/vsrc_testsrc.c:173–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171};
172
173static 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

Callers

nothing calls this directly

Calls 7

ff_outlink_frame_wantedFunction · 0.85
av_rescale_qFunction · 0.85
ff_outlink_set_statusFunction · 0.85
av_frame_freeFunction · 0.85
ff_get_video_bufferFunction · 0.85
av_frame_cloneFunction · 0.85
ff_filter_frameFunction · 0.85

Tested by

no test coverage detected