?? videoctl.cpp
字號:
//------------------------------------------------------------------------------
// File: VideoCtl.cpp
//
// Desc: DirectShow base classes.
//
// Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <streams.h>
#include "ddmm.h"
// Load a string from the resource file string table. The buffer must be at
// least STR_MAX_LENGTH bytes. The easiest way to use this is to declare a
// buffer in the property page class and use it for all string loading. It
// cannot be static as multiple property pages may be active simultaneously
TCHAR *WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID)
{
if (LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
return TEXT("");
}
return pBuffer;
}
#ifdef UNICODE
char *WINAPI StringFromResource(char *pBuffer, int iResourceID)
{
if (LoadStringA(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
return "";
}
return pBuffer;
}
#endif
// Property pages typically are called through their OLE interfaces. These
// use UNICODE strings regardless of how the binary is built. So when we
// load strings from the resource file we sometimes want to convert them
// to UNICODE. This method is passed the target UNICODE buffer and does a
// convert after loading the string (if built UNICODE this is not needed)
// On WinNT we can explicitly call LoadStringW which saves two conversions
#ifndef UNICODE
WCHAR * WINAPI WideStringFromResource(WCHAR *pBuffer, int iResourceID)
{
*pBuffer = 0;
if (g_amPlatform == VER_PLATFORM_WIN32_NT) {
LoadStringW(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH);
} else {
CHAR szBuffer[STR_MAX_LENGTH];
DWORD dwStringLength = LoadString(g_hInst,iResourceID,szBuffer,STR_MAX_LENGTH);
// if we loaded a string convert it to wide characters, ensuring
// that we also null terminate the result.
if (dwStringLength++) {
MultiByteToWideChar(CP_ACP,0,szBuffer,dwStringLength,pBuffer,STR_MAX_LENGTH);
}
}
return pBuffer;
}
#endif
// Helper function to calculate the size of the dialog
BOOL WINAPI GetDialogSize(int iResourceID,
DLGPROC pDlgProc,
LPARAM lParam,
SIZE *pResult)
{
RECT rc;
HWND hwnd;
// Create a temporary property page
hwnd = CreateDialogParam(g_hInst,
MAKEINTRESOURCE(iResourceID),
GetDesktopWindow(),
pDlgProc,
lParam);
if (hwnd == NULL) {
return FALSE;
}
GetWindowRect(hwnd, &rc);
pResult->cx = rc.right - rc.left;
pResult->cy = rc.bottom - rc.top;
DestroyWindow(hwnd);
return TRUE;
}
// Class that aggregates on the IDirectDraw interface. Although DirectDraw
// has the ability in its interfaces to be aggregated they're not currently
// implemented. This makes it difficult for various parts of Quartz that want
// to aggregate these interfaces. In particular the video renderer passes out
// media samples that expose IDirectDraw and IDirectDrawSurface. The filter
// graph manager also exposes IDirectDraw as a plug in distributor. For these
// objects we provide these aggregation classes that republish the interfaces
STDMETHODIMP CAggDirectDraw::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
ASSERT(m_pDirectDraw);
// Do we have this interface
if (riid == IID_IDirectDraw) {
return GetInterface((IDirectDraw *)this,ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid,ppv);
}
}
STDMETHODIMP CAggDirectDraw::Compact()
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->Compact();
}
STDMETHODIMP CAggDirectDraw::CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->CreatePalette(dwFlags,lpColorTable,lplpDDPalette,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->CreateSurface(lpDDSurfaceDesc,lplpDDSurface,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->DuplicateSurface(lpDDSurface,lplpDupDDSurface);
}
STDMETHODIMP CAggDirectDraw::EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->EnumDisplayModes(dwSurfaceDescCount,lplpDDSurfaceDescList,lpContext,lpEnumCallback);
}
STDMETHODIMP CAggDirectDraw::EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->EnumSurfaces(dwFlags,lpDDSD,lpContext,lpEnumCallback);
}
STDMETHODIMP CAggDirectDraw::FlipToGDISurface()
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->FlipToGDISurface();
}
STDMETHODIMP CAggDirectDraw::GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetCaps(lpDDDriverCaps,lpDDHELCaps);
}
STDMETHODIMP CAggDirectDraw::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetDisplayMode(lpDDSurfaceDesc);
}
STDMETHODIMP CAggDirectDraw::GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetFourCCCodes(lpNumCodes,lpCodes);
}
STDMETHODIMP CAggDirectDraw::GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetGDISurface(lplpGDIDDSurface);
}
STDMETHODIMP CAggDirectDraw::GetMonitorFrequency(LPDWORD lpdwFrequency)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetMonitorFrequency(lpdwFrequency);
}
STDMETHODIMP CAggDirectDraw::GetScanLine(LPDWORD lpdwScanLine)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetScanLine(lpdwScanLine);
}
STDMETHODIMP CAggDirectDraw::GetVerticalBlankStatus(LPBOOL lpblsInVB)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->GetVerticalBlankStatus(lpblsInVB);
}
STDMETHODIMP CAggDirectDraw::Initialize(GUID *lpGUID)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->Initialize(lpGUID);
}
STDMETHODIMP CAggDirectDraw::RestoreDisplayMode()
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->RestoreDisplayMode();
}
STDMETHODIMP CAggDirectDraw::SetCooperativeLevel(HWND hWnd,DWORD dwFlags)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->SetCooperativeLevel(hWnd,dwFlags);
}
STDMETHODIMP CAggDirectDraw::SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->SetDisplayMode(dwWidth,dwHeight,dwBpp);
}
STDMETHODIMP CAggDirectDraw::WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent)
{
ASSERT(m_pDirectDraw);
return m_pDirectDraw->WaitForVerticalBlank(dwFlags,hEvent);
}
// Class that aggregates an IDirectDrawSurface interface. Although DirectDraw
// has the ability in its interfaces to be aggregated they're not currently
// implemented. This makes it difficult for various parts of Quartz that want
// to aggregate these interfaces. In particular the video renderer passes out
// media samples that expose IDirectDraw and IDirectDrawSurface. The filter
// graph manager also exposes IDirectDraw as a plug in distributor. For these
// objects we provide these aggregation classes that republish the interfaces
STDMETHODIMP CAggDrawSurface::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
ASSERT(m_pDirectDrawSurface);
// Do we have this interface
if (riid == IID_IDirectDrawSurface) {
return GetInterface((IDirectDrawSurface *)this,ppv);
} else {
return CUnknown::NonDelegatingQueryInterface(riid,ppv);
}
}
STDMETHODIMP CAggDrawSurface::AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->AddAttachedSurface(lpDDSAttachedSurface);
}
STDMETHODIMP CAggDrawSurface::AddOverlayDirtyRect(LPRECT lpRect)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->AddOverlayDirtyRect(lpRect);
}
STDMETHODIMP CAggDrawSurface::Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->Blt(lpDestRect,lpDDSrcSurface,lpSrcRect,dwFlags,lpDDBltFx);
}
STDMETHODIMP CAggDrawSurface::BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->BltBatch(lpDDBltBatch,dwCount,dwFlags);
}
STDMETHODIMP CAggDrawSurface::BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->BltFast(dwX,dwY,lpDDSrcSurface,lpSrcRect,dwTrans);
}
STDMETHODIMP CAggDrawSurface::DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->DeleteAttachedSurface(dwFlags,lpDDSAttachedSurface);
}
STDMETHODIMP CAggDrawSurface::EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->EnumAttachedSurfaces(lpContext,lpEnumSurfacesCallback);
}
STDMETHODIMP CAggDrawSurface::EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->EnumOverlayZOrders(dwFlags,lpContext,lpfnCallback);
}
STDMETHODIMP CAggDrawSurface::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->Flip(lpDDSurfaceTargetOverride,dwFlags);
}
STDMETHODIMP CAggDrawSurface::GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->GetAttachedSurface(lpDDSCaps,lplpDDAttachedSurface);
}
STDMETHODIMP CAggDrawSurface::GetBltStatus(DWORD dwFlags)
{
ASSERT(m_pDirectDrawSurface);
return m_pDirectDrawSurface->GetBltStatus(dwFlags);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -