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

Function init

libavfilter/vf_drawbox.c:230–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230static av_cold int init(AVFilterContext *ctx)
231{
232 DrawBoxContext *s = ctx->priv;
233
234 if (s->box_source_string) {
235 s->box_source = box_source_string_parse(s->box_source_string);
236 if ((int)s->box_source < 0) {
237 av_log(ctx, AV_LOG_ERROR, "Error box source: %s\n",s->box_source_string);
238 return AVERROR(EINVAL);
239 }
240 }
241
242 if (!strcmp(s->color_str, "invert"))
243 s->invert_color = 1;
244 else if (av_parse_color(s->rgba_color, s->color_str, -1, ctx) < 0)
245 return AVERROR(EINVAL);
246
247 if (!s->invert_color) {
248 s->yuv_color[Y] = RGB_TO_Y_CCIR(s->rgba_color[0], s->rgba_color[1], s->rgba_color[2]);
249 s->yuv_color[U] = RGB_TO_U_CCIR(s->rgba_color[0], s->rgba_color[1], s->rgba_color[2], 0);
250 s->yuv_color[V] = RGB_TO_V_CCIR(s->rgba_color[0], s->rgba_color[1], s->rgba_color[2], 0);
251 s->yuv_color[A] = s->rgba_color[3];
252 }
253
254 return 0;
255}
256
257static const enum AVPixelFormat pix_fmts[] = {
258 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,

Callers 1

process_commandFunction · 0.70

Calls 3

box_source_string_parseFunction · 0.85
av_logFunction · 0.85
av_parse_colorFunction · 0.85

Tested by

no test coverage detected