mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-12 09:15:29 +00:00
examples: gl: remove bitrotten clutter examples
https://bugzilla.gnome.org/show_bug.cgi?id=797173
This commit is contained in:
parent
a85a59e4a8
commit
85c484a510
11 changed files with 1 additions and 985 deletions
|
@ -1026,7 +1026,6 @@ tests/examples/gl/gtk/filternovideooverlay/Makefile
|
||||||
tests/examples/gl/gtk/filtervideooverlay/Makefile
|
tests/examples/gl/gtk/filtervideooverlay/Makefile
|
||||||
tests/examples/gl/cocoa/Makefile
|
tests/examples/gl/cocoa/Makefile
|
||||||
tests/examples/gl/sdl/Makefile
|
tests/examples/gl/sdl/Makefile
|
||||||
tests/examples/gl/clutter/Makefile
|
|
||||||
tests/examples/overlay/Makefile
|
tests/examples/overlay/Makefile
|
||||||
tests/examples/seek/Makefile
|
tests/examples/seek/Makefile
|
||||||
tests/examples/snapshot/Makefile
|
tests/examples/snapshot/Makefile
|
||||||
|
|
33
m4/gst-gl.m4
33
m4/gst-gl.m4
|
@ -1120,45 +1120,12 @@ dnl --------------------------------------------------------------------------
|
||||||
AC_DEFUN([AG_GST_GL_EXAMPLES_CHECKS],
|
AC_DEFUN([AG_GST_GL_EXAMPLES_CHECKS],
|
||||||
[
|
[
|
||||||
|
|
||||||
dnl clutter is optional and used in examples
|
|
||||||
HAVE_CLUTTER=no
|
|
||||||
HAVE_CLUTTER_X11=no
|
|
||||||
HAVE_CLUTTER_GLX=no
|
|
||||||
if test "x$BUILD_EXAMPLES" = "xyes"; then
|
|
||||||
PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= 1.8, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
|
|
||||||
AC_SUBST(CLUTTER_LIBS)
|
|
||||||
AC_SUBST(CLUTTER_CFLAGS)
|
|
||||||
AC_SUBST(HAVE_CLUTTER)
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(CLUTTER_GLX, clutter-glx-1.0 >= 1.8, HAVE_CLUTTER_GLX=yes, HAVE_CLUTTER_GLX=no)
|
|
||||||
AC_SUBST(CLUTTER_GLX_LIBS)
|
|
||||||
AC_SUBST(CLUTTER_GLX_CFLAGS)
|
|
||||||
AC_SUBST(HAVE_CLUTTER_GLX)
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(CLUTTER_X11, clutter-x11-1.0 >= 1.8, HAVE_CLUTTER_X11=yes, HAVE_CLUTTER_X11=no)
|
|
||||||
AC_SUBST(CLUTTER_X11_LIBS)
|
|
||||||
AC_SUBST(CLUTTER_X11_CFLAGS)
|
|
||||||
AC_SUBST(HAVE_CLUTTER_X11)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(HAVE_CLUTTER, test "x$HAVE_CLUTTER" = "xyes")
|
|
||||||
AM_CONDITIONAL(HAVE_CLUTTER_GLX, test "x$HAVE_CLUTTER_GLX" = "xyes")
|
|
||||||
AM_CONDITIONAL(HAVE_CLUTTER_X11, test "x$HAVE_CLUTTER_X11" = "xyes")
|
|
||||||
|
|
||||||
dnl used in the gl/clutteractor example
|
|
||||||
if test "x$BUILD_EXAMPLES" = "xyes"; then
|
|
||||||
PKG_CHECK_MODULES(XCOMPOSITE, xcomposite, HAVE_XCOMPOSITE=yes, HAVE_XCOMPOSITE=no)
|
|
||||||
AC_SUBST(XCOMPOSITE_CFLAGS)
|
|
||||||
AC_SUBST(XCOMPOSITE_LIBS)
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(HAVE_XCOMPOSITE, test "x$HAVE_XCOMPOSITE" = "xyes")
|
|
||||||
|
|
||||||
dnl sdl is optional and used in examples
|
dnl sdl is optional and used in examples
|
||||||
HAVE_SDL=NO
|
HAVE_SDL=NO
|
||||||
if test "x$BUILD_EXAMPLES" = "xyes"; then
|
if test "x$BUILD_EXAMPLES" = "xyes"; then
|
||||||
PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
|
PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
|
||||||
AC_SUBST(SDL_LIBS)
|
AC_SUBST(SDL_LIBS)
|
||||||
AC_SUBST(SDL_CFLAGS)
|
AC_SUBST(SDL_CFLAGS)
|
||||||
AC_SUBST(SDL_CLUTTER)
|
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xyes")
|
AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xyes")
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,6 @@ else
|
||||||
|
|
||||||
SUBDIRS += generic qt
|
SUBDIRS += generic qt
|
||||||
|
|
||||||
if HAVE_CLUTTER
|
|
||||||
SUBDIRS += clutter
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAVE_SDL
|
if HAVE_SDL
|
||||||
SUBDIRS += sdl
|
SUBDIRS += sdl
|
||||||
endif
|
endif
|
||||||
|
@ -25,6 +21,6 @@ endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DIST_SUBDIRS=cocoa generic qt clutter sdl gtk
|
DIST_SUBDIRS=cocoa generic qt sdl gtk
|
||||||
|
|
||||||
include $(top_srcdir)/common/parallel-subdirs.mak
|
include $(top_srcdir)/common/parallel-subdirs.mak
|
||||||
|
|
3
tests/examples/gl/clutter/.gitignore
vendored
3
tests/examples/gl/clutter/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
clutteractor
|
|
||||||
clutteractortee
|
|
||||||
cluttershare
|
|
|
@ -1,52 +0,0 @@
|
||||||
noinst_PROGRAMS = ##
|
|
||||||
|
|
||||||
#works on win32 and X
|
|
||||||
if HAVE_CLUTTER
|
|
||||||
|
|
||||||
noinst_PROGRAMS += cluttershare
|
|
||||||
|
|
||||||
cluttershare_SOURCES = cluttershare.c
|
|
||||||
|
|
||||||
cluttershare_CFLAGS= \
|
|
||||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
|
||||||
$(GST_CFLAGS) $(GL_CFLAGS) $(CLUTTER_CFLAGS)
|
|
||||||
cluttershare_LDADD= \
|
|
||||||
$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
|
|
||||||
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
|
|
||||||
$(GST_LIBS) $(GL_LIBS) $(CLUTTER_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if HAVE_CLUTTER_GLX
|
|
||||||
if HAVE_CLUTTER_X11
|
|
||||||
if HAVE_XCOMPOSITE
|
|
||||||
|
|
||||||
noinst_PROGRAMS += clutteractor clutteractortee
|
|
||||||
|
|
||||||
clutteractor_SOURCES = clutteractor.c
|
|
||||||
|
|
||||||
clutteractor_CFLAGS= \
|
|
||||||
$(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
|
||||||
$(GL_CFLAGS) $(CLUTTER_CFLAGS) \
|
|
||||||
$(CLUTTER_GLX_CFLAGS) $(CLUTTER_X11_CFLAGS) $(XCOMPOSITE_CFLAGS)
|
|
||||||
clutteractor_LDADD= \
|
|
||||||
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
|
|
||||||
$(GST_LIBS) $(GL_LIBS) \
|
|
||||||
$(CLUTTER_LIBS) $(CLUTTER_GLX_LIBS) $(CLUTTER_X11_LIBS) \
|
|
||||||
$(XCOMPOSITE_LIBS)
|
|
||||||
|
|
||||||
clutteractortee_SOURCES = clutteractortee.c
|
|
||||||
|
|
||||||
clutteractortee_CFLAGS= \
|
|
||||||
$(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
|
||||||
$(GL_CFLAGS) $(CLUTTER_CFLAGS) \
|
|
||||||
$(CLUTTER_GLX_CFLAGS) $(CLUTTER_X11_CFLAGS) $(XCOMPOSITE_CFLAGS)
|
|
||||||
clutteractortee_LDADD= \
|
|
||||||
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
|
|
||||||
$(GST_LIBS) $(GL_LIBS) \
|
|
||||||
$(CLUTTER_LIBS) $(CLUTTER_GLX_LIBS) $(CLUTTER_X11_LIBS) \
|
|
||||||
$(XCOMPOSITE_LIBS)
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
|
@ -1,179 +0,0 @@
|
||||||
/*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/extensions/Xcomposite.h>
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
#include <clutter/x11/clutter-x11.h>
|
|
||||||
#include <clutter/glx/clutter-glx.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/video/videooverlay.h>
|
|
||||||
|
|
||||||
#define W 320
|
|
||||||
#define H 240
|
|
||||||
|
|
||||||
struct GstGLClutterActor_
|
|
||||||
{
|
|
||||||
Window win;
|
|
||||||
Window root;
|
|
||||||
ClutterActor *texture;
|
|
||||||
ClutterActor *stage;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct GstGLClutterActor_ GstGLClutterActor;
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
create_actor (GstGLClutterActor * actor)
|
|
||||||
{
|
|
||||||
//ClutterKnot knot[2];
|
|
||||||
//ClutterTimeline *timeline;
|
|
||||||
ClutterAnimation *animation = NULL;
|
|
||||||
|
|
||||||
actor->texture = g_object_new (CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
|
|
||||||
"window", actor->win, "automatic-updates", TRUE, NULL);
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (actor->stage),
|
|
||||||
actor->texture);
|
|
||||||
clutter_actor_set_scale (actor->texture, 0.2, 0.2);
|
|
||||||
clutter_actor_set_opacity (actor->texture, 0);
|
|
||||||
clutter_actor_show (actor->texture);
|
|
||||||
|
|
||||||
//timeline =
|
|
||||||
// clutter_timeline_new (120 /* frames */ , 50 /* frames per second. */ );
|
|
||||||
//clutter_timeline_set_loop (timeline, TRUE);
|
|
||||||
//clutter_timeline_start (timeline);
|
|
||||||
|
|
||||||
/* Instead of our custom callback,
|
|
||||||
* we could use a standard callback. For instance, CLUTTER_ALPHA_SINE_INC.
|
|
||||||
*/
|
|
||||||
/*effect_template =
|
|
||||||
clutter_effect_template_new (timeline, CLUTTER_ALPHA_SINE_INC); */
|
|
||||||
animation =
|
|
||||||
clutter_actor_animate (actor->texture, CLUTTER_LINEAR, 2400,
|
|
||||||
"x", 100.0, "y", 100.0, "opacity", 0, NULL);
|
|
||||||
|
|
||||||
/* knot[0].x = -10;
|
|
||||||
knot[0].y = -10;
|
|
||||||
knot[1].x = 160;
|
|
||||||
knot[1].y = 120; */
|
|
||||||
|
|
||||||
// Move the actor along the path:
|
|
||||||
/* clutter_effect_path (effect_template, actor->texture, knot,
|
|
||||||
sizeof (knot) / sizeof (ClutterKnot), NULL, NULL);
|
|
||||||
clutter_effect_scale (effect_template, actor->texture, 1.0, 1.0, NULL, NULL);
|
|
||||||
clutter_effect_rotate (effect_template, actor->texture,
|
|
||||||
CLUTTER_Z_AXIS, 360.0, W / 2.0, H / 2.0, 0.0,
|
|
||||||
CLUTTER_ROTATE_CW, NULL, NULL);
|
|
||||||
clutter_effect_rotate (effect_template, actor->texture,
|
|
||||||
CLUTTER_X_AXIS, 360.0, 0.0, W / 4.0, 0.0, CLUTTER_ROTATE_CW, NULL, NULL); */
|
|
||||||
|
|
||||||
// Also change the actor's opacity while moving it along the path:
|
|
||||||
// (You would probably want to use a different ClutterEffectTemplate,
|
|
||||||
// so you could use a different alpha callback for this.)
|
|
||||||
//clutter_effect_fade (effect_template, actor->texture, 255, NULL, NULL);
|
|
||||||
|
|
||||||
g_object_unref (animation);
|
|
||||||
//g_object_unref (timeline);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstBusSyncReply
|
|
||||||
create_window (GstBus * bus, GstMessage * message, gpointer data)
|
|
||||||
{
|
|
||||||
GstGLClutterActor *actor = (GstGLClutterActor *) data;
|
|
||||||
// ignore anything but 'prepare-window-handle' element messages
|
|
||||||
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
|
|
||||||
return GST_BUS_PASS;
|
|
||||||
|
|
||||||
if (!gst_is_video_overlay_prepare_window_handle_message (message))
|
|
||||||
return GST_BUS_PASS;
|
|
||||||
|
|
||||||
g_debug ("CREATING WINDOW");
|
|
||||||
|
|
||||||
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
|
|
||||||
(message)), actor->win);
|
|
||||||
clutter_threads_add_idle ((GSourceFunc) create_actor, actor);
|
|
||||||
|
|
||||||
gst_message_unref (message);
|
|
||||||
return GST_BUS_DROP;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstPipeline *pipeline;
|
|
||||||
GstBus *bus;
|
|
||||||
ClutterActor *stage;
|
|
||||||
GstGLClutterActor *actor;
|
|
||||||
Display *disp;
|
|
||||||
Window stage_win;
|
|
||||||
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
|
|
||||||
|
|
||||||
clutter_err = clutter_init (&argc, &argv);
|
|
||||||
if (clutter_err != CLUTTER_INIT_SUCCESS)
|
|
||||||
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
disp = clutter_x11_get_default_display ();
|
|
||||||
if (!clutter_x11_has_composite_extension ()) {
|
|
||||||
g_error ("XComposite extension missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
|
||||||
// clutter_actor_set_size (CLUTTER_ACTOR (stage), W*3+2, H);
|
|
||||||
|
|
||||||
stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
|
|
||||||
|
|
||||||
actor = g_new0 (GstGLClutterActor, 1);
|
|
||||||
actor->stage = stage;
|
|
||||||
actor->win = XCreateSimpleWindow (disp, stage_win, 0, 0, W, H, 0, 0, 0);
|
|
||||||
XCompositeRedirectWindow (disp, actor->win, CompositeRedirectManual);
|
|
||||||
XMapRaised (disp, actor->win);
|
|
||||||
XSync (disp, FALSE);
|
|
||||||
|
|
||||||
pipeline =
|
|
||||||
GST_PIPELINE (gst_parse_launch
|
|
||||||
("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
|
|
||||||
"gleffects effect=twirl ! glimagesink", NULL));
|
|
||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
|
||||||
|
|
||||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
|
|
||||||
NULL);
|
|
||||||
gst_object_unref (bus);
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
clutter_actor_show_all (stage);
|
|
||||||
|
|
||||||
clutter_main ();
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,232 +0,0 @@
|
||||||
/*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/extensions/Xcomposite.h>
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
#include <clutter/x11/clutter-x11.h>
|
|
||||||
#include <clutter/glx/clutter-glx.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/video/videooverlay.h>
|
|
||||||
|
|
||||||
#define ROWS 3
|
|
||||||
#define COLS 3
|
|
||||||
#define N_ACTORS ROWS*COLS
|
|
||||||
#define W 160
|
|
||||||
#define H 120
|
|
||||||
|
|
||||||
struct GstGLClutterActor_
|
|
||||||
{
|
|
||||||
Window win;
|
|
||||||
Window root;
|
|
||||||
ClutterActor *texture;
|
|
||||||
ClutterActor *stage;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct GstGLClutterActor_ GstGLClutterActor;
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
create_actor (GstGLClutterActor * actor)
|
|
||||||
{
|
|
||||||
static gint xpos = 0;
|
|
||||||
static gint ypos = 0;
|
|
||||||
actor->texture = g_object_new (CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
|
|
||||||
"window", actor->win, "automatic-updates", TRUE, NULL);
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (actor->stage),
|
|
||||||
actor->texture);
|
|
||||||
clutter_actor_set_position (actor->texture, xpos, ypos);
|
|
||||||
|
|
||||||
if (xpos > (COLS - 1) * W) {
|
|
||||||
xpos = 0;
|
|
||||||
ypos += H + 1;
|
|
||||||
} else
|
|
||||||
xpos += W + 1;
|
|
||||||
clutter_actor_show (actor->texture);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstBusSyncReply
|
|
||||||
create_window (GstBus * bus, GstMessage * message, gpointer data)
|
|
||||||
{
|
|
||||||
GstGLClutterActor **actor = (GstGLClutterActor **) data;
|
|
||||||
static gint count = 0;
|
|
||||||
static GMutex mutex;
|
|
||||||
// ignore anything but 'prepare-window-handle' element messages
|
|
||||||
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
|
|
||||||
return GST_BUS_PASS;
|
|
||||||
|
|
||||||
if (!gst_is_video_overlay_prepare_window_handle_message (message))
|
|
||||||
return GST_BUS_PASS;
|
|
||||||
|
|
||||||
g_mutex_lock (&mutex);
|
|
||||||
|
|
||||||
if (count < N_ACTORS) {
|
|
||||||
g_message ("adding actor %d", count);
|
|
||||||
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
|
|
||||||
(message)), actor[count]->win);
|
|
||||||
clutter_threads_add_idle ((GSourceFunc) create_actor, actor[count]);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mutex_unlock (&mutex);
|
|
||||||
|
|
||||||
gst_message_unref (message);
|
|
||||||
return GST_BUS_DROP;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
void
|
|
||||||
apply_fx (GstElement * element, const gchar * fx)
|
|
||||||
{
|
|
||||||
GEnumClass *p_class;
|
|
||||||
|
|
||||||
/* from fxtest ;) */
|
|
||||||
/* heeeellppppp!! */
|
|
||||||
p_class =
|
|
||||||
G_PARAM_SPEC_ENUM (g_object_class_find_property (G_OBJECT_GET_CLASS
|
|
||||||
(G_OBJECT (data)), "effect")
|
|
||||||
)->enum_class;
|
|
||||||
|
|
||||||
g_print ("setting: %s - %s\n", fx, g_enum_get_value_by_nick (p_class,
|
|
||||||
fx)->value_name);
|
|
||||||
g_object_set (G_OBJECT (element), "effect", g_enum_get_value_by_nick (p_class,
|
|
||||||
fx)->value, NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstPipeline *pipeline;
|
|
||||||
GstBus *bus;
|
|
||||||
|
|
||||||
GstElement *srcbin;
|
|
||||||
GstElement *tee;
|
|
||||||
GstElement *queue[N_ACTORS], *sink[N_ACTORS];
|
|
||||||
GstElement *upload[N_ACTORS];
|
|
||||||
/*
|
|
||||||
GstElement *effect[N_ACTORS];
|
|
||||||
*/
|
|
||||||
ClutterActor *stage;
|
|
||||||
GstGLClutterActor *actor[N_ACTORS];
|
|
||||||
Display *disp;
|
|
||||||
Window stage_win;
|
|
||||||
const gchar *desc;
|
|
||||||
gint i;
|
|
||||||
gint ok = FALSE;
|
|
||||||
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
|
|
||||||
|
|
||||||
clutter_err = clutter_init (&argc, &argv);
|
|
||||||
if (clutter_err != CLUTTER_INIT_SUCCESS)
|
|
||||||
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
disp = clutter_x11_get_default_display ();
|
|
||||||
if (!clutter_x11_has_composite_extension ()) {
|
|
||||||
g_error ("XComposite extension missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
|
||||||
clutter_actor_set_size (CLUTTER_ACTOR (stage),
|
|
||||||
W * COLS + (COLS - 1), H * ROWS + (ROWS - 1));
|
|
||||||
|
|
||||||
stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
|
|
||||||
XCompositeRedirectSubwindows (disp, stage_win, CompositeRedirectManual);
|
|
||||||
|
|
||||||
for (i = 0; i < N_ACTORS; i++) {
|
|
||||||
actor[i] = g_new0 (GstGLClutterActor, 1);
|
|
||||||
actor[i]->stage = stage;
|
|
||||||
actor[i]->win = XCreateSimpleWindow (disp, stage_win, 0, 0, W, H, 0, 0, 0);
|
|
||||||
XMapRaised (disp, actor[i]->win);
|
|
||||||
XSync (disp, FALSE);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
desc = g_strdup_printf ("v4l2src ! "
|
|
||||||
"video/x-raw, width=640, height=480, framerate=30/1 ! "
|
|
||||||
"videoscale !"
|
|
||||||
"video/x-raw, width=%d, height=%d ! "
|
|
||||||
"identity", W, H);
|
|
||||||
*/
|
|
||||||
desc = g_strdup_printf ("videotestsrc ! "
|
|
||||||
"video/x-raw, format=RGB, width=%d, height=%d !" "identity", W, H);
|
|
||||||
pipeline = GST_PIPELINE (gst_pipeline_new (NULL));
|
|
||||||
|
|
||||||
srcbin = gst_parse_bin_from_description (desc, TRUE, NULL);
|
|
||||||
if (!srcbin)
|
|
||||||
g_error ("Source bin creation failed");
|
|
||||||
|
|
||||||
tee = gst_element_factory_make ("tee", NULL);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), srcbin, tee, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < N_ACTORS; i++) {
|
|
||||||
queue[i] = gst_element_factory_make ("queue", NULL);
|
|
||||||
upload[i] = gst_element_factory_make ("glupload", NULL);
|
|
||||||
/* effect[i] = gst_element_factory_make ("gleffects", NULL); */
|
|
||||||
sink[i] = gst_element_factory_make ("glimagesink", NULL);
|
|
||||||
/* gst_bin_add_many (GST_BIN (pipeline),
|
|
||||||
queue[i], upload[i], effect[i], sink[i], NULL); */
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), queue[i], upload[i], sink[i], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_link_many (srcbin, tee, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < N_ACTORS; i++) {
|
|
||||||
ok |=
|
|
||||||
// gst_element_link_many (tee, queue[i], upload[i], effect[i], sink[i],
|
|
||||||
gst_element_link_many (tee, queue[i], upload[i], sink[i], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
g_error ("Failed to link one or more elements");
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (i = 0; i < N_ACTORS; i++) {
|
|
||||||
g_message ("setting effect %d on %s", i + 1,
|
|
||||||
gst_element_get_name (effect[i]));
|
|
||||||
g_object_set (G_OBJECT (effect[i]), "effect", i + 1, NULL);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
|
||||||
|
|
||||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
|
|
||||||
NULL);
|
|
||||||
gst_object_unref (bus);
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
clutter_actor_show_all (stage);
|
|
||||||
|
|
||||||
clutter_main ();
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,383 +0,0 @@
|
||||||
/*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
|
|
||||||
#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
|
|
||||||
#define CLUTTER_VERSION_MAX_ALLOWED CLUTTER_VERSION_1_10
|
|
||||||
#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_ENCODE (1, 16, 0)
|
|
||||||
#define COGL_VERSION_MAX_ALLOWED COGL_VERSION_ENCODE (1, 18, 0)
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <clutter/x11/clutter-x11.h>
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/video/video.h>
|
|
||||||
#include <gst/video/gstvideometa.h>
|
|
||||||
#include <gst/gl/gl.h>
|
|
||||||
|
|
||||||
/* This example shows how to use textures that come from a
|
|
||||||
* gst-plugins-gl pipeline, into the clutter framework
|
|
||||||
* It requires at least clutter 0.8.6
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* rotation */
|
|
||||||
static void
|
|
||||||
on_new_frame (ClutterTimeline * timeline, gint msecs, gpointer data)
|
|
||||||
{
|
|
||||||
ClutterActor *rect_actor = CLUTTER_ACTOR (data);
|
|
||||||
ClutterActor *texture_actor =
|
|
||||||
g_object_get_data (G_OBJECT (timeline), "texture_actor");
|
|
||||||
|
|
||||||
clutter_actor_set_rotation (rect_actor, CLUTTER_Z_AXIS,
|
|
||||||
60.0 * (gdouble) msecs / 1000.0, clutter_actor_get_width (rect_actor) / 2,
|
|
||||||
clutter_actor_get_height (rect_actor) / 2, 0);
|
|
||||||
|
|
||||||
clutter_actor_set_rotation (texture_actor, CLUTTER_Z_AXIS,
|
|
||||||
60.0 * (gdouble) msecs / 1000.0,
|
|
||||||
clutter_actor_get_width (texture_actor) / 6,
|
|
||||||
clutter_actor_get_height (texture_actor) / 6, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* clutter scene */
|
|
||||||
static ClutterActor *
|
|
||||||
setup_stage (ClutterStage * stage)
|
|
||||||
{
|
|
||||||
ClutterTimeline *timeline = NULL;
|
|
||||||
ClutterActor *texture_actor = NULL;
|
|
||||||
ClutterColor rect_color = { 125, 50, 200, 255 };
|
|
||||||
ClutterActor *rect_actor = NULL;
|
|
||||||
|
|
||||||
/* texture actor */
|
|
||||||
|
|
||||||
texture_actor = clutter_texture_new ();
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture_actor);
|
|
||||||
clutter_actor_set_position (texture_actor, 300, 170);
|
|
||||||
clutter_actor_set_scale (texture_actor, 0.6, 0.6);
|
|
||||||
clutter_actor_show (texture_actor);
|
|
||||||
g_object_set_data (G_OBJECT (texture_actor), "stage", stage);
|
|
||||||
|
|
||||||
/* rectangle actor */
|
|
||||||
|
|
||||||
rect_actor = clutter_rectangle_new_with_color (&rect_color);
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect_actor);
|
|
||||||
clutter_actor_set_size (rect_actor, 50, 50);
|
|
||||||
clutter_actor_set_position (rect_actor, 300, 300);
|
|
||||||
clutter_actor_show (rect_actor);
|
|
||||||
|
|
||||||
/* timeline */
|
|
||||||
|
|
||||||
timeline = clutter_timeline_new (6000);
|
|
||||||
g_object_set_data (G_OBJECT (timeline), "texture_actor", texture_actor);
|
|
||||||
clutter_timeline_set_loop (timeline, TRUE);
|
|
||||||
clutter_timeline_start (timeline);
|
|
||||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (on_new_frame),
|
|
||||||
rect_actor);
|
|
||||||
|
|
||||||
return texture_actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put a gst gl buffer in the texture actor */
|
|
||||||
static gboolean
|
|
||||||
update_texture_actor (gpointer data)
|
|
||||||
{
|
|
||||||
ClutterTexture *texture_actor = (ClutterTexture *) data;
|
|
||||||
GAsyncQueue *queue_input_buf =
|
|
||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
|
|
||||||
GAsyncQueue *queue_output_buf =
|
|
||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
|
|
||||||
GstBuffer *inbuf = g_async_queue_pop (queue_input_buf);
|
|
||||||
ClutterActor *stage = g_object_get_data (G_OBJECT (texture_actor), "stage");
|
|
||||||
CoglHandle cogl_texture = 0;
|
|
||||||
GstVideoMeta *v_meta;
|
|
||||||
GstVideoInfo info;
|
|
||||||
GstVideoFrame frame;
|
|
||||||
guint tex_id;
|
|
||||||
|
|
||||||
v_meta = gst_buffer_get_video_meta (inbuf);
|
|
||||||
if (!v_meta) {
|
|
||||||
g_warning ("Required Meta was not found on buffers");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_video_info_set_format (&info, v_meta->format, v_meta->width,
|
|
||||||
v_meta->height);
|
|
||||||
|
|
||||||
if (!gst_video_frame_map (&frame, &info, inbuf, GST_MAP_READ | GST_MAP_GL)) {
|
|
||||||
g_warning ("Failed to map video frame");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_is_gl_memory (frame.map[0].memory)) {
|
|
||||||
g_warning ("Input buffer does not have GLMemory");
|
|
||||||
gst_video_frame_unmap (&frame);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
tex_id = *(guint *) frame.data[0];
|
|
||||||
|
|
||||||
/* Create a cogl texture from the gst gl texture */
|
|
||||||
glEnable (GL_TEXTURE_2D);
|
|
||||||
glBindTexture (GL_TEXTURE_2D, tex_id);
|
|
||||||
if (glGetError () != GL_NO_ERROR)
|
|
||||||
g_debug ("failed to bind texture that comes from gst-gl\n");
|
|
||||||
cogl_texture = cogl_texture_new_from_foreign (tex_id,
|
|
||||||
GL_TEXTURE_2D, v_meta->width, v_meta->height, 0, 0,
|
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888);
|
|
||||||
glBindTexture (GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
gst_video_frame_unmap (&frame);
|
|
||||||
|
|
||||||
/* Previous cogl texture is replaced and so its ref counter discreases to 0.
|
|
||||||
* According to the source code, glDeleteTexture is not called when the previous
|
|
||||||
* ref counter of the previous cogl texture is reaching 0 because is_foreign is TRUE */
|
|
||||||
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (texture_actor),
|
|
||||||
cogl_texture);
|
|
||||||
cogl_handle_unref (cogl_texture);
|
|
||||||
|
|
||||||
/* we can now show the clutter scene if not yet visible */
|
|
||||||
if (!CLUTTER_ACTOR_IS_VISIBLE (stage))
|
|
||||||
clutter_actor_show_all (stage);
|
|
||||||
|
|
||||||
/* push buffer so it can be unref later */
|
|
||||||
g_async_queue_push (queue_output_buf, inbuf);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* fakesink handoff callback */
|
|
||||||
static void
|
|
||||||
on_gst_buffer (GstElement * element, GstBuffer * buf, GstPad * pad,
|
|
||||||
ClutterActor * texture_actor)
|
|
||||||
{
|
|
||||||
GAsyncQueue *queue_input_buf = NULL;
|
|
||||||
GAsyncQueue *queue_output_buf = NULL;
|
|
||||||
|
|
||||||
/* ref then push buffer to use it in clutter */
|
|
||||||
gst_buffer_ref (buf);
|
|
||||||
queue_input_buf =
|
|
||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
|
|
||||||
g_async_queue_push (queue_input_buf, buf);
|
|
||||||
if (g_async_queue_length (queue_input_buf) > 2)
|
|
||||||
clutter_threads_add_idle_full (G_PRIORITY_HIGH, update_texture_actor,
|
|
||||||
texture_actor, NULL);
|
|
||||||
|
|
||||||
/* pop then unref buffer we have finished to use in clutter */
|
|
||||||
queue_output_buf =
|
|
||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
|
|
||||||
if (g_async_queue_length (queue_output_buf) > 2) {
|
|
||||||
GstBuffer *buf_old = g_async_queue_pop (queue_output_buf);
|
|
||||||
gst_buffer_unref (buf_old);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* gst bus signal watch callback */
|
|
||||||
static void
|
|
||||||
end_stream_cb (GstBus * bus, GstMessage * msg, gpointer data)
|
|
||||||
{
|
|
||||||
switch (GST_MESSAGE_TYPE (msg)) {
|
|
||||||
|
|
||||||
case GST_MESSAGE_EOS:
|
|
||||||
g_print ("End-of-stream\n");
|
|
||||||
g_print
|
|
||||||
("For more information, try to run: GST_DEBUG=gldisplay:2 ./cluttershare\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GST_MESSAGE_ERROR:
|
|
||||||
{
|
|
||||||
gchar *debug = NULL;
|
|
||||||
GError *err = NULL;
|
|
||||||
|
|
||||||
gst_message_parse_error (msg, &err, &debug);
|
|
||||||
|
|
||||||
g_print ("Error: %s\n", err->message);
|
|
||||||
g_error_free (err);
|
|
||||||
|
|
||||||
if (debug) {
|
|
||||||
g_print ("Debug deails: %s\n", debug);
|
|
||||||
g_free (debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
|
|
||||||
#ifdef WIN32
|
|
||||||
HGLRC clutter_gl_context = 0;
|
|
||||||
HDC clutter_dc = 0;
|
|
||||||
#else
|
|
||||||
Display *clutter_display = NULL;
|
|
||||||
Window clutter_win = 0;
|
|
||||||
GLXContext clutter_gl_context = NULL;
|
|
||||||
#endif
|
|
||||||
GstPipeline *pipeline = NULL;
|
|
||||||
GstBus *bus = NULL;
|
|
||||||
GstElement *glfilter = NULL;
|
|
||||||
GstState state = 0;
|
|
||||||
ClutterActor *stage = NULL;
|
|
||||||
ClutterActor *clutter_texture = NULL;
|
|
||||||
GAsyncQueue *queue_input_buf = NULL;
|
|
||||||
GAsyncQueue *queue_output_buf = NULL;
|
|
||||||
GstElement *fakesink = NULL;
|
|
||||||
|
|
||||||
/* init gstreamer then clutter */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
clutter_threads_init ();
|
|
||||||
clutter_err = clutter_init (&argc, &argv);
|
|
||||||
if (clutter_err != CLUTTER_INIT_SUCCESS)
|
|
||||||
g_warning ("Failed to initalize clutter: %d\n", clutter_err);
|
|
||||||
clutter_threads_enter ();
|
|
||||||
g_print ("clutter version: %s\n", CLUTTER_VERSION_S);
|
|
||||||
clutter_set_default_frame_rate (2);
|
|
||||||
|
|
||||||
/* avoid to dispatch unecesary events */
|
|
||||||
clutter_ungrab_keyboard ();
|
|
||||||
clutter_ungrab_pointer ();
|
|
||||||
|
|
||||||
/* retrieve and turn off clutter opengl context */
|
|
||||||
stage = clutter_stage_get_default ();
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
clutter_gl_context = wglGetCurrentContext ();
|
|
||||||
clutter_dc = wglGetCurrentDC ();
|
|
||||||
wglMakeCurrent (0, 0);
|
|
||||||
#else
|
|
||||||
clutter_display = clutter_x11_get_default_display ();
|
|
||||||
clutter_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
|
|
||||||
clutter_gl_context = glXGetCurrentContext ();
|
|
||||||
glXMakeCurrent (clutter_display, None, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* setup gstreamer pipeline */
|
|
||||||
|
|
||||||
pipeline =
|
|
||||||
GST_PIPELINE (gst_parse_launch
|
|
||||||
("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
|
|
||||||
"gleffects effect=5 ! glfiltercube ! fakesink sync=1", NULL));
|
|
||||||
|
|
||||||
/* setup bus */
|
|
||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
|
||||||
gst_bus_add_signal_watch (bus);
|
|
||||||
g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), NULL);
|
|
||||||
g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), NULL);
|
|
||||||
g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), NULL);
|
|
||||||
gst_object_unref (bus);
|
|
||||||
|
|
||||||
/* clutter_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */
|
|
||||||
glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfiltercube0");
|
|
||||||
g_object_set (G_OBJECT (glfilter), "external-opengl-context",
|
|
||||||
clutter_gl_context, NULL);
|
|
||||||
gst_object_unref (glfilter);
|
|
||||||
|
|
||||||
/* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
|
|
||||||
* shared with the clutter one */
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
|
|
||||||
state = GST_STATE_PAUSED;
|
|
||||||
if (gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL,
|
|
||||||
GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_SUCCESS) {
|
|
||||||
g_debug ("failed to pause pipeline\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* turn on back clutter opengl context */
|
|
||||||
#ifdef WIN32
|
|
||||||
wglMakeCurrent (clutter_dc, clutter_gl_context);
|
|
||||||
#else
|
|
||||||
glXMakeCurrent (clutter_display, clutter_win, clutter_gl_context);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* clutter stage */
|
|
||||||
clutter_actor_set_size (stage, 640, 480);
|
|
||||||
clutter_actor_set_position (stage, 0, 0);
|
|
||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "clutter and gst-plugins-gl");
|
|
||||||
clutter_texture = setup_stage (CLUTTER_STAGE (stage));
|
|
||||||
|
|
||||||
/* append a gst-gl texture to this queue when you do not need it no more */
|
|
||||||
queue_input_buf = g_async_queue_new ();
|
|
||||||
queue_output_buf = g_async_queue_new ();
|
|
||||||
g_object_set_data (G_OBJECT (clutter_texture), "queue_input_buf",
|
|
||||||
queue_input_buf);
|
|
||||||
g_object_set_data (G_OBJECT (clutter_texture), "queue_output_buf",
|
|
||||||
queue_output_buf);
|
|
||||||
|
|
||||||
/* set a callback to retrieve the gst gl textures */
|
|
||||||
fakesink = gst_bin_get_by_name (GST_BIN (pipeline), "fakesink0");
|
|
||||||
g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (fakesink, "handoff", G_CALLBACK (on_gst_buffer),
|
|
||||||
clutter_texture);
|
|
||||||
gst_object_unref (fakesink);
|
|
||||||
|
|
||||||
/* play gst */
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
/* main loop */
|
|
||||||
clutter_main ();
|
|
||||||
|
|
||||||
/* before to deinitialize the gst-gl-opengl context,
|
|
||||||
* no shared context (here the clutter one) must be current
|
|
||||||
*/
|
|
||||||
#ifdef WIN32
|
|
||||||
wglMakeCurrent (0, 0);
|
|
||||||
#else
|
|
||||||
glXMakeCurrent (clutter_display, None, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clutter_threads_leave ();
|
|
||||||
|
|
||||||
/* stop and clean up the pipeline */
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
/* make sure there is no pending gst gl buffer in the communication queues
|
|
||||||
* between clutter and gst-gl
|
|
||||||
*/
|
|
||||||
while (g_async_queue_length (queue_input_buf) > 0) {
|
|
||||||
GstBuffer *buf = g_async_queue_pop (queue_input_buf);
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (g_async_queue_length (queue_output_buf) > 0) {
|
|
||||||
GstBuffer *buf = g_async_queue_pop (queue_output_buf);
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("END\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_project_file>
|
|
||||||
<FileVersion major="1" minor="6" />
|
|
||||||
<Project>
|
|
||||||
<Option title="cluttershare" />
|
|
||||||
<Option pch_mode="2" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Build>
|
|
||||||
<Target title="Debug">
|
|
||||||
<Option output="bin\Debug\cluttershare" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj\Debug\" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-g" />
|
|
||||||
</Compiler>
|
|
||||||
</Target>
|
|
||||||
<Target title="Release">
|
|
||||||
<Option output="bin\Release\cluttershare" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj\Release\" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-O2" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add option="-s" />
|
|
||||||
</Linker>
|
|
||||||
</Target>
|
|
||||||
</Build>
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-Wall" />
|
|
||||||
<Add option="-ansi" />
|
|
||||||
<Add option="-std=c89" />
|
|
||||||
<Add option="-DWIN32" />
|
|
||||||
<Add directory="..\..\..\..\clutter\include\clutter-0.8" />
|
|
||||||
<Add directory="C:\gstreamer\include\glib-2.0" />
|
|
||||||
<Add directory="C:\gstreamer\lib\glib-2.0\include" />
|
|
||||||
<Add directory="C:\gstreamer\include\gstreamer-1.0" />
|
|
||||||
<Add directory="C:\gstreamer\include\pango-1.0" />
|
|
||||||
<Add directory="C:\gstreamer\include\cairo" />
|
|
||||||
<Add directory="C:\gstreamer\include\libxml2" />
|
|
||||||
<Add directory="C:\gstreamer\include" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add library="clutter-win32-0.8" />
|
|
||||||
<Add library="gio-2.0" />
|
|
||||||
<Add library="gthread-2.0" />
|
|
||||||
<Add library="gobject-2.0" />
|
|
||||||
<Add library="gstreamer-1.0" />
|
|
||||||
<Add library="gmodule-2.0" />
|
|
||||||
<Add library="gstvideo-1.0" />
|
|
||||||
<Add library="glib-2.0" />
|
|
||||||
<Add library="pangocairo-1.0" />
|
|
||||||
<Add library="pangowin32-1.0" />
|
|
||||||
<Add library="pango-1.0" />
|
|
||||||
<Add library="gdk_pixbuf-2.0" />
|
|
||||||
<Add library="cairo" />
|
|
||||||
<Add library="glu32" />
|
|
||||||
<Add library="opengl32" />
|
|
||||||
<Add library="gdi32" />
|
|
||||||
<Add library="winmm" />
|
|
||||||
<Add directory="..\..\..\..\clutter\lib" />
|
|
||||||
<Add directory="C:\gstreamer\lib" />
|
|
||||||
<Add directory="C:\gstreamer\bin" />
|
|
||||||
<Add directory="..\..\..\..\gtk+\lib" />
|
|
||||||
</Linker>
|
|
||||||
<Unit filename="cluttershare.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
</Unit>
|
|
||||||
<Extensions>
|
|
||||||
<code_completion />
|
|
||||||
<debugger />
|
|
||||||
</Extensions>
|
|
||||||
</Project>
|
|
||||||
</CodeBlocks_project_file>
|
|
|
@ -1,20 +0,0 @@
|
||||||
clutter_dep = dependency('clutter-1.0', version: '>= 1.8', required: get_option('examples'))
|
|
||||||
if clutter_dep.found()
|
|
||||||
# works on win32 and X
|
|
||||||
executable('cluttershare', 'cluttershare.c',
|
|
||||||
dependencies : [gstgl_dep, gl_dep, video_dep, clutter_dep],
|
|
||||||
install: false)
|
|
||||||
|
|
||||||
clutter_glx_dep = dependency('clutter-glx-1.0', version: '>= 1.8', required: get_option('examples'))
|
|
||||||
clutter_x11_dep = dependency('clutter-x11-1.0', version: '>= 1.8', required: get_option('examples'))
|
|
||||||
xcomposite_dep = dependency('xcomposite', required: get_option('examples'))
|
|
||||||
|
|
||||||
if clutter_glx_dep.found() and clutter_x11_dep.found() and xcomposite_dep.found()
|
|
||||||
executable('clutteractor', 'clutteractor.c',
|
|
||||||
dependencies : [gstgl_dep, gl_dep, video_dep, clutter_dep, clutter_glx_dep, clutter_x11_dep, xcomposite_dep],
|
|
||||||
install: false)
|
|
||||||
executable('clutteractortee', 'clutteractortee.c',
|
|
||||||
dependencies : [gstgl_dep, gl_dep, video_dep, clutter_dep, clutter_glx_dep, clutter_x11_dep, xcomposite_dep],
|
|
||||||
install: false)
|
|
||||||
endif
|
|
||||||
endif
|
|
|
@ -1,4 +1,3 @@
|
||||||
subdir('clutter')
|
|
||||||
# FIXME: subdir('cocoa')
|
# FIXME: subdir('cocoa')
|
||||||
subdir('generic')
|
subdir('generic')
|
||||||
subdir('gtk', if_found : gtk_dep)
|
subdir('gtk', if_found : gtk_dep)
|
||||||
|
|
Loading…
Reference in a new issue