Module: wine Branch: master Commit: 3547dfc5299214b6fec2682401e82fe56a218311 URL: https://gitlab.winehq.org/wine/wine/-/commit/3547dfc5299214b6fec2682401e82fe...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Tue Apr 23 21:02:39 2024 +0900
quartz/tests: Test read position after MPEG splitter connection.
To demonstrate the difference in behavior, we need a special MPEG program stream that is at least 32kB over in size.
---
dlls/quartz/tests/mpegsplit.c | 50 +++++++++++++++++++++++++++++++++++++++++- dlls/quartz/tests/rsrc.rc | 4 ++++ dlls/quartz/tests/test2.mpg | Bin 0 -> 34816 bytes 3 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 8fd0202c58e..8799c6afb8f 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -1084,6 +1084,7 @@ struct testfilter HANDLE eos_event; unsigned int sample_count, eos_count, new_segment_count, byte_count; REFERENCE_TIME segment_start, segment_end_min, segment_end_max, seek_start, seek_end; + LONGLONG read_position; };
static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface) @@ -1318,7 +1319,9 @@ static HRESULT WINAPI async_reader_SyncReadAligned(IAsyncReader *iface, IMediaSa
static HRESULT WINAPI async_reader_SyncRead(IAsyncReader *iface, LONGLONG position, LONG length, BYTE *buffer) { - return IAsyncReader_SyncRead(impl_from_IAsyncReader(iface)->reader, position, length, buffer); + struct testfilter *filter = impl_from_IAsyncReader(iface); + filter->read_position = position + length; + return IAsyncReader_SyncRead(filter->reader, position, length, buffer); }
static HRESULT WINAPI async_reader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available) @@ -2148,6 +2151,50 @@ static void test_no_acceptable_type(void) DeleteFileW(filename); }
+static void test_video_read_position(void) +{ + IBaseFilter *filter = create_mpeg_splitter(), *reader; + const WCHAR *filename = load_resource(L"test2.mpg"); + struct IFileSourceFilter *filesource; + struct testfilter testsource; + LONGLONG total, avail; + IFilterGraph2 *graph; + IPin *sink, *source; + HRESULT hr; + BOOL ret; + + CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + testfilter_init(&testsource); + IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source"); + IFilterGraph2_AddFilter(graph, filter, L"splitter"); + hr = IBaseFilter_FindPin(filter, L"Input", &sink); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&reader); + IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource); + IFileSourceFilter_Load(filesource, filename, NULL); + IFileSourceFilter_Release(filesource); + IBaseFilter_FindPin(reader, L"Output", &source); + IPin_QueryInterface(source, &IID_IAsyncReader, (void **)&testsource.reader); + IAsyncReader_Length(testsource.reader, &total, &avail); + IPin_Release(source); + + hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(testsource.read_position == total, "Got 0x%s, expected 0x%s.\n", wine_dbgstr_longlong(testsource.read_position), wine_dbgstr_longlong(total)); + + IAsyncReader_Release(testsource.reader); + IPin_Release(sink); + IFilterGraph2_Release(graph); + IBaseFilter_Release(reader); + IBaseFilter_Release(filter); + IBaseFilter_Release(&testsource.filter.IBaseFilter_iface); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %lu.\n", GetLastError()); +} + START_TEST(mpegsplit) { IBaseFilter *filter; @@ -2176,6 +2223,7 @@ START_TEST(mpegsplit) test_large_file(); test_video_file(); test_no_acceptable_type(); + test_video_read_position();
CoUninitialize(); } diff --git a/dlls/quartz/tests/rsrc.rc b/dlls/quartz/tests/rsrc.rc index 2cc0d789ff0..a16edacf1d1 100644 --- a/dlls/quartz/tests/rsrc.rc +++ b/dlls/quartz/tests/rsrc.rc @@ -35,3 +35,7 @@ test.mp3 RCDATA "test.mp3" /* ffmpeg -f lavfi -i "sine=frequency=600" -t 0.1 -ar 44100 -f wav -acodec pcm_u8 test.wav */ /* @makedep: test.wav */ test.wav RCDATA "test.wav" + +/* ffmpeg -f lavfi -i smptebars -f lavfi -i "sine=frequency=1000" -t 2.04 -r 25 -f mpeg -vcodec mpeg1video -vf scale=64x48 -acodec mp2 -ar 32k -ab 96k test2.mpg */ +/* @makedep: test2.mpg */ +test2.mpg RCDATA "test2.mpg" diff --git a/dlls/quartz/tests/test2.mpg b/dlls/quartz/tests/test2.mpg new file mode 100644 index 00000000000..5122b6845a8 Binary files /dev/null and b/dlls/quartz/tests/test2.mpg differ