Click here to Skip to main content
15,884,537 members
Articles / Multimedia / DirectX

DirectShow Filters Development Part 1: Video Rendering with Direct2D

Rate me:
Please Sign up or sign in to vote.
4.85/5 (44 votes)
31 Jan 2011CPOL10 min read 218K   6.8K   118  
This article is about DirectShow development in general and filters development in detail.
#pragma once

#include "D2DRenderer.h"
#include "IVideoRenderer.h"
#include "VideoWindow.h"
#include "Dvdmedia.h"
#include "ColorSpaceConverter.h"

class CD2DVideoRender : public CBaseVideoRenderer, public IVideoRenderer
{
public:
	DECLARE_IUNKNOWN;
	
	CD2DVideoRender(LPUNKNOWN pUnk, HRESULT* phr);
	virtual ~CD2DVideoRender(void);

	virtual HRESULT DoRenderSample(IMediaSample *pMediaSample);
    virtual HRESULT CheckMediaType(const CMediaType *pmt);
	virtual HRESULT SetMediaType(const CMediaType *pmt);
	virtual HRESULT StartStreaming();

	static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr); 
	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);

	STDMETHODIMP SetVideoWindow(HWND hWnd);
	STDMETHOD_(void, SetDisplayMode)(DisplayMode);
	STDMETHOD_(DisplayMode, GetDisplayMode)(void);

	void CreateDefaultWindow();

private:
	HWND m_hWnd;
	CD2DRenderer* m_renderer;
	HANDLE m_event;
	BITMAPINFOHEADER m_bmpInfo;
	CMediaType m_mediaType;
	CColorSpaceConverter* m_converter;
};


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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions