c++ - Create a custom class for this directshow system, cant figure out how -


i'm trying learn directshow, , computer vision opencv. keep code cleaner want "put away" (create class) directshow code i've borrowed internet. code is: http://alax.info/trac/public/browser/trunk/utilities/setlifecamstudioresolutionsample/setlifecamstudioresolutionsample.cpp

okay. in vc++ project, create new class. call "directshowclass", have directshowclass.h & .cpp.

the problem have cant figure out how take care of parts in code.

everything in _tmain() put in 1 function. 1 okay.

but do with:

ccomptr<ipin> getpin(ibasefilter* pbasefilter, size_t nindex = 0) {     .... } 

and:

#pragma region formerly located in qedit.h in windows sdk, obsoleted , defined within project  struct __declspec(uuid("0579154a-2b53-4994-b0d0-e773148eff85")) isamplegrabbercb : iunknown {     //     // raw methods provided interface     //        virtual hresult __stdcall samplecb (double sampletime,struct imediasample * psample ) = 0;       virtual hresult __stdcall buffercb double sampletime,unsigned char * pbuffer, long bufferlen ) = 0; };  struct __declspec(uuid("6b652fff-11fe-4fce-92ad-0266b5d7c78f")) isamplegrabber : iunknown {     //     // raw methods provided interface     //        virtual hresult __stdcall setoneshot (         long oneshot ) = 0;       virtual hresult __stdcall setmediatype (         struct _ammediatype * ptype ) = 0;       virtual hresult __stdcall getconnectedmediatype (         struct _ammediatype * ptype ) = 0;       virtual hresult __stdcall setbuffersamples (         long bufferthem ) = 0;       virtual hresult __stdcall getcurrentbuffer (         /*[in,out]*/ long * pbuffersize,         /*[out]*/ long * pbuffer ) = 0;       virtual hresult __stdcall getcurrentsample (         /*[out,retval]*/ struct imediasample * * ppsample ) = 0;       virtual hresult __stdcall setcallback (         struct isamplegrabbercb * pcallback,         long whichmethodtocallback ) = 0; };  struct __declspec(uuid("c1f400a0-3f08-11d3-9f0b-006008039e37")) samplegrabber;     // [ default ] interface isamplegrabber  #pragma endregion  #undef atlensure_succeeded #define atlensure_succeeded(x) { hresult __a = (x); if(failed(__a)) { _tprintf(_t("error 0x%08x in line %d\n"), __a, __line__); atlthrow(__a); } } 

how declare them in .h file? , .cpp file.

the second fragment (#pragma region/endregion) ok included on .h in project, visible code needs it.

the first fragment static function. can copy of classes, or can add "inline" specifier right before "ccomptr getpin..." on first line , again leave on .h file.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -