Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfreadwrite/tests/mfplat.c | 59 +++++++++++++++++++++++++++++++++ include/mfreadwrite.idl | 21 +++++++----- 2 files changed, 72 insertions(+), 8 deletions(-)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 188e6889fe..29e8e08eb7 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -187,11 +187,14 @@ static struct async_callback *create_async_callback(void) static void test_source_reader(void) { IMFMediaType *mediatype, *mediatype2; + DWORD stream_flags, actual_index; struct async_callback *callback; IMFAttributes *attributes; IMFSourceReader *reader; IMFMediaSource *source; IMFByteStream *stream; + LONGLONG timestamp; + IMFSample *sample; BOOL selected; HRESULT hr;
@@ -298,6 +301,62 @@ todo_wine ok(hr == S_OK, "Failed to get current media type, hr %#x.\n", hr); IMFMediaType_Release(mediatype);
+ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, + ×tamp, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(actual_index == 0, "Unexpected stream index %u\n", actual_index); + ok(!stream_flags, "Unexpected stream flags %#x.\n", stream_flags); + IMFSample_Release(sample); + + /* There is no video stream. */ + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &actual_index, &stream_flags, + ×tamp, &sample); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr); + ok(actual_index == MF_SOURCE_READER_FIRST_VIDEO_STREAM, "Unexpected stream index %u\n", actual_index); + ok(stream_flags == MF_SOURCE_READERF_ERROR, "Unexpected stream flags %#x.\n", stream_flags); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, + ×tamp, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(actual_index == 0, "Unexpected stream index %u\n", actual_index); + ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#x.\n", stream_flags); + ok(!sample, "Unexpected sample object.\n"); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + &actual_index, &stream_flags, ×tamp, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(actual_index == 0, "Unexpected stream index %u\n", actual_index); + ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#x.\n", stream_flags); + ok(!sample, "Unexpected sample object.\n"); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + &actual_index, &stream_flags, ×tamp, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + &actual_index, NULL, ×tamp, &sample); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + NULL, &stream_flags, ×tamp, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#x.\n", stream_flags); + ok(!sample, "Unexpected sample object.\n"); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + &actual_index, &stream_flags, NULL, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(actual_index == 0, "Unexpected stream index %u\n", actual_index); + ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#x.\n", stream_flags); + ok(!sample, "Unexpected sample object.\n"); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_ANY_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, + &actual_index, &stream_flags, NULL, &sample); + ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr); + ok(actual_index == 0, "Unexpected stream index %u\n", actual_index); + ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#x.\n", stream_flags); + ok(!sample, "Unexpected sample object.\n"); + /* Flush. */ hr = IMFSourceReader_Flush(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM); ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr); diff --git a/include/mfreadwrite.idl b/include/mfreadwrite.idl index 0eea43b08b..ed09b74aae 100644 --- a/include/mfreadwrite.idl +++ b/include/mfreadwrite.idl @@ -19,6 +19,11 @@ import "mfobjects.idl"; import "mftransform.idl";
+typedef [v1_enum] enum MF_SOURCE_READER_CONTROL_FLAG +{ + MF_SOURCE_READER_CONTROLF_DRAIN = 0x00000001, +} MF_SOURCE_READER_CONTROL_FLAG; + enum { MF_SOURCE_READER_INVALID_STREAM_INDEX = 0xffffffff, @@ -30,15 +35,15 @@ enum MF_SOURCE_READER_CURRENT_TYPE_INDEX = 0xffffffff };
-typedef enum MF_SOURCE_READER_FLAG +typedef [v1_enum] enum MF_SOURCE_READER_FLAG { - MF_SOURCE_READERF_ERROR = 0x001, - MF_SOURCE_READERF_ENDOFSTREAM = 0x002, - MF_SOURCE_READERF_NEWSTREAM = 0x004, - MF_SOURCE_READERF_NATIVEMEDIATYPECHANGED = 0x010, - MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED = 0x020, - MF_SOURCE_READERF_STREAMTICK = 0x100, - MF_SOURCE_READERF_ALLEFFECTSREMOVED = 0x200 + MF_SOURCE_READERF_ERROR = 0x00000001, + MF_SOURCE_READERF_ENDOFSTREAM = 0x00000002, + MF_SOURCE_READERF_NEWSTREAM = 0x00000004, + MF_SOURCE_READERF_NATIVEMEDIATYPECHANGED = 0x00000010, + MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED = 0x00000020, + MF_SOURCE_READERF_STREAMTICK = 0x00000100, + MF_SOURCE_READERF_ALLEFFECTSREMOVED = 0x00000200, } MF_SOURCE_READER_FLAG;
typedef struct _MF_SINK_WRITER_STATISTICS