• 全部
  • 问答

视频捕捉和压缩windows实现方式

stidio_zhougang 2002-07-31 09:38:35
视频捕捉和压缩windows实现方式?
...全文
15 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
夭夭 2002-07-31
#ifndef VIDEOCAP_H
#define VIDEOCAP_H
#include <dshow.h>
#include <Qedit.h>
class CSampleGrabberCB;
class CVideoCap
{
//--------------------------------------------------------------
class CSampleGrabberCB : public ISampleGrabberCB
{
private:
CVideoCap *m_pfather;
public:
CSampleGrabberCB( )
{
;
}
int SetFather(CVideoCap *p)
{
this->m_pfather=p;
return 0;
}
STDMETHODIMP_(ULONG) AddRef() { return 2; }
STDMETHODIMP_(ULONG) Release() { return 1; }
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv)
{
if( riid == IID_ISampleGrabberCB || riid == IID_IUnknown )
{
*ppv = (void *) static_cast<ISampleGrabberCB*> ( this );
return NOERROR;
}
return E_NOINTERFACE;
}
STDMETHODIMP SampleCB( double SampleTime, IMediaSample * pSample )
{
return 0;
}
STDMETHODIMP BufferCB( double dblSampleTime, BYTE * pBuffer, long lBufferSize )
{
return this->m_pfather->OnCapture((char *)pBuffer,(unsigned long)lBufferSize);
}
};
//--------------------------------------------------------------
public:
int StartCap(void);//开始
int StopCap(void); //停止
protected:
virtual int OnCapture(char * pData,unsigned long nLen){return 0;};//捕获
private:
int CapInit(void);//初始化
int CapUnInit(void);//释放
public:
CVideoCap(void);
virtual ~CVideoCap(void);
private:
CSampleGrabberCB m_SampleGrabberCB;//数据采集回调设置类
//----------------------
IGraphBuilder *m_pGB ;//图形接口
ICaptureGraphBuilder2 *m_pCG ;//捕获接口
IMediaControl *m_pMC ;//控制接口
IVideoWindow *m_pVW ;//播放窗口
ISampleGrabber *m_pSG;//回调设置
IBaseFilter *m_pSGFilter;//数据源,
IBaseFilter *m_pCGFilter;//捕获源
IPin *m_pRP; //图形接口的输出PIN
AM_MEDIA_TYPE *m_Amt;//数据采集格式
IAMStreamConfig *m_pVSC;//设置捕获流的格式
bool m_Ready; //初始化成功
private:
IBaseFilter * GetCapFilter(void);//获取采集源
int InstallSampleGrabber(void); //安装回调
IPin * GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir);//获得过滤器的输入或是输出接口
int ConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond);//连接过滤器
};
#endif
这是接口部份,别的太长了,不好发,发到你的邮箱
回复
发帖
C语言
创建于2007-09-28

6.3w+

社区成员

C语言相关问题讨论
申请成为版主
帖子事件
创建了帖子
2002-07-31 09:38
社区公告
暂无公告