コード例 #1
0
ファイル: player.c プロジェクト: rzr/gnome-initial-setup
/* XXX: not sure how to keep the frame data on screen during
 * fade out, so just have a solid idle material for now. */
static void
set_idle_material (ClutterGstVideoTexture *video_texture)
{
  CoglColor transparent;
  CoglHandle material;

  cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
  material = cogl_material_new ();
  cogl_material_set_color (material, &transparent);
  clutter_gst_video_texture_set_idle_material (video_texture, material);
  cogl_handle_unref (material);
}
コード例 #2
0
static gboolean
_start_video_preview (MexContentTile *self)
{
  MexContentTilePrivate *priv = self->priv;
  GstElement *pipeline;
  gint gst_flags;

  const gchar *mimetype, *uri;

  /* Check we're still focused */
  if (!mex_actor_has_focus (CLUTTER_ACTOR (self)))
    return FALSE;

  /* Don't play if the main player is still playing..
   * too many videos spoil the broth.
   */
  if (clutter_media_get_playing (mex_player_get_clutter_media (mex_player_get_default ())))
    return FALSE;

  mimetype = mex_content_get_metadata (priv->content,
                                       MEX_CONTENT_METADATA_MIMETYPE);

  if ((mimetype) && strncmp (mimetype, "video/", 6) != 0)
    return FALSE;

  if (!(uri = mex_content_get_metadata (priv->content,
                                        MEX_CONTENT_METADATA_STREAM)))
    return FALSE;

  priv->video_preview = clutter_gst_video_texture_new ();

  pipeline = clutter_gst_video_texture_get_pipeline (CLUTTER_GST_VIDEO_TEXTURE (priv->video_preview));
  g_object_get (G_OBJECT (pipeline), "flags", &gst_flags, NULL);

  gst_flags = 1;//GST_PLAY_FLAG_VIDEO;

  g_object_set (G_OBJECT (pipeline), "flags", gst_flags, NULL);


  clutter_gst_video_texture_set_idle_material (CLUTTER_GST_VIDEO_TEXTURE (priv->video_preview),
                                               NULL);
  g_signal_connect (priv->video_preview, "eos",
                    G_CALLBACK (_stop_video_eos),
                    self);

  clutter_actor_set_opacity (priv->video_preview, 0);

  g_object_ref (priv->image);
  clutter_actor_remove_child (CLUTTER_ACTOR (self), priv->image);
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->video_preview);


  clutter_actor_animate (priv->video_preview, CLUTTER_LINEAR, 500,
                         "opacity", 0xff, NULL);

  clutter_actor_set_size (priv->video_preview,
                          (gfloat)priv->thumb_width,
                          (gfloat)priv->thumb_height);

  clutter_media_set_uri (CLUTTER_MEDIA (priv->video_preview), uri);
  clutter_media_set_playing (CLUTTER_MEDIA (priv->video_preview), TRUE);

  if (priv->stop_video_preview <= 0)
    priv->stop_video_preview =
      g_timeout_add_seconds (180, (GSourceFunc)_stop_video_preview, self);

  return FALSE;
}