/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
////																					////
////																					////
////					 - WmpRenderer.cpp -	        								////
////																					////
////																					////
////				Implementation of TextureRenderer Class             		    	////
////						Version  1.0	(August 2001)    			 				////
////																					////
////						Nadège SONNET     	  							            ////
////																					////
////																					////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////

#ifdef _WMPVIDEORENDERER_
#else
#define _WMPVIDEORENDERER_
 


#include <streams.h>
#include <assert.h>
#include "Wmp.h"




// Player state
typedef enum {
    Uninitialized = 0, Stopped, Paused, Playing
} PLAYER_STATE ;

  

//-----------------------------------------------------------------------------
// CTextureRenderer Class Declarations
//-----------------------------------------------------------------------------
class CTextureRenderer : public CBaseVideoRenderer
{
public:
    CTextureRenderer(LPUNKNOWN pUnk,HRESULT *phr);
    ~CTextureRenderer();
 
 

public:
    HRESULT CheckMediaType(const CMediaType *pmt );     // Format acceptable?
    HRESULT SetMediaType(const CMediaType *pmt );       // Video format notification
    HRESULT DoRenderSample(IMediaSample *pMediaSample); //Render Sample (blit on a texture)
	void OnReceiveFirstSample(IMediaSample *pMediaSample); //Render first received sample


	static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);//Query IBaseFilter interface
    DECLARE_IUNKNOWN;
    STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);

    HRESULT RenderFile(IGraphBuilder *m_pGB, LPCWSTR lpwstrFile, LPCWSTR lpwstrPlayList);//render media file
	STDMETHODIMP Stop(IMediaControl *m_pMC);//stop media file
	STDMETHODIMP Pause(IMediaControl *m_pMC);//pause media file
	STDMETHODIMP Run(IMediaControl *m_pMC);//run media file
	void WaitForState(FILTER_STATE State,IMediaControl *m_pMC);//Wait change of state
	BOOL    IsGraphReady(void)                  { return (Uninitialized != m_eState) ; } ;//Verify if filters graph ready

    void Init(IUnknown* pUnknown, mywmpbuf p);//Init of class parameters



private:
	mywmpbuf			m_mywmpbuf;//video rendere buffer
    IUnknown*			m_pUnknown;//IUnkown interface
	LONG m_lVidWidth;	// Video width
	LONG m_lVidHeight;	// Video Height
	LONG m_lVidPitch;	// Video Pitcht
	PLAYER_STATE m_eState;//Video state (stopped, paused or playing)


};



#endif