static void mex_get_stream_cb (MexProgram *program, const gchar *url, const GError *error, gpointer user_data) { MexPlayer *player = user_data; MexPlayerPrivate *priv = player->priv; MexGenericContent *generic_content; #ifdef USE_PLAYER_CLUTTER_GST ClutterGstVideoTexture *video_texture; #endif /* if idle mode has been set before the program stream was found */ if (priv->idle_mode) return; if (G_UNLIKELY (error)) { g_warning ("Could not play content: %s (%s)", error->message, url); return; } #ifdef USE_PLAYER_CLUTTER_GST /* We seek at the precise time when the file is local, but we * seek to key frame when streaming */ video_texture = CLUTTER_GST_VIDEO_TEXTURE (priv->media); if (g_str_has_prefix (url, "file://")) { clutter_gst_video_texture_set_seek_flags (video_texture, CLUTTER_GST_SEEK_FLAG_ACCURATE); } else { clutter_gst_video_texture_set_seek_flags (video_texture, CLUTTER_GST_SEEK_FLAG_NONE); } #endif clutter_media_set_uri (CLUTTER_MEDIA (priv->media), url); generic_content = MEX_GENERIC_CONTENT (priv->content); if (mex_generic_content_get_last_position_start (generic_content)) clutter_media_set_progress (CLUTTER_MEDIA (priv->media), priv->position); clutter_media_set_playing (CLUTTER_MEDIA (priv->media), TRUE); }
static void save_old_content (MexPlayer *player) { MexPlayerPrivate *priv = player->priv; guint position; gchar str[20]; if (priv->duration && mex_generic_content_get_save_last_position (MEX_GENERIC_CONTENT (priv->content))) { priv->position = priv->current_position; position = (guint) (priv->position * priv->duration); snprintf (str, sizeof (str), "%u", position); mex_content_set_metadata (priv->content, MEX_CONTENT_METADATA_LAST_POSITION, str); } mex_content_set_last_used_metadatas (priv->content); mex_content_save_metadata (priv->content); }
static void mex_get_stream_cb (MexProgram *program, const gchar *url, const GError *error, gpointer user_data) { MexPlayer *player = user_data; MexPlayerPrivate *priv = player->priv; MexGenericContent *generic_content; #ifdef USE_PLAYER_CLUTTER_GST ClutterGstVideoTexture *video_texture; #endif /* if idle mode has been set before the program stream was found */ if (priv->idle_mode) return; if (G_UNLIKELY (error)) { g_warning ("Could not play content: %s (%s)", error->message, url); return; } #ifdef USE_PLAYER_CLUTTER_GST /* We seek at the precise time when the file is local, but we * seek to key frame when streaming */ video_texture = CLUTTER_GST_VIDEO_TEXTURE (priv->media); if (g_str_has_prefix (url, "file://")) { clutter_gst_video_texture_set_seek_flags (video_texture, CLUTTER_GST_SEEK_FLAG_ACCURATE); } else { clutter_gst_video_texture_set_seek_flags (video_texture, CLUTTER_GST_SEEK_FLAG_NONE); } /* TODO when we have settings we can configure this feature */ if (g_str_has_prefix (mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_MIMETYPE), "audio/")) { GstElement *gst_element, *visual; gint gst_flags; gst_element = clutter_gst_video_texture_get_pipeline (video_texture); g_object_get (G_OBJECT (gst_element), "flags", &gst_flags, NULL); gst_flags = (GST_PLAY_FLAG_VIS | gst_flags); g_object_set (G_OBJECT (gst_element), "flags", gst_flags, NULL); visual = gst_element_factory_make ("libvisual_infinite", NULL); if (visual) g_object_set (G_OBJECT (gst_element), "vis-plugin", visual, NULL); } #endif clutter_media_set_uri (CLUTTER_MEDIA (priv->media), url); generic_content = MEX_GENERIC_CONTENT (priv->content); if (mex_generic_content_get_last_position_start (generic_content)) clutter_media_set_progress (CLUTTER_MEDIA (priv->media), priv->position); clutter_media_set_playing (CLUTTER_MEDIA (priv->media), TRUE); }