www.pudn.com > MoviePlay.zip > MovieView.h
//==========================================================================; // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR // PURPOSE. // // Copyright (c) 1994 - 1998 Microsoft Corporation. All Rights Reserved. // //--------------------------------------------------------------------------; // // MovieView.h : interface of the CMovieView class // aze // (c) Stephane Rodriguez 98 ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_) #define AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 ///////////////////////////////////////////////////////////////////////////// // CMovieApp: // See MovieWinBackMFC.cpp for the implementation of this class // // This application uses a Multimedia stream to render // a video file to a DirectDrawEx surface contained in // a window. It implements a primary DirectDraw surface // and an offscreen DirectDraw surface to optimize individual // frame blits. It also attaches a DirectDraw clipper to the // window to process window overlapping. //To compile this program you must have DXMedia SDK 5.1 installed //and you will need set your include path under tools/options/directories/include //to c:\DXMedia\include and your library path to c:\DXMedia\lib //Also link with the following libraries under project/settings/link... //amstrmid.lib quartz.lib strmbase.lib ddraw.lib #include// DirectDraw multimedia stream interfaces #include // DirectDrawEx interfaces #include extern CComModule _Module; #include #include #define APPLICATIONNAME "Multimedia Stream In Window" #define CLASSNAME "MMSDDRAWEXWINDOW" class CMovieView : public CView { protected: // create from serialization only CMovieView(); DECLARE_DYNCREATE(CMovieView) // Attributes public: CMovieDoc* GetDocument(); protected : BOOL m_bAppactive, // The mmstream is rendering ? m_bFileLoaded, // There is a file loaded ? m_bPaused; // The movie has been paused ? WORD m_video_width, m_video_height; TCHAR m_szFilename[MAX_PATH]; STREAM_TIME m_StreamTime; // Stream time of the movie file //DirectDrawEx interfaces IDirectDraw *m_pDD; IDirectDraw3 *m_pDD3; IDirectDrawFactory *m_pDDF; IDirectDrawSurface *m_pPrimarySurface; IDirectDrawSurface *m_pDDSOffscreen; IDirectDrawSurface *m_pDDSOffscreen2; IDirectDrawClipper *m_pDDClipper; //MultiMedia streaming interfaces IMultiMediaStream *m_pMMStream; IMediaStream *m_pPrimaryVidStream; IDirectDrawMediaStream *m_pDDStream; IDirectDrawStreamSample *m_pSample; // (can't use CComPtr here because of multiple instanciations : open a video, then another, ...) // Operations protected : HRESULT InitDDrawEx(); BOOL GetOpenMovieFile(LPSTR szName); HRESULT RenderFileToMMStream(LPCTSTR szFilename); HRESULT InitRenderToSurface(); void switchPlayPause(); void DestroyObjects(); void ExitCode(); public : void RenderToSurface(BOOL bSingleBlit=TRUE); // Implementation public: virtual ~CMovieView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CMovieView) // NOTE - the ClassWizard will add and remove member functions here. virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); BOOL OnEraseBkgnd( CDC* pDC ); afx_msg void OnFileOpen(); afx_msg void OnStart(); afx_msg void OnPause(); afx_msg void OnStop(); afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ); afx_msg void OnLButtonDown( UINT nFlags, CPoint point ); // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in MovieView.cpp inline CMovieDoc* CMovieView::GetDocument() { return (CMovieDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MOVIEVIEW_H__8F3E666D_3B66_11D2_92F7_00104B498E9D__INCLUDED_)