Skip to content

Commit ccefc17

Browse files
authored
melt: skip Qt preflight for XML-only consumers (#1231)
1 parent 08c2b3b commit ccefc17

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/melt/melt.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,13 @@ static mlt_consumer create_consumer(mlt_profile profile, char *id)
284284
return consumer;
285285
}
286286

287+
static int consumer_is_xml(mlt_consumer consumer)
288+
{
289+
mlt_properties properties = consumer ? MLT_CONSUMER_PROPERTIES(consumer) : NULL;
290+
const char *service = properties ? mlt_properties_get(properties, "mlt_service") : NULL;
291+
return service && !strcmp(service, "xml");
292+
}
293+
287294
static int load_consumer(mlt_consumer *consumer, mlt_profile profile, int argc, char **argv)
288295
{
289296
int i;
@@ -955,12 +962,14 @@ int main(int argc, char **argv)
955962
// Look for the consumer option to load profile settings from consumer properties
956963
backup_profile = mlt_profile_clone(profile);
957964

958-
// Try to initialize QApplication on the main thread to prevent crash
959-
mlt_filter_close(mlt_factory_filter(profile, "qtcrop", NULL));
960-
961965
if (load_consumer(&consumer, profile, argc, argv) != EXIT_SUCCESS)
962966
return error;
963967

968+
// The XML consumer serializes the graph and should not instantiate Qt filters here.
969+
// Other paths keep the main-thread Qt preflight for filters used during rendering.
970+
if (!consumer_is_xml(consumer))
971+
mlt_filter_close(mlt_factory_filter(profile, "qtcrop", NULL));
972+
964973
// If the consumer changed the profile, then it is explicit.
965974
if (backup_profile && !profile->is_explicit
966975
&& (profile->width != backup_profile->width || profile->height != backup_profile->height

0 commit comments

Comments
 (0)