Click here to Skip to main content
15,881,172 members
Articles / Multimedia / DirectX

Prototyping DirectShow filters in C#

Rate me:
Please Sign up or sign in to vote.
4.42/5 (6 votes)
14 Dec 20054 min read 282.6K   3.7K   66  
This article shows how to implement a DirectShow filter in C#.
#pragma once
#using <mscorlib.dll>
#using <MyBW.dll>

#include <vcclr.h>

class CCsSobel : public CTransformFilter
{

public:

    DECLARE_IUNKNOWN;
    static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);

    // Overrriden from CTransformFilter base class
    HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
    HRESULT CheckInputType(const CMediaType *mtIn);
    HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut);
    HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pProperties);
    HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);


private:

    // Constructor
    CCsSobel(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
	~CCsSobel();

    CCritSec m_CsSobelLock;         // Private play critical section

    gcroot< MyBW *> mySobel;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
You can read my blog entries at:
http://wwww.informikon.com/blog/

Comments and Discussions