⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 media.h

📁 本源码是关于在wince下如何使用directx播放多媒体文件的小程序
💻 H
字号:
/////////////////////////////////////////////////////////////////////        
//Media.h: interface for the CMedia class.
//
//Version:
//    1.2.0
//Date:
//    2007.05.08
/**///////////////////////////////////////////////////////////////////////
#ifndef MEDIA_H
#define    MEDIA_H


#include <mmsystem.h>
#include <streams.h>


//--------------------------------------------------------------------
//Macro define

//The volume value
#define MAX_VOLUME                    0
#define MIN_VOLUME                    -10000

//The balance value
#define MAX_BALANCE                    10000
#define MIN_BALANCE                    -10000

//--------------------------------------------------------------------
//Enum value

enum DISPLAYMODE
{    
    //Fit to the play window size. How wide (height) the window is, how 
    //is the move. Keep aspect ratio.
    DISP_FIT,

    //Stretch to the play window size. Don't keep the aspect ratio.
    DISP_STRETCH,

    //Full screen play.
    DISP_FULLSCREEN,

    //When the size of video is smaller than the play window, it displayes
    //as the video size. If it's bigger , it just like the DISP_FIT mode.
    DISP_NATIVE
};
//--------------------------------------------------------------------

//The media file property
typedef struct
{
    //The volume range is –10,000 to 0.
    //Divide by 100 to get equivalent decibel value (for example –10,000 = –100 dB). 
    LONG lVolume;

    //The value from –10,000 to 10,000 indicating the stereo balance
    //As with the Volume property, units correspond to .01 decibels (multiplied by –1 when plBalance is a positive value).
    //For example, a value of 1000 indicates –10 dB on the right channel and –90 dB on the left channel. 
    LONG lBalance;

    //Width of the video  
    LONG lWidth;

    //Height of the video
    LONG lHeight;

    //Approximate bit rate
    LONG lBitRate;

}MEDIAPROPERTY,*PMEDIAPROPERTY;
//--------------------------------------------------------------------
class CMedia  
{
public:
    BOOL GetEvent(LONG *plEvCode, LONG *plParam1, LONG *plParam2);
    BOOL SetNotifyWindow(HWND hWnd, UINT wMsg,long lInstanceData);
    BOOL SetVolume(LONG lVolume, LONG lBalance = 0);
    BOOL SetDisplayMode(DISPLAYMODE mode);
    BOOL GetMediaProperty(PMEDIAPROPERTY pOutProperty);
    static CMedia * GetInstance();
    void Close();
    BOOL CheckVisibility();
    void SetVideoWindow(HWND hWndVideo);
    BOOL Open(TCHAR * pszFileName);
    BOOL Stop();
    BOOL Pause();
    BOOL Play();
    virtual ~CMedia();

protected:


    CMedia();
    
    // Collection of interfaces
    IGraphBuilder *m_pGB;
    IMediaControl *m_pMC;
    IMediaEventEx *m_pME;
    IVideoWindow  *m_pVW;
    IBasicAudio   *m_pBA;
    IBasicVideo   *m_pBV;
    IMediaSeeking *m_pMS;

    TCHAR m_szFileName[MAX_PATH];
    HWND m_hWndVideo; //The window play video
    HWND m_hWndNotify; //The window notify
    BOOL m_bExitThrd;
    BOOL m_bThrdRunning;
    static CMedia * m_pInstance;
    DISPLAYMODE m_DispMode;

};

#endif //#ifndef MEDIA_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -