static void emit_playing_stream_and_tags (RBPlayerGst *player, gboolean track_change) { GList *t; if (track_change) { /* swap stream data */ _destroy_stream_data (player); player->priv->stream_data = player->priv->next_stream_data; player->priv->stream_data_destroy = player->priv->next_stream_data_destroy; player->priv->next_stream_data = NULL; player->priv->next_stream_data_destroy = NULL; } _rb_player_emit_playing_stream (RB_PLAYER (player), player->priv->stream_data); /* process any tag lists we received while starting the stream */ for (t = player->priv->stream_tags; t != NULL; t = t->next) { GstTagList *tags; tags = (GstTagList *)t->data; rb_debug ("processing buffered taglist"); gst_tag_list_foreach (tags, (GstTagForeachFunc) process_tag, player); gst_tag_list_free (tags); } g_list_free (player->priv->stream_tags); player->priv->stream_tags = NULL; }
static gboolean impl_close (RBPlayer *player, const char *uri, GError **error) { RBPlayerGst *mp = RB_PLAYER_GST (player); if ((uri != NULL) && (mp->priv->uri != NULL) && strcmp (mp->priv->uri, uri) == 0) { rb_debug ("URI doesn't match current playing URI; ignoring"); return TRUE; } mp->priv->playing = FALSE; mp->priv->buffering = FALSE; mp->priv->current_track_finishing = FALSE; _destroy_stream_data (mp); if (uri == NULL) { _destroy_next_stream_data (mp); } g_free (mp->priv->uri); g_free (mp->priv->prev_uri); mp->priv->uri = NULL; mp->priv->prev_uri = NULL; if (mp->priv->tick_timeout_id != 0) { g_source_remove (mp->priv->tick_timeout_id); mp->priv->tick_timeout_id = 0; } if (mp->priv->playbin != NULL) { start_state_change (mp, GST_STATE_NULL, PLAYER_SHUTDOWN); } return TRUE; }
static void emit_playing_stream_and_tags (RBPlayerGst *player, gboolean track_change) { if (track_change) { /* swap stream data */ _destroy_stream_data (player); player->priv->stream_data = player->priv->next_stream_data; player->priv->stream_data_destroy = player->priv->next_stream_data_destroy; player->priv->next_stream_data = NULL; player->priv->next_stream_data_destroy = NULL; } if (rb_is_main_thread ()) { if (player->priv->emit_stream_idle_id != 0) { g_source_remove (player->priv->emit_stream_idle_id); } actually_emit_stream_and_tags (player); } else if (player->priv->emit_stream_idle_id == 0) { player->priv->emit_stream_idle_id = g_idle_add ((GSourceFunc) actually_emit_stream_and_tags, player); } }