📄 videoio.cxx
字号:
/* * videoio.cxx * * Classes to support streaming video input (grabbing) and output. * * Portable Windows Library * * Copyright (c) 1993-2000 Equivalence Pty. Ltd. * * 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. * * The Original Code is Portable Windows Library. * * The Initial Developer of the Original Code is Equivalence Pty. Ltd. * * Contributor(s): ______________________________________. * * $Log: videoio.cxx,v $ * Revision 1.4 2000/07/26 03:50:50 robertj * Added last error variable to video device. * * Revision 1.3 2000/07/26 02:13:48 robertj * Added some more "common" bounds checking to video device. * * Revision 1.2 2000/07/25 13:38:26 robertj * Added frame rate parameter to video frame grabber. * * Revision 1.1 2000/07/15 09:47:35 robertj * Added video I/O device classes. * */#include <ptlib.h>#include <ptlib/videoio.h>///////////////////////////////////////////////////////////////////////////////// PVideoDevicePVideoDevice::PVideoDevice(VideoFormat videofmt, unsigned channel, ColourFormat colourFmt){ lastError = 0; videoFormat = videofmt; channelNumber = channel; colourFormat = colourFmt; frameRate = 15; frameWidth = CIF_WIDTH; frameHeight = CIF_HEIGHT;}BOOL PVideoDevice::SetVideoFormat(VideoFormat videoFmt){ videoFormat = videoFmt; return IsOpen();}PVideoDevice::VideoFormat PVideoDevice::GetVideoFormat() const{ return videoFormat;}unsigned PVideoDevice::GetNumChannels() const{ return 1;}BOOL PVideoDevice::SetChannel(unsigned channelNum){ if (channelNum >= GetNumChannels()) return FALSE; channelNumber = channelNum; return IsOpen();}unsigned PVideoDevice::GetChannel() const{ return channelNumber;}BOOL PVideoDevice::SetColourFormat(ColourFormat colourFmt){ colourFormat = colourFmt; return IsOpen();}PVideoDevice::ColourFormat PVideoDevice::GetColourFormat() const{ return colourFormat;}BOOL PVideoDevice::SetFrameRate(unsigned rate){ frameRate = rate; return IsOpen();}unsigned PVideoDevice::GetFrameRate() const{ return frameRate;}BOOL PVideoDevice::GetFrameSizeLimits(unsigned & minWidth, unsigned & minHeight, unsigned & maxWidth, unsigned & maxHeight) const{ minWidth = minHeight = 1; maxWidth = maxHeight = UINT_MAX; return FALSE;}BOOL PVideoDevice::SetFrameSize(unsigned width, unsigned height){ unsigned minWidth, minHeight, maxWidth, maxHeight; GetFrameSizeLimits(minWidth, minHeight, maxWidth, maxHeight); if (width < minWidth) frameWidth = minWidth; else if (width > maxWidth) frameWidth = maxWidth; else frameWidth = width; if (height < minHeight) frameHeight = minHeight; else if (height > maxHeight) frameHeight = maxHeight; else frameHeight = height; return IsOpen();}BOOL PVideoDevice::GetFrameSize(unsigned & width, unsigned & height) const{ width = frameWidth; height = frameHeight; return IsOpen();}///////////////////////////////////////////////////////////////////////////////// PVideoInputDeviceBOOL PVideoInputDevice::GetFrame(PBYTEArray & frame){ PINDEX returned; if (!GetFrameData(frame.GetPointer(GetMaxFrameBytes()), &returned)) return FALSE; frame.SetSize(returned); return TRUE;}// End Of File ///////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -