static void play_uri (GstPlay * play, const gchar * next_uri) { gchar *loc; gst_element_set_state (play->playbin, GST_STATE_READY); play_reset (play); loc = play_uri_get_display_name (play, next_uri); g_print (_("Now playing %s\n"), loc); g_free (loc); g_object_set (play->playbin, "uri", next_uri, NULL); switch (gst_element_set_state (play->playbin, GST_STATE_PAUSED)) { case GST_STATE_CHANGE_FAILURE: /* ignore, we should get an error message posted on the bus */ break; case GST_STATE_CHANGE_NO_PREROLL: g_print ("Pipeline is live.\n"); play->is_live = TRUE; break; case GST_STATE_CHANGE_ASYNC: g_print ("Prerolling...\r"); break; default: break; } if (play->desired_state != GST_STATE_PAUSED) gst_element_set_state (play->playbin, play->desired_state); }
static void play_free (GstPlay * play) { play_reset (play); gst_object_unref (play->player); g_main_loop_unref (play->loop); g_strfreev (play->uris); g_free (play); }
static void play_uri (GstPlay * play, const gchar * next_uri) { gchar *loc; play_reset (play); loc = play_uri_get_display_name (play, next_uri); g_print ("Now playing %s\n", loc); g_free (loc); g_object_set (play->player, "uri", next_uri, NULL); gst_player_play (play->player); }
static void play_free (GstPlay * play) { play_reset (play); gst_element_set_state (play->playbin, GST_STATE_NULL); gst_object_unref (play->playbin); g_source_remove (play->bus_watch); g_source_remove (play->timeout); g_main_loop_unref (play->loop); g_strfreev (play->uris); g_free (play); }
static void play_free (GstPlay * play) { /* No need to see all those pad caps going to NULL etc., it's just noise */ if (play->deep_notify_id != 0) g_signal_handler_disconnect (play->playbin, play->deep_notify_id); play_reset (play); gst_element_set_state (play->playbin, GST_STATE_NULL); gst_object_unref (play->playbin); g_source_remove (play->bus_watch); g_source_remove (play->timeout); g_main_loop_unref (play->loop); g_strfreev (play->uris); g_free (play); }
/* returns FALSE if we have reached the end of the playlist */ static gboolean play_next (GstPlay * play) { GstStateChangeReturn sret; const gchar *next_uri; gchar *loc; if (++play->cur_idx >= play->num_uris) return FALSE; gst_element_set_state (play->playbin, GST_STATE_READY); play_reset (play); next_uri = play->uris[play->cur_idx]; loc = play_uri_get_display_name (play, next_uri); g_print ("Now playing %s\n", loc); g_free (loc); g_object_set (play->playbin, "uri", next_uri, NULL); sret = gst_element_set_state (play->playbin, GST_STATE_PLAYING); switch (sret) { case GST_STATE_CHANGE_FAILURE: /* ignore, we should get an error message posted on the bus */ break; case GST_STATE_CHANGE_NO_PREROLL: g_print ("Pipeline is live.\n"); play->is_live = TRUE; break; case GST_STATE_CHANGE_ASYNC: g_print ("Prerolling...\r"); break; default: break; } return TRUE; }