00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __VETLIB_VETDIRECTXINPUT2_H__
00026 #define __VETLIB_VETDIRECTXINPUT2_H__
00027
00028 #include "../../source/vetDefs.h"
00029 #include "../../source/vetInput.h"
00030
00031 #include "../../source/vetFrameRGB24.h"
00032 #include "../../source/vetFrameYUV420.h"
00033 #include "../../source/vetFrameT.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 typedef unsigned long DWORD;
00046
00047
00048
00049
00050
00051
00052
00053
00054 #define VETDX_MAXDEVICES 20
00055
00056 struct vetDXCapture2;
00057
00058
00059 class vetDirectXInput2 : public vetInput
00060 {
00061
00062 protected:
00063
00064 vetDXCapture2* cCap;
00065
00066 DWORD g_dwGraphRegister;
00067
00068
00069 unsigned int width;
00070 unsigned int height;
00071
00075 char deviceVideoDesc[VETDX_MAXDEVICES][160];
00076
00080 char deviceAudioDesc[VETDX_MAXDEVICES][160];
00081
00082
00083 int InitCapFilters(void);
00084 void FreeCapFilters(void);
00085
00086 void TearDownGraph(void);
00087 int BuildCaptureGraph(void);
00088 int BuildPreviewGraph(void);
00089 int BuildGrabberGraph(bool mpeg2 = false);
00090
00091 int MakeBuilder(void);
00092 int MakeGraph(void);
00093
00094
00095 void RegisterDevicesNotification(void);
00096
00097
00098
00099
00100 int RemoveGraphFromRot(DWORD pdwRegister);
00101
00102
00103
00104
00105
00106 public:
00107
00108 enum FORMAT_CSP {
00109 UNKNOWN,
00110 VETFRAMET_CS_MONO,
00111 VETFRAMET_CS_RGB,
00112 VETFRAMET_CS_BGR,
00113 VETFRAMET_CS_ARGB,
00114 VETFRAMET_CS_ABGR,
00115 VETFRAMET_CS_RGBA,
00116 VETFRAMET_CS_BGRA,
00117 VETFRAMET_CS_RGB565,
00118 VETFRAMET_CS_BGR565,
00119 VETFRAMET_CS_RGB555,
00120 VETFRAMET_CS_BGR555,
00121 VETFRAMET_CS_I420,
00122 VETFRAMET_CS_YV12,
00123 VETFRAMET_CS_YUY2,
00124 VETFRAMET_CS_UYVY,
00125 VETFRAMET_CS_YVYU,
00126 VETFRAMET_CS_CUSTOM,
00127 } ;
00128
00129 vetDirectXInput2(int device = -1);
00130
00131 vetDirectXInput2(int device, float fps);
00132
00137 ~vetDirectXInput2();
00138
00139 void Close(void);
00140
00141 bool EoF();
00142
00143 int reset() { return 666; };
00144
00145
00147
00148
00155 const char* getDeviceDescription(int device);
00156
00157 void enumerateDevices(void);
00158
00164 int getDeviceVideoCount(void);
00165
00171 int getDeviceAudioCount(void);
00172
00179 const char* getDeviceVideoDescription(int device);
00180
00187 const char* getDeviceAudioDescription(int device);
00188
00195 int getCurrentDeviceVideo();
00196
00203 int getCurrentDeviceAudio();
00204
00205
00206 int getVideoFriendlyName(char* buffer);
00207 int getAudioFriendlyName(char* buffer);
00208
00209
00210 int setCurrentDevices(int szVideo, int szAudio);
00211
00213
00214
00215 int StartPreview();
00216 int StopPreview();
00217
00218 int StartCapture();
00219 int StopCapture();
00220
00221
00222
00223
00225
00226 void setPreviewEnabled(bool value = true);
00227
00228 int showPreviewWindow(bool show = true);
00229
00230 int setPreviewWindow(void* HWND_Owner);
00231 void doUpdatePreviewWindow();
00232 void setAutoUpdatePreviewWindowEnabled(bool enable = true);
00233
00234
00235
00236 int AllocCaptureFile(unsigned short fileSize_mb = 10);
00237
00238 int setFrameRate(double rate = 0.0);
00239
00240
00241 int setCaptureFile(char* pszName);
00242
00243
00244 int setFrameRateControlEnabled( bool enable = true);
00245
00246
00247 int setCaptureAudioEnabled( bool enable = true);
00248
00249 int setMPEG2Encode(bool enable = true);
00250
00251 void setErrorMessagesEnabled(bool enable = true);
00252
00253
00254 int showCaptureVideoForWindowPropertyPage();
00255
00256 int showCaptureVideoFilterPropertyPage();
00257 int showCaptureAudioFilterPropertyPage();
00258
00259 int showGraphFilterPropertyPage();
00260 int showVideoRendererPropertyPage();
00261
00262 int showSampleGrabberPropertyPage();
00263
00264
00265 unsigned long getVideoBitRate();
00266 unsigned long getAudioBitRate();
00267
00268 int setFrameGrabbingEnabled(bool enable = true);
00269 bool isFrameGrabbingEnabled();
00270
00271
00272 FORMAT_CSP getCurrentFormat();
00273 int getCurrentFormatDescription(char* buffer);
00275
00276
00277 bool isPreviewing();
00278 bool isCapturing();
00279
00280 bool isPreviewFaked();
00281 bool isAutoUpdatePreviewWindowEnabled();
00282
00283 bool isCapturingAudio();
00284
00285 void UpdateStatus(bool fAllStats = false);
00286
00287 bool isUncompressed();
00288 bool isMPEG2Encoded();
00289
00290 double getFrameRate();
00291 double getFrameRateCurrent();
00292
00293 long getCapturedElapsedTime();
00294
00295 unsigned short getFileSize(bool forceUpdate = false);
00296
00297
00298 long getDroppedFramesCount(bool forceUpdate = false);
00299 long getCapturedFramesCount(bool forceUpdate = false);
00300 long getAverageFrameSize(bool forceUpdate = false);
00301 long getCapturedDataRate(bool forceUpdate = false);
00302 double getCapturedFrameRate(bool forceUpdate = false);
00303
00304
00310 unsigned int getWidth() const { return width; };
00311
00317 unsigned int getHeight() const { return height; };
00318
00319
00320
00321 long getFreeSpaceLeft();
00322
00324
00325 int extractTo(vetFrameRGB24& img);
00326
00327 int extractTo(vetFrameYUV420& img);
00328
00329 int extractTo(vetFrameT<unsigned char>& img);
00330
00331 };
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 #endif //__VETLIB_VETDIRECTXINPUT2_H__
00346
00347