From: Damien S. <dsa...@us...> - 2004-09-21 12:54:32
|
Update of /cvsroot/openh323/pwlib/plugins/vidinput_v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15114/vidinput_v4l2 Added Files: Makefile vidinput_v4l2.cxx vidinput_v4l2.h Log Message: Added initial port to the new pwlib API/V4L2 API for the video4linux 2 code of Guilhem Tardy. Thanks! --- NEW FILE: vidinput_v4l2.cxx --- /* * video4linux2.cxx * * Classes to support streaming video input (grabbing) and output. * * Portable Windows Library * * Copyright (c) 1998-2000 Equivalence Pty. Ltd. * Copyright (c) 2003 March Networks * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. [...989 lines suppressed...] frameHue = -1; else frameHue = c.value; *whiteness = frameWhiteness; *brightness = frameBrightness; *colour = frameColour; *contrast = frameContrast; *hue = frameHue; return TRUE; } BOOL PVideoInputV4l2Device::TestAllFormats() { return TRUE; } // End Of File /////////////////////////////////////////////////////////////// --- NEW FILE: Makefile --- ifndef PWLIBDIR PWLIBDIR = $(HOME)/pwlib endif PLUGIN_NAME = v4l2 PLUGIN_FAMILY = device/videoinput PLUGIN_LIBS = PLUGIN_SOURCES = vidinput_v4l2.cxx include ../../make/plugins.mak --- NEW FILE: vidinput_v4l2.h --- #ifndef _PVIDEOIOV4L2 #define _PVIDEOIOV4L2 #include <sys/mman.h> #include <sys/time.h> #include <ptlib.h> #include <ptlib/videoio.h> #include <ptlib/vconvert.h> #include <linux/videodev.h> class PVideoInputV4l2Device: public PVideoInputDevice { PCLASSINFO(PVideoInputV4l2Device, PVideoInputDevice); public: PVideoInputV4l2Device(); ~PVideoInputV4l2Device(); void ReadDeviceDirectory (PDirectory, POrdinalToString &); static PStringList GetInputDeviceNames(); PStringList GetDeviceNames() const { return GetInputDeviceNames(); } BOOL Open(const PString &deviceName, BOOL startImmediate); BOOL IsOpen(); BOOL Close(); BOOL Start(); BOOL Stop(); BOOL IsCapturing(); PINDEX GetMaxFrameBytes(); BOOL GetFrame(PBYTEArray & frame); BOOL GetFrameData(BYTE*, PINDEX*); BOOL GetFrameDataNoDelay(BYTE*, PINDEX*); BOOL GetFrameSizeLimits(unsigned int&, unsigned int&, unsigned int&, unsigned int&); BOOL TestAllFormats(); BOOL SetFrameSize(unsigned int, unsigned int); BOOL SetFrameRate(unsigned int); BOOL VerifyHardwareFrameSize(unsigned int, unsigned int); BOOL GetParameters(int*, int*, int*, int*, int*); BOOL SetColourFormat(const PString&); int GetContrast(); BOOL SetContrast(unsigned int); int GetBrightness(); BOOL SetBrightness(unsigned int); int GetWhiteness(); BOOL SetWhiteness(unsigned int); int GetColour(); BOOL SetColour(unsigned int); int GetHue(); BOOL SetHue(unsigned int); BOOL SetVideoChannelFormat(int, PVideoDevice::VideoFormat); BOOL SetVideoFormat(PVideoDevice::VideoFormat); int GetNumChannels(); BOOL SetChannel(int); BOOL NormalReadProcess(BYTE*, PINDEX*); void ClearMapping(); BOOL SetMapping(); struct v4l2_capability videoCapability; struct v4l2_streamparm videoStreamParm; BOOL canRead; BOOL canStream; BOOL canSelect; BOOL canSetFrameRate; BOOL isMapped; #define NUM_VIDBUF 4 BYTE * videoBuffer[NUM_VIDBUF]; uint videoBufferCount; int videoFd; int frameBytes; BOOL started; }; #endif |