vaapisink overlay
imeshns
imeshns at gmail.com
Sat Aug 6 06:54:57 UTC 2016
Hi,
I use example from the internet and when I'm using glimagesink everything is
ok, but when I use vaapisink the overlay does not work correct, only black
screen. When I use gst-inspect with vaapisink it's ok, but Gtk overlay does
not work.
What's wrong?
Thanks for all help.
My code:
#include <gst/gst.h>
#include <gst/video/videooverlay.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#if defined (GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
#elif defined (GDK_WINDOWING_WIN32)
#include <gdk/gdkwin32.h>
#elif defined (GDK_WINDOWING_QUARTZ)
#include <gdk/gdkquartz.h>
#endif
static void realize_cb (GtkWidget *widget, GstElement *sink)
{
GdkWindow *window = gtk_widget_get_window (widget);
guintptr window_handle;
if (!gdk_window_ensure_native (window))
g_error ("Couldn't create native window needed for GstXOverlay!");
#if defined (GDK_WINDOWING_WIN32)
window_handle = (guintptr)GDK_WINDOW_HWND (window);
#elif defined (GDK_WINDOWING_QUARTZ)
window_handle = gdk_quartz_window_get_nsview (window);
#elif defined (GDK_WINDOWING_X11)
window_handle = GDK_WINDOW_XID (window);
#endif
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink),
window_handle);
}
int main (void)
{
gst_init (NULL, NULL);
gtk_init (NULL, NULL);
GError *error = NULL;
GstElement *pipeline, *sink;
GtkWidget *windowHead = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *video_window;
pipeline = gst_parse_launch ("rtspsrc latency=5 drop-on-latency=true
protocols=1 location=rtsp://x.x.x.x ! rtph264depay ! h264parse !
vaapidecodebin ! vaapisink name=sink", &error);
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
video_window = gtk_drawing_area_new ();
g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), sink);
gtk_container_add (GTK_CONTAINER (windowHead), video_window);
gtk_window_set_default_size (GTK_WINDOW (windowHead), 800, 600);
gtk_widget_show_all (windowHead);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("Now playing...\n");
gtk_main();
return 0;
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/vaapisink-overlay-tp4678988.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list