Enable the V4L2 support in Kopete. Tested with MSN webcam support.

ok robert@
This commit is contained in:
brad 2008-09-07 22:58:25 +00:00
parent d0ee955f35
commit 9ff8167cd5
5 changed files with 557 additions and 8 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.60 2008/08/27 15:21:50 espie Exp $
# $OpenBSD: Makefile,v 1.61 2008/09/07 22:58:25 brad Exp $
COMMENT = K Desktop Environment, network applications
CATEGORIES = x11 x11/kde
VERSION = 3.5.10
DISTNAME = kdenetwork-${VERSION}
PKGNAME = ${DISTNAME}
PKGNAME = ${DISTNAME}p0
MODKDE_VERSION = 3.5.8
FLAVORS = debug
SHARED_LIBS += kopete 2.0 # .1.0
@ -27,7 +27,6 @@ WANTLIB = ICE SM X11 Xext Xi Xrender Xss Xtst Xxf86vm art_lgpl_2 c \
png pthread ssl stdc++ util xml2 xslt z glib-2.0 gmodule-2.0 \
Xau Xdmcp fam rpcsvc
post-configure:
@touch ${WRKSRC}/Makefile.in
@touch ${WRKBUILD}/Makefile

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-kopete_libkopete_avdevice_videocontrol_h,v 1.1 2007/10/24 21:52:18 espie Exp $
--- kopete/libkopete/avdevice/videocontrol.h.orig Wed Oct 24 00:18:36 2007
+++ kopete/libkopete/avdevice/videocontrol.h Wed Oct 24 00:22:20 2007
$OpenBSD: patch-kopete_libkopete_avdevice_videocontrol_h,v 1.2 2008/09/07 22:58:25 brad Exp $
--- kopete/libkopete/avdevice/videocontrol.h.orig Mon Oct 8 05:49:07 2007
+++ kopete/libkopete/avdevice/videocontrol.h Sun Jun 22 03:01:23 2008
@@ -20,15 +20,12 @@
#ifndef KOPETE_AVVIDEOCONTROL_H
#define KOPETE_AVVIDEOCONTROL_H
@ -11,14 +11,14 @@ $OpenBSD: patch-kopete_libkopete_avdevice_videocontrol_h,v 1.1 2007/10/24 21:52:
-#define __u64 unsigned long long
-#endif // __u64
+#include <stdint.h>
+#define __u64 uint64_t
-#ifndef __s64 //required by videodev.h
-#define __s64 long long
-#endif // __s64
+#define __s64 int64_t
+#define __u32 uint32_t
+#define __s32 int32_t
+#define __u64 uint64_t
+#define __u32 uint32_t
#include <qstring.h>
#include <kdebug.h>

View File

@ -0,0 +1,474 @@
$OpenBSD: patch-kopete_libkopete_avdevice_videodevice_cpp,v 1.3 2008/09/07 23:00:17 brad Exp $
--- kopete/libkopete/avdevice/videodevice.cpp.orig Wed Feb 13 16:03:06 2008
+++ kopete/libkopete/avdevice/videodevice.cpp Sun Jun 22 03:59:23 2008
@@ -181,7 +181,7 @@ int VideoDevice::checkDevice()
m_videostream=false;
m_driver=VIDEODEV_DRIVER_NONE;
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
//if(!getWorkaroundBrokenDriver())
@@ -360,6 +360,7 @@ kdDebug(14010) << k_funcinfo << " Control: " << QStri
}
#endif
+#ifdef __linux__
CLEAR(V4L_capabilities);
@@ -425,6 +426,7 @@ kdDebug(14010) << k_funcinfo << " Control: " << QStri
}
}
#endif
+#endif
m_name=m_model; // Take care about changing the name to be different from the model itself...
detectPixelFormats();
@@ -512,7 +514,7 @@ int VideoDevice::initDevice()
m_io_method = IO_METHOD_NONE;
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
if(V4L2_capabilities.capabilities & V4L2_CAP_READWRITE)
@@ -540,6 +542,7 @@ int VideoDevice::initDevice()
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
m_videoread=true;
m_io_method=IO_METHOD_READ;
@@ -551,6 +554,7 @@ int VideoDevice::initDevice()
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
@@ -558,7 +562,7 @@ int VideoDevice::initDevice()
}
// Select video input, video standard and tune here.
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (-1 == xioctl (VIDIOC_CROPCAP, &cropcap))
@@ -676,7 +680,7 @@ kdDebug(14010) << k_funcinfo << "setSize(" << newwidt
// Change resolution for the video device
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
// CLEAR (fmt);
@@ -705,6 +709,7 @@ kdDebug(14010) << k_funcinfo << "VIDIOC_S_FMT worked (
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_window V4L_videowindow;
@@ -734,6 +739,7 @@ kdDebug(14010) << "------------- width: " << V4L_video
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -778,7 +784,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format
// Change the pixel format for the video device
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
// CLEAR (fmt);
@@ -805,6 +811,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -829,6 +836,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -867,7 +875,7 @@ int VideoDevice::selectInput(int newinput)
{
switch (m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
if (-1 == ioctl (descriptor, VIDIOC_S_INPUT, &newinput))
@@ -877,6 +885,7 @@ int VideoDevice::selectInput(int newinput)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
struct video_channel V4L_input;
V4L_input.channel=newinput;
@@ -888,6 +897,7 @@ int VideoDevice::selectInput(int newinput)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -935,7 +945,7 @@ int VideoDevice::startCapturing()
case IO_METHOD_READ: // Nothing to do
break;
case IO_METHOD_MMAP:
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
{
unsigned int loop;
@@ -957,7 +967,7 @@ int VideoDevice::startCapturing()
#endif
break;
case IO_METHOD_USERPTR:
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
{
unsigned int loop;
@@ -995,7 +1005,7 @@ int VideoDevice::getFrame()
/// @todo implement me
ssize_t bytesread;
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
struct v4l2_buffer v4l2buffer;
#endif
@@ -1029,7 +1039,7 @@ int VideoDevice::getFrame()
}
break;
case IO_METHOD_MMAP:
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
CLEAR (v4l2buffer);
v4l2buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -1089,7 +1099,7 @@ memcpy(&m_currentbuffer.data[0], m_rawbuffers[v4l2buff
#endif
break;
case IO_METHOD_USERPTR:
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
{
unsigned int i;
@@ -1475,7 +1485,7 @@ float VideoDevice::setBrightness(float brightness)
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
{
@@ -1512,6 +1522,7 @@ float VideoDevice::setBrightness(float brightness)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1523,6 +1534,7 @@ float VideoDevice::setBrightness(float brightness)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1545,7 +1557,7 @@ float VideoDevice::setContrast(float contrast)
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
{
@@ -1582,6 +1594,7 @@ float VideoDevice::setContrast(float contrast)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1593,6 +1606,7 @@ float VideoDevice::setContrast(float contrast)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1615,7 +1629,7 @@ float VideoDevice::setSaturation(float saturation)
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
{
@@ -1652,6 +1666,7 @@ float VideoDevice::setSaturation(float saturation)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1663,6 +1678,7 @@ float VideoDevice::setSaturation(float saturation)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1685,7 +1701,7 @@ float VideoDevice::setWhiteness(float whiteness)
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
{
@@ -1722,6 +1738,7 @@ float VideoDevice::setWhiteness(float whiteness)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1733,6 +1750,7 @@ float VideoDevice::setWhiteness(float whiteness)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1755,7 +1773,7 @@ float VideoDevice::setHue(float hue)
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
{
@@ -1792,6 +1810,7 @@ float VideoDevice::setHue(float hue)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1803,6 +1822,7 @@ float VideoDevice::setHue(float hue)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1876,7 +1896,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int p
{
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
switch(palette)
@@ -1927,6 +1947,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int p
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
switch(palette)
{
@@ -1945,6 +1966,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int p
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return PIXELFORMAT_NONE; break;
@@ -1956,7 +1978,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelfor
{
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
switch(pixelformat)
@@ -2007,6 +2029,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelfor
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
switch(pixelformat)
{
@@ -2052,6 +2075,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelfor
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return PIXELFORMAT_NONE; break;
@@ -2162,7 +2186,7 @@ QString VideoDevice::pixelFormatName(int pixelformat)
returnvalue = "None";
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
switch(pixelformat)
@@ -2213,6 +2237,7 @@ QString VideoDevice::pixelFormatName(int pixelformat)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
switch(pixelformat)
{
@@ -2230,6 +2255,7 @@ QString VideoDevice::pixelFormatName(int pixelformat)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -2242,7 +2268,7 @@ int VideoDevice::detectPixelFormats()
int err = 0;
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
fmtdesc.index = 0;
@@ -2264,6 +2290,7 @@ int VideoDevice::detectPixelFormats()
}
// break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
// TODO: THis thing can be used to detec what pixel formats are supported in a API-independent way, but V4L2 has VIDIOC_ENUM_PIXFMT.
// The correct thing to do is to isolate these calls and do a proper implementation for V4L and another for V4L2 when this thing will be migrated to a plugin architecture.
@@ -2308,6 +2335,7 @@ int VideoDevice::detectPixelFormats()
if(PIXELFORMAT_NONE != setPixelFormat(PIXELFORMAT_YYUV)) kdDebug(14010) << k_funcinfo << pixelFormatName(PIXELFORMAT_YYUV) << endl;
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return PIXELFORMAT_NONE; break;
@@ -2319,7 +2347,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard
{
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
switch(standard)
@@ -2362,6 +2390,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
switch(standard)
{
@@ -2403,6 +2432,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return STANDARD_NONE; break;
@@ -2461,7 +2491,7 @@ QString VideoDevice::signalStandardName(int standard)
returnvalue = "None";
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
switch(standard)
@@ -2503,6 +2533,7 @@ QString VideoDevice::signalStandardName(int standard)
}
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
switch(standard)
{
@@ -2517,6 +2548,7 @@ QString VideoDevice::signalStandardName(int standard)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -2531,13 +2563,15 @@ int VideoDevice::detectSignalStandards()
{
switch(m_driver)
{
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
break;
#endif
+#ifdef __linux__
case VIDEODEV_DRIVER_V4L:
break;
+#endif
#endif
case VIDEODEV_DRIVER_NONE:
default:

View File

@ -0,0 +1,64 @@
$OpenBSD: patch-kopete_libkopete_avdevice_videodevice_h,v 1.3 2008/09/07 23:00:17 brad Exp $
--- kopete/libkopete/avdevice/videodevice.h.orig Sun Jun 22 02:46:34 2008
+++ kopete/libkopete/avdevice/videodevice.h Sun Jun 22 04:05:39 2008
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <signal.h>
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && defined(__linux__)
#include <asm/types.h>
#undef __STRICT_ANSI__
@@ -61,6 +61,18 @@
#endif // __linux__
+#if defined(ENABLE_AV) && defined(__OpenBSD__)
+
+#include <stdint.h>
+
+#define __s64 int64_t
+#define __s32 int32_t
+#define __u64 uint64_t
+#define __u32 uint32_t
+
+#include <sys/videoio.h>
+#endif // __OpenBSD__
+
#include <qstring.h>
#include <qfile.h>
#include <qimage.h>
@@ -80,9 +92,11 @@ namespace AV {
typedef enum
{
VIDEODEV_DRIVER_NONE
-#if defined( __linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
+#ifdef __linux__
,
VIDEODEV_DRIVER_V4L
+#endif
#ifdef V4L2_CAP_VIDEO_CAPTURE
,
VIDEODEV_DRIVER_V4L2
@@ -276,7 +290,7 @@ class VideoDevice{ (public)
int descriptor;
//protected:
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
#ifdef V4L2_CAP_VIDEO_CAPTURE
struct v4l2_capability V4L2_capabilities;
struct v4l2_cropcap cropcap;
@@ -289,8 +303,10 @@ class VideoDevice{ (public)
void enumerateMenu (void);
#endif
+#ifdef __linux__
struct video_capability V4L_capabilities;
struct video_buffer V4L_videobuffer;
+#endif
#endif
QValueVector<Kopete::AV::VideoInput> m_input;
QValueVector<Kopete::AV::VideoControl> m_control;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-kopete_libkopete_avdevice_videodevicepool_cpp,v 1.3 2008/09/07 23:00:17 brad Exp $
--- kopete/libkopete/avdevice/videodevicepool.cpp.orig Mon Jun 16 17:31:03 2008
+++ kopete/libkopete/avdevice/videodevicepool.cpp Mon Jun 16 17:32:41 2008
@@ -608,7 +608,7 @@ int VideoDevicePool::scanDevices()
/// @todo implement me
kdDebug(14010) << k_funcinfo << "called" << endl;
-#if defined(__linux__) && defined(ENABLE_AV)
+#if defined(ENABLE_AV) && (defined(__linux__) || defined(__OpenBSD__))
QDir videodevice_dir;
const QString videodevice_dir_path=QString::fromLocal8Bit("/dev/v4l/");
const QString videodevice_dir_filter=QString::fromLocal8Bit("video*");