Commit 4f4ee0e1 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winegstreamer: Implement MFT_MESSAGE_COMMAND_FLUSH for the H264 decoder.

parent 16347299
...@@ -4026,7 +4026,6 @@ static void test_h264_decoder_concat_streams(void) ...@@ -4026,7 +4026,6 @@ static void test_h264_decoder_concat_streams(void)
{ {
{.length = 0x3600}, {.length = 0x3600},
{.length = 0x4980}, {.length = 0x4980},
{.length = 0, .todo_length = TRUE},
}; };
const struct attribute_desc output_sample_attributes[] = const struct attribute_desc output_sample_attributes[] =
{ {
...@@ -4057,13 +4056,6 @@ static void test_h264_decoder_concat_streams(void) ...@@ -4057,13 +4056,6 @@ static void test_h264_decoder_concat_streams(void)
.buffer_count = 1, .buffers = output_buffer_desc + 1, .repeat_count = 6, .buffer_count = 1, .buffers = output_buffer_desc + 1, .repeat_count = 6,
.todo_time = TRUE, .todo_time = TRUE,
}, },
{
/* Wine outputs spurious buffers */
.attributes = output_sample_attributes + 0,
.sample_time = 0, .sample_duration = 400000,
.buffer_count = 1, .buffers = output_buffer_desc + 2, .repeat_count = 22,
.todo_time = TRUE, .todo_length = TRUE,
},
{0}, {0},
}; };
const WCHAR *filenames[] = const WCHAR *filenames[] =
...@@ -4212,7 +4204,6 @@ static void test_h264_decoder_concat_streams(void) ...@@ -4212,7 +4204,6 @@ static void test_h264_decoder_concat_streams(void)
hr = IMFCollection_GetElementCount(output_samples, &output_count); hr = IMFCollection_GetElementCount(output_samples, &output_count);
ok(hr == S_OK, "GetElementCount returned %#lx\n", hr); ok(hr == S_OK, "GetElementCount returned %#lx\n", hr);
todo_wine
ok(output_count == 96, "GetElementCount returned %#lx\n", output_count); ok(output_count == 96, "GetElementCount returned %#lx\n", output_count);
ret = check_mf_sample_collection(output_samples, output_sample_desc, NULL); ret = check_mf_sample_collection(output_samples, output_sample_desc, NULL);
......
...@@ -107,6 +107,7 @@ void wg_transform_destroy(struct wg_transform *transform); ...@@ -107,6 +107,7 @@ void wg_transform_destroy(struct wg_transform *transform);
bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format); bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format);
bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input); bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input);
HRESULT wg_transform_drain(struct wg_transform *transform); HRESULT wg_transform_drain(struct wg_transform *transform);
HRESULT wg_transform_flush(struct wg_transform *transform);
unsigned int wg_format_get_max_size(const struct wg_format *format); unsigned int wg_format_get_max_size(const struct wg_format *format);
......
...@@ -630,6 +630,9 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_ ...@@ -630,6 +630,9 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
case MFT_MESSAGE_COMMAND_DRAIN: case MFT_MESSAGE_COMMAND_DRAIN:
return wg_transform_drain(decoder->wg_transform); return wg_transform_drain(decoder->wg_transform);
case MFT_MESSAGE_COMMAND_FLUSH:
return wg_transform_flush(decoder->wg_transform);
default: default:
FIXME("Ignoring message %#x.\n", message); FIXME("Ignoring message %#x.\n", message);
return S_OK; return S_OK;
......
...@@ -441,6 +441,21 @@ HRESULT wg_transform_drain(struct wg_transform *transform) ...@@ -441,6 +441,21 @@ HRESULT wg_transform_drain(struct wg_transform *transform)
return S_OK; return S_OK;
} }
HRESULT wg_transform_flush(struct wg_transform *transform)
{
NTSTATUS status;
TRACE("transform %p.\n", transform);
if ((status = WINE_UNIX_CALL(unix_wg_transform_flush, transform)))
{
WARN("wg_transform_flush returned status %#lx\n", status);
return HRESULT_FROM_NT(status);
}
return S_OK;
}
#define ALIGN(n, alignment) (((n) + (alignment) - 1) & ~((alignment) - 1)) #define ALIGN(n, alignment) (((n) + (alignment) - 1) & ~((alignment) - 1))
unsigned int wg_format_get_stride(const struct wg_format *format) unsigned int wg_format_get_stride(const struct wg_format *format)
......
...@@ -54,6 +54,7 @@ extern NTSTATUS wg_transform_push_data(void *args) DECLSPEC_HIDDEN; ...@@ -54,6 +54,7 @@ extern NTSTATUS wg_transform_push_data(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_read_data(void *args) DECLSPEC_HIDDEN; extern NTSTATUS wg_transform_read_data(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_get_status(void *args) DECLSPEC_HIDDEN; extern NTSTATUS wg_transform_get_status(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_drain(void *args) DECLSPEC_HIDDEN; extern NTSTATUS wg_transform_drain(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_flush(void *args) DECLSPEC_HIDDEN;
/* wg_allocator.c */ /* wg_allocator.c */
......
...@@ -377,6 +377,7 @@ enum unix_funcs ...@@ -377,6 +377,7 @@ enum unix_funcs
unix_wg_transform_read_data, unix_wg_transform_read_data,
unix_wg_transform_get_status, unix_wg_transform_get_status,
unix_wg_transform_drain, unix_wg_transform_drain,
unix_wg_transform_flush,
}; };
#endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */ #endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */
...@@ -1940,4 +1940,5 @@ const unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -1940,4 +1940,5 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
X(wg_transform_read_data), X(wg_transform_read_data),
X(wg_transform_get_status), X(wg_transform_get_status),
X(wg_transform_drain), X(wg_transform_drain),
X(wg_transform_flush),
}; };
...@@ -904,3 +904,27 @@ error: ...@@ -904,3 +904,27 @@ error:
GST_ERROR("Failed to drain transform %p.", transform); GST_ERROR("Failed to drain transform %p.", transform);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
NTSTATUS wg_transform_flush(void *args)
{
struct wg_transform *transform = args;
GstBuffer *input_buffer;
GstSample *sample;
NTSTATUS status;
GST_LOG("transform %p", transform);
while ((input_buffer = gst_atomic_queue_pop(transform->input_queue)))
gst_buffer_unref(input_buffer);
if ((status = wg_transform_drain(transform)))
return status;
while ((sample = gst_atomic_queue_pop(transform->output_queue)))
gst_sample_unref(sample);
if ((sample = transform->output_sample))
gst_sample_unref(sample);
transform->output_sample = NULL;
return STATUS_SUCCESS;
}
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