v4l2: re-enable x-overlay support

This commit is contained in:
Rob Clark 2010-04-04 06:37:16 -05:00
parent 417b899c44
commit 67cd90408f
5 changed files with 32 additions and 24 deletions

View file

@ -1,13 +1,12 @@
plugin_LTLIBRARIES = libgstvideo4linux2.la plugin_LTLIBRARIES = libgstvideo4linux2.la
# overlay is still not supported in current implementation if USE_XVIDEO
# if USE_XVIDEO xv_source = gstv4l2xoverlay.c
#xv_source = gstv4l2xoverlay.c xv_libs = $(X_LIBS) $(XVIDEO_LIBS)
#xv_libs = $(X_LIBS) $(XVIDEO_LIBS) else
#else xv_source =
#xv_source = xv_libs =
#xv_libs = endif
#endif
libgstvideo4linux2_la_SOURCES = gstv4l2.c \ libgstvideo4linux2_la_SOURCES = gstv4l2.c \
gstv4l2colorbalance.c \ gstv4l2colorbalance.c \

View file

@ -34,7 +34,7 @@
#include "v4l2_calls.h" #include "v4l2_calls.h"
#include "gstv4l2tuner.h" #include "gstv4l2tuner.h"
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
#include "gstv4l2xoverlay.h" #include "gstv4l2xoverlay.h"
#endif #endif
#include "gstv4l2colorbalance.h" #include "gstv4l2colorbalance.h"
@ -695,7 +695,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object)
else else
return FALSE; return FALSE;
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
gst_v4l2_xoverlay_start (v4l2object); gst_v4l2_xoverlay_start (v4l2object);
#endif #endif
@ -705,7 +705,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object)
gboolean gboolean
gst_v4l2_object_stop (GstV4l2Object * v4l2object) gst_v4l2_object_stop (GstV4l2Object * v4l2object)
{ {
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
gst_v4l2_xoverlay_stop (v4l2object); gst_v4l2_xoverlay_stop (v4l2object);
#endif #endif

View file

@ -43,7 +43,7 @@
#include "gstv4l2colorbalance.h" #include "gstv4l2colorbalance.h"
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
#include "gstv4l2xoverlay.h" #include "gstv4l2xoverlay.h"
#endif #endif
#include "gstv4l2vidorient.h" #include "gstv4l2vidorient.h"
@ -75,7 +75,7 @@ enum
GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SinkClass, gst_v4l2sink); GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SinkClass, gst_v4l2sink);
GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Sink, 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); GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Sink, gst_v4l2sink);
#endif #endif
GST_IMPLEMENT_V4L2_VIDORIENT_METHODS (GstV4l2Sink, gst_v4l2sink); 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; 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 || g_assert (iface_type == GST_TYPE_X_OVERLAY ||
iface_type == GST_TYPE_COLOR_BALANCE || iface_type == GST_TYPE_COLOR_BALANCE ||
iface_type == GST_TYPE_VIDEO_ORIENTATION); iface_type == GST_TYPE_VIDEO_ORIENTATION);
@ -97,7 +97,7 @@ gst_v4l2sink_iface_supported (GstImplementsInterface * iface, GType iface_type)
if (v4l2object->video_fd == -1) if (v4l2object->video_fd == -1)
return FALSE; 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)) if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2object))
return FALSE; return FALSE;
#endif #endif
@ -122,7 +122,7 @@ gst_v4l2sink_init_interfaces (GType type)
NULL, NULL,
NULL, NULL,
}; };
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
static const GInterfaceInfo v4l2_xoverlay_info = { static const GInterfaceInfo v4l2_xoverlay_info = {
(GInterfaceInitFunc) gst_v4l2sink_xoverlay_interface_init, (GInterfaceInitFunc) gst_v4l2sink_xoverlay_interface_init,
NULL, NULL,
@ -147,7 +147,7 @@ gst_v4l2sink_init_interfaces (GType type)
g_type_add_interface_static (type, g_type_add_interface_static (type,
GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); 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); g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info);
#endif #endif
g_type_add_interface_static (type, 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))) { V4L2_BUF_TYPE_VIDEO_OUTPUT))) {
return GST_FLOW_ERROR; 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; v4l2sink->state = STATE_PENDING_STREAMON;
GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()"); GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()");

View file

@ -51,7 +51,7 @@
#include "gstv4l2colorbalance.h" #include "gstv4l2colorbalance.h"
#include "gstv4l2tuner.h" #include "gstv4l2tuner.h"
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
#include "gstv4l2xoverlay.h" #include "gstv4l2xoverlay.h"
#endif #endif
#include "gstv4l2vidorient.h" #include "gstv4l2vidorient.h"
@ -79,7 +79,7 @@ enum
GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src); GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src);
GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src); GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src);
GST_IMPLEMENT_V4L2_TUNER_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); GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Src, gst_v4l2src);
#endif #endif
GST_IMPLEMENT_V4L2_VIDORIENT_METHODS (GstV4l2Src, gst_v4l2src); 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; 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 || g_assert (iface_type == GST_TYPE_TUNER ||
iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_X_OVERLAY ||
iface_type == GST_TYPE_COLOR_BALANCE || iface_type == GST_TYPE_COLOR_BALANCE ||
@ -106,7 +106,7 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type)
if (v4l2object->video_fd == -1) if (v4l2object->video_fd == -1)
return FALSE; 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)) if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2object))
return FALSE; return FALSE;
#endif #endif
@ -142,7 +142,7 @@ gst_v4l2src_init_interfaces (GType type)
NULL, NULL,
NULL, NULL,
}; };
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #ifdef HAVE_XVIDEO
static const GInterfaceInfo v4l2_xoverlay_info = { static const GInterfaceInfo v4l2_xoverlay_info = {
(GInterfaceInitFunc) gst_v4l2src_xoverlay_interface_init, (GInterfaceInitFunc) gst_v4l2src_xoverlay_interface_init,
NULL, NULL,
@ -169,7 +169,7 @@ gst_v4l2src_init_interfaces (GType type)
g_type_add_interface_static (type, g_type_add_interface_static (type,
GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info);
g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l2_tuner_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); g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info);
#endif #endif
g_type_add_interface_static (type, g_type_add_interface_static (type,

View file

@ -37,6 +37,8 @@
#include "gstv4l2object.h" #include "gstv4l2object.h"
#include "v4l2_calls.h" #include "v4l2_calls.h"
#include "gst/gst-i18n-plugin.h"
struct _GstV4l2Xv struct _GstV4l2Xv
{ {
Display *dpy; Display *dpy;
@ -101,7 +103,8 @@ gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object)
} }
min = s.st_rdev & 0xff; min = s.st_rdev & 0xff;
for (i = 0; i < anum; i++) { 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) if (first_id == 0)
first_id = ai[i].base_id; first_id = ai[i].base_id;