[clutter-gst] ClutterGstVideoActor: Add new actor replacing ClutterGstVideoTexture.
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst] ClutterGstVideoActor: Add new actor replacing ClutterGstVideoTexture.
- Date: Mon, 18 Mar 2013 23:35:19 +0000 (UTC)
commit bc24c2870c3a90cd4f6e136c291ad7c18c086f19
Author: Andre Moreira Magalhaes (andrunko) <andre magalhaes collabora co uk>
Date: Wed Aug 22 11:43:42 2012 -0300
ClutterGstVideoActor: Add new actor replacing ClutterGstVideoTexture.
This patch re-enables examples/video-player and the tests that were requiring ClutterGstVideoTexture
(using ClutterGstVideoActor instead).
clutter-gst/Makefile.am | 2 +
clutter-gst/clutter-gst-video-actor.c | 201 +++++++++++++++++++++++++++++
clutter-gst/clutter-gst-video-actor.h | 113 ++++++++++++++++
clutter-gst/clutter-gst.h | 1 +
examples/Makefile.am | 15 +-
examples/video-player.c | 112 ++++++++++------
tests/Makefile.am | 33 ++---
tests/test-start-stop.c | 14 +-
tests/test-video-texture-new-unref-loop.c | 12 +-
9 files changed, 423 insertions(+), 80 deletions(-)
---
diff --git a/clutter-gst/Makefile.am b/clutter-gst/Makefile.am
index 37ad5c3..ee68356 100644
--- a/clutter-gst/Makefile.am
+++ b/clutter-gst/Makefile.am
@@ -27,6 +27,7 @@ source_h = \
$(srcdir)/clutter-gst-version.h \
$(srcdir)/clutter-gst-actor.h \
$(srcdir)/clutter-gst-video-sink.h \
+ $(srcdir)/clutter-gst-video-actor.h \
$(srcdir)/clutter-gst-player.h \
$(NULL)
@@ -42,6 +43,7 @@ source_c = \
$(srcdir)/clutter-gst-player.c \
$(srcdir)/clutter-gst-actor.c \
$(srcdir)/clutter-gst-video-sink.c \
+ $(srcdir)/clutter-gst-video-actor.c \
$(srcdir)/clutter-gst-util.c \
$(glib_enum_c) \
$(NULL)
diff --git a/clutter-gst/clutter-gst-video-actor.c b/clutter-gst/clutter-gst-video-actor.c
new file mode 100644
index 0000000..baf7609
--- /dev/null
+++ b/clutter-gst/clutter-gst-video-actor.c
@@ -0,0 +1,201 @@
+/*
+ * Clutter-GStreamer.
+ *
+ * GStreamer integration library for Clutter.
+ *
+ * clutter-gst-video-actor.c - ClutterActor using GStreamer to display a
+ * video stream.
+ *
+ * Authored By Matthew Allum <mallum openedhand com>
+ * Damien Lespiau <damien lespiau intel com>
+ * Lionel Landwerlin <lionel g landwerlin linux intel com>
+ * Andre Moreira Magalhaes <andre magalhaes collabora co uk>
+ *
+ * Copyright (C) 2006 OpenedHand
+ * Copyright (C) 2010, 2011 Intel Corporation
+ * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:clutter-gst-video-actor
+ * @short_description: Actor for playback of video files.
+ *
+ * #ClutterGstVideoActor is a #ClutterActor that plays video files.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gst/base/gstbasesink.h>
+#include <gst/video/video.h>
+
+#include "clutter-gst-video-actor.h"
+#include "clutter-gst-debug.h"
+#include "clutter-gst-enum-types.h"
+#include "clutter-gst-marshal.h"
+#include "clutter-gst-player.h"
+#include "clutter-gst-private.h"
+
+/*
+ * FIXME:
+ * - Remove implementation of ClutterMedia which requires updating ClutterGstPlayer.
+ */
+
+struct _ClutterGstVideoActorPrivate
+{
+};
+
+static void clutter_gst_video_actor_media_init (ClutterMediaIface *iface);
+static void clutter_gst_video_actor_player_init (ClutterGstPlayerIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (ClutterGstVideoActor,
+ clutter_gst_video_actor,
+ CLUTTER_GST_TYPE_ACTOR,
+ G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_MEDIA,
+ clutter_gst_video_actor_media_init)
+ G_IMPLEMENT_INTERFACE (CLUTTER_GST_TYPE_PLAYER,
+ clutter_gst_video_actor_player_init));
+
+/*
+ * ClutterMedia implementation
+ */
+
+static void
+clutter_gst_video_actor_media_init (ClutterMediaIface *iface)
+{
+}
+
+/*
+ * ClutterGstPlayer implementation
+ */
+
+static void
+clutter_gst_video_actor_player_init (ClutterGstPlayerIface *iface)
+{
+}
+
+/*
+ * ClutterGstActor implementation
+ */
+
+static gboolean
+clutter_gst_video_actor_is_idle (ClutterGstActor *actor)
+{
+ return clutter_gst_player_get_idle (CLUTTER_GST_PLAYER (actor));
+}
+
+/*
+ * GObject implementation
+ */
+
+static void
+clutter_gst_video_actor_dispose (GObject *object)
+{
+ clutter_gst_player_deinit (CLUTTER_GST_PLAYER (object));
+
+ G_OBJECT_CLASS (clutter_gst_video_actor_parent_class)->dispose (object);
+}
+
+static void
+clutter_gst_video_actor_class_init (ClutterGstVideoActorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ClutterGstActorClass *gst_actor_class = CLUTTER_GST_ACTOR_CLASS (klass);
+
+ //g_type_class_add_private (klass, sizeof (ClutterGstVideoActorPrivate));
+
+ object_class->dispose = clutter_gst_video_actor_dispose;
+
+ gst_actor_class->is_idle = clutter_gst_video_actor_is_idle;
+
+ clutter_gst_player_class_init (object_class);
+}
+
+static gboolean
+setup_pipeline (ClutterGstVideoActor *video_actor)
+{
+ GstElement *pipeline, *video_sink;
+
+ pipeline =
+ clutter_gst_player_get_pipeline (CLUTTER_GST_PLAYER (video_actor));
+ if (!pipeline)
+ {
+ g_critical ("Unable to create pipeline");
+ return FALSE;
+ }
+
+ video_sink = gst_element_factory_make ("cluttersink", NULL);
+ g_object_set (video_sink,
+ "actor", CLUTTER_GST_ACTOR (video_actor),
+ NULL);
+ g_object_set (pipeline,
+ "video-sink", video_sink,
+ "subtitle-font-desc", "Sans 16",
+ NULL);
+
+ return TRUE;
+}
+
+static void
+clutter_gst_video_actor_init (ClutterGstVideoActor *video_actor)
+{
+ //video_actor->priv =
+ // G_TYPE_INSTANCE_GET_PRIVATE (video_actor,
+ // CLUTTER_GST_TYPE_VIDEO_ACTOR,
+ // ClutterGstVideoActorPrivate);
+
+ if (!clutter_gst_player_init (CLUTTER_GST_PLAYER (video_actor)))
+ {
+ g_warning ("Failed to initiate suitable playback pipeline.");
+ return;
+ }
+
+ if (!setup_pipeline (video_actor))
+ {
+ g_warning ("Failed to initiate suitable sinks for pipeline.");
+ return;
+ }
+}
+
+/*
+ * Public symbols
+ */
+
+/**
+ * clutter_gst_video_actor_new:
+ *
+ * Creates a video actor.
+ *
+ * <note>This function has to be called from Clutter's main thread. While
+ * GStreamer will spawn threads to do its work, we want all the GL calls to
+ * happen in the same thread. Clutter-gst knows which thread it is by
+ * assuming this constructor is called from the Clutter thread.</note>
+ *
+ * Return value: the newly created video actor
+ */
+ClutterActor*
+clutter_gst_video_actor_new (void)
+{
+ return g_object_new (CLUTTER_GST_TYPE_VIDEO_ACTOR,
+ NULL);
+}
diff --git a/clutter-gst/clutter-gst-video-actor.h b/clutter-gst/clutter-gst-video-actor.h
new file mode 100644
index 0000000..6f8bd1b
--- /dev/null
+++ b/clutter-gst/clutter-gst-video-actor.h
@@ -0,0 +1,113 @@
+/*
+ * Clutter-GStreamer.
+ *
+ * GStreamer integration library for Clutter.
+ *
+ * clutter-gst-video-actor.h - ClutterActor using GStreamer to display a
+ * video stream.
+ *
+ * Authored By Matthew Allum <mallum openedhand com>
+ * Andre Moreira Magalhaes <andre magalhaes collabora co uk>
+ *
+ * Copyright (C) 2006 OpenedHand
+ * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__CLUTTER_GST_H_INSIDE__) && !defined(CLUTTER_GST_COMPILATION)
+#error "Only <clutter-gst/clutter-gst.h> can be included directly."
+#endif
+
+#ifndef __CLUTTER_GST_VIDEO_ACTOR_H__
+#define __CLUTTER_GST_VIDEO_ACTOR_H__
+
+#include <glib-object.h>
+#include <clutter/clutter.h>
+#include <gst/gstelement.h>
+
+#include <clutter-gst/clutter-gst-actor.h>
+#include <clutter-gst/clutter-gst-types.h>
+
+G_BEGIN_DECLS
+
+#define CLUTTER_GST_TYPE_VIDEO_ACTOR clutter_gst_video_actor_get_type()
+
+#define CLUTTER_GST_VIDEO_ACTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CLUTTER_GST_TYPE_VIDEO_ACTOR, ClutterGstVideoActor))
+
+#define CLUTTER_GST_VIDEO_ACTOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CLUTTER_GST_TYPE_VIDEO_ACTOR, ClutterGstVideoActorClass))
+
+#define CLUTTER_GST_IS_VIDEO_ACTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CLUTTER_GST_TYPE_VIDEO_ACTOR))
+
+#define CLUTTER_GST_IS_VIDEO_ACTOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CLUTTER_GST_TYPE_VIDEO_ACTOR))
+
+#define CLUTTER_GST_VIDEO_ACTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CLUTTER_GST_TYPE_VIDEO_ACTOR, ClutterGstVideoActorClass))
+
+typedef struct _ClutterGstVideoActor ClutterGstVideoActor;
+typedef struct _ClutterGstVideoActorClass ClutterGstVideoActorClass;
+typedef struct _ClutterGstVideoActorPrivate ClutterGstVideoActorPrivate;
+
+/**
+ * ClutterGstVideoActor:
+ *
+ * Subclass of #ClutterGstActor that displays videos using GStreamer.
+ *
+ * The #ClutterGstVideoActor structure contains only private data and
+ * should not be accessed directly.
+ */
+struct _ClutterGstVideoActor
+{
+ /*< private >*/
+ ClutterGstActor parent;
+ ClutterGstVideoActorPrivate *priv;
+};
+
+/**
+ * ClutterGstVideoActorClass:
+ *
+ * Base class for #ClutterGstVideoActor.
+ */
+struct _ClutterGstVideoActorClass
+{
+ /*< private >*/
+ ClutterGstActorClass parent_class;
+
+ /* Future padding */
+ void (* _clutter_reserved1) (void);
+ void (* _clutter_reserved2) (void);
+ void (* _clutter_reserved3) (void);
+ void (* _clutter_reserved4) (void);
+ void (* _clutter_reserved5) (void);
+ void (* _clutter_reserved6) (void);
+};
+
+GType clutter_gst_video_actor_get_type (void) G_GNUC_CONST;
+
+ClutterActor * clutter_gst_video_actor_new (void);
+
+G_END_DECLS
+
+#endif /* __CLUTTER_GST_VIDEO_ACTOR_H__ */
diff --git a/clutter-gst/clutter-gst.h b/clutter-gst/clutter-gst.h
index 128d223..c4233d1 100644
--- a/clutter-gst/clutter-gst.h
+++ b/clutter-gst/clutter-gst.h
@@ -34,6 +34,7 @@
#include "clutter-gst-enum-types.h"
#include "clutter-gst-actor.h"
#include "clutter-gst-video-sink.h"
+#include "clutter-gst-video-actor.h"
#include "clutter-gst-util.h"
#include "clutter-gst-version.h"
#include "clutter-gst-player.h"
diff --git a/examples/Makefile.am b/examples/Makefile.am
index bd555a2..4cd466b 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,18 +1,17 @@
NULL = #
-#noinst_PROGRAMS = video-player video-sink video-sink-navigation
-noinst_PROGRAMS = video-sink video-sink-navigation
+noinst_PROGRAMS = video-player video-sink video-sink-navigation
INCLUDES = -I$(top_srcdir) \
$(MAINTAINER_CFLAGS) \
$(NULL)
-#video_player_SOURCES = video-player.c
-#video_player_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
-#video_player_LDFLAGS = \
-# $(CLUTTER_GST_LIBS) \
-# $(GST_LIBS) \
-# $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
+video_player_SOURCES = video-player.c
+video_player_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
+video_player_LDFLAGS = \
+ $(CLUTTER_GST_LIBS) \
+ $(GST_LIBS) \
+ $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
video_sink_SOURCES = video-sink.c
video_sink_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
diff --git a/examples/video-player.c b/examples/video-player.c
index 3295e6e..af29d2c 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -3,7 +3,7 @@
*
* GStreamer integration library for Clutter.
*
- * video-player.c - A simple video player with an OSD.
+ * video-player.c - A simple video player with an OSD using ClutterGstVideoActor.
*
* Copyright (C) 2007,2008 OpenedHand
* Copyright (C) 2013 Collabora
@@ -29,6 +29,8 @@
#include <clutter/clutter.h>
#include <clutter-gst/clutter-gst.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
#define SEEK_H 14
#define SEEK_W 440
@@ -38,7 +40,7 @@ typedef struct _VideoApp
{
ClutterActor *stage;
- ClutterActor *vtexture;
+ ClutterActor *vactor;
ClutterActor *control;
ClutterActor *control_bg;
@@ -156,12 +158,12 @@ show_controls (VideoApp *app, gboolean vis)
void
toggle_pause_state (VideoApp *app)
{
- if (app->vtexture == NULL)
+ if (app->vactor == NULL)
return;
if (app->paused)
{
- clutter_media_set_playing (CLUTTER_MEDIA(app->vtexture),
+ clutter_media_set_playing (CLUTTER_MEDIA(app->vactor),
TRUE);
app->paused = FALSE;
clutter_actor_hide (app->control_play);
@@ -169,7 +171,7 @@ toggle_pause_state (VideoApp *app)
}
else
{
- clutter_media_set_playing (CLUTTER_MEDIA(app->vtexture),
+ clutter_media_set_playing (CLUTTER_MEDIA(app->vactor),
FALSE);
app->paused = TRUE;
clutter_actor_hide (app->control_pause);
@@ -181,8 +183,8 @@ static void
reset_animation (ClutterTimeline *animation,
VideoApp *app)
{
- if (app->vtexture)
- clutter_actor_set_rotation_angle (app->vtexture, CLUTTER_Y_AXIS, 0.0);
+ if (app->vactor)
+ clutter_actor_set_rotation_angle (app->vactor, CLUTTER_Y_AXIS, 0.0);
}
static gboolean
@@ -230,7 +232,7 @@ input_cb (ClutterStage *stage,
progress = (gdouble) dist / SEEK_W;
- clutter_media_set_progress (CLUTTER_MEDIA (app->vtexture),
+ clutter_media_set_progress (CLUTTER_MEDIA (app->vactor),
progress);
}
}
@@ -244,10 +246,10 @@ input_cb (ClutterStage *stage,
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_d:
- if (app->vtexture)
+ if (app->vactor)
{
- clutter_actor_remove_child (app->stage, app->vtexture);
- app->vtexture = NULL;
+ clutter_actor_remove_child (app->stage, app->vactor);
+ app->vactor = NULL;
}
if (app->control)
{
@@ -261,12 +263,12 @@ input_cb (ClutterStage *stage,
break;
case CLUTTER_e:
- if (app->vtexture == NULL)
+ if (app->vactor == NULL)
break;
- clutter_actor_set_pivot_point (app->vtexture, 0.5, 0);
+ clutter_actor_set_pivot_point (app->vactor, 0.5, 0);
- animation = _actor_animate (app->vtexture, CLUTTER_LINEAR, 500,
+ animation = _actor_animate (app->vactor, CLUTTER_LINEAR, 500,
"rotation-angle-y", 360.0, NULL);
g_signal_connect_after (animation, "completed",
@@ -300,7 +302,7 @@ input_cb (ClutterStage *stage,
}
static void
-size_change (ClutterTexture *texture,
+size_change (ClutterActor *actor,
gint base_width,
gint base_height,
VideoApp *app)
@@ -314,8 +316,8 @@ size_change (ClutterTexture *texture,
/* base_width and base_height are the actual dimensions of the buffers before
* taking the pixel aspect ratio into account. We need to get the actual
- * size of the texture to display */
- clutter_actor_get_size (CLUTTER_ACTOR (texture), &frame_width, &frame_height);
+ * size of the actor to display */
+ clutter_actor_get_size (actor, &frame_width, &frame_height);
new_height = (frame_height * stage_width) / frame_width;
if (new_height <= stage_height)
@@ -334,8 +336,8 @@ size_change (ClutterTexture *texture,
new_y = 0;
}
- clutter_actor_set_position (CLUTTER_ACTOR (texture), new_x, new_y);
- clutter_actor_set_size (CLUTTER_ACTOR (texture), new_width, new_height);
+ clutter_actor_set_position (actor, new_x, new_y);
+ clutter_actor_set_size (actor, new_width, new_height);
}
static void
@@ -368,8 +370,8 @@ tick (GObject *object,
GParamSpec *pspec,
VideoApp *app)
{
- ClutterMedia *video_texture = CLUTTER_MEDIA (object);
- gdouble progress = clutter_media_get_progress (video_texture);
+ ClutterMedia *vactor = CLUTTER_MEDIA (object);
+ gdouble progress = clutter_media_get_progress (vactor);
clutter_actor_set_size (app->control_seekbar,
progress * SEEK_W,
@@ -377,7 +379,7 @@ tick (GObject *object,
}
static void
-on_video_texture_eos (ClutterMedia *media,
+on_video_actor_eos (ClutterMedia *media,
VideoApp *app)
{
if (opt_loop)
@@ -396,6 +398,37 @@ _new_rectangle_with_color (ClutterColor *color)
return actor;
}
+static ClutterActor *
+control_actor_new_from_image (const gchar *image_filename)
+{
+ ClutterActor *actor;
+ ClutterContent *image;
+ GdkPixbuf *pixbuf;
+
+ actor = clutter_actor_new ();
+
+ image = clutter_image_new ();
+ pixbuf = gdk_pixbuf_new_from_file (image_filename, NULL);
+ clutter_image_set_data (CLUTTER_IMAGE (image),
+ gdk_pixbuf_get_pixels (pixbuf),
+ gdk_pixbuf_get_has_alpha (pixbuf)
+ ? COGL_PIXEL_FORMAT_RGBA_8888
+ : COGL_PIXEL_FORMAT_RGB_888,
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf),
+ NULL);
+ clutter_actor_set_size (actor,
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf));
+ g_object_unref (pixbuf);
+
+ clutter_actor_set_content (actor, image);
+ g_object_unref (image);
+
+ return actor;
+}
+
int
main (int argc, char *argv[])
{
@@ -442,23 +475,22 @@ main (int argc, char *argv[])
app = g_new0(VideoApp, 1);
app->stage = stage;
- app->vtexture = clutter_gst_video_texture_new ();
+ app->vactor = clutter_gst_video_actor_new ();
- if (app->vtexture == NULL)
- g_error("failed to create vtexture");
+ if (app->vactor == NULL)
+ g_error("failed to create vactor");
/* By default ClutterGst seeks to the nearest key frame (faster). However
* it has the weird effect that when you click on the progress bar, the fill
* goes to the key frame position that can be quite far from where you
* clicked. Using the ACCURATE flag tells playbin2 to seek to the actual
* frame */
- clutter_gst_video_texture_set_seek_flags (
- CLUTTER_GST_VIDEO_TEXTURE (app->vtexture),
- CLUTTER_GST_SEEK_FLAG_ACCURATE);
+ clutter_gst_player_set_seek_flags (CLUTTER_GST_PLAYER (app->vactor),
+ CLUTTER_GST_SEEK_FLAG_ACCURATE);
- g_signal_connect (app->vtexture,
+ g_signal_connect (app->vactor,
"eos",
- G_CALLBACK (on_video_texture_eos),
+ G_CALLBACK (on_video_actor_eos),
app);
g_signal_connect (stage,
@@ -472,15 +504,15 @@ main (int argc, char *argv[])
NULL);
/* Handle it ourselves so can scale up for fullscreen better */
- g_signal_connect_after (CLUTTER_TEXTURE (app->vtexture),
+ g_signal_connect_after (app->vactor,
"size-change",
G_CALLBACK (size_change), app);
- /* Load up out video texture */
- clutter_media_set_filename (CLUTTER_MEDIA (app->vtexture), argv[1]);
+ /* Load up out video actor */
+ clutter_media_set_filename (CLUTTER_MEDIA (app->vactor), argv[1]);
/* Set up things so that a visualisation is played if there's no video */
- pipe = clutter_gst_video_texture_get_pipeline (CLUTTER_GST_VIDEO_TEXTURE (app->vtexture));
+ pipe = clutter_gst_player_get_pipeline (CLUTTER_GST_PLAYER (app->vactor));
if (!pipe)
g_error ("Unable to get gstreamer pipeline!\n");
@@ -513,11 +545,11 @@ main (int argc, char *argv[])
app->control = clutter_actor_new ();
app->control_bg =
- clutter_texture_new_from_file ("vid-panel.png", NULL);
+ control_actor_new_from_image ("vid-panel.png");
app->control_play =
- clutter_texture_new_from_file ("media-actions-start.png", NULL);
+ control_actor_new_from_image ("media-actions-start.png");
app->control_pause =
- clutter_texture_new_from_file ("media-actions-pause.png", NULL);
+ control_actor_new_from_image ("media-actions-pause.png");
g_assert (app->control_bg && app->control_play && app->control_pause);
@@ -556,7 +588,7 @@ main (int argc, char *argv[])
clutter_actor_set_position (app->control_label, 82, 29);
/* Add control UI to stage */
- clutter_actor_add_child (stage, app->vtexture);
+ clutter_actor_add_child (stage, app->vactor);
clutter_actor_add_child (stage, app->control);
position_controls (app, app->control);
@@ -569,11 +601,11 @@ main (int argc, char *argv[])
/* Hook up other events */
g_signal_connect (stage, "event", G_CALLBACK (input_cb), app);
- g_signal_connect (app->vtexture,
+ g_signal_connect (app->vactor,
"notify::progress", G_CALLBACK (tick),
app);
- clutter_media_set_playing (CLUTTER_MEDIA (app->vtexture), TRUE);
+ clutter_media_set_playing (CLUTTER_MEDIA (app->vactor), TRUE);
clutter_actor_show (stage);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9c4df22..59fc3ba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,16 +1,11 @@
NULL = #
-#noinst_PROGRAMS = \
-# test-alpha \
-# test-rgb-upload \
-# test-start-stop \
-# test-yuv-upload \
-# test-video-texture-new-unref-loop \
-# $(NULL)
noinst_PROGRAMS = \
test-alpha \
test-rgb-upload \
+ test-start-stop \
test-yuv-upload \
+ test-video-texture-new-unref-loop \
$(NULL)
INCLUDES = -I$(top_srcdir) \
@@ -31,12 +26,12 @@ test_rgb_upload_LDFLAGS = \
$(GST_LIBS) \
$(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
-#test_start_stop_SOURCES = test-start-stop.c
-#test_start_stop_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
-#test_start_stop_LDFLAGS = \
-# $(CLUTTER_GST_LIBS) \
-# $(GST_LIBS) \
-# $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
+test_start_stop_SOURCES = test-start-stop.c
+test_start_stop_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
+test_start_stop_LDFLAGS = \
+ $(CLUTTER_GST_LIBS) \
+ $(GST_LIBS) \
+ $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
test_yuv_upload_SOURCES = test-yuv-upload.c
test_yuv_upload_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
@@ -45,9 +40,9 @@ test_yuv_upload_LDFLAGS = \
$(GST_LIBS) \
$(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
-#test_video_texture_new_unref_loop_SOURCES = test-video-texture-new-unref-loop.c
-#test_video_texture_new_unref_loop_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
-#test_video_texture_new_unref_loop_LDFLAGS = \
-# $(CLUTTER_GST_LIBS) \
-# $(GST_LIBS) \
-# $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
+test_video_texture_new_unref_loop_SOURCES = test-video-texture-new-unref-loop.c
+test_video_texture_new_unref_loop_CFLAGS = $(CLUTTER_GST_CFLAGS) $(GST_CFLAGS)
+test_video_texture_new_unref_loop_LDFLAGS = \
+ $(CLUTTER_GST_LIBS) \
+ $(GST_LIBS) \
+ $(top_builddir)/clutter-gst/libclutter-gst- CLUTTER_GST_MAJORMINOR@.la
diff --git a/tests/test-start-stop.c b/tests/test-start-stop.c
index b7b6938..d969c39 100644
--- a/tests/test-start-stop.c
+++ b/tests/test-start-stop.c
@@ -33,7 +33,7 @@
char *video_files[] = {NULL, NULL};
void
-size_change (ClutterTexture *texture,
+size_change (ClutterActor *actor,
gint width,
gint height,
gpointer user_data)
@@ -61,8 +61,8 @@ size_change (ClutterTexture *texture,
new_y = 0;
}
- clutter_actor_set_position (CLUTTER_ACTOR (texture), new_x, new_y);
- clutter_actor_set_size (CLUTTER_ACTOR (texture), new_width, new_height);
+ clutter_actor_set_position (actor, new_x, new_y);
+ clutter_actor_set_size (actor, new_width, new_height);
}
void
@@ -144,14 +144,14 @@ main (int argc, char *argv[])
stage = clutter_stage_new ();
clutter_actor_set_background_color (stage, &stage_color);
- video = clutter_gst_video_texture_new ();
- g_assert (CLUTTER_GST_IS_VIDEO_TEXTURE(video));
+ video = clutter_gst_video_actor_new ();
+ g_assert (CLUTTER_GST_IS_VIDEO_ACTOR(video));
- g_signal_connect (CLUTTER_TEXTURE(video),
+ g_signal_connect (video,
"size-change",
G_CALLBACK(size_change),
stage);
- g_signal_connect (CLUTTER_TEXTURE(video),
+ g_signal_connect (video,
"error",
G_CALLBACK(on_error),
stage);
diff --git a/tests/test-video-texture-new-unref-loop.c b/tests/test-video-texture-new-unref-loop.c
index 10ba16e..5a611f2 100644
--- a/tests/test-video-texture-new-unref-loop.c
+++ b/tests/test-video-texture-new-unref-loop.c
@@ -3,7 +3,7 @@
*
* GStreamer integration library for Clutter.
*
- * test-video-texture-new-unref-loop.c - Create and free a Video texture in a
+ * test-video-actor-new-unref-loop.c - Create and free a Video actor in a
* tight loop to quickly check if we are leaking or not.
*
* Copyright (C) 2011 Intel Corporation
@@ -35,17 +35,17 @@
int
main (int argc, char *argv[])
{
- ClutterActor *vtexture;
+ ClutterActor *vactor;
int i;
clutter_gst_init (&argc, &argv);
for (i = 0; ; i++)
{
- g_debug("VideoTexure #%d", i);
- vtexture = clutter_gst_video_texture_new();
- g_object_ref_sink (vtexture);
- g_object_unref (vtexture);
+ g_debug("VideoActor #%d", i);
+ vactor = clutter_gst_video_actor_new ();
+ g_object_ref_sink (vactor);
+ g_object_unref (vactor);
}
return EXIT_SUCCESS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]