diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am index 8d46d438d9..22cfec4dd3 100644 --- a/sys/v4l2/Makefile.am +++ b/sys/v4l2/Makefile.am @@ -1,13 +1,12 @@ plugin_LTLIBRARIES = libgstvideo4linux2.la -# overlay is still not supported in current implementation -# if USE_XVIDEO -#xv_source = gstv4l2xoverlay.c -#xv_libs = $(X_LIBS) $(XVIDEO_LIBS) -#else -#xv_source = -#xv_libs = -#endif +if USE_XVIDEO +xv_source = gstv4l2xoverlay.c +xv_libs = $(X_LIBS) $(XVIDEO_LIBS) +else +xv_source = +xv_libs = +endif libgstvideo4linux2_la_SOURCES = gstv4l2.c \ gstv4l2colorbalance.c \ diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 4abdb107a3..aaa88d4d78 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -34,7 +34,7 @@ #include "v4l2_calls.h" #include "gstv4l2tuner.h" -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO #include "gstv4l2xoverlay.h" #endif #include "gstv4l2colorbalance.h" @@ -695,7 +695,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object) else return FALSE; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO gst_v4l2_xoverlay_start (v4l2object); #endif @@ -705,7 +705,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object) gboolean gst_v4l2_object_stop (GstV4l2Object * v4l2object) { -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO gst_v4l2_xoverlay_stop (v4l2object); #endif diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 703c304807..cec4c80f66 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -43,7 +43,7 @@ #include "gstv4l2colorbalance.h" -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO #include "gstv4l2xoverlay.h" #endif #include "gstv4l2vidorient.h" @@ -75,7 +75,7 @@ enum GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SinkClass, gst_v4l2sink); GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Sink, gst_v4l2sink); -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Sink, gst_v4l2sink); #endif GST_IMPLEMENT_V4L2_VIDORIENT_METHODS (GstV4l2Sink, gst_v4l2sink); @@ -85,7 +85,7 @@ gst_v4l2sink_iface_supported (GstImplementsInterface * iface, GType iface_type) { GstV4l2Object *v4l2object = GST_V4L2SINK (iface)->v4l2object; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO g_assert (iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE || iface_type == GST_TYPE_VIDEO_ORIENTATION); @@ -97,7 +97,7 @@ gst_v4l2sink_iface_supported (GstImplementsInterface * iface, GType iface_type) if (v4l2object->video_fd == -1) return FALSE; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2object)) return FALSE; #endif @@ -122,7 +122,7 @@ gst_v4l2sink_init_interfaces (GType type) NULL, NULL, }; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO static const GInterfaceInfo v4l2_xoverlay_info = { (GInterfaceInitFunc) gst_v4l2sink_xoverlay_interface_init, NULL, @@ -147,7 +147,7 @@ gst_v4l2sink_init_interfaces (GType type) g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); #endif g_type_add_interface_static (type, @@ -638,6 +638,12 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, V4L2_BUF_TYPE_VIDEO_OUTPUT))) { return GST_FLOW_ERROR; } +#ifdef HAVE_XVIDEO + if (GST_V4L2_IS_OVERLAY (v4l2sink->v4l2object)) { + gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (v4l2sink)); + } +#endif + v4l2sink->state = STATE_PENDING_STREAMON; GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()"); diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 4724fe9675..3fd26519ee 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -51,7 +51,7 @@ #include "gstv4l2colorbalance.h" #include "gstv4l2tuner.h" -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO #include "gstv4l2xoverlay.h" #endif #include "gstv4l2vidorient.h" @@ -79,7 +79,7 @@ enum GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src); GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src); GST_IMPLEMENT_V4L2_TUNER_METHODS (GstV4l2Src, gst_v4l2src); -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Src, gst_v4l2src); #endif GST_IMPLEMENT_V4L2_VIDORIENT_METHODS (GstV4l2Src, gst_v4l2src); @@ -92,7 +92,7 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type) { GstV4l2Object *v4l2object = GST_V4L2SRC (iface)->v4l2object; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO g_assert (iface_type == GST_TYPE_TUNER || iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE || @@ -106,7 +106,7 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type) if (v4l2object->video_fd == -1) return FALSE; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2object)) return FALSE; #endif @@ -142,7 +142,7 @@ gst_v4l2src_init_interfaces (GType type) NULL, NULL, }; -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO static const GInterfaceInfo v4l2_xoverlay_info = { (GInterfaceInitFunc) gst_v4l2src_xoverlay_interface_init, NULL, @@ -169,7 +169,7 @@ gst_v4l2src_init_interfaces (GType type) g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l2_tuner_info); -#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ +#ifdef HAVE_XVIDEO g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); #endif g_type_add_interface_static (type, diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c index 4c13e5bfdd..1b1e63b67d 100644 --- a/sys/v4l2/gstv4l2xoverlay.c +++ b/sys/v4l2/gstv4l2xoverlay.c @@ -37,6 +37,8 @@ #include "gstv4l2object.h" #include "v4l2_calls.h" +#include "gst/gst-i18n-plugin.h" + struct _GstV4l2Xv { Display *dpy; @@ -101,7 +103,8 @@ gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object) } min = s.st_rdev & 0xff; for (i = 0; i < anum; i++) { - if (!strcmp (ai[i].name, "video4linux2")) { + if (!strcmp (ai[i].name, "video4linux2") || + !strcmp (ai[i].name, "video4linux")) { if (first_id == 0) first_id = ai[i].base_id;