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.
 
 
 
 
 

193 lines
4.1 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 24/03/2000
// Last modification: 02/06/2001
// Project Intruder Position Indicator
// SUBSYSTEM: Video Camera Showing Window
// FILE: VideoDirectShow.h
// AUTHOR: Chizhevskiy Sergey
// OVERVIEW
// ~~~~~~~~
// Header file for class CVideoDirectShow
//----------------------------------------------------------------------------
#ifndef __VIDEO__DIRECT__SHOW__H__INCLUDED__
#define __VIDEO__DIRECT__SHOW__H__INCLUDED__
#if _MSC_VER > 1000
#pragma once
#endif
#include "ICaptureDIB.h"
#ifndef _AFXDLL
class CRect : public RECT
{
public:
CRect() { left = right = top = bottom = 0; }
CRect( LONG l, LONG t, LONG r, LONG b ) { left = l; right = r; top = t; bottom = b; }
CRect( CRect* rect ) { left = rect->left; right = rect->right; top = rect->top; bottom = rect->bottom; }
};
#define POSITION void*
template <class TYPE, class ARG_TYPE>
class CList
{
public:
CList()
{
m_pFirst = NULL;
m_pLast = NULL;
m_nCount = 0;
}
~CList()
{
RemoveAll();
}
private:
typedef struct tagNODE
{
tagNODE *pNext;
tagNODE *pPrev;
ARG_TYPE data;
}NODE, *PNODE;
public:
POSITION AddTail( ARG_TYPE newElement )
{
PNODE pNewNode = new NODE;
if( !pNewNode )
return NULL;
pNewNode->pNext = NULL;
pNewNode->pPrev = m_pLast;
pNewNode->data = newElement;
if( m_pLast )
m_pLast->pNext = pNewNode;
m_pLast = pNewNode;
if( !m_pFirst )
m_pFirst = m_pLast;
m_nCount++;
return (POSITION)m_pLast;
}
void RemoveAll()
{
PNODE pNode = m_pFirst;
while( pNode )
{
PNODE pDelNode = pNode;
pNode = pNode->pNext;
delete pDelNode;
}
m_pFirst = NULL;
m_pLast = NULL;
m_nCount = 0;
}
POSITION Find( ARG_TYPE searchValue, POSITION startAfter = NULL ) const
{
PNODE pNode = (PNODE) ( startAfter ? startAfter : m_pFirst );
while( pNode )
{
if( pNode->data == searchValue )
return pNode;
pNode = pNode->pNext;
}
return (POSITION) NULL;
}
POSITION GetHeadPosition() const
{
return (POSITION)m_pFirst;
}
TYPE& GetNext( POSITION& rPosition )
{
PNODE pNode = (PNODE)rPosition;
rPosition = pNode->pNext;
return pNode->data;
}
private:
NODE *m_pFirst;
NODE *m_pLast;
int m_nCount;
};
#endif // CList
class CVideoDirectShow
{
public:
CVideoDirectShow();
virtual ~CVideoDirectShow();
public:
void ShowWindow( int n, int nShow );
void SetWindowPosition( int n, int x, int y, int cx, int cy );
BOOL SetupDialog( HWND hWnd, int n );
BOOL Create( LPCTSTR pFileName );
BOOL ConnectWnd( int n, HWND hWnd, int x, int y, int cx, int cy );
BOOL Capture( int n, LPBITMAPINFO pBmi, LPBYTE pByte );
private:
IGraphBuilder *m_pGraph;
IMediaControl *m_pMediaControl;
private:
BOOL FindVideos();
BOOL SetupFilters();
private:
friend static INT_PTR CALLBACK DialogProcSetup( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if( uMsg == WM_INITDIALOG )
::SetWindowLong( hWnd, GWL_USERDATA, lParam );
CVideoDirectShow *pThis = (CVideoDirectShow*) ::GetWindowLong( hWnd, GWL_USERDATA );
if( pThis )
return pThis->DialogProc( hWnd, uMsg, wParam, lParam );
return FALSE;
}
BOOL DialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
private:
struct PROPERTY
{
ISpecifyPropertyPages *pSpecify;
IUnknown *pUnknown;
WCHAR pName[MAX_FILTER_NAME];
};
typedef CList<PROPERTY,PROPERTY> CSpecifyList;
typedef CList<CLSID, CLSID> CGuidList;
private:
ICaptureDIB *FindCaptureDIB( IBaseFilter* pFilter, CGuidList &list );
void EnumFilters( IBaseFilter* pFilter, CGuidList &gList, CSpecifyList &sList );
bool IsCompatible( IBaseFilter *pFilter, REFIID IID );
private:
private:
CSpecifyList m_SpecifyList;
private:
HWND m_phWnd[10];
IVideoWindow *m_ppVideoWindow[10];
ICaptureDIB *m_ppCaptureDIB[10];
int m_nCount;
};
#endif