[Opalvoip-svn] SF.net SVN: opalvoip:[28498] ptlib/branches/v2_12/plugins/vidinput_v4l
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2012-10-05 12:56:40
|
Revision: 28498 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=28498&view=rev Author: rjongbloed Date: 2012-10-05 12:56:34 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Fixed V4L plugin after API change. Modified Paths: -------------- ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.cxx ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.h Modified: ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.cxx =================================================================== --- ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.cxx 2012-10-05 12:38:38 UTC (rev 28497) +++ ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.cxx 2012-10-05 12:56:34 UTC (rev 28498) @@ -1201,115 +1201,24 @@ return true; } -int PVideoInputDevice_V4L::GetBrightness() -{ - if (!IsOpen()) - return -1; - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return -1; - frameBrightness = vp.brightness; - - return frameBrightness; -} - - -int PVideoInputDevice_V4L::GetWhiteness() -{ - if (!IsOpen()) - return -1; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return -1; - frameWhiteness = vp.whiteness; - - return frameWhiteness; -} - -int PVideoInputDevice_V4L::GetColour() -{ - if (!IsOpen()) - return -1; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return -1; - frameColour = vp.colour; - - return frameColour; -} - - - -int PVideoInputDevice_V4L::GetContrast() +bool PVideoInputDevice_V4L::GetAttributes(Attributes & attrib) { if (!IsOpen()) - return -1; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return -1; - frameContrast = vp.contrast; - - return frameContrast; -} - -int PVideoInputDevice_V4L::GetHue() -{ - if (!IsOpen()) - return -1; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return -1; - frameHue = vp.hue; - - return frameHue; -} - -PBoolean PVideoInputDevice_V4L::SetBrightness(unsigned newBrightness) -{ - if (!IsOpen()) return false; struct video_picture vp; if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return false; - - vp.brightness = newBrightness; - if (::ioctl(videoFd, VIDIOCSPICT, &vp) < 0) - return false; - - frameBrightness=newBrightness; + return -1; + attrib.m_brightness = vp.brightness; + attrib.m_contrast = vp.contrast; + attrib.m_hue = vp.hue; return true; } -PBoolean PVideoInputDevice_V4L::SetWhiteness(unsigned newWhiteness) -{ - if (!IsOpen()) - return false; - struct video_picture vp; - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return false; - - vp.whiteness = newWhiteness; - if (::ioctl(videoFd, VIDIOCSPICT, &vp) < 0) - return false; - - frameWhiteness = newWhiteness; - return true; -} - -PBoolean PVideoInputDevice_V4L::SetColour(unsigned newColour) +bool PVideoInputDevice_V4L::SetAttributes(const Attributes & attrib) { if (!IsOpen()) return false; @@ -1319,78 +1228,17 @@ if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) return false; - vp.colour = newColour; - if (::ioctl(videoFd, VIDIOCSPICT, &vp) < 0) - return false; + vp.brightness = attrib.m_brightness; + vp.contrast = attrib.m_contrast; + vp.hue = attrib.m_hue; - frameColour = newColour; - return true; -} -PBoolean PVideoInputDevice_V4L::SetContrast(unsigned newContrast) -{ - if (!IsOpen()) - return false; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return false; - - vp.contrast = newContrast; if (::ioctl(videoFd, VIDIOCSPICT, &vp) < 0) return false; - frameContrast = newContrast; return true; } -PBoolean PVideoInputDevice_V4L::SetHue(unsigned newHue) -{ - if (!IsOpen()) - return false; - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - return false; - - vp.hue = newHue; - if (::ioctl(videoFd, VIDIOCSPICT, &vp) < 0) - return false; - - frameHue=newHue; - return true; -} - -PBoolean PVideoInputDevice_V4L::GetParameters (int *whiteness, int *brightness, - int *colour, int *contrast, int *hue) -{ - if (!IsOpen()) - return false; - - struct video_picture vp; - - if (::ioctl(videoFd, VIDIOCGPICT, &vp) < 0) - { - PTRACE(3, "GetParams bombs out!"); - return false; - } - - *brightness = vp.brightness; - *colour = vp.colour; - *contrast = vp.contrast; - *hue = vp.hue; - *whiteness = vp.whiteness; - - frameBrightness = *brightness; - frameColour = *colour; - frameContrast = *contrast; - frameHue = *hue; - frameWhiteness = *whiteness; - - return true; -} - PBoolean PVideoInputDevice_V4L::TestAllFormats() { return true; Modified: ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.h =================================================================== --- ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.h 2012-10-05 12:38:38 UTC (rev 28497) +++ ptlib/branches/v2_12/plugins/vidinput_v4l/vidinput_v4l.h 2012-10-05 12:56:34 UTC (rev 28498) @@ -46,21 +46,11 @@ PBoolean SetFrameRate(unsigned int); PBoolean VerifyHardwareFrameSize(unsigned int, unsigned int); - PBoolean GetParameters(int*, int*, int*, int*, int*); + bool GetAttributes(Attributes & attrib); + bool SetAttributes(const Attributes & attrib); PBoolean SetColourFormat(const PString&); - int GetContrast(); - PBoolean SetContrast(unsigned int); - int GetBrightness(); - PBoolean SetBrightness(unsigned int); - int GetWhiteness(); - PBoolean SetWhiteness(unsigned int); - int GetColour(); - PBoolean SetColour(unsigned int); - int GetHue(); - PBoolean SetHue(unsigned int); - PBoolean SetVideoChannelFormat(int, PVideoDevice::VideoFormat); PBoolean SetVideoFormat(PVideoDevice::VideoFormat); int GetNumChannels(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |