From e665667bff833a7e28156e68902b0ccf4f620609 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 1 Jul 2018 21:58:13 +0200 Subject: [PATCH] mediafile: Check if media files are open when trying to play If no file is open, refuse to play. --- modules/media/gtkffmediafile.c | 3 +++ modules/media/gtkgstmediafile.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/media/gtkffmediafile.c b/modules/media/gtkffmediafile.c index 7f6244224e..04737f7474 100644 --- a/modules/media/gtkffmediafile.c +++ b/modules/media/gtkffmediafile.c @@ -656,6 +656,9 @@ gtk_ff_media_file_play (GtkMediaStream *stream) { GtkFfMediaFile *video = GTK_FF_MEDIA_FILE (stream); + if (video->format_ctx == NULL) + return FALSE; + if (!gtk_media_stream_is_prepared (stream)) return TRUE; diff --git a/modules/media/gtkgstmediafile.c b/modules/media/gtkgstmediafile.c index 93162eae5b..afbf637bd3 100644 --- a/modules/media/gtkgstmediafile.c +++ b/modules/media/gtkgstmediafile.c @@ -245,6 +245,9 @@ gtk_gst_media_file_play (GtkMediaStream *stream) { GtkGstMediaFile *self = GTK_GST_MEDIA_FILE (stream); + if (self->player == NULL) + return FALSE; + gst_player_play (self->player); return TRUE;