Old fashion design for PC-104
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: VideoCaptureDevice.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of VideoCaptureDevice.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "VideoCaptureDevice.h"
#include "..\..\LgLib\Version.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;#define new DEBUG_NEW
#endif
CVideoCaptureDevice::CVideoCaptureDevice(){ m_ppVideoCaptureSource = NULL; m_nVideoStandard = 0;
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoCaptureDevice::CVideoCaptureDevice") );}
CVideoCaptureDevice::~CVideoCaptureDevice(){ Destroy();
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoCaptureDevice::~CVideoCaptureDevice") );}
void CVideoCaptureDevice::Destroy(){ if( m_ppVideoCaptureSource ) { delete [] m_ppVideoCaptureSource; m_ppVideoCaptureSource = NULL; }
CVideoDevice::Destroy();}
BOOL CVideoCaptureDevice::AssignCaptureSource( int nInput, CVideoCaptureSource *pVideoCaptureSource ){ if( nInput >= GetInputCount() || pVideoCaptureSource == NULL ) return FALSE;
if( !m_ppVideoCaptureSource ) return FALSE;
// if already assigned
if( m_ppVideoCaptureSource[nInput] ) return FALSE;
m_ppVideoCaptureSource[nInput] = pVideoCaptureSource;
return TRUE;}
void CVideoCaptureDevice::SetIOCount( int nInput, int nOutput ){ CVideoDevice::SetIOCount( nInput, nOutput ); m_ppVideoCaptureSource = new CVideoCaptureSource*[ nInput ]; if( !m_ppVideoCaptureSource ) return;
for( int i = 0; i < nInput; i++ ) m_ppVideoCaptureSource[i] = NULL;}
BOOL CVideoCaptureDevice::Capture( int nInput, LPBITMAPINFO *pBitmapInfo, LPBYTE *ppBytes, HBITMAP *pBitmap, DWORD dwPreviewTime ){ if( nInput >= GetInputCount() ) return NULL;
if( !m_ppVideoCaptureSource ) return NULL;
// if was not assigned
if( !m_ppVideoCaptureSource[nInput] ) return NULL;
return m_ppVideoCaptureSource[nInput]->Capture( pBitmapInfo, ppBytes, pBitmap, dwPreviewTime );}
int CVideoCaptureDevice::GetAvailiblePin( CVideoPin *pOutputPin, int nSearchFrom ){ if( !pOutputPin ) return NULL;
nSearchFrom = ( nSearchFrom < 0 ) ? 0 : nSearchFrom + 1;
int nAvaliblePin = -1; int nMinWeight = INT_MAX;
for( int i = nSearchFrom; i < GetInputCount(); i++ ) { CVideoPin *pInputPin = GetInput(i);
ASSERT( pInputPin );
int nWeight = pInputPin->TestConnection( pOutputPin );
if( nMinWeight > nWeight ) { nMinWeight = nWeight; nAvaliblePin = i; } }
return nAvaliblePin;}
BOOL CVideoCaptureDevice::AssignVideoCamera( int nInput, CVideoCamera *pVideoCamera ){ if( nInput >= GetInputCount() || pVideoCamera == NULL ) return FALSE;
if( !m_ppVideoCaptureSource ) return FALSE;
if( !m_ppVideoCaptureSource[ nInput ] ) return FALSE;
// assign video camera to video source
m_ppVideoCaptureSource[ nInput ]->AssignVideoCamera( pVideoCamera );
return TRUE;}
|