@ -57,7 +57,7 @@ VideoDevice::~VideoDevice()
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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)
# if def 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
}
}
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
CLEAR ( V4L_capabilities ) ;
@ -423,6 +423,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...
@ -512,7 +513,7 @@ int VideoDevice::initDevice()
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
m_videoread = true ;
m_io_method = IO_METHOD_READ ;
@ -549,6 +550,7 @@ int VideoDevice::initDevice()
kdDebug ( 14010 ) < < k_funcinfo < < " Streaming interface " < < endl ;
}
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)
# if def 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)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_window V4L_videowindow ;
@ -732,6 +734,7 @@ kdDebug(14010) << "------------- width: " << V4L_videowindow.width << " Height:
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -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)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -827,6 +819,7 @@ pixel_format VideoDevice::setPixelFormat(pixel_format newformat)
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -867,7 +860,7 @@ int VideoDevice::selectInput(int newinput)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
struct video_channel V4L_input ;
V4L_input . channel = newinput ;
@ -886,6 +879,7 @@ int VideoDevice::selectInput(int newinput)
return EXIT_FAILURE ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -935,7 +929,7 @@ int VideoDevice::startCapturing()
break ;
case IO_METHOD_MMAP :
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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)
# if def 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)
# if def 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)
# if def 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)
# if def 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 :
# if def 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)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -1521,6 +1515,7 @@ float VideoDevice::setBrightness(float brightness)
kdDebug ( 14010 ) < < k_funcinfo < < " Card seems to not support adjusting image brightness. Fallback to it is not yet implemented. " < < endl ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1545,7 +1540,7 @@ float VideoDevice::setContrast(float contrast)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -1591,6 +1586,7 @@ float VideoDevice::setContrast(float contrast)
kdDebug ( 14010 ) < < k_funcinfo < < " Card seems to not support adjusting image contrast. Fallback to it is not yet implemented. " < < endl ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1615,7 +1611,7 @@ float VideoDevice::setSaturation(float saturation)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -1661,6 +1657,7 @@ float VideoDevice::setSaturation(float saturation)
kdDebug ( 14010 ) < < k_funcinfo < < " Card seems to not support adjusting image saturation. Fallback to it is not yet implemented. " < < endl ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1685,7 +1682,7 @@ float VideoDevice::setWhiteness(float whiteness)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -1731,6 +1728,7 @@ float VideoDevice::setWhiteness(float whiteness)
kdDebug ( 14010 ) < < k_funcinfo < < " Card seems to not support adjusting white level. Fallback to it is not yet implemented. " < < endl ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1755,7 +1753,7 @@ float VideoDevice::setHue(float hue)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
{
struct video_picture V4L_picture ;
@ -1801,6 +1799,7 @@ float VideoDevice::setHue(float hue)
kdDebug ( 14010 ) < < k_funcinfo < < " Card seems to not support adjusting image hue. Fallback to it is not yet implemented. " < < endl ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1876,7 +1875,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette )
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
switch ( palette )
{
@ -1945,6 +1944,7 @@ pixel_format VideoDevice::pixelFormatForPalette( int palette )
case VIDEO_PALETTE_YUV422P : return PIXELFORMAT_YUV422P ; break ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -1958,7 +1958,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
switch ( pixelformat )
{
@ -2056,6 +2056,7 @@ int VideoDevice::pixelFormatCode(pixel_format pixelformat)
case PIXELFORMAT_YYUV : return 0 ; break ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2172,7 +2173,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
switch ( pixelformat )
{
@ -2240,6 +2241,7 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
case VIDEO_PALETTE_YUV422P : returnvalue = pixelFormatName ( PIXELFORMAT_YUV422P ) ; break ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2251,14 +2253,14 @@ TQString VideoDevice::pixelFormatName(int pixelformat)
int VideoDevice : : detectPixelFormats ( )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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)
# if def 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;
# e ndif
# e lif 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.
@ -2322,6 +2324,7 @@ int VideoDevice::detectPixelFormats()
if ( PIXELFORMAT_NONE ! = setPixelFormat ( PIXELFORMAT_WNVA ) ) kdDebug ( 14010 ) < < k_funcinfo < < pixelFormatName ( PIXELFORMAT_WNVA ) < < endl ;
if ( PIXELFORMAT_NONE ! = setPixelFormat ( PIXELFORMAT_YYUV ) ) kdDebug ( 14010 ) < < k_funcinfo < < pixelFormatName ( PIXELFORMAT_YYUV ) < < endl ;
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2335,7 +2338,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
switch ( standard )
{
@ -2417,6 +2420,7 @@ __u64 VideoDevice::signalStandardCode(signal_standard standard)
case STANDARD_ALL : return VIDEO_MODE_AUTO ; break ;
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2477,7 +2481,7 @@ TQString VideoDevice::signalStandardName(int standard)
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def 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 ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
switch ( standard )
{
@ -2531,6 +2535,7 @@ TQString VideoDevice::signalStandardName(int standard)
case VIDEO_MODE_NTSC_JP : returnvalue = signalStandardName ( STANDARD_NTSC_M_JP ) ; break ; // Undocumented value found to be compatible with V4L bttv driver
}
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2547,12 +2552,13 @@ int VideoDevice::detectSignalStandards()
switch ( m_driver )
{
# if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
# if def V4L2_CAP_VIDEO_CAPTURE
# if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
case VIDEODEV_DRIVER_V4L2 :
break ;
# e ndif
# e lif defined(__LINUX_VIDEODEV_H) /* V4L */
case VIDEODEV_DRIVER_V4L :
break ;
# endif
# endif
case VIDEODEV_DRIVER_NONE :
default :
@ -2606,7 +2612,7 @@ int VideoDevice::initMmap()
if ( isOpen ( ) )
{
kdDebug ( 14010 ) < < k_funcinfo < < full_filename < < " Trying to MMAP " < < endl ;
# if def 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 ( ) )
{
# if def V4L2_CAP_VIDEO_CAPTURE
# if defined(V4L2_CAP_VIDEO_CAPTURE) /* V4L2 */
struct v4l2_requestbuffers req ;
CLEAR ( req ) ;