1
1
/*
2
2
* consumer_sdl.c -- A Simple DirectMedia Layer consumer
3
- * Copyright (C) 2017-2024 Meltytech, LLC
3
+ * Copyright (C) 2017-2025 Meltytech, LLC
4
4
*
5
5
* This library is free software; you can redistribute it and/or
6
6
* modify it under the terms of the GNU Lesser General Public
@@ -216,6 +216,10 @@ int consumer_start(mlt_consumer parent)
216
216
}
217
217
218
218
// Initialize SDL video if needed.
219
+ #ifdef __APPLE__
220
+ if (setup_sdl_video (self ))
221
+ return 1 ;
222
+ #else
219
223
if (!SDL_WasInit (SDL_INIT_VIDEO )) {
220
224
pthread_mutex_lock (& mlt_sdl_mutex );
221
225
int ret = SDL_Init (SDL_INIT_VIDEO );
@@ -227,6 +231,7 @@ int consumer_start(mlt_consumer parent)
227
231
return 1 ;
228
232
}
229
233
}
234
+ #endif
230
235
231
236
pthread_create (& self -> thread , NULL , consumer_thread , self );
232
237
}
@@ -481,6 +486,20 @@ static int setup_sdl_video(consumer_sdl self)
481
486
if (video_off || preview_off )
482
487
return error ;
483
488
489
+ #ifdef __APPLE__
490
+ if (!SDL_WasInit (SDL_INIT_VIDEO )) {
491
+ pthread_mutex_lock (& mlt_sdl_mutex );
492
+ int ret = SDL_Init (SDL_INIT_VIDEO );
493
+ pthread_mutex_unlock (& mlt_sdl_mutex );
494
+ if (ret < 0 ) {
495
+ mlt_log_error (MLT_CONSUMER_SERVICE (& self -> parent ),
496
+ "Failed to initialize SDL: %s\n" ,
497
+ SDL_GetError ());
498
+ return -1 ;
499
+ }
500
+ }
501
+ #endif
502
+
484
503
#ifdef MLT_IMAGE_FORMAT
485
504
int image_format = mlt_properties_get_int (self -> properties , "mlt_image_format" );
486
505
0 commit comments