| 1194 | } |
| 1195 | |
| 1196 | static 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 | |
| 1253 | fail: |
nothing calls this directly
no test coverage detected