Skip to content

Commit c96f9c9

Browse files
committed
Fix default value for choice parameters
It was showing as the integer index, not one of the string choices.
1 parent 0d88179 commit c96f9c9

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/modules/openfx/mlt_openfx.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2858,11 +2858,29 @@ void *mltofx_fetch_params(OfxPlugin *plugin, mlt_properties params, mlt_properti
28582858
char *p_name = mlt_properties_get_name(dim1, jt);
28592859
if (strcmp(p_name, kOfxParamPropDefault) == 0) {
28602860
if (strcmp(param_type, kOfxParamTypeInteger) == 0
2861-
|| strcmp(param_type, kOfxParamTypeChoice) == 0
28622861
|| strcmp(param_type, kOfxParamTypeBoolean) == 0) {
28632862
int default_value = 0;
28642863
propGetInt((OfxPropertySetHandle) ppp, p_name, 0, &default_value);
28652864
mlt_properties_set_int(p, "default", default_value);
2865+
} else if (strcmp(param_type, kOfxParamTypeChoice) == 0) {
2866+
int default_value = 0;
2867+
int choice_count = 0;
2868+
char *choice_str = NULL;
2869+
2870+
propGetInt((OfxPropertySetHandle) ppp, p_name, 0, &default_value);
2871+
propGetDimension((OfxPropertySetHandle) ppp,
2872+
kOfxParamPropChoiceOption,
2873+
&choice_count);
2874+
2875+
if (default_value >= 0 && default_value < choice_count
2876+
&& propGetString((OfxPropertySetHandle) ppp,
2877+
kOfxParamPropChoiceOption,
2878+
default_value,
2879+
&choice_str)
2880+
== kOfxStatOK
2881+
&& choice_str) {
2882+
mlt_properties_set(p, "default", choice_str);
2883+
}
28662884
} else if (strcmp(param_type, kOfxParamTypeDouble) == 0) {
28672885
double default_value = 0.0;
28682886
propGetDouble((OfxPropertySetHandle) ppp, p_name, 0, &default_value);

0 commit comments

Comments
 (0)