From kopete-devel Tue Nov 02 20:07:17 2010 From: Max Brazhnikov Date: Tue, 02 Nov 2010 20:07:17 +0000 To: kopete-devel Subject: KDE/kdenetwork/kopete/libkopete/avdevice Message-Id: <20101102200717.7EC9CAC89B () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kopete-devel&m=128872921528664 SVN commit 1192383 by makc: Enable video support on FreeBSD via v4l compatibility. http://reviewboard.kde.org/r/5750/ CCMAIL:kopete-devel@kde.org M +27 -27 videodevice.cpp M +10 -6 videodevice.h --- trunk/KDE/kdenetwork/kopete/libkopete/avdevice/videodevice.cpp #1192382:1192383 @@ -58,7 +58,7 @@ */ void VideoDevice::setupControls() { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) bool driver_vflip = false; bool driver_hflip = false; #endif @@ -69,7 +69,7 @@ switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: struct v4l2_queryctrl qctrl; @@ -147,7 +147,7 @@ break; } -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) // Software controls: BooleanVideoControl boolCtrl; boolCtrl.value_default = 0; @@ -172,7 +172,7 @@ #endif } -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE /*! \fn bool VideoDevice::getMenuCtrlOptions(quint32 id, quint32 maxindex, QStringList * options) @@ -380,7 +380,7 @@ m_videostream=false; m_driver=VIDEODEV_DRIVER_NONE; -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE CLEAR(V4L2_capabilities); @@ -650,7 +650,7 @@ m_io_method = IO_METHOD_NONE; switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: if(V4L2_capabilities.capabilities & V4L2_CAP_READWRITE) @@ -696,7 +696,7 @@ } // Select video input, video standard and tune here. -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE struct v4l2_cropcap cropcap; struct v4l2_crop crop; @@ -827,7 +827,7 @@ // Change resolution for the video device switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: // CLEAR (fmt); @@ -933,7 +933,7 @@ // Change the pixel format for the video device switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: // CLEAR (fmt); @@ -1026,7 +1026,7 @@ { switch (m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: if (-1 == ioctl (descriptor, VIDIOC_S_INPUT, &newinput)) @@ -1077,7 +1077,7 @@ case IO_METHOD_READ: // Nothing to do break; case IO_METHOD_MMAP: -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE { unsigned int loop; @@ -1099,7 +1099,7 @@ #endif break; case IO_METHOD_USERPTR: -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE { unsigned int loop; @@ -1137,7 +1137,7 @@ /// @todo implement me ssize_t bytesread; -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE struct v4l2_buffer v4l2buffer; #endif @@ -1176,7 +1176,7 @@ } break; case IO_METHOD_MMAP: -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE CLEAR (v4l2buffer); v4l2buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -1212,7 +1212,7 @@ #endif break; case IO_METHOD_USERPTR: -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE { unsigned int i; @@ -1725,7 +1725,7 @@ if (!isOpen()) return EXIT_FAILURE; -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) if (ctrl_id == IMGCTRL_ID_SOFT_AUTOBRIGHTNESSCONTRASTCORR) { if (m_current_input < m_input.size() ) @@ -1774,7 +1774,7 @@ switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: { @@ -1865,7 +1865,7 @@ if (!isOpen()) return EXIT_FAILURE; -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) if (ctrl_id == IMGCTRL_ID_SOFT_AUTOBRIGHTNESSCONTRASTCORR) { if (m_current_input < m_input.size() ) @@ -1910,7 +1910,7 @@ switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: { @@ -2013,7 +2013,7 @@ { switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: switch(palette) @@ -2093,7 +2093,7 @@ { switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: switch(pixelformat) @@ -2299,7 +2299,7 @@ returnvalue = "None"; switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: switch(pixelformat) @@ -2379,7 +2379,7 @@ int err = 0; switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: struct v4l2_fmtdesc fmtdesc; @@ -2457,7 +2457,7 @@ { switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: switch(standard) @@ -2641,7 +2641,7 @@ returnvalue = "None"; switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: switch(standard) @@ -2727,7 +2727,7 @@ { switch(m_driver) { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE case VIDEODEV_DRIVER_V4L2: @@ -2999,7 +2999,7 @@ } -#if defined(__linux__) && defined(ENABLE_AV) && defined(V4L2_CAP_VIDEO_CAPTURE) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) && defined(V4L2_CAP_VIDEO_CAPTURE) /*! \fn const char * VideoDevice::getUnifiedV4L2StdCtrlName(quint32 std_ctrl_id) \param std_ctrl_id ID of the V4L2 standard video control --- trunk/KDE/kdenetwork/kopete/libkopete/avdevice/videodevice.h #1192382:1192383 @@ -32,9 +32,11 @@ #include #include -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) +#if defined(__linux__) #include +#endif #undef __STRICT_ANSI__ #ifndef __u64 //required by videodev.h #define __u64 unsigned long long @@ -48,8 +50,10 @@ #define pgoff_t unsigned long #endif +#if defined(__linux__) #include #include +#endif #include #define VIDEO_MODE_PAL_Nc 3 #define VIDEO_MODE_PAL_M 4 @@ -61,7 +65,7 @@ #include #endif // HAVE_V4L2 -#endif // __linux__ +#endif // __linux__ __FreeBSD__ ENABLE_AV #include #include @@ -80,7 +84,7 @@ typedef enum { VIDEODEV_DRIVER_NONE -#if defined( __linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) , VIDEODEV_DRIVER_V4L #ifdef V4L2_CAP_VIDEO_CAPTURE @@ -327,7 +331,7 @@ QVector m_input; protected: -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) /*! \enum VideoDevice::imgctrl_id Control-IDs used for V4L1- and software-controls */ @@ -356,7 +360,7 @@ int descriptor; videodev_driver m_driver; QString m_model; -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE struct v4l2_capability V4L2_capabilities; struct v4l2_format fmt; @@ -388,7 +392,7 @@ virtual int initDevice(); void setupControls(); -#if defined(__linux__) && defined(ENABLE_AV) && defined(V4L2_CAP_VIDEO_CAPTURE) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) && defined(V4L2_CAP_VIDEO_CAPTURE) bool getMenuCtrlOptions(quint32 id, quint32 maxindex, QStringList * options); void saveV4L2ControlData(struct v4l2_queryctrl qctrl); const char *getUnifiedV4L2StdCtrlName(quint32 std_ctrl_id); _______________________________________________ kopete-devel mailing list kopete-devel@kde.org https://mail.kde.org/mailman/listinfo/kopete-devel