Commit 3e9cee05 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Add VIDEOINFOHEADER2 support to VideoRenderer.

parent 62010249
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
#include "evcode.h" #include "evcode.h"
#include "strmif.h" #include "strmif.h"
#include "ddraw.h" #include "ddraw.h"
#include "dvdmedia.h"
#include "assert.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -263,7 +265,6 @@ static const IMemInputPinVtbl MemInputPin_Vtbl = ...@@ -263,7 +265,6 @@ static const IMemInputPinVtbl MemInputPin_Vtbl =
static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size) static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
{ {
VIDEOINFOHEADER* format;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
HRESULT hr = S_OK; HRESULT hr = S_OK;
DDSURFACEDESC sdesc; DDSURFACEDESC sdesc;
...@@ -271,6 +272,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -271,6 +272,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
int height; int height;
LPBYTE palette = NULL; LPBYTE palette = NULL;
HDC hDC; HDC hDC;
BITMAPINFOHEADER *bmiHeader;
TRACE("%p %p %d\n", This, data, size); TRACE("%p %p %d\n", This, data, size);
...@@ -280,23 +282,39 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -280,23 +282,39 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
ERR("Unable to retrieve media type\n"); ERR("Unable to retrieve media type\n");
return hr; return hr;
} }
format = (VIDEOINFOHEADER*)amt.pbFormat;
TRACE("biSize = %d\n", format->bmiHeader.biSize); if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
TRACE("biWidth = %d\n", format->bmiHeader.biWidth); {
TRACE("biHeight = %d\n", format->bmiHeader.biHeight); bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
TRACE("biPlanes = %d\n", format->bmiHeader.biPlanes); }
TRACE("biBitCount = %d\n", format->bmiHeader.biBitCount); else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(format->bmiHeader.biCompression), 4)); {
TRACE("biSizeImage = %d\n", format->bmiHeader.biSizeImage); bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
}
else
{
FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
return VFW_E_RUNTIME_ERROR;
}
width = format->bmiHeader.biWidth;
height = format->bmiHeader.biHeight; TRACE("biSize = %d\n", bmiHeader->biSize);
palette = ((LPBYTE)&format->bmiHeader) + format->bmiHeader.biSize; TRACE("biWidth = %d\n", bmiHeader->biWidth);
TRACE("biHeight = %d\n", bmiHeader->biHeight);
TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
width = bmiHeader->biWidth;
height = bmiHeader->biHeight;
palette = ((LPBYTE)bmiHeader) + bmiHeader->biSize;
if (!This->init) if (!This->init)
{ {
/* Honor previously set WindowPos */ if (!This->WindowPos.right || !This->WindowPos.bottom)
This->WindowPos = This->SourceRect;
TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom); TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
SetWindowPos(This->hWnd, NULL, SetWindowPos(This->hWnd, NULL,
This->WindowPos.left, This->WindowPos.left,
...@@ -304,6 +322,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -304,6 +322,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
This->WindowPos.right - This->WindowPos.left, This->WindowPos.right - This->WindowPos.left,
This->WindowPos.bottom - This->WindowPos.top, This->WindowPos.bottom - This->WindowPos.top,
SWP_NOZORDER|SWP_NOMOVE); SWP_NOZORDER|SWP_NOMOVE);
GetClientRect(This->hWnd, &This->DestRect); GetClientRect(This->hWnd, &This->DestRect);
This->init = TRUE; This->init = TRUE;
} }
...@@ -321,10 +340,9 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, ...@@ -321,10 +340,9 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left, StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top, This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top, This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
data, (BITMAPINFO*)&format->bmiHeader, DIB_RGB_COLORS, SRCCOPY); data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
ReleaseDC(This->hWnd, hDC); ReleaseDC(This->hWnd, hDC);
if (This->AutoShow) if (This->AutoShow)
ShowWindow(This->hWnd, SW_SHOW); ShowWindow(This->hWnd, SW_SHOW);
...@@ -385,17 +403,29 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt ...@@ -385,17 +403,29 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8)) IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
{ {
VideoRendererImpl* This = (VideoRendererImpl*) iface; VideoRendererImpl* This = (VideoRendererImpl*) iface;
VIDEOINFOHEADER* format = (VIDEOINFOHEADER*)pmt->pbFormat;
if (!IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
{ {
WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype)); VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
return S_FALSE;
}
This->SourceRect.left = 0; This->SourceRect.left = 0;
This->SourceRect.top = 0; This->SourceRect.top = 0;
This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth; This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight; This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
}
else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
{
VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
This->SourceRect.left = 0;
This->SourceRect.top = 0;
This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
}
else
{
WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
return S_FALSE;
}
return S_OK; return S_OK;
} }
return S_FALSE; return S_FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment