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

Function command

libavfilter/vf_drawtext.c:1196–1257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1194}
1195
1196static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
1197{
1198 DrawTextContext *old = ctx->priv;
1199 DrawTextContext *new = NULL;
1200 int ret;
1201
1202 if (!strcmp(cmd, "reinit")) {
1203 new = av_mallocz(sizeof(DrawTextContext));
1204 if (!new)
1205 return AVERROR(ENOMEM);
1206
1207 new->class = &drawtext_class;
1208 ret = av_opt_copy(new, old);
1209 if (ret < 0)
1210 goto fail;
1211
1212 ctx->priv = new;
1213 ret = av_set_options_string(ctx, arg, "=", ":");
1214 if (ret < 0) {
1215 ctx->priv = old;
1216 goto fail;
1217 }
1218
1219 ret = init(ctx);
1220 if (ret < 0) {
1221 uninit(ctx);
1222 ctx->priv = old;
1223 goto fail;
1224 }
1225
1226 new->reinit = 1;
1227
1228 ctx->priv = old;
1229 uninit(ctx);
1230 av_opt_free(old);
1231 av_freep(&old);
1232
1233 ctx->priv = new;
1234 return config_input(ctx->inputs[0]);
1235 } else {
1236 int old_borderw = old->borderw;
1237 if ((ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags)) < 0) {
1238 return ret;
1239 }
1240 if (old->borderw != old_borderw) {
1241 FT_Stroker_Set(old->stroker, old->borderw << 6, FT_STROKER_LINECAP_ROUND,
1242 FT_STROKER_LINEJOIN_ROUND, 0);
1243 // Dispose the old border glyphs
1244 av_tree_enumerate(old->glyphs, NULL, NULL, glyph_enu_border_free);
1245 } else if (strcmp(cmd, "fontsize") == 0) {
1246 av_expr_free(old->fontsize_pexpr);
1247 old->fontsize_pexpr = NULL;
1248 old->blank_advance64 = 0;
1249 }
1250 return config_input(ctx->inputs[0]);
1251 }
1252
1253fail:

Callers

nothing calls this directly

Calls 12

av_opt_copyFunction · 0.85
av_set_options_stringFunction · 0.85
av_opt_freeFunction · 0.85
av_freepFunction · 0.85
av_tree_enumerateFunction · 0.85
av_expr_freeFunction · 0.85
av_logFunction · 0.85
initFunction · 0.70
uninitFunction · 0.70
config_inputFunction · 0.70
av_malloczFunction · 0.50

Tested by

no test coverage detected