mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-06 07:28:48 +00:00
playback/player: gtk-play: handle duplicate uri in playlist
current logic does not play all the files from playlist if the list contains a duplicate uris.
This commit is contained in:
parent
88e7131ae7
commit
653c8c973e
1 changed files with 8 additions and 16 deletions
|
@ -45,6 +45,7 @@ typedef struct
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
GList *uris;
|
GList *uris;
|
||||||
|
GList *current_uri;
|
||||||
|
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *play_pause_button;
|
GtkWidget *play_pause_button;
|
||||||
|
@ -155,16 +156,13 @@ skip_prev_clicked_cb (GtkButton * button, GtkPlay * play)
|
||||||
GList *prev;
|
GList *prev;
|
||||||
gchar *cur_uri;
|
gchar *cur_uri;
|
||||||
|
|
||||||
prev = g_list_find_custom (play->uris,
|
prev = g_list_previous (play->current_uri);
|
||||||
gst_player_get_uri (play->player), (GCompareFunc) strcmp);
|
|
||||||
|
|
||||||
g_return_if_fail (prev != NULL);
|
|
||||||
prev = g_list_previous (prev);
|
|
||||||
g_return_if_fail (prev != NULL);
|
g_return_if_fail (prev != NULL);
|
||||||
|
|
||||||
gtk_widget_set_sensitive (play->next_button, TRUE);
|
gtk_widget_set_sensitive (play->next_button, TRUE);
|
||||||
gtk_widget_set_sensitive (play->media_info, FALSE);
|
gtk_widget_set_sensitive (play->media_info, FALSE);
|
||||||
gst_player_set_uri (play->player, prev->data);
|
gst_player_set_uri (play->player, prev->data);
|
||||||
|
play->current_uri = prev;
|
||||||
gst_player_play (play->player);
|
gst_player_play (play->player);
|
||||||
set_title (play, prev->data);
|
set_title (play, prev->data);
|
||||||
gtk_widget_set_sensitive (play->prev_button, g_list_previous (prev) != NULL);
|
gtk_widget_set_sensitive (play->prev_button, g_list_previous (prev) != NULL);
|
||||||
|
@ -176,16 +174,13 @@ skip_next_clicked_cb (GtkButton * button, GtkPlay * play)
|
||||||
GList *next, *l;
|
GList *next, *l;
|
||||||
gchar *cur_uri;
|
gchar *cur_uri;
|
||||||
|
|
||||||
next = g_list_find_custom (play->uris,
|
next = g_list_next (play->current_uri);
|
||||||
gst_player_get_uri (play->player), (GCompareFunc) strcmp);
|
|
||||||
|
|
||||||
g_return_if_fail (next != NULL);
|
|
||||||
next = g_list_next (next);
|
|
||||||
g_return_if_fail (next != NULL);
|
g_return_if_fail (next != NULL);
|
||||||
|
|
||||||
gtk_widget_set_sensitive (play->prev_button, TRUE);
|
gtk_widget_set_sensitive (play->prev_button, TRUE);
|
||||||
gtk_widget_set_sensitive (play->media_info, FALSE);
|
gtk_widget_set_sensitive (play->media_info, FALSE);
|
||||||
gst_player_set_uri (play->player, next->data);
|
gst_player_set_uri (play->player, next->data);
|
||||||
|
play->current_uri = next;
|
||||||
gst_player_play (play->player);
|
gst_player_play (play->player);
|
||||||
set_title (play, next->data);
|
set_title (play, next->data);
|
||||||
gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
|
gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
|
||||||
|
@ -631,12 +626,7 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
|
||||||
GList *next = NULL;
|
GList *next = NULL;
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
next = g_list_find_custom (play->uris,
|
next = g_list_next (play->current_uri);
|
||||||
gst_player_get_uri (play->player), (GCompareFunc) strcmp);
|
|
||||||
|
|
||||||
g_return_if_fail (next != NULL);
|
|
||||||
|
|
||||||
next = g_list_next (next);
|
|
||||||
if (next) {
|
if (next) {
|
||||||
if (!gtk_widget_is_sensitive (play->prev_button))
|
if (!gtk_widget_is_sensitive (play->prev_button))
|
||||||
gtk_widget_set_sensitive (play->prev_button, TRUE);
|
gtk_widget_set_sensitive (play->prev_button, TRUE);
|
||||||
|
@ -645,6 +635,7 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
|
||||||
gtk_widget_set_sensitive (play->media_info, FALSE);
|
gtk_widget_set_sensitive (play->media_info, FALSE);
|
||||||
|
|
||||||
gst_player_set_uri (play->player, next->data);
|
gst_player_set_uri (play->player, next->data);
|
||||||
|
play->current_uri = next;
|
||||||
gst_player_play (play->player);
|
gst_player_play (play->player);
|
||||||
set_title (play, next->data);
|
set_title (play, next->data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -768,6 +759,7 @@ main (gint argc, gchar ** argv)
|
||||||
/* We have file(s) that need playing. */
|
/* We have file(s) that need playing. */
|
||||||
set_title (&play, g_list_first (play.uris)->data);
|
set_title (&play, g_list_first (play.uris)->data);
|
||||||
gst_player_play (play.player);
|
gst_player_play (play.player);
|
||||||
|
play.current_uri = g_list_first (play.uris);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue