diff options
author | Benjamin Otte <otte@redhat.com> | 2018-07-01 21:58:13 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-07-04 06:15:33 +0200 |
commit | e665667bff833a7e28156e68902b0ccf4f620609 (patch) | |
tree | 1adbd2a57f65fae8bcf43761207d22fb78ffa0a9 /modules | |
parent | 3ca59b8701f93b446a695a61be3b76fa4d842e4c (diff) | |
download | gtk+-e665667bff833a7e28156e68902b0ccf4f620609.tar.gz |
mediafile: Check if media files are open when trying to play
If no file is open, refuse to play.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/media/gtkffmediafile.c | 3 | ||||
-rw-r--r-- | modules/media/gtkgstmediafile.c | 3 |
2 files changed, 6 insertions, 0 deletions
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; |