103 lines
2.9 KiB
C
103 lines
2.9 KiB
C
//------------------------------------------------------------------------------
|
|
// File: Ticker.h
|
|
//
|
|
// Desc: DirectShow sample code - header file for VMR Ticker sample
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//------------------------------------------------------------------------------
|
|
|
|
// VMR9 Headers
|
|
#include <d3d9.h>
|
|
#include <vmr9.h>
|
|
|
|
//
|
|
// Function prototypes
|
|
//
|
|
HRESULT InitPlayerWindow(void);
|
|
HRESULT InitVideoWindow(int nMultiplier, int nDivider);
|
|
HRESULT HandleGraphEvent(void);
|
|
|
|
BOOL GetClipFileName(LPTSTR szName);
|
|
BOOL CheckVideoVisibility(void);
|
|
|
|
void PaintAudioWindow(void);
|
|
void MoveVideoWindow(void);
|
|
void CloseInterfaces(void);
|
|
void OpenClip(void);
|
|
void CloseClip(void);
|
|
void GetFilename(TCHAR *pszFull, TCHAR *pszFile);
|
|
void Msg(TCHAR *szFormat, ...);
|
|
|
|
HRESULT BlendApplicationImage(HWND hwndApp);
|
|
HRESULT InitializeWindowlessVMR(IBaseFilter **ppVmr9);
|
|
void OnPaint(HWND hwnd);
|
|
|
|
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister);
|
|
void RemoveGraphFromRot(DWORD pdwRegister);
|
|
BOOL VerifyVMR9(void);
|
|
|
|
//
|
|
// Constants
|
|
//
|
|
|
|
// File filter for OpenFile dialog
|
|
#define FILE_FILTER_TEXT \
|
|
TEXT("Video Files (*.asf; *.avi; *.qt; *.mov; *.mpg; *.mpeg; *.m1v; *.wmv)\0*.asf; *.avi; *.qt; *.mov; *.mpg; *.mpeg; *.m1v; *.wmv\0\0")
|
|
|
|
#define BFT_BITMAP 0x4d42 /* 'BM' */
|
|
|
|
// Begin default media search at root directory
|
|
#define DEFAULT_MEDIA_PATH TEXT("\\\0")
|
|
|
|
// Defaults used with audio-only files
|
|
#define DEFAULT_PLAYER_WIDTH 240
|
|
#define DEFAULT_PLAYER_HEIGHT 120
|
|
#define DEFAULT_VIDEO_WIDTH 320
|
|
#define DEFAULT_VIDEO_HEIGHT 240
|
|
#define MINIMUM_VIDEO_WIDTH 200
|
|
#define MINIMUM_VIDEO_HEIGHT 120
|
|
|
|
#define APPLICATIONNAME TEXT("VMR9 Ticker\0")
|
|
#define CLASSNAME TEXT("VMR9Ticker\0")
|
|
|
|
#define WM_GRAPHNOTIFY WM_USER+13
|
|
|
|
//
|
|
// Global data
|
|
//
|
|
extern HWND ghApp;
|
|
extern HMENU ghMenu;
|
|
extern HINSTANCE ghInst;
|
|
extern TCHAR g_szFileName[MAX_PATH];
|
|
extern DWORD g_dwGraphRegister;
|
|
extern DWORD g_dwTickerFlags;
|
|
|
|
// DirectShow interfaces
|
|
extern IGraphBuilder *pGB;
|
|
extern IMediaControl *pMC;
|
|
extern IVMRWindowlessControl9 *pWC;
|
|
extern IMediaControl *pMC;
|
|
extern IMediaEventEx *pME;
|
|
extern IMediaSeeking *pMS;
|
|
|
|
//
|
|
// Macros
|
|
//
|
|
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
|
|
|
|
#define JIF(x) if (FAILED(hr=(x))) \
|
|
{Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n\0"), hr); return hr;}
|
|
|
|
#define LIF(x) if (FAILED(hr=(x))) \
|
|
{Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n\0"), hr);}
|
|
|
|
// DIB Macros
|
|
#define DibNumColors(lpbi) ((lpbi)->biClrUsed == 0 && (lpbi)->biBitCount <= 8 \
|
|
? (int)(1 << (int)(lpbi)->biBitCount) \
|
|
: (int)(lpbi)->biClrUsed)
|
|
|
|
#define DibSize(lpbi) ((lpbi)->biSize + (lpbi)->biSizeImage + (int)(lpbi)->biClrUsed * sizeof(RGBQUAD))
|
|
|
|
#define DibPaletteSize(lpbi) (DibNumColors(lpbi) * sizeof(RGBQUAD))
|
|
|