mediafile: Check if media files are open when trying to play

If no file is open, refuse to play.
This commit is contained in:
Benjamin Otte 2018-07-01 21:58:13 +02:00
parent 3ca59b8701
commit e665667bff
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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;