⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vmdirectshow.cpp

📁 VideoMan is a very easy image acquisition library. It is able to manage many video inputs at the sam
💻 CPP
字号:
#include "stdafx.h"

#include "VideoManInputFormat.h"
#include "VideoInput.h"

#include "VideoFileDShow.h"
#include "CaptureDeviceDShow.h"
//#include "USBCameraDShow.h"
//#include "FirewireCameraDShow.h"

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{	
	
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:		
		CoInitialize(NULL);	
		break;
	case DLL_THREAD_ATTACH:        
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:						
		CoUninitialize();			
		break;
	}

    return TRUE;
}

extern "C" __declspec(dllexport) VideoInput *initVideoInput( const inputIdentification &device, VideoManInputFormat *format );

VideoInput *initVideoInput( const inputIdentification &device, VideoManInputFormat *format )
{
	if ( device.identifier == "DSHOW_VIDEO_FILE" )
	{
		VideoFileDShow *videoFile;
		videoFile = new VideoFileDShow();
		if (!videoFile->loadVideoFile( device.fileName, format ))
		{
			delete videoFile;
			return NULL;
		}
		return videoFile;
	}
	else if ( device.identifier == "DSHOW_CAPTURE_DEVICE" )
	{
		CaptureDeviceDShow *capture;
		capture = new CaptureDeviceDShow();
		if (!capture->initCamera( device.friendlyName, device.devicePath, format ))
		{
			delete capture;
			return NULL;
		}
		return capture;
	}
	/*else if ( device.identifier == "DSHOW_USB_CAMERA" )
	{
		USBCameraDShow *camera;
		camera = new USBCameraDShow();
		if (!camera->initCamera( device.friendlyName, format ))
		{
			delete camera;
			return NULL;
		}
		return camera;
	}
	else if ( device.identifier == "DSHOW_FIREWIRE_CAMERA" )
	{
        FirewireCameraDShow *camera;
		camera = new FirewireCameraDShow();
		if ( !camera->initCamera( device.devicePath, format ) )
		{
			delete camera;
			return NULL;
		}
		return camera;
	}*/

 	return NULL;	
}

extern "C" __declspec(dllexport) void getAvailableDevices( std::vector<inputIdentification> &deviceList );
void getAvailableDevices( std::vector<inputIdentification> &deviceList )
{
	CaptureDeviceDShow::getAvailableDevices( deviceList );
	//USBCameraDShow::getAvailableDevices( deviceList );
	//FirewireCameraDShow::getAvailableDevices( deviceList );
}

extern "C" __declspec(dllexport) void getIdentifiers( std::vector< std::string > &identifierList );
void getIdentifiers( std::vector< std::string > &identifierList )
{
	identifierList.push_back( "DSHOW_CAPTURE_DEVICE" );
	//identifierList.push_back( "DSHOW_FIREWIRE_CAMERA" );
	//identifierList.push_back( "DSHOW_USB_CAMERA" );
	identifierList.push_back( "DSHOW_VIDEO_FILE" );	
}

extern "C" __declspec(dllexport) std::string checkVersion( );
std::string checkVersion( )
{
	#ifdef _DEBUG
		return "DEBUG" ;			
	#endif
	#ifdef NDEBUG
		return "RELEASE";			
	#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -