Commit 3547dfc5 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

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.
parent 9c93676d
...@@ -1084,6 +1084,7 @@ struct testfilter ...@@ -1084,6 +1084,7 @@ struct testfilter
HANDLE eos_event; HANDLE eos_event;
unsigned int sample_count, eos_count, new_segment_count, byte_count; 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; 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) 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 ...@@ -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) 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) static HRESULT WINAPI async_reader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available)
...@@ -2148,6 +2151,50 @@ static void test_no_acceptable_type(void) ...@@ -2148,6 +2151,50 @@ static void test_no_acceptable_type(void)
DeleteFileW(filename); 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) START_TEST(mpegsplit)
{ {
IBaseFilter *filter; IBaseFilter *filter;
...@@ -2176,6 +2223,7 @@ START_TEST(mpegsplit) ...@@ -2176,6 +2223,7 @@ START_TEST(mpegsplit)
test_large_file(); test_large_file();
test_video_file(); test_video_file();
test_no_acceptable_type(); test_no_acceptable_type();
test_video_read_position();
CoUninitialize(); CoUninitialize();
} }
...@@ -35,3 +35,7 @@ test.mp3 RCDATA "test.mp3" ...@@ -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 */ /* ffmpeg -f lavfi -i "sine=frequency=600" -t 0.1 -ar 44100 -f wav -acodec pcm_u8 test.wav */
/* @makedep: test.wav */ /* @makedep: test.wav */
test.wav RCDATA "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"
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