Fixed Kopete FTBFS

This commit also adds initial V4L2 support for Motion AutoAway plugin.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
feat/add_kopete-otr_plugin
Mavridis Philippe 3 years ago
parent de786a075b
commit 7a3a7896b3
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -92,7 +92,7 @@ typedef enum
{
VIDEODEV_DRIVER_NONE
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
#if defined(__LINUX_VIDEODEV2_H) /* V4L2 */
#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
,
VIDEODEV_DRIVER_V4L2
#elif defined(__LINUX_VIDEODEV_H) /* V4L */
@ -289,7 +289,7 @@ public:
//protected:
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
#if defined(__LINUX_VIDEODEV2_H) /* V4L2 */
#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_capability V4L2_capabilities;
struct v4l2_cropcap cropcap;
struct v4l2_crop crop;

@ -110,9 +110,13 @@ MotionAwayPlugin::MotionAwayPlugin( TQObject *parent, const char *name, const TQ
kdDebug(14305) << k_funcinfo << "Worked! Setting Capture timers!" << endl;
/* Capture first image, or we will get a alarm on start */
getImage (m_deviceHandler, m_imageRef, DEF_WIDTH, DEF_HEIGHT, IN_DEFAULT, NORM_DEFAULT,
VIDEO_PALETTE_RGB24);
#ifdef V4L2_CAP_VIDEO_CAPTURE /* V4L2 */
V4L2_PIX_FMT_RGB24);
#else /* V4L or BSD compat layer */
VIDEO_PALETTE_RGB24);
#endif
/* We have the first image now */
/* We have the first image now */
m_tookFirst = true;
m_wentAway = false;
@ -142,14 +146,49 @@ void MotionAwayPlugin::loadSettings(){
int MotionAwayPlugin::getImage(int _dev, TQByteArray &_image, int _width, int _height, int _input, int _norm, int _fmt)
{
struct video_capability vid_caps;
struct video_channel vid_chnl;
struct video_window vid_win;
struct pollfd video_fd;
// Just to avoid a warning
_fmt = 0;
#if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_queryctrl queryctrl;
struct v4l2_format fmt;
int newinput = _input;
if (ioctl(_dev, VIDIOC_QUERYCTRL, &queryctrl) == -1)
{
perror("ioctl (VIDIOC_QUERYCTRL)");
return(-1);
}
if (_input != IN_DEFAULT)
{
newinput = -1;
if (ioctl(_dev, VIDIOC_S_INPUT, &newinput) == -1)
{
perror ("ioctl (VIDIOC_S_INPUT)");
return EXIT_FAILURE;
}
}
// Set image size
if (ioctl(_dev, VIDIOC_G_FMT, &fmt) == -1)
perror("ioctl (VIDIOC_G_FMT)");
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = _width;
fmt.fmt.pix.height = _height;
fmt.fmt.pix.field = V4L2_FIELD_ANY;
if (ioctl(_dev, VIDIOC_S_FMT, &fmt) == -1)
perror("ioctl (VIDIOC_S_FMT)");
#elif defined(__LINUX_VIDEODEV_H) /* V4L */
struct video_capability vid_caps;
struct video_channel vid_chnl;
struct video_window vid_win;
if (ioctl (_dev, VIDIOCGCAP, &vid_caps) == -1)
{
perror ("ioctl (VIDIOCGCAP)");
@ -186,6 +225,8 @@ int MotionAwayPlugin::getImage(int _dev, TQByteArray &_image, int _width, int _h
if (ioctl (_dev, VIDIOCSWIN, &vid_win) == -1)
return (-1);
#endif
/* Check if data available on the video device */
video_fd.fd = _dev;
video_fd.events = 0;
@ -206,10 +247,15 @@ void MotionAwayPlugin::slotCapture()
{
/* Should go on forever... emphasis on 'should' */
if ( getImage ( m_deviceHandler, m_imageNew, m_width, m_height, IN_DEFAULT, NORM_DEFAULT,
VIDEO_PALETTE_RGB24) == m_width * m_height *3 )
#ifdef V4L2_CAP_VIDEO_CAPTURE /* V4L2 */
V4L2_PIX_FMT_RGB24
#else /* V4L or BSD compat layer */
VIDEO_PALETTE_RGB24
#endif
) == m_width * m_height *3 )
{
int diffs = 0;
if ( m_tookFirst )
if ( m_tookFirst )
{
/* Make a differences picture in image_out */
for (int i=0; i< m_width * m_height * 3 ; i++)

Loading…
Cancel
Save