summaryrefslogtreecommitdiffstats
path: root/kopete
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-06-27 15:38:58 +0300
committerMavridis Philippe <mavridisf@gmail.com>2021-06-30 11:04:57 +0300
commit88c2dc15e7839673636c0f26b87d7318d7b931f9 (patch)
tree830d569cfafc08ab2f3d63cf3050d33d0f6e6122 /kopete
parent715f32e924b14576c39dc3337806db2d690b8fe2 (diff)
downloadtdenetwork-88c2dc15e7839673636c0f26b87d7318d7b931f9.tar.gz
tdenetwork-88c2dc15e7839673636c0f26b87d7318d7b931f9.zip
Fixes for Kopete videodevice support
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit de786a075b31b4988341a625ef85c081530e2a7d)
Diffstat (limited to 'kopete')
-rw-r--r--kopete/ConfigureChecks.cmake12
-rw-r--r--kopete/libkopete/avdevice/videodevice.cpp120
-rw-r--r--kopete/libkopete/avdevice/videodevice.h12
-rw-r--r--kopete/libkopete/avdevice/videodevicepool.cpp17
4 files changed, 88 insertions, 73 deletions
diff --git a/kopete/ConfigureChecks.cmake b/kopete/ConfigureChecks.cmake
index 445c76f9..c8e03e06 100644
--- a/kopete/ConfigureChecks.cmake
+++ b/kopete/ConfigureChecks.cmake
@@ -46,13 +46,13 @@ endif( )
### Check for videodev header
-check_include_file( "libv4l1-videodev.h" HAVE_LIBV4L1_VIDEODEV_H )
-if( HAVE_LIBV4L1_VIDEODEV_H )
- set( VIDEODEV_HEADER "libv4l1-videodev.h" CACHE INTERNAL "" )
+check_include_file( "linux/videodev2.h" HAVE_VIDEODEV_H )
+if( HAVE_VIDEODEV_H )
+ set( VIDEODEV_HEADER "linux/videodev2.h" CACHE INTERNAL "" )
else( )
- check_include_file( "linux/videodev.h" HAVE_VIDEODEV_H )
- if( HAVE_VIDEODEV_H )
- set( VIDEODEV_HEADER "linux/videodev.h" CACHE INTERNAL "" )
+ check_include_file( "libv4l1-videodev.h" HAVE_LIBV4L1_VIDEODEV_H )
+ if( HAVE_LIBV4L1_VIDEODEV_H )
+ set( VIDEODEV_HEADER "libv4l1-videodev.h" CACHE INTERNAL "" )
else( )
if( BUILD_KOPETE_PLUGIN_MOTIONAUTOAWAY )
tde_message_fatal( "libv4l1-videodev.h or linux/videodev.h is required, but not found on your system" )
diff --git a/kopete/libkopete/avdevice/videodevice.cpp b/kopete/libkopete/avdevice/videodevice.cpp
index f79479e7..801d8950 100644
--- a/kopete/libkopete/avdevice/videodevice.cpp
+++ b/kopete/libkopete/avdevice/videodevice.cpp
@@ -57,7 +57,7 @@ VideoDevice::~VideoDevice()
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
void VideoDevice::enumerateMenu (void)
{
@@ -181,7 +181,7 @@ int VideoDevice::checkDevice()
m_driver=VIDEODEV_DRIVER_NONE;
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
//if(!getWorkaroundBrokenDriver())
{
@@ -321,7 +321,7 @@ kdDebug(14010) << k_funcinfo << " Control: " << TQString(TQString::fromLocal8Bi
kdDebug(14010) << k_funcinfo << "Checking CID private controls" << endl;
-for (currentid = V4L2_CID_PRIVATE_BASE;; currentid++)
+for (currentid = V4L2_CID_PRIVATE_BASE; currentid < V4L2_CID_PRIVATE_BASE + V4L2_CID_LASTP1 - V4L2_CID_BASE; currentid++)
//for (queryctrl.id = 9963776; queryctrl.id < 9963800; queryctrl.id++)
{
queryctrl.id = currentid;
@@ -358,7 +358,7 @@ kdDebug(14010) << k_funcinfo << " Control: " << TQString(TQString::fromLocal8Bi
}
}
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
CLEAR(V4L_capabilities);
@@ -424,6 +424,7 @@ kdDebug(14010) << k_funcinfo << " Control: " << TQString(TQString::fromLocal8Bi
}
}
#endif
+#endif
m_name=m_model; // Take care about changing the name to be different from the model itself...
detectPixelFormats();
@@ -512,7 +513,7 @@ int VideoDevice::initDevice()
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
if(V4L2_capabilities.capabilities & V4L2_CAP_READWRITE)
{
@@ -538,7 +539,7 @@ int VideoDevice::initDevice()
return EXIT_FAILURE;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
m_videoread=true;
m_io_method=IO_METHOD_READ;
@@ -550,6 +551,7 @@ int VideoDevice::initDevice()
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
@@ -558,7 +560,7 @@ int VideoDevice::initDevice()
// Select video input, video standard and tune here.
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (-1 == xioctl (VIDIOC_CROPCAP, &cropcap))
{ // Errors ignored.
@@ -676,7 +678,7 @@ kdDebug(14010) << k_funcinfo << "setSize(" << newwidth << ", " << newheight <<
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
// CLEAR (fmt);
if (-1 == xioctl (VIDIOC_G_FMT, &fmt))
@@ -703,7 +705,7 @@ kdDebug(14010) << k_funcinfo << "VIDIOC_S_FMT worked (" << errno << ").Returned
m_buffer_size=fmt.fmt.pix.sizeimage ;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_window V4L_videowindow;
@@ -733,6 +735,7 @@ kdDebug(14010) << "------------- width: " << V4L_videowindow.width << " Height:
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -759,17 +762,6 @@ kdDebug(14010) << k_funcinfo << "setSize(" << newwidth << ", " << newheight <<
}
-
-
-
-
-
-
-
-
-
-
-
pixel_format VideoDevice::setPixelFormat(pixel_format newformat)
{
pixel_format ret = PIXELFORMAT_NONE;
@@ -778,7 +770,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format newformat)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
// CLEAR (fmt);
if (-1 == xioctl (VIDIOC_G_FMT, &fmt))
@@ -803,7 +795,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format newformat)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -828,6 +820,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format newformat)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -867,7 +860,7 @@ int VideoDevice::selectInput(int newinput)
switch (m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
if (-1 == ioctl (descriptor, VIDIOC_S_INPUT, &newinput))
{
@@ -875,7 +868,7 @@ int VideoDevice::selectInput(int newinput)
return EXIT_FAILURE;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
struct video_channel V4L_input;
V4L_input.channel=newinput;
@@ -887,6 +880,7 @@ int VideoDevice::selectInput(int newinput)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -935,7 +929,7 @@ int VideoDevice::startCapturing()
break;
case IO_METHOD_MMAP:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
{
unsigned int loop;
for (loop = 0; loop < m_streambuffers; ++loop)
@@ -957,7 +951,7 @@ int VideoDevice::startCapturing()
break;
case IO_METHOD_USERPTR:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
{
unsigned int loop;
for (loop = 0; loop < m_streambuffers; ++loop)
@@ -995,7 +989,7 @@ int VideoDevice::getFrame()
ssize_t bytesread;
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_buffer v4l2buffer;
#endif
#endif
@@ -1029,7 +1023,7 @@ int VideoDevice::getFrame()
break;
case IO_METHOD_MMAP:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
CLEAR (v4l2buffer);
v4l2buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
v4l2buffer.memory = V4L2_MEMORY_MMAP;
@@ -1089,7 +1083,7 @@ memcpy(&m_currentbuffer.data[0], m_rawbuffers[v4l2buffer.index].start, m_current
break;
case IO_METHOD_USERPTR:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
{
unsigned int i;
CLEAR (v4l2buffer);
@@ -1414,7 +1408,7 @@ int VideoDevice::stopCapturing()
break;
case IO_METHOD_MMAP:
case IO_METHOD_USERPTR:
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
{
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (-1 == xioctl (VIDIOC_STREAMOFF, &type))
@@ -1475,7 +1469,7 @@ float VideoDevice::setBrightness(float brightness)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
{
struct v4l2_queryctrl queryctrl;
@@ -1510,7 +1504,7 @@ float VideoDevice::setBrightness(float brightness)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1522,6 +1516,7 @@ float VideoDevice::setBrightness(float brightness)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1545,7 +1540,7 @@ float VideoDevice::setContrast(float contrast)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
{
struct v4l2_queryctrl queryctrl;
@@ -1580,7 +1575,7 @@ float VideoDevice::setContrast(float contrast)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1592,6 +1587,7 @@ float VideoDevice::setContrast(float contrast)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1615,7 +1611,7 @@ float VideoDevice::setSaturation(float saturation)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
{
struct v4l2_queryctrl queryctrl;
@@ -1650,7 +1646,7 @@ float VideoDevice::setSaturation(float saturation)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1662,6 +1658,7 @@ float VideoDevice::setSaturation(float saturation)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1685,7 +1682,7 @@ float VideoDevice::setWhiteness(float whiteness)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
{
struct v4l2_queryctrl queryctrl;
@@ -1720,7 +1717,7 @@ float VideoDevice::setWhiteness(float whiteness)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1732,6 +1729,7 @@ float VideoDevice::setWhiteness(float whiteness)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1755,7 +1753,7 @@ float VideoDevice::setHue(float hue)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
{
struct v4l2_queryctrl queryctrl;
@@ -1790,7 +1788,7 @@ float VideoDevice::setHue(float hue)
}
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
{
struct video_picture V4L_picture;
@@ -1802,6 +1800,7 @@ float VideoDevice::setHue(float hue)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -1876,7 +1875,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette )
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
switch(palette)
{
@@ -1925,7 +1924,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette )
case V4L2_PIX_FMT_YYUV : return PIXELFORMAT_YYUV; break;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
switch(palette)
{
@@ -1946,6 +1945,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette )
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return PIXELFORMAT_NONE; break;
@@ -1958,7 +1958,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
switch(pixelformat)
{
@@ -2007,7 +2007,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat)
case PIXELFORMAT_YYUV : return V4L2_PIX_FMT_YYUV; break;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
switch(pixelformat)
{
@@ -2057,6 +2057,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return PIXELFORMAT_NONE; break;
@@ -2172,7 +2173,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
switch(pixelformat)
{
@@ -2221,7 +2222,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
case V4L2_PIX_FMT_YYUV : returnvalue = pixelFormatName(PIXELFORMAT_YYUV); break;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
switch(pixelformat)
{
@@ -2241,6 +2242,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -2251,14 +2253,14 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
int VideoDevice::detectPixelFormats()
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
int err = 0;
#endif
#endif
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
fmtdesc.index = 0;
fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -2278,7 +2280,7 @@ int VideoDevice::detectPixelFormats()
}
}
// break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
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.
@@ -2323,6 +2325,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;
@@ -2335,7 +2338,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
switch(standard)
{
@@ -2376,7 +2379,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard)
case STANDARD_ALL : return V4L2_STD_ALL; break;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
switch(standard)
{
@@ -2418,6 +2421,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
return STANDARD_NONE; break;
@@ -2477,7 +2481,7 @@ TQString VideoDevice::signalStandardName(int standard)
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
switch(standard)
{
@@ -2517,7 +2521,7 @@ TQString VideoDevice::signalStandardName(int standard)
case V4L2_STD_ALL : returnvalue = signalStandardName(STANDARD_ALL); break;
}
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
switch(standard)
{
@@ -2532,6 +2536,7 @@ TQString VideoDevice::signalStandardName(int standard)
}
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -2547,13 +2552,14 @@ int VideoDevice::detectSignalStandards()
switch(m_driver)
{
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2:
break;
-#endif
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L:
break;
#endif
+#endif
case VIDEODEV_DRIVER_NONE:
default:
break;
@@ -2606,7 +2612,7 @@ int VideoDevice::initMmap()
if(isOpen())
{
kdDebug(14010) << k_funcinfo << full_filename << " Trying to MMAP" << endl;
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_requestbuffers req;
CLEAR (req);
@@ -2678,7 +2684,7 @@ int VideoDevice::initUserptr()
/// @todo implement me
if(isOpen())
{
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_requestbuffers req;
CLEAR (req);
diff --git a/kopete/libkopete/avdevice/videodevice.h b/kopete/libkopete/avdevice/videodevice.h
index 970f6655..a1ace57e 100644
--- a/kopete/libkopete/avdevice/videodevice.h
+++ b/kopete/libkopete/avdevice/videodevice.h
@@ -92,11 +92,12 @@ typedef enum
{
VIDEODEV_DRIVER_NONE
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
- ,
- VIDEODEV_DRIVER_V4L
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(__LINUX_VIDEODEV2_H) /* V4L2 */
,
VIDEODEV_DRIVER_V4L2
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
+ ,
+ VIDEODEV_DRIVER_V4L
#endif
#endif
} videodev_driver;
@@ -288,7 +289,7 @@ public:
//protected:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
-#ifdef V4L2_CAP_VIDEO_CAPTURE
+#if defined(__LINUX_VIDEODEV2_H) /* V4L2 */
struct v4l2_capability V4L2_capabilities;
struct v4l2_cropcap cropcap;
struct v4l2_crop crop;
@@ -299,8 +300,7 @@ public:
struct v4l2_querymenu querymenu;
void enumerateMenu (void);
-#endif
-#ifdef ENABLE_AV
+#elif defined(__LINUX_VIDEODEV_H) /* V4L */
struct video_capability V4L_capabilities;
struct video_buffer V4L_videobuffer;
#endif
diff --git a/kopete/libkopete/avdevice/videodevicepool.cpp b/kopete/libkopete/avdevice/videodevicepool.cpp
index 7396d5a0..ffb9b770 100644
--- a/kopete/libkopete/avdevice/videodevicepool.cpp
+++ b/kopete/libkopete/avdevice/videodevicepool.cpp
@@ -608,8 +608,10 @@ int VideoDevicePool::scanDevices()
kdDebug(14010) << k_funcinfo << "called" << endl;
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
TQDir videodevice_dir;
- const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/v4l/");
- const TQString videodevice_dir_filter=TQString::fromLocal8Bit("video*");
+
+ // Check *video* symlinks in /dev/v4l/by-id
+ const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/v4l/by-id/");
+ const TQString videodevice_dir_filter=TQString::fromLocal8Bit("*video*");
VideoDevice videodevice;
m_videodevice.clear();
@@ -617,7 +619,7 @@ int VideoDevicePool::scanDevices()
videodevice_dir.setPath(videodevice_dir_path);
videodevice_dir.setNameFilter(videodevice_dir_filter);
- videodevice_dir.setFilter( TQDir::System | TQDir::NoSymLinks | TQDir::Readable | TQDir::Writable );
+ videodevice_dir.setFilter( TQDir::System | TQDir::Readable | TQDir::Writable );
videodevice_dir.setSorting( TQDir::Name );
kdDebug(14010) << k_funcinfo << "Looking for devices in " << videodevice_dir_path << endl;
@@ -627,6 +629,8 @@ int VideoDevicePool::scanDevices()
{
kdDebug(14010) << k_funcinfo << "Found no suitable devices in " << videodevice_dir_path << endl;
TQDir videodevice_dir;
+
+ // Alternatively, check all block devices starting with 'video' in /dev
const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/");
const TQString videodevice_dir_filter=TQString::fromLocal8Bit("video*");
VideoDevice videodevice;
@@ -679,7 +683,12 @@ int VideoDevicePool::scanDevices()
kdDebug(14010) << k_funcinfo << "scanning devices in " << videodevice_dir_path << "..." << endl;
while ( (fileinfo = fileiterator.current()) != 0 )
{
- videodevice.setFileName(fileinfo->absFilePath());
+ if( fileinfo->isSymLink() ) {
+ TQFileInfo realfileinfo(videodevice_dir_path + fileinfo->readLink());
+ videodevice.setFileName(realfileinfo.absFilePath());
+ } else {
+ videodevice.setFileName(fileinfo->absFilePath());
+ }
kdDebug(14010) << k_funcinfo << "Found device " << videodevice.full_filename << endl;
videodevice.open(); // It should be opened with O_NONBLOCK (it's a FIFO) but I dunno how to do it using TQFile
if(videodevice.isOpen())