tests: update for GstXOverlay => GstVideoOverlay

This commit is contained in:
Tim-Philipp Müller 2011-08-08 13:55:21 +01:00
parent 7f11e9bc30
commit 789e325678
15 changed files with 83 additions and 78 deletions

View file

@ -64,7 +64,7 @@
#include <gst/interfaces/tuner.h> #include <gst/interfaces/tuner.h>
#include <gst/interfaces/tunernorm.h> #include <gst/interfaces/tunernorm.h>
#include <gst/interfaces/videoorientation.h> #include <gst/interfaces/videoorientation.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <gst/netbuffer/gstnetbuffer.h> #include <gst/netbuffer/gstnetbuffer.h>

View file

@ -45,7 +45,7 @@
#include <gst/interfaces/streamvolume.h> #include <gst/interfaces/streamvolume.h>
#include <gst/interfaces/tuner.h> #include <gst/interfaces/tuner.h>
#include <gst/interfaces/videoorientation.h> #include <gst/interfaces/videoorientation.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <gst/netbuffer/gstnetbuffer.h> #include <gst/netbuffer/gstnetbuffer.h>
#include <gst/pbutils/pbutils.h> #include <gst/pbutils/pbutils.h>
#include <gst/riff/riff-media.h> #include <gst/riff/riff-media.h>

View file

@ -1,5 +1,5 @@
gtk-xoverlay gtk-videooverlay
qt-xoverlay qt-videooverlay
qtgv-xoverlay qtgv-videooverlay
moc_*.cpp moc_*.cpp

View file

@ -3,41 +3,41 @@ EXAMPLES =
if USE_X if USE_X
if HAVE_GTK_X11 if HAVE_GTK_X11
EXAMPLES += gtk-xoverlay EXAMPLES += gtk-videooverlay
gtk_xoverlay_SOURCES = gtk-xoverlay.c gtk_videooverlay_SOURCES = gtk-videooverlay.c
gtk_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS) gtk_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
gtk_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \ gtk_videooverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
endif endif
if HAVE_QT if HAVE_QT
EXAMPLES += qt-xoverlay EXAMPLES += qt-videooverlay
qt_xoverlay_SOURCES = qt-xoverlay.cpp qt_videooverlay_SOURCES = qt-videooverlay.cpp
qt_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) qt_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
qt_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \ qt_videooverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
endif endif
if HAVE_QT_GV if HAVE_QT_GV
EXAMPLES += qtgv-xoverlay EXAMPLES += qtgv-videooverlay
qtgv_xoverlay_SOURCES = qtgv-xoverlay.cpp qtgv-xoverlay.h qtgv_videooverlay_SOURCES = qtgv-videooverlay.cpp qtgv-videooverlay.h
qtgv_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) qtgv_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
qtgv_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \ qtgv_videooverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
# qt moc support, according to http://qtnode.net/wiki/Qt_with_autotools # qt moc support, according to http://qtnode.net/wiki/Qt_with_autotools
nodist_qtgv_xoverlay_SOURCES = moc_qtgv-xoverlay.cpp nodist_qtgv_videooverlay_SOURCES = moc_qtgv-videooverlay.cpp
moc_%.cpp:%.h moc_%.cpp:%.h
$(AM_V_GEN)$(QT4_MOC) $< -o $@ $(AM_V_GEN)$(QT4_MOC) $< -o $@
EXTRA_DIST = $(nodist_qtgv_xoverlay_SOURCES:moc_%.cpp=%.h) EXTRA_DIST = $(nodist_qtgv_videooverlay_SOURCES:moc_%.cpp=%.h)
CLEANFILES = $(nodist_qtgv_xoverlay_SOURCES) CLEANFILES = $(nodist_qtgv_videooverlay_SOURCES)
endif endif

View file

@ -1,7 +1,7 @@
/* GStreamer /* GStreamer
* Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net> * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
* *
* gtk-xoverlay: demonstrate overlay handling using gtk * gtk-videooverlay: demonstrate overlay handling using gtk
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -28,7 +28,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <string.h> #include <string.h>
@ -134,7 +134,7 @@ main (int argc, char **argv)
video_window_xwindow = gtk_widget_get_window (video_window); video_window_xwindow = gtk_widget_get_window (video_window);
embed_xid = GDK_WINDOW_XID (video_window_xwindow); embed_xid = GDK_WINDOW_XID (video_window_xwindow);
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
/* run the pipeline */ /* run the pipeline */

View file

@ -25,7 +25,7 @@
#include <glib.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <QApplication> #include <QApplication>
#include <QTimer> #include <QTimer>
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
window.show(); window.show();
WId xwinid = window.winId(); WId xwinid = window.winId();
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
/* run the pipeline */ /* run the pipeline */

View file

@ -23,12 +23,12 @@
#include "config.h" #include "config.h"
#endif #endif
#include "qtgv-xoverlay.h" #include "qtgv-videooverlay.h"
#include <QApplication> #include <QApplication>
#include <QTimer> #include <QTimer>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
SinkPipeline::SinkPipeline(QGraphicsView *parent) : QObject(parent) SinkPipeline::SinkPipeline(QGraphicsView *parent) : QObject(parent)
{ {
@ -90,10 +90,10 @@ void SinkPipeline::startPipeline()
GstStateChangeReturn sret; GstStateChangeReturn sret;
/* we know what the video sink is in this case (xvimagesink), so we can /* we know what the video sink is in this case (xvimagesink), so we can
* just set it directly here now (instead of waiting for a prepare-xwindow-id * just set it directly here now (instead of waiting for a
* element message in a sync bus handler and setting it there) */ * prepare-window-handle element message in a sync bus handler and setting
* it there) */
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING); sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (sret == GST_STATE_CHANGE_FAILURE) { if (sret == GST_STATE_CHANGE_FAILURE) {

View file

@ -45,7 +45,7 @@
#ifdef HAVE_X #ifdef HAVE_X
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif #endif
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
GST_DEBUG_CATEGORY_STATIC (seek_debug); GST_DEBUG_CATEGORY_STATIC (seek_debug);
#define GST_CAT_DEFAULT (seek_debug) #define GST_CAT_DEFAULT (seek_debug)
@ -2438,7 +2438,7 @@ msg_clock_lost (GstBus * bus, GstMessage * message, GstPipeline * data)
static gulong embed_xid = 0; static gulong embed_xid = 0;
/* We set the xid here in response to the prepare-xwindow-id message via a /* We set the xid here in response to the prepare-window-handle message via a
* bus sync handler because we don't know the actual videosink used from the * bus sync handler because we don't know the actual videosink used from the
* start (as we don't know the pipeline, or bin elements such as autovideosink * start (as we don't know the pipeline, or bin elements such as autovideosink
* or gconfvideosink may be used which create the actual videosink only once * or gconfvideosink may be used which create the actual videosink only once
@ -2447,10 +2447,10 @@ static GstBusSyncReply
bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data) bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
{ {
if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) && if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
gst_message_has_name (message, "prepare-xwindow-id")) { gst_message_has_name (message, "prepare-window-handle")) {
GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message)); GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid); g_print ("got prepare-window-handle, setting XID %lu\n", embed_xid);
if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
"force-aspect-ratio")) { "force-aspect-ratio")) {
@ -2464,7 +2464,8 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
* shouldn't be done from a non-GUI thread without explicit locking). */ * shouldn't be done from a non-GUI thread without explicit locking). */
g_assert (embed_xid != 0); g_assert (embed_xid != 0);
gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element),
embed_xid);
} }
return GST_BUS_PASS; return GST_BUS_PASS;
} }
@ -2498,7 +2499,7 @@ realize_cb (GtkWidget * widget, gpointer data)
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
* as well */ * as well */
if (!gdk_window_ensure_native (window)) if (!gdk_window_ensure_native (window))
g_error ("Couldn't create native window needed for GstXOverlay!"); g_error ("Couldn't create native window needed for GstVideoOverlay!");
} }
#endif #endif
@ -2541,7 +2542,7 @@ connect_bus_signals (GstElement * pipeline)
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
#ifdef HAVE_X #ifdef HAVE_X
/* handle prepare-xwindow-id element message synchronously */ /* handle prepare-window-handle element message synchronously */
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
pipeline); pipeline);
#endif #endif

View file

@ -39,7 +39,7 @@
#include <gdk/gdkwin32.h> #include <gdk/gdkwin32.h>
#endif #endif
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1) #if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
#define gtk_combo_box_text_new gtk_combo_box_new_text #define gtk_combo_box_text_new gtk_combo_box_new_text
@ -1575,7 +1575,7 @@ msg_clock_lost (GstBus * bus, GstMessage * message, GstPipeline * data)
static gulong embed_xid = 0; static gulong embed_xid = 0;
/* We set the xid here in response to the prepare-xwindow-id message via a /* We set the xid here in response to the prepare-window-handle message via a
* bus sync handler because we don't know the actual videosink used from the * bus sync handler because we don't know the actual videosink used from the
* start (as we don't know the pipeline, or bin elements such as autovideosink * start (as we don't know the pipeline, or bin elements such as autovideosink
* or gconfvideosink may be used which create the actual videosink only once * or gconfvideosink may be used which create the actual videosink only once
@ -1584,10 +1584,10 @@ static GstBusSyncReply
bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data) bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
{ {
if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) && if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
gst_message_has_name (message, "prepare-xwindow-id")) { gst_message_has_name (message, "prepare-window-handle")) {
GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message)); GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid); g_print ("got prepare-window-handle, setting XID %lu\n", embed_xid);
if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
"force-aspect-ratio")) { "force-aspect-ratio")) {
@ -1601,7 +1601,8 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
* shouldn't be done from a non-GUI thread without explicit locking). */ * shouldn't be done from a non-GUI thread without explicit locking). */
g_assert (embed_xid != 0); g_assert (embed_xid != 0);
gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element),
embed_xid);
} }
return GST_BUS_PASS; return GST_BUS_PASS;
} }
@ -1635,7 +1636,7 @@ realize_cb (GtkWidget * widget, gpointer data)
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
* as well */ * as well */
if (!gdk_window_ensure_native (window)) if (!gdk_window_ensure_native (window))
g_error ("Couldn't create native window needed for GstXOverlay!"); g_error ("Couldn't create native window needed for GstVideoOverlay!");
} }
#endif #endif
@ -1682,7 +1683,7 @@ connect_bus_signals (GstElement * pipeline)
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) #if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32)
/* handle prepare-xwindow-id element message synchronously */ /* handle prepare-window-handle element message synchronously */
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
pipeline); pipeline);
#endif #endif

View file

@ -4,9 +4,9 @@ output-selector-test
playbin-text playbin-text
position-formats position-formats
stress-playbin stress-playbin
stress-xoverlay stress-videooverlay
test-textoverlay test-textoverlay
test-scale test-scale
test-box test-box
test-colorkey test-colorkey
test-xoverlay test-videooverlay

View file

@ -2,16 +2,16 @@ SUBDIRS = playback
DIST_SUBDIRS = playback DIST_SUBDIRS = playback
if USE_X if USE_X
X_TESTS = stress-xoverlay X_TESTS = stress-videooverlay
stress_xoverlay_SOURCES = stress-xoverlay.c stress_videooverlay_SOURCES = stress-videooverlay.c
stress_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ stress_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
stress_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) \ stress_videooverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
if HAVE_GTK_X11 if HAVE_GTK_X11
X_TESTS += test-colorkey test-xoverlay X_TESTS += test-colorkey test-videooverlay
test_colorkey_SOURCES = test-colorkey.c test_colorkey_SOURCES = test-colorkey.c
test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
@ -19,10 +19,10 @@ test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
test_colorkey_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \ test_colorkey_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
test_xoverlay_SOURCES = test-xoverlay.c test_videooverlay_SOURCES = test-videooverlay.c
test_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ test_videooverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
test_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \ test_videooverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
endif endif

View file

@ -22,7 +22,7 @@
#endif #endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@ -94,11 +94,11 @@ move_window (GstPipeline * pipeline)
} }
static gboolean static gboolean
toggle_events (GstXOverlay * ov) toggle_events (GstVideoOverlay * ov)
{ {
static gboolean events_toggled; static gboolean events_toggled;
gst_x_overlay_handle_events (ov, events_toggled); gst_video_overlay_handle_events (ov, events_toggled);
if (events_toggled) { if (events_toggled) {
g_print ("Events are handled\n"); g_print ("Events are handled\n");
@ -112,7 +112,7 @@ toggle_events (GstXOverlay * ov)
} }
static gboolean static gboolean
cycle_window (GstXOverlay * ov) cycle_window (GstVideoOverlay * ov)
{ {
XGCValues values; XGCValues values;
Window old_win = win; Window old_win = win;
@ -128,7 +128,7 @@ cycle_window (GstXOverlay * ov)
XSync (disp, FALSE); XSync (disp, FALSE);
gst_x_overlay_set_window_handle (ov, win); gst_video_overlay_set_window_handle (ov, win);
if (old_win) { if (old_win) {
XDestroyWindow (disp, old_win); XDestroyWindow (disp, old_win);
@ -143,14 +143,14 @@ static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
{ {
const GstStructure *s; const GstStructure *s;
GstXOverlay *ov = NULL; GstVideoOverlay *ov = NULL;
s = gst_message_get_structure (message); s = gst_message_get_structure (message);
if (s == NULL || !gst_structure_has_name (s, "prepare-xwindow-id")) { if (s == NULL || !gst_structure_has_name (s, "prepare-window-handle")) {
return GST_BUS_PASS; return GST_BUS_PASS;
} }
ov = GST_X_OVERLAY (GST_MESSAGE_SRC (message)); ov = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
g_print ("Creating our own window\n"); g_print ("Creating our own window\n");
@ -206,7 +206,8 @@ main (int argc, char **argv)
if (argc != 2) { if (argc != 2) {
g_print ("Usage: %s \"pipeline description with launch format\"\n", g_print ("Usage: %s \"pipeline description with launch format\"\n",
argv[0]); argv[0]);
g_print ("The pipeline should contain an element implementing XOverlay.\n"); g_print
("The pipeline should contain an element implementing GstVideoOverlay.\n");
g_print ("Example: %s \"videotestsrc ! ximagesink\"\n", argv[0]); g_print ("Example: %s \"videotestsrc ! ximagesink\"\n", argv[0]);
return -1; return -1;
} }

View file

@ -31,7 +31,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <gst/interfaces/propertyprobe.h> #include <gst/interfaces/propertyprobe.h>
#if !GTK_CHECK_VERSION (2, 17, 7) #if !GTK_CHECK_VERSION (2, 17, 7)
@ -105,7 +105,7 @@ realize_cb (GtkWidget * widget, gpointer data)
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
* as well */ * as well */
if (!gdk_window_ensure_native (window)) if (!gdk_window_ensure_native (window))
g_error ("Couldn't create native window needed for GstXOverlay!"); g_error ("Couldn't create native window needed for GstVideoOverlay!");
} }
#endif #endif
@ -270,10 +270,11 @@ main (int argc, char **argv)
g_assert (embed_xid != 0); g_assert (embed_xid != 0);
/* we know what the video sink is in this case (xvimagesink), so we can /* we know what the video sink is in this case (xvimagesink), so we can
* just set it directly here now (instead of waiting for a prepare-xwindow-id * just set it directly here now (instead of waiting for a
* element message in a sync bus handler and setting it there) */ * prepare-window-handle element message in a sync bus handler and setting
* it there) */
g_print ("setting XID %lu\n", embed_xid); g_print ("setting XID %lu\n", embed_xid);
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
g_idle_add (start_pipeline, pipeline); g_idle_add (start_pipeline, pipeline);
gtk_main (); gtk_main ();

View file

@ -1,7 +1,7 @@
/* GStreamer /* GStreamer
* Copyright (C) <2008> Stefan Kost <ensonic@users.sf.net> * Copyright (C) <2008> Stefan Kost <ensonic@users.sf.net>
* *
* test-xoverlay: test xoverlay custom event handling and subregions * test-videooverlay: test videooverlay custom event handling and subregions
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -32,7 +32,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/interfaces/xoverlay.h> #include <gst/interfaces/videooverlay.h>
#include <gst/video/gstvideosink.h> #include <gst/video/gstvideosink.h>
#if !GTK_CHECK_VERSION (2, 17, 7) #if !GTK_CHECK_VERSION (2, 17, 7)
@ -46,7 +46,7 @@ gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
static struct static struct
{ {
gint w, h; gint w, h;
GstXOverlay *overlay; GstVideoOverlay *overlay;
GtkWidget *widget; GtkWidget *widget;
gdouble a, p; gdouble a, p;
GstVideoRectangle rect; GstVideoRectangle rect;
@ -72,7 +72,7 @@ animate_render_rect (gpointer user_data)
r->h = anim_state.h / 2; r->h = anim_state.h / 2;
r->y = (r->h - (r->h / 2)) + s * (r->h / 2); r->y = (r->h - (r->h / 2)) + s * (r->h / 2);
gst_x_overlay_set_render_rectangle (anim_state.overlay, r->x, r->y, gst_video_overlay_set_render_rectangle (anim_state.overlay, r->x, r->y,
r->w, r->h); r->w, r->h);
gtk_widget_queue_draw (anim_state.widget); gtk_widget_queue_draw (anim_state.widget);
} }
@ -131,7 +131,7 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event,
if (verbose) { if (verbose) {
g_print ("expose(%p)\n", widget); g_print ("expose(%p)\n", widget);
} }
gst_x_overlay_expose (anim_state.overlay); gst_video_overlay_expose (anim_state.overlay);
return FALSE; return FALSE;
} }
@ -214,11 +214,12 @@ main (gint argc, gchar ** argv)
} }
/* we know what the video sink is in this case (xvimagesink), so we can /* we know what the video sink is in this case (xvimagesink), so we can
* just set it directly here now (instead of waiting for a prepare-xwindow-id * just set it directly here now (instead of waiting for a
* element message in a sync bus handler and setting it there) */ * prepare-window-handle element message in a sync bus handler and setting
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), embed_xid); * it there) */
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), embed_xid);
anim_state.overlay = GST_X_OVERLAY (sink); anim_state.overlay = GST_VIDEO_OVERLAY (sink);
anim_state.widget = video_window; anim_state.widget = video_window;
anim_state.w = 320; anim_state.w = 320;
anim_state.h = 240; anim_state.h = 240;