//------------------------------------------------------------------------------
// File: AMFilter.cpp
//
// Desc: DirectShow base classes - implements class hierarchy for streams
// architecture.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//=====================================================================
//=====================================================================
// The following classes are declared in this header:
//
//
// CBaseMediaFilter Basic IMediaFilter support (abstract class)
// CBaseFilter Support for IBaseFilter (incl. IMediaFilter)
// CEnumPins Enumerate input and output pins
// CEnumMediaTypes Enumerate the preferred pin formats
// CBasePin Abstract base class for IPin interface
// CBaseOutputPin Adds data provider member functions
// CBaseInputPin Implements IMemInputPin interface
// CMediaSample Basic transport unit for IMemInputPin
// CBaseAllocator General list guff for most allocators
// CMemAllocator Implements memory buffer allocation
//
//=====================================================================
//=====================================================================
#include <streams.h>
#include <strsafe.h>
#ifdef DXMPERF
#include "dxmperf.h"
#endif // DXMPERF
//=====================================================================
// Helpers
//=====================================================================
STDAPI CreateMemoryAllocator(__deref_out IMemAllocator **ppAllocator)
{
return CoCreateInstance(CLSID_MemoryAllocator,
0,
CLSCTX_INPROC_SERVER,
IID_IMemAllocator,
(void **)ppAllocator);
}
// Put this one here rather than in ctlutil.cpp to avoid linking
// anything brought in by ctlutil.cpp
STDAPI CreatePosPassThru(
__in_opt LPUNKNOWN pAgg,
BOOL bRenderer,
IPin *pPin,
__deref_out IUnknown **ppPassThru
)
{
*ppPassThru = NULL;
IUnknown *pUnkSeek;
HRESULT hr = CoCreateInstance(CLSID_SeekingPassThru,
pAgg,
CLSCTX_INPROC_SERVER,
IID_IUnknown,
(void **)&pUnkSeek
);
if (FAILED(hr)) {
return hr;
}
ISeekingPassThru *pPassThru;
hr = pUnkSeek->QueryInterface(IID_ISeekingPassThru, (void**)&pPassThru);
if (FAILED(hr)) {
pUnkSeek->Release();
return hr;
}
hr = pPassThru->Init(bRenderer, pPin);
pPassThru->Release();
if (FAILED(hr)) {
pUnkSeek->Release();
return hr;
}
*ppPassThru = pUnkSeek;
return S_OK;
}
#define CONNECT_TRACE_LEVEL 3
//=====================================================================
//=====================================================================
// Implements CBaseMediaFilter
//=====================================================================
//=====================================================================
/* Constructor */
CBaseMediaFilter::CBaseMediaFilter(__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
__in CCritSec *pLock,
REFCLSID clsid) :
CUnknown(pName, pUnk),
m_pLock(pLock),
m_clsid(clsid),
m_State(State_Stopped),
m_pClock(NULL)
{
}
/* Destructor */
CBaseMediaFilter::~CBaseMediaFilter()
{
// must be stopped, but can't call Stop here since
// our critsec has been destroyed.
/* Release any clock we were using */
if (m_pClock) {
m_pClock->Release();
m_pClock = NULL;
}
}
/* Override this to say what interfaces we support and where */
STDMETHODIMP
CBaseMediaFilter::NonDelegatingQueryInterface(
REFIID riid,
__deref_out void ** ppv)
{
if (riid == IID_IMediaFilter) {
return GetInterface((IMediaFilter *) this, ppv);
} else if (riid == IID_IPersist) {
return GetInterface((IPersist *) this, ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
/* Return the filter's clsid */
STDMETHODIMP
CBaseMediaFilter::GetClassID(__out CLSID *pClsID)
{
CheckPointer(pClsID,E_POINTER);
ValidateReadWritePtr(pClsID,sizeof(CLSID));
*pClsID = m_clsid;
return NOERROR;
}
/* Override this if your state changes are not done synchronously */
STDMETHODIMP
CBaseMediaFilter::GetState(DWORD dwMSecs, __out FILTER_STATE *State)
{
UNREFERENCED_PARAMETER(dwMSecs);
CheckPointer(State,E_POINTER);
ValidateReadWritePtr(State,sizeof(FILTER_STATE));
*State = m_State;
return S_OK;
}
/* Set the clock we will use for synchronisation */
STDMETHODIMP
CBaseMediaFilter::SetSyncSource(__inout_opt IReferenceClock *pClock)
{
CAutoLock cObjectLock(m_pLock);
// Ensure the new one does not go away - even if the same as the old
if (pClock) {
pClock->AddRef();
}
// if we have a clock, release it
if (m_pClock) {
m_pClock->Release();
}
// Set the new reference clock (might be NULL)
// Should we query it to ensure it is a clock? Consider for a debug build.
m_pClock = pClock;
return NOERROR;
}
/* Return the clock we are using for synchronisation */
STDMETHODIMP
CBaseMediaFilter::GetSyncSource(__deref_out_opt IReferenceClock **pClock)
{
CheckPointer(pClock,E_POINTER);
ValidateReadWritePtr(pClock,sizeof(IReferenceClock *));
CAutoLock cObjectLock(m_pLock);
if (m_pClock) {
// returning an interface... addref it...
m_pClock->AddRef();
}
*pClock = (IReferenceClock*)m_pClock;
return NOERROR;
}
/* Put the filter into a stopped state */
STDMETHODIMP
CBaseMediaFilter::Stop()
{
CAutoLock cObjectLock(m_pLock);
m_State = State_Stopped;
return S_OK;
}
/* Put the filter into a paused state */
STDMETHODIMP
CBaseMediaFilter::Pause()
{
CAutoLock cObjectLock(m_pLock);
m_State = State_Paused;
return S_OK;
}
// Put the filter into a running state.
// The time parameter is the offset to be added to the samples'
// stream time to get the reference time at which they should be presented.
//
// you can either add these two and compare it against the reference clock,
// or you can call CBaseMediaFilter::StreamTime and compare that against
// the sample timestamp.
STDMETHODIMP
CBaseMediaFilter::Run(REFERENCE_TIME tStart)
{
CAutoLock cObjectLock(m_pLock);
// remember the stream time offset
m_tStart = tStart;
if (m_State == State_Stopped){
HRESULT hr = Pause();
if (FAILED(hr)) {
return hr;
}
}
m_State = State_Running;
return S_OK;
}
//
// return the current stream time - samples with start timestamps of this
// time or before should be rendered by now
HRESULT
CBaseMediaFilter::StreamTime(CRefTime& rtStream)
{
// Caller must lock for synchronization
// We can't grab the filter lock because we want to be able to call
// this from worker threads without deadlocking
if (m_pClock == NULL) {
return VFW_E_NO_CLOCK;
}
// get the current reference time
HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream);
if (FAILED(hr)) {
return hr;
}
// subtract the stream offset to get stream time
rtStream -= m_tStart;
return S_OK;
}
//====================================================================
没有合适的资源?快使用搜索试试~ 我知道了~
directshow开发环境include/lib[x86/x64]
共95个文件
h:48个
cpp:39个
lib:4个
5星 · 超过95%的资源 需积分: 16 24 下载量 106 浏览量
2018-01-15
11:18:23
上传
评论 1
收藏 2.38MB RAR 举报
温馨提示
通过vs2013编译Debug/Release的strmbasd.lib/strmbase.lib[x86/x64] 请在工程里添加directshow的include/lib查找路径
资源推荐
资源详情
资源评论
收起资源包目录
directshow.rar (95个子文件)
include
wincontrol.h 3KB
wxutil.h 16KB
winutil.cpp 94KB
wxdebug.h 12KB
reftime.h 3KB
amextra.cpp 3KB
ctlutil.cpp 54KB
perfstruct.h 7KB
outputq.h 5KB
winctrl.cpp 67KB
combase.h 10KB
strmctl.cpp 13KB
vtrans.cpp 17KB
listbox.cpp 9KB
combobox.h 1KB
schedule.h 4KB
BaseWindow.h 1KB
fourcc.h 2KB
dialog.cpp 7KB
smartptr.h 4KB
listbox.h 1KB
streams.h 7KB
ddmm.cpp 3KB
combase.cpp 8KB
measure.h 8KB
outputq.cpp 24KB
wxdebug.cpp 48KB
wxutil.cpp 20KB
dllsetup.h 1KB
amfilter.cpp 155KB
checkbmi.h 4KB
source.cpp 12KB
schedule.cpp 8KB
combobox.cpp 7KB
videoctl.cpp 23KB
dllentry.cpp 10KB
dshowutil.h 70KB
winutil.h 17KB
wxlist.h 20KB
transip.cpp 34KB
ddmm.h 989B
amextra.h 2KB
baseclasses.sln 2KB
refclock.h 8KB
renbase.cpp 97KB
sysclock.h 1KB
toolbar.cpp 12KB
dialog.h 5KB
slider.cpp 17KB
source.h 6KB
strmctl.h 6KB
cache.h 3KB
toolbar.h 2KB
cprop.cpp 10KB
winctrl.h 10KB
wxlist.cpp 25KB
transfrm.h 10KB
button.cpp 3KB
renbase.h 21KB
amfilter.h 57KB
perflog.cpp 8KB
perflog.h 1KB
wincontrol.cpp 2KB
cprop.h 4KB
BaseWindow.cpp 4KB
BaseClasses.vcxproj 17KB
mtype.cpp 12KB
msgthrd.h 4KB
BaseClasses.vcxproj.filters 7KB
dllsetup.cpp 18KB
utils.h 2KB
pstream.cpp 5KB
vtrans.h 7KB
pullpin.h 4KB
videoctl.h 8KB
amvideo.cpp 9KB
sysclock.cpp 2KB
ctlutil.h 28KB
pullpin.cpp 11KB
transfrm.cpp 28KB
button.h 972B
mtype.h 3KB
UpgradeLog.htm 70KB
arithutil.cpp 10KB
refclock.cpp 13KB
seekpt.cpp 3KB
pstream.h 4KB
transip.h 9KB
seekpt.h 887B
dxmperf.h 10KB
slider.h 2KB
lib
strmbase.lib 3.44MB
strmbasd.lib 4.88MB
x64
strmbase.lib 3.68MB
strmbasd.lib 4.48MB
共 95 条
- 1
资源评论
- ObjLinking2018-07-31very good !!!
报告_前方高能
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功