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.
 
 
 
 
 

94 lines
2.6 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: DirectShowSampleGrabberCB.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of DirectShowSampleGrabberCB.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "..\Version.h"
#include "DirectShowStream.h"
#include "DirectShowSampleGrabberCB.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CDirectShowSampleGrabberCB::CDirectShowSampleGrabberCB()
{
m_RefCount = 1UL;
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectShowSampleGrabberCB::CDirectShowSampleGrabberCB") );
}
CDirectShowSampleGrabberCB::~CDirectShowSampleGrabberCB()
{
// unlink stream
CLgLinkSP<CDirectShowSampleGrabberCB,CDirectShowStream>::Unlink();
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectShowSampleGrabberCB::~CDirectShowSampleGrabberCB") );
}
HRESULT STDMETHODCALLTYPE CDirectShowSampleGrabberCB::QueryInterface( REFIID riid, void** ppvObject )
{
if( riid == IID_IUnknown )
{
*ppvObject = (IUnknown*)this;
AddRef();
return S_OK;
}
if( riid == IID_ISampleGrabberCB )
{
*ppvObject = (ISampleGrabberCB*)this;
AddRef();
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDirectShowSampleGrabberCB::AddRef( void)
{
return ::InterlockedIncrement( (PLONG)&m_RefCount );
}
ULONG STDMETHODCALLTYPE CDirectShowSampleGrabberCB::Release( void)
{
ULONG nRefCount = ::InterlockedDecrement( (PLONG)&m_RefCount );
if( !nRefCount )
delete this;
return nRefCount;
}
HRESULT STDMETHODCALLTYPE CDirectShowSampleGrabberCB::SampleCB( double SampleTime, IMediaSample *pSample )
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE CDirectShowSampleGrabberCB::BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen )
{
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CDirectShowSampleGrabberCB::BufferCB"), _T("Started...") );
// lock link
CLgLocker Lock( &CLgLinkSP<CDirectShowSampleGrabberCB,CDirectShowStream>::GetLock() );
// call stream
CDirectShowStream *pDirectShowStream = *this;
if( pDirectShowStream )
pDirectShowStream->OnVideoSample( SampleTime, pBuffer, BufferLen );
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CDirectShowSampleGrabberCB::BufferCB"), _T("Done") );
return S_OK;
}