PTLib
Version 2.10.4
|
00001 /* 00002 * pffvdev.cxx 00003 * 00004 * Video device for ffmpeg 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (C) 2008 Post Increment 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is 00023 * Craig Southeren <craigs@postincrement.com> 00024 * 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Revision: 24867 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2010-11-10 01:29:17 -0600 (Wed, 10 Nov 2010) $ 00032 */ 00033 00034 #ifndef PTLIB_PFFVDEV_H 00035 #define PTLIB_PFFVDEV_H 00036 00037 #ifdef P_USE_PRAGMA 00038 #pragma interface 00039 #endif 00040 00041 #include <ptlib.h> 00042 00043 #if P_VIDEO 00044 #if P_FFVDEV 00045 00046 #include <ptlib/pipechan.h> 00047 #include <ptclib/delaychan.h> 00048 00050 // 00051 // This class defines a video capture (input) device that reads video from an FFMpeg command 00052 // 00053 00054 00055 class PVideoInputDevice_FFMPEG : public PVideoInputDevice 00056 { 00057 PCLASSINFO(PVideoInputDevice_FFMPEG, PVideoInputDevice); 00058 public: 00061 PVideoInputDevice_FFMPEG(); 00062 00065 ~PVideoInputDevice_FFMPEG(); 00066 00067 00070 PBoolean Open( 00071 const PString & deviceName, 00072 PBoolean startImmediate = true 00073 ); 00074 00077 PBoolean IsOpen() ; 00078 00081 PBoolean Close(); 00082 00085 PBoolean Start(); 00086 00089 PBoolean Stop(); 00090 00093 PBoolean IsCapturing(); 00094 00097 static PStringArray GetInputDeviceNames(); 00098 00099 virtual PStringArray GetDeviceNames() const 00100 { return GetInputDeviceNames(); } 00101 00104 static bool GetDeviceCapabilities( 00105 const PString & /*deviceName*/, 00106 Capabilities * /*caps*/ 00107 ) { return false; } 00108 00114 virtual PINDEX GetMaxFrameBytes(); 00115 00120 virtual PBoolean GetFrameData( 00121 BYTE * buffer, 00122 PINDEX * bytesReturned = NULL 00123 ); 00124 00129 virtual PBoolean GetFrameDataNoDelay( 00130 BYTE * buffer, 00131 PINDEX * bytesReturned = NULL 00132 ); 00133 00134 00140 virtual PBoolean SetVideoFormat( 00141 VideoFormat videoFormat 00142 ); 00143 00148 virtual int GetNumChannels() ; 00149 00152 virtual PBoolean SetChannel( 00153 int channelNumber 00154 ); 00155 00161 virtual PBoolean SetColourFormat( 00162 const PString & colourFormat // New colour format for device. 00163 ); 00164 00170 virtual PBoolean SetFrameRate( 00171 unsigned rate 00172 ); 00173 00179 virtual PBoolean GetFrameSizeLimits( 00180 unsigned & minWidth, 00181 unsigned & minHeight, 00182 unsigned & maxWidth, 00183 unsigned & maxHeight 00184 ) ; 00185 00191 virtual PBoolean SetFrameSize( 00192 unsigned width, 00193 unsigned height 00194 ); 00195 00196 void ClearMapping() { return ; } 00197 00198 00199 protected: 00200 unsigned m_ffmpegFrameWidth; 00201 unsigned m_ffmpegFrameHeight; 00202 unsigned m_ffmpegFrameRate; 00203 unsigned m_ffmpegFrameSize; 00204 PPipeChannel m_command; 00205 PINDEX m_videoFrameSize; 00206 unsigned grabCount; 00207 PAdaptiveDelay pacing; 00208 }; 00209 00210 00211 #endif // P_FFVDEV 00212 #endif 00213 00214 #endif // PTLIB_PVFILEDEV_H 00215 00216 00217 // End Of File ///////////////////////////////////////////////////////////////