Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SDL_CreateWindowFrom #1033

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions src/modules/sdl2/consumer_sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ int consumer_start(mlt_consumer parent)
mlt_properties properties = MLT_CONSUMER_PROPERTIES(parent);
int audio_off = mlt_properties_get_int(properties, "audio_off");
char *output_display = mlt_properties_get(properties, "output_display");
char *window_id = mlt_properties_get(properties, "window_id");
char *audio_driver = mlt_properties_get(properties, "audio_driver");
char *video_driver = mlt_properties_get(properties, "video_driver");
char *audio_device = mlt_properties_get(properties, "audio_device");
Expand All @@ -187,9 +186,6 @@ int consumer_start(mlt_consumer parent)
if (output_display != NULL)
setenv("DISPLAY", output_display, 1);

if (window_id != NULL)
setenv("SDL_WINDOWID", window_id, 1);

if (video_driver != NULL)
setenv("SDL_VIDEODRIVER", video_driver, 1);

Expand Down Expand Up @@ -480,6 +476,8 @@ static int setup_sdl_video(consumer_sdl self)
// Skip this if video is disabled.
int video_off = mlt_properties_get_int(self->properties, "video_off");
int preview_off = mlt_properties_get_int(self->properties, "preview_off");
uintptr_t window_id = mlt_properties_get_int(self->properties, "window_id");

if (video_off || preview_off)
return error;

Expand Down Expand Up @@ -516,12 +514,20 @@ static int setup_sdl_video(consumer_sdl self)
}

pthread_mutex_lock(&mlt_sdl_mutex);
self->sdl_window = SDL_CreateWindow("MLT",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
self->window_width,
self->window_height,
sdl_flags);

if (window_id) {
self->sdl_window = SDL_CreateWindowFrom((void *)window_id);
} else {
self->sdl_window = SDL_CreateWindow(
"MLT",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
self->window_width,
self->window_height,
sdl_flags
);
}

self->sdl_renderer = SDL_CreateRenderer(self->sdl_window, -1, SDL_RENDERER_ACCELERATED);
if (self->sdl_renderer) {
// Get texture width and height from the profile.
Expand Down