mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
[560/906] examples: update for bus api changes and glimagesink changes
This commit is contained in:
parent
de25a454ce
commit
38ab01769d
4 changed files with 26 additions and 26 deletions
|
@ -159,7 +159,8 @@ main (int argc, char *argv[])
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ main (int argc, char *argv[])
|
|||
GstElement *srcbin;
|
||||
GstElement *tee;
|
||||
GstElement *queue[N_ACTORS], *sink[N_ACTORS];
|
||||
/*
|
||||
GstElement *upload[N_ACTORS];
|
||||
/*
|
||||
GstElement *effect[N_ACTORS];
|
||||
*/
|
||||
ClutterActor *stage;
|
||||
|
@ -185,12 +185,12 @@ main (int argc, char *argv[])
|
|||
|
||||
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); */
|
||||
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], sink[i], NULL);
|
||||
gst_bin_add_many (GST_BIN (pipeline), queue[i], upload[i], sink[i], NULL);
|
||||
}
|
||||
|
||||
gst_element_link_many (srcbin, tee, NULL);
|
||||
|
@ -198,7 +198,7 @@ main (int argc, char *argv[])
|
|||
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], sink[i], NULL);
|
||||
gst_element_link_many (tee, queue[i], upload[i], sink[i], NULL);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
|
@ -214,7 +214,8 @@ main (int argc, char *argv[])
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -30,26 +30,16 @@
|
|||
#ifndef WIN32
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#endif
|
||||
|
||||
#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
|
||||
* gst-plugins-gl pipeline, into the clutter framework
|
||||
* 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 */
|
||||
void
|
||||
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");
|
||||
GAsyncQueue *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");
|
||||
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 */
|
||||
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)
|
||||
g_debug ("failed to bind texture that comes from gst-gl\n");
|
||||
cogl_texture = cogl_texture_new_from_foreign (gst_gl_buf->texture,
|
||||
GL_TEXTURE_RECTANGLE_ARB, gst_gl_buf->width, gst_gl_buf->height, 0, 0,
|
||||
cogl_texture = cogl_texture_new_from_foreign (gl_meta->memory->tex_id,
|
||||
GL_TEXTURE_RECTANGLE_ARB, v_meta->width, v_meta->height, 0, 0,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
|
@ -142,7 +139,7 @@ update_texture_actor (gpointer data)
|
|||
clutter_actor_show_all (stage);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
@ -309,7 +309,8 @@ main (gint argc, gchar * argv[])
|
|||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
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);
|
||||
g_signal_connect (bus, "message::error", G_CALLBACK (message_cb), pipeline);
|
||||
g_signal_connect (bus, "message::warning", G_CALLBACK (message_cb), pipeline);
|
||||
|
|
Loading…
Reference in a new issue