diff options
Diffstat (limited to 'kopete/libkopete/avdevice/videodevice.cpp')
-rw-r--r-- | kopete/libkopete/avdevice/videodevice.cpp | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/kopete/libkopete/avdevice/videodevice.cpp b/kopete/libkopete/avdevice/videodevice.cpp index 1df1220f..f79479e7 100644 --- a/kopete/libkopete/avdevice/videodevice.cpp +++ b/kopete/libkopete/avdevice/videodevice.cpp @@ -56,6 +56,7 @@ VideoDevice::~VideoDevice() +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE void VideoDevice::enumerateMenu (void) @@ -79,7 +80,7 @@ void VideoDevice::enumerateMenu (void) } } - +#endif #endif @@ -179,7 +180,7 @@ int VideoDevice::checkDevice() 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 //if(!getWorkaroundBrokenDriver()) @@ -510,7 +511,7 @@ int VideoDevice::initDevice() 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) @@ -556,7 +557,7 @@ int VideoDevice::initDevice() } // 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 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (-1 == xioctl (VIDIOC_CROPCAP, &cropcap)) @@ -674,7 +675,7 @@ kdDebug(14010) << k_funcinfo << "setSize(" << newwidth << ", " << newheight << // 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); @@ -776,7 +777,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format newformat) // 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); @@ -865,7 +866,7 @@ int VideoDevice::selectInput(int newinput) { 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)) @@ -933,7 +934,7 @@ int VideoDevice::startCapturing() 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; @@ -955,7 +956,7 @@ int VideoDevice::startCapturing() #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; @@ -993,7 +994,7 @@ int VideoDevice::getFrame() /// @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 @@ -1027,7 +1028,7 @@ int VideoDevice::getFrame() } 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; @@ -1087,7 +1088,7 @@ memcpy(&m_currentbuffer.data[0], m_rawbuffers[v4l2buffer.index].start, m_current #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; @@ -1473,7 +1474,7 @@ float VideoDevice::setBrightness(float brightness) 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: { @@ -1543,7 +1544,7 @@ float VideoDevice::setContrast(float contrast) 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: { @@ -1613,7 +1614,7 @@ float VideoDevice::setSaturation(float saturation) 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: { @@ -1683,7 +1684,7 @@ float VideoDevice::setWhiteness(float whiteness) 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: { @@ -1753,7 +1754,7 @@ float VideoDevice::setHue(float hue) 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: { @@ -1874,7 +1875,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette ) { 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) @@ -1937,7 +1938,9 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette ) case VIDEO_PALETTE_RGB32 : return PIXELFORMAT_RGB32; break; case VIDEO_PALETTE_YUYV : return PIXELFORMAT_YUYV; break; case VIDEO_PALETTE_UYVY : return PIXELFORMAT_UYVY; break; +#if !defined(__FreeBSD__) case VIDEO_PALETTE_YUV420 : +#endif case VIDEO_PALETTE_YUV420P : return PIXELFORMAT_YUV420P; break; case VIDEO_PALETTE_YUV422P : return PIXELFORMAT_YUV422P; break; } @@ -1954,7 +1957,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat) { 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) @@ -2029,7 +2032,11 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat) case PIXELFORMAT_GREY : return VIDEO_PALETTE_GREY; break; case PIXELFORMAT_YUYV : return VIDEO_PALETTE_YUYV; break; case PIXELFORMAT_UYVY : return VIDEO_PALETTE_UYVY; break; +#if defined(__FreeBSD__) + case PIXELFORMAT_YUV420P: return VIDEO_PALETTE_YUV420P; break; +#else case PIXELFORMAT_YUV420P: return VIDEO_PALETTE_YUV420; break; +#endif case PIXELFORMAT_YUV422P: return VIDEO_PALETTE_YUV422P; break; // Compressed formats @@ -2082,7 +2089,11 @@ int VideoDevice::pixelFormatDepth(pixel_format pixelformat) case PIXELFORMAT_GREY : return 8; break; case PIXELFORMAT_YUYV : return 16; break; case PIXELFORMAT_UYVY : return 16; break; +#if defined(__FreeBSD__) + case PIXELFORMAT_YUV420P: return 24; break; +#else case PIXELFORMAT_YUV420P: return 16; break; +#endif case PIXELFORMAT_YUV422P: return 16; break; // Compressed formats @@ -2160,7 +2171,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat) 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) @@ -2222,7 +2233,9 @@ TQString VideoDevice::pixelFormatName(int pixelformat) case VIDEO_PALETTE_RGB32 : returnvalue = pixelFormatName(PIXELFORMAT_RGB32); break; case VIDEO_PALETTE_YUYV : returnvalue = pixelFormatName(PIXELFORMAT_YUYV); break; case VIDEO_PALETTE_UYVY : returnvalue = pixelFormatName(PIXELFORMAT_UYVY); break; +#if !defined(__FreeBSD__) case VIDEO_PALETTE_YUV420 : +#endif case VIDEO_PALETTE_YUV420P : returnvalue = pixelFormatName(PIXELFORMAT_YUV420P); break; case VIDEO_PALETTE_YUV422P : returnvalue = pixelFormatName(PIXELFORMAT_YUV422P); break; } @@ -2237,14 +2250,14 @@ TQString VideoDevice::pixelFormatName(int pixelformat) int VideoDevice::detectPixelFormats() { -#if defined(__linux__) && defined(ENABLE_AV) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) #ifdef V4L2_CAP_VIDEO_CAPTURE int err = 0; #endif #endif 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: fmtdesc.index = 0; @@ -2321,7 +2334,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard) { 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) @@ -2463,7 +2476,7 @@ TQString VideoDevice::signalStandardName(int standard) 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) @@ -2533,7 +2546,7 @@ int VideoDevice::detectSignalStandards() { 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: break; |