[560/906] examples: update for bus api changes and glimagesink changes
This commit is contained in:
parent
de25a454ce
commit
38ab01769d
@ -159,7 +159,8 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
|
||||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor);
|
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ main (int argc, char *argv[])
|
|||||||
GstElement *srcbin;
|
GstElement *srcbin;
|
||||||
GstElement *tee;
|
GstElement *tee;
|
||||||
GstElement *queue[N_ACTORS], *sink[N_ACTORS];
|
GstElement *queue[N_ACTORS], *sink[N_ACTORS];
|
||||||
/*
|
|
||||||
GstElement *upload[N_ACTORS];
|
GstElement *upload[N_ACTORS];
|
||||||
|
/*
|
||||||
GstElement *effect[N_ACTORS];
|
GstElement *effect[N_ACTORS];
|
||||||
*/
|
*/
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
@ -185,12 +185,12 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
for (i = 0; i < N_ACTORS; i++) {
|
for (i = 0; i < N_ACTORS; i++) {
|
||||||
queue[i] = gst_element_factory_make ("queue", NULL);
|
queue[i] = gst_element_factory_make ("queue", NULL);
|
||||||
/* upload[i] = gst_element_factory_make ("glupload", NULL);
|
upload[i] = gst_element_factory_make ("glupload", NULL);
|
||||||
effect[i] = gst_element_factory_make ("gleffects", NULL); */
|
/* effect[i] = gst_element_factory_make ("gleffects", NULL); */
|
||||||
sink[i] = gst_element_factory_make ("glimagesink", NULL);
|
sink[i] = gst_element_factory_make ("glimagesink", NULL);
|
||||||
/* gst_bin_add_many (GST_BIN (pipeline),
|
/* gst_bin_add_many (GST_BIN (pipeline),
|
||||||
queue[i], upload[i], effect[i], sink[i], NULL); */
|
queue[i], upload[i], effect[i], sink[i], NULL); */
|
||||||
gst_bin_add_many (GST_BIN (pipeline), queue[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);
|
gst_element_link_many (srcbin, tee, NULL);
|
||||||
@ -198,7 +198,7 @@ main (int argc, char *argv[])
|
|||||||
for (i = 0; i < N_ACTORS; i++) {
|
for (i = 0; i < N_ACTORS; i++) {
|
||||||
ok |=
|
ok |=
|
||||||
// gst_element_link_many (tee, queue[i], upload[i], effect[i], sink[i],
|
// gst_element_link_many (tee, queue[i], upload[i], effect[i], sink[i],
|
||||||
gst_element_link_many (tee, queue[i], sink[i], NULL);
|
gst_element_link_many (tee, queue[i], upload[i], sink[i], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
@ -214,7 +214,8 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
|
||||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor);
|
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
@ -30,26 +30,16 @@
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <clutter/x11/clutter-x11.h>
|
#include <clutter/x11/clutter-x11.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/gl/gstglmeta.h>
|
||||||
|
|
||||||
/* This example shows how to use textures that come from a
|
/* This example shows how to use textures that come from a
|
||||||
* gst-plugins-gl pipeline, into the clutter framework
|
* gst-plugins-gl pipeline, into the clutter framework
|
||||||
* It requires at least clutter 0.8.6
|
* It requires at least clutter 0.8.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* hack */
|
|
||||||
typedef struct _GstGLBuffer GstGLBuffer;
|
|
||||||
struct _GstGLBuffer
|
|
||||||
{
|
|
||||||
GstBuffer buffer;
|
|
||||||
|
|
||||||
GObject *obj;
|
|
||||||
|
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
GLuint texture;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* rotation */
|
/* rotation */
|
||||||
void
|
void
|
||||||
on_new_frame (ClutterTimeline * timeline, gint msecs, gpointer data)
|
on_new_frame (ClutterTimeline * timeline, gint msecs, gpointer data)
|
||||||
@ -116,17 +106,24 @@ update_texture_actor (gpointer data)
|
|||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
|
g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
|
||||||
GAsyncQueue *queue_output_buf =
|
GAsyncQueue *queue_output_buf =
|
||||||
g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
|
g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
|
||||||
GstGLBuffer *gst_gl_buf = g_async_queue_pop (queue_input_buf);
|
GstBuffer *inbuf = g_async_queue_pop (queue_input_buf);
|
||||||
ClutterActor *stage = g_object_get_data (G_OBJECT (texture_actor), "stage");
|
ClutterActor *stage = g_object_get_data (G_OBJECT (texture_actor), "stage");
|
||||||
CoglHandle cogl_texture = 0;
|
CoglHandle cogl_texture = 0;
|
||||||
|
GstVideoMeta *v_meta;
|
||||||
|
GstGLMeta *gl_meta;
|
||||||
|
|
||||||
|
v_meta = gst_buffer_get_video_meta (inbuf);
|
||||||
|
gl_meta = gst_buffer_get_gl_meta (inbuf);
|
||||||
|
if (!v_meta || !gl_meta)
|
||||||
|
g_warning ("Required Meta was not found on buffers");
|
||||||
|
|
||||||
/* Create a cogl texture from the gst gl texture */
|
/* Create a cogl texture from the gst gl texture */
|
||||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, gst_gl_buf->texture);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, gl_meta->memory->tex_id);
|
||||||
if (glGetError () != GL_NO_ERROR)
|
if (glGetError () != GL_NO_ERROR)
|
||||||
g_debug ("failed to bind texture that comes from gst-gl\n");
|
g_debug ("failed to bind texture that comes from gst-gl\n");
|
||||||
cogl_texture = cogl_texture_new_from_foreign (gst_gl_buf->texture,
|
cogl_texture = cogl_texture_new_from_foreign (gl_meta->memory->tex_id,
|
||||||
GL_TEXTURE_RECTANGLE_ARB, gst_gl_buf->width, gst_gl_buf->height, 0, 0,
|
GL_TEXTURE_RECTANGLE_ARB, v_meta->width, v_meta->height, 0, 0,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888);
|
COGL_PIXEL_FORMAT_RGBA_8888);
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||||
|
|
||||||
@ -142,7 +139,7 @@ update_texture_actor (gpointer data)
|
|||||||
clutter_actor_show_all (stage);
|
clutter_actor_show_all (stage);
|
||||||
|
|
||||||
/* push buffer so it can be unref later */
|
/* push buffer so it can be unref later */
|
||||||
g_async_queue_push (queue_output_buf, gst_gl_buf);
|
g_async_queue_push (queue_output_buf, inbuf);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,8 @@ main (gint argc, gchar * argv[])
|
|||||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||||
|
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen);
|
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen,
|
||||||
|
NULL);
|
||||||
gst_bus_add_signal_watch (bus);
|
gst_bus_add_signal_watch (bus);
|
||||||
g_signal_connect (bus, "message::error", G_CALLBACK (message_cb), pipeline);
|
g_signal_connect (bus, "message::error", G_CALLBACK (message_cb), pipeline);
|
||||||
g_signal_connect (bus, "message::warning", G_CALLBACK (message_cb), pipeline);
|
g_signal_connect (bus, "message::warning", G_CALLBACK (message_cb), pipeline);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user