当前位置: 代码迷 >> Windows Mobile >> 急求如何样在directshow里实时取每一桢,以及翻转90度
  详细解决方案

急求如何样在directshow里实时取每一桢,以及翻转90度

热度:2337   发布时间:2013-02-26 00:00:00.0
急求怎么样在directshow里实时取每一桢,以及翻转90度
急求怎么样在directshow里实时取每一桢,而且要转换成YUV格式的,我在网上看到一下资料是用ISampleGrabber的,但wm不支持ISampleGrabber.还有我在Preview发现图像转了90度,在网上看到了一些资料说要在CTransformFilter里翻转,但我写了一个类继承CTransformFilter时出现了error C2512: 'CTransformFilter' : no appropriate default constructor available,急求大家指点一下,最好是有代码例子的,谢谢大家了.唉,刚刚接触directshow, 项目又紧
------解决方案--------------------------------------------------------
error C2512: 'CTransformFilter' : no appropriate default constructor available的问题是我自己加了构造函数去掉后出现下面的错误

1>CameraCap.obj : error LNK2019: unresolved external symbol "public: __cdecl CTransformFilter::CTransformFilter(wchar_t *,struct IUnknown *,struct _GUID const &)" (??0CTransformFilter@@QAA@PA_WPAUIUnknown@@ABU_GUID@@@Z) referenced in function "public: __cdecl CCRotateFilter::CCRotateFilter(struct IUnknown *,long *)" (??0CCRotateFilter@@QAA@PAUIUnknown@@PAJ@Z)
1>CameraCap.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __cdecl CBaseFilter::NonDelegatingRelease(void)" (?NonDelegatingRelease@CBaseFilter@@UAAKXZ)
1>CameraCap.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CTransformFilter::FindPin(wchar_t const *,struct IPin * *)" (?FindPin@CTransformFilter@@UAAJPB_WPAPAUIPin@@@Z)
1>CameraCap.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CBaseFilter::JoinFilterGraph(struct IFilterGraph *,wchar_t const *)" (?JoinFilterGraph@CBaseFilter@@UAAJPAUIFilterGraph@@PB_W@Z)
1>CameraCap.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CBaseFilter::QueryVendorInfo(wchar_t * *)" (?QueryVendorInfo@CBaseFilter@@UAAJPAPA_W@Z)
------解决方案--------------------------------------------------------
这个错像是头文件的问题啊。
------解决方案--------------------------------------------------------
头文件???

我在.h中的申明
#pragma once

EXTERN_GUID(CLSID_MyFilter, 0x00780718, 0x8864, 0x4a60, 0xb2, 0x6c, 0x55, 0x2f, 0x9a, 0xa4, 0x72, 0xe2);

class CCRotateFilter : CTransformFilter
{
public:
DECLARE_IUNKNOWN;

CCRotateFilter(LPUNKNOWN pUnk, HRESULT* phr) :
CTransformFilter(NAME("My Filter1"), pUnk, CLSID_MyFilter)
{
m_lWidth   = 0;
m_lHeight = 0;
m_biBitCount = 0;
m_biCompression = 0;
m_cbWidth = 0;
m_cbHeight = 0;
}

HRESULT CheckInputType(const CMediaType * mtIn);
HRESULT GetMediaType(int iPos, CMediaType * pmt);

HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut);
HRESULT DecideBufferSize(IMemAllocator * pima, ALLOCATOR_PROPERTIES * pProperties);

HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);

private:
long m_lWidth;//每行总像素数
long m_lHeight;//
long m_cbWidth;//每行总字节数(16位色:m_cbWidth = 2*m_lWidth)
long m_cbHeight;//
WORD m_biBitCount;
DWORD m_biCompression;
};

.cpp中是
#include "stdafx.h"
//#include "streams.h"
#include "RotateFilter.h"


HRESULT CCRotateFilter::CheckInputType(const CMediaType * mtIn)
  相关解决方案