Commit 44ef5177 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Add more tests for parser media types.

parent 0a9acdef
......@@ -526,14 +526,21 @@ static void test_media_types(void)
{
static const VIDEOINFOHEADER expect_vih =
{
{0}, {0}, 0, 0, 1000 * 10000,
{sizeof(BITMAPINFOHEADER), 32, 24, 1, 12, mmioFOURCC('I','4','2','0'), 32*24*12/8}
.AvgTimePerFrame = 1000 * 10000,
.bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
.bmiHeader.biWidth = 32,
.bmiHeader.biHeight = 24,
.bmiHeader.biPlanes = 1,
.bmiHeader.biBitCount = 12,
.bmiHeader.biCompression = mmioFOURCC('I','4','2','0'),
.bmiHeader.biSizeImage = 32 * 24 * 12 / 8,
};
const WCHAR *filename = load_resource(L"test.avi");
IBaseFilter *filter = create_avi_splitter();
AM_MEDIA_TYPE mt = {{0}}, *pmt;
IEnumMediaTypes *enummt;
VIDEOINFOHEADER *vih;
IFilterGraph2 *graph;
HRESULT hr;
ULONG ref;
......@@ -630,6 +637,28 @@ static void test_media_types(void)
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
pmt->formattype = FORMAT_VideoInfo;
vih = (VIDEOINFOHEADER *)pmt->pbFormat;
vih->AvgTimePerFrame = 10000;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
vih->AvgTimePerFrame = 1000 * 10000;
vih->dwBitRate = 1000000;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
vih->dwBitRate = 0;
SetRect(&vih->rcSource, 0, 0, 32, 24);
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
SetRect(&vih->rcSource, 0, 0, 0, 0);
vih->bmiHeader.biCompression = BI_RGB;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
vih->bmiHeader.biCompression = mmioFOURCC('I','4','2','0');
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
......
......@@ -529,7 +529,9 @@ static void test_media_types(void)
const WCHAR *filename = load_resource(L"test.mp3");
AM_MEDIA_TYPE mt = {{0}}, *pmt, expect_mt = {{0}};
IBaseFilter *filter = create_mpeg_splitter();
MPEGLAYER3WAVEFORMAT *mp3wfx;
IEnumMediaTypes *enummt;
MPEG1WAVEFORMAT *wfx;
IFilterGraph2 *graph;
HRESULT hr;
ULONG ref;
......@@ -595,41 +597,47 @@ static void test_media_types(void)
mt.subtype = MEDIASUBTYPE_MPEG1Video;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1VideoCD;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1System;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1Payload;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1Packet;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.subtype = GUID_NULL;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.subtype = MEDIASUBTYPE_MPEG1Audio;
mt.majortype = MEDIATYPE_Audio;
mt.subtype = MEDIASUBTYPE_MPEG1Audio;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.majortype = GUID_NULL;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.majortype = MEDIATYPE_Stream;
mt.formattype = FORMAT_None;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.formattype = FORMAT_VideoInfo;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mt.formattype = FORMAT_WaveFormatEx;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
mt.bFixedSizeSamples = TRUE;
mt.bTemporalCompression = TRUE;
mt.lSampleSize = 123;
mt.formattype = FORMAT_WaveFormatEx;
hr = IPin_QueryAccept(pin, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......@@ -688,6 +696,9 @@ static void test_media_types(void)
pmt->majortype = MEDIATYPE_Video;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
pmt->majortype = GUID_NULL;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = MEDIASUBTYPE_MPEG1Audio;
......@@ -709,6 +720,18 @@ static void test_media_types(void)
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
pmt->formattype = FORMAT_WaveFormatEx;
wfx = (MPEG1WAVEFORMAT *)pmt->pbFormat;
wfx->fwHeadLayer = ACM_MPEG_LAYER2;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
wfx->fwHeadLayer = ACM_MPEG_LAYER3;
wfx->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
wfx->wfx.wFormatTag = WAVE_FORMAT_MPEG;
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
......@@ -786,6 +809,18 @@ static void test_media_types(void)
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
pmt->formattype = FORMAT_WaveFormatEx;
mp3wfx = (MPEGLAYER3WAVEFORMAT *)pmt->pbFormat;
mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_OFF;
hr = IPin_QueryAccept(pin, pmt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO;
mp3wfx->wfx.wFormatTag = WAVE_FORMAT_MPEG;
hr = IPin_QueryAccept(pin, pmt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
mp3wfx->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
......
......@@ -20,6 +20,7 @@
#define COBJMACROS
#include "dshow.h"
#include "mmreg.h"
#include "wine/test.h"
static IBaseFilter *create_wave_parser(void)
......@@ -525,6 +526,7 @@ static void test_media_types(void)
AM_MEDIA_TYPE mt = {{0}}, *pmt;
IEnumMediaTypes *enummt;
IFilterGraph2 *graph;
WAVEFORMATEX *wfx;
HRESULT hr;
ULONG ref;
IPin *pin;
......@@ -619,6 +621,20 @@ static void test_media_types(void)
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
wfx = (WAVEFORMATEX *)pmt->pbFormat;
wfx->nChannels = wfx->nBlockAlign = 2;
wfx->nAvgBytesPerSec = 44100 * 2;
wfx->nBlockAlign = 2;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
*wfx = expect_wfx;
wfx->wFormatTag = WAVE_FORMAT_IMA_ADPCM;
hr = IPin_QueryAccept(pin, pmt);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
*wfx = expect_wfx;
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
......
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