static void media_eos_cb (ClutterMedia *media, MexPlayer *player) { MexPlayerPrivate *priv = player->priv; priv->position = 0.0; if (priv->idle_mode) { /* loop the video in idle mode */ clutter_media_set_progress (media, priv->position); clutter_media_set_playing (media, TRUE); } else { /* set the control visible */ mex_player_set_controls_visible (player, TRUE); clutter_media_set_progress (media, priv->position); clutter_media_set_playing (media, FALSE); /* focus the related content */ mex_media_controls_focus_content (MEX_MEDIA_CONTROLS (priv->controls), priv->content); /* we're not playing the content or playing the idle video so allow * screensaver if previously inhibited */ mex_screensaver_uninhibit (priv->screensaver); priv->current_position = 0.0; priv->at_eos = TRUE; } }
static void media_eos_cb (ClutterMedia *media, MexPlayer *player) { MexPlayerPrivate *priv = player->priv; priv->position = 0.0; if (priv->idle_mode) { /* loop the video in idle mode */ clutter_media_set_progress (media, priv->position); clutter_media_set_playing (media, TRUE); } else { /* Check to see if we have enqueued content and if so play it next */ MexContent *enqueued_content; enqueued_content = mex_media_controls_get_enqueued (MEX_MEDIA_CONTROLS (priv->controls), priv->content); /* set the control visible */ clutter_actor_animate (priv->info_panel, CLUTTER_EASE_IN_SINE, 250, "opacity", 0x00, NULL); mex_player_set_controls_visible (player, TRUE); if (enqueued_content) { priv->playing_from_queue = TRUE; mex_player_set_content (MEX_CONTENT_VIEW (player), enqueued_content); } else { priv->playing_from_queue = TRUE; mex_screensaver_uninhibit (priv->screensaver); clutter_media_set_progress (media, priv->position); clutter_media_set_playing (media, FALSE); priv->current_position = 0.0; priv->at_eos = TRUE; } /* focus the related content */ mex_media_controls_focus_content (MEX_MEDIA_CONTROLS (priv->controls), priv->content); } }
void mex_media_controls_set_content (MexMediaControls *self, MexContent *content, MexModel *context) { MexMediaControlsPrivate *priv = self->priv; gboolean show_description; g_return_if_fail (MEX_IS_CONTENT (content)); if (priv->model == context) { if (priv->content == content) return; if (priv->content) g_object_unref (priv->content); if (content) priv->content = g_object_ref_sink (content); mex_media_controls_focus_content (self, priv->content); mex_media_controls_update_header (self); return; } if (priv->model) { g_object_unref (priv->model); priv->model = NULL; } if (context) priv->model = g_object_ref_sink (context); if (priv->content) { g_object_unref (priv->content); priv->content = NULL; } if (content) priv->content = g_object_ref_sink (content); priv->is_queue_model = FALSE; mex_media_controls_update_header (self); /* We may not have a context if we're launched by something like SetUri*/ if (context) { MexModel *orig_model; orig_model = mex_model_get_model (context); g_object_set (G_OBJECT (priv->proxy_model), "model", orig_model, NULL); mex_view_model_set_start_content (priv->proxy_model, priv->content); mex_view_model_set_loop (priv->proxy_model, TRUE); /* Work out if the context was a queue FIXME unreliable */ /* From coloumn context = MexViewModel MexAggregateModel MexQueueModel */ /* From grid context = MexProxyModel MexProxyModel MexQueueModel */ if (MEX_IS_PROXY_MODEL (context)) { MexModel *model_from_proxy; model_from_proxy = mex_proxy_model_get_model (MEX_PROXY_MODEL (orig_model)); if (MEX_IS_QUEUE_MODEL (model_from_proxy)) priv->is_queue_model = TRUE; } else if (MEX_IS_AGGREGATE_MODEL (orig_model)) { MexModel *real_model; real_model = mex_aggregate_model_get_model_for_content (MEX_AGGREGATE_MODEL (orig_model), content); if (MEX_IS_QUEUE_MODEL (real_model)) priv->is_queue_model = TRUE; } } /* Update content on the queue button */ mex_content_view_set_content (MEX_CONTENT_VIEW (priv->queue_button), priv->content); /* show the description rather than the seek bar for certain content */ show_description = !g_strcmp0 ("x-mex/tv", mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_MIMETYPE)); mex_media_controls_show_description(self, show_description); }