mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
uvch264: Make gudev/libusb a hard dependency and remove XU_FIND_UNIT ioctl support
Conflicts: sys/uvch264/gstuvch264_src.c
This commit is contained in:
parent
b807753453
commit
7a7267b402
3 changed files with 80 additions and 113 deletions
|
@ -694,7 +694,7 @@ AG_GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
|
||||||
dnl *** UVC H264 ***
|
dnl *** UVC H264 ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_UVCH264, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_UVCH264, true)
|
||||||
AG_GST_CHECK_FEATURE(UVCH264, [UVC H264], uvch264, [
|
AG_GST_CHECK_FEATURE(UVCH264, [UVC H264], uvch264, [
|
||||||
AC_CHECK_HEADER(linux/uvcvideo.h, HAVE_UVCH264=yes, HAVE_UVCH264=no)
|
AC_CHECK_HEADER(linux/uvcvideo.h, HAVE_UVCVIDEO_H=yes, HAVE_UVCVIDEO_H=no)
|
||||||
AG_GST_PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-0.10 >= 0.10.36)
|
AG_GST_PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-0.10 >= 0.10.36)
|
||||||
PKG_CHECK_MODULES(G_UDEV, gudev-1.0 , [
|
PKG_CHECK_MODULES(G_UDEV, gudev-1.0 , [
|
||||||
AC_DEFINE([HAVE_GUDEV], 1, [Define if gudev is installed])
|
AC_DEFINE([HAVE_GUDEV], 1, [Define if gudev is installed])
|
||||||
|
@ -704,6 +704,13 @@ AG_GST_CHECK_FEATURE(UVCH264, [UVC H264], uvch264, [
|
||||||
AC_DEFINE([HAVE_LIBUSB], 1, [Define if libusb 1.x is installed])
|
AC_DEFINE([HAVE_LIBUSB], 1, [Define if libusb 1.x is installed])
|
||||||
HAVE_LIBUSB="yes" ],
|
HAVE_LIBUSB="yes" ],
|
||||||
[HAVE_LIBUSB="no"])
|
[HAVE_LIBUSB="no"])
|
||||||
|
if test "x$HAVE_UVCVIDEO_H" == "xyes" && \
|
||||||
|
test "x$HAVE_GUDEV" == "xyes" && \
|
||||||
|
test "x$HAVE_LIBUSB" == "xyes"; then
|
||||||
|
HAVE_UVCH264=yes
|
||||||
|
else
|
||||||
|
HAVE_UVCH264=no
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
AC_SUBST(LIBUDEV_CFLAGS)
|
AC_SUBST(LIBUDEV_CFLAGS)
|
||||||
AC_SUBST(LIBUDEV_LIBS)
|
AC_SUBST(LIBUDEV_LIBS)
|
||||||
|
|
|
@ -32,13 +32,16 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstuvch264_src.h"
|
||||||
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <linux/uvcvideo.h>
|
#include <linux/uvcvideo.h>
|
||||||
#include <linux/usb/video.h>
|
#include <linux/usb/video.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if defined (HAVE_GUDEV) && defined (HAVE_LIBUSB)
|
#include "gstuvch264_src.h"
|
||||||
|
#include "gstuvch264-marshal.h"
|
||||||
#include <gudev/gudev.h>
|
#include <gudev/gudev.h>
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
|
@ -61,22 +64,6 @@ typedef struct
|
||||||
#define USB_VIDEO_CONTROL 1
|
#define USB_VIDEO_CONTROL 1
|
||||||
#define USB_VIDEO_CONTROL_INTERFACE 0x24
|
#define USB_VIDEO_CONTROL_INTERFACE 0x24
|
||||||
#define USB_VIDEO_CONTROL_XU_TYPE 0x06
|
#define USB_VIDEO_CONTROL_XU_TYPE 0x06
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gstuvch264_src.h"
|
|
||||||
|
|
||||||
#ifndef UVCIOC_XU_FIND_UNIT
|
|
||||||
/* Define the needed structure if <linux/uvcvideo.h> is too old.
|
|
||||||
* This might fail though if the kernel itself does not support it.
|
|
||||||
*/
|
|
||||||
struct uvc_xu_find_unit
|
|
||||||
{
|
|
||||||
__u8 guid[16];
|
|
||||||
__u8 unit;
|
|
||||||
};
|
|
||||||
#define UVCIOC_XU_FIND_UNIT _IOWR('u', 0x22, struct uvc_xu_find_unit)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -628,13 +615,9 @@ gst_uvc_h264_src_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
GstUvcH264Src *self = GST_UVC_H264_SRC (object);
|
GstUvcH264Src *self = GST_UVC_H264_SRC (object);
|
||||||
|
|
||||||
#if defined (HAVE_GUDEV) && defined (HAVE_LIBUSB)
|
|
||||||
if (self->usb_ctx)
|
if (self->usb_ctx)
|
||||||
libusb_exit (self->usb_ctx);
|
libusb_exit (self->usb_ctx);
|
||||||
self->usb_ctx = NULL;
|
self->usb_ctx = NULL;
|
||||||
#else
|
|
||||||
(void) self;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -1811,20 +1794,7 @@ gst_uvc_h264_src_event (GstPad * pad, GstEvent * event)
|
||||||
static guint8
|
static guint8
|
||||||
xu_get_id (GstUvcH264Src * self)
|
xu_get_id (GstUvcH264Src * self)
|
||||||
{
|
{
|
||||||
struct uvc_xu_find_unit xu;
|
|
||||||
static const __u8 guid[16] = GUID_UVCX_H264_XU;
|
static const __u8 guid[16] = GUID_UVCX_H264_XU;
|
||||||
|
|
||||||
if (self->v4l2_fd == -1) {
|
|
||||||
GST_WARNING_OBJECT (self, "Can't query XU with fd = -1");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (xu.guid, guid, 16);
|
|
||||||
xu.unit = 0;
|
|
||||||
|
|
||||||
if (-1 == ioctl (self->v4l2_fd, UVCIOC_XU_FIND_UNIT, &xu)) {
|
|
||||||
#if defined (HAVE_GUDEV) && defined (HAVE_LIBUSB)
|
|
||||||
/* Fallback on libusb */
|
|
||||||
GUdevClient *client;
|
GUdevClient *client;
|
||||||
GUdevDevice *udevice;
|
GUdevDevice *udevice;
|
||||||
GUdevDevice *parent;
|
GUdevDevice *parent;
|
||||||
|
@ -1835,7 +1805,6 @@ xu_get_id (GstUvcH264Src * self)
|
||||||
ssize_t cnt;
|
ssize_t cnt;
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "XU_FIND_UNIT ioctl failed. Fallback on libusb");
|
|
||||||
|
|
||||||
if (self->usb_ctx == NULL)
|
if (self->usb_ctx == NULL)
|
||||||
libusb_init (&self->usb_ctx);
|
libusb_init (&self->usb_ctx);
|
||||||
|
@ -1910,13 +1879,8 @@ xu_get_id (GstUvcH264Src * self)
|
||||||
}
|
}
|
||||||
libusb_unref_device (device);
|
libusb_unref_device (device);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
GST_WARNING_OBJECT (self, "XU_FIND_UNIT ioctl failed");
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return xu.unit;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/basecamerabinsrc/gstbasecamerasrc.h>
|
#include <gst/basecamerabinsrc/gstbasecamerasrc.h>
|
||||||
#if defined (HAVE_GUDEV) && defined (HAVE_LIBUSB)
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "uvc_h264.h"
|
#include "uvc_h264.h"
|
||||||
|
|
||||||
|
@ -105,9 +103,7 @@ struct _GstUvcH264Src
|
||||||
|
|
||||||
int v4l2_fd;
|
int v4l2_fd;
|
||||||
guint8 h264_unit_id;
|
guint8 h264_unit_id;
|
||||||
#if defined (HAVE_GUDEV) && defined (HAVE_LIBUSB)
|
|
||||||
libusb_context *usb_ctx;
|
libusb_context *usb_ctx;
|
||||||
#endif
|
|
||||||
|
|
||||||
GstPadEventFunction srcpad_event_func;
|
GstPadEventFunction srcpad_event_func;
|
||||||
GstEvent *key_unit_event;
|
GstEvent *key_unit_event;
|
||||||
|
|
Loading…
Reference in a new issue