winegstreamer: Support the MFSampleExtension_CleanPoint sample attribute.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-04-03 19:13:22 +02:00 committed by Alexandre Julliard
parent d906277844
commit 7144bf27b9
4 changed files with 10 additions and 2 deletions

View File

@ -6488,9 +6488,7 @@ static void test_wma_decoder(void)
ok(status == 0, "got status %#lx\n", status);
value = 0xdeadbeef;
hr = IMFSample_GetUINT32(sample, &MFSampleExtension_CleanPoint, &value);
todo_wine
ok(hr == S_OK, "GetUINT32 MFSampleExtension_CleanPoint returned %#lx\n", hr);
todo_wine
ok(value == 1, "got MFSampleExtension_CleanPoint %u\n", value);
hr = IMFSample_GetTotalLength(sample, &length);
ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr);

View File

@ -904,6 +904,7 @@ HRESULT mf_create_wg_sample(IMFSample *sample, struct wg_sample **out)
DWORD current_length, max_length;
struct mf_sample *mf_sample;
LONGLONG time, duration;
UINT32 value;
BYTE *buffer;
HRESULT hr;
@ -924,6 +925,8 @@ HRESULT mf_create_wg_sample(IMFSample *sample, struct wg_sample **out)
mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
mf_sample->wg_sample.duration = duration;
}
if (SUCCEEDED(IMFSample_GetUINT32(sample, &MFSampleExtension_CleanPoint, &value)) && value)
mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
IMFSample_AddRef((mf_sample->sample = sample));
mf_sample->wg_sample.data = buffer;
@ -953,6 +956,8 @@ void mf_destroy_wg_sample(struct wg_sample *wg_sample)
IMFSample_SetSampleTime(mf_sample->sample, wg_sample->pts);
if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
IMFSample_SetSampleDuration(mf_sample->sample, wg_sample->duration);
if (wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT)
IMFSample_SetUINT32(mf_sample->sample, &MFSampleExtension_CleanPoint, 1);
IMFSample_Release(mf_sample->sample);
free(mf_sample);

View File

@ -116,6 +116,7 @@ enum wg_sample_flag
WG_SAMPLE_FLAG_INCOMPLETE = 1,
WG_SAMPLE_FLAG_HAS_PTS = 2,
WG_SAMPLE_FLAG_HAS_DURATION = 4,
WG_SAMPLE_FLAG_SYNC_POINT = 8,
};
struct wg_sample

View File

@ -369,6 +369,8 @@ NTSTATUS wg_transform_push_data(void *args)
GST_BUFFER_PTS(buffer) = sample->pts * 100;
if (sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
GST_BUFFER_DURATION(buffer) = sample->duration * 100;
if (!(sample->flags & WG_SAMPLE_FLAG_SYNC_POINT))
GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);
gst_buffer_list_insert(transform->input, -1, buffer);
GST_INFO("Copied %u bytes from sample %p to input buffer list", sample->size, sample);
@ -415,6 +417,8 @@ static NTSTATUS read_transform_output_data(GstBuffer *buffer, struct wg_sample *
sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
sample->duration = duration;
}
if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT))
sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
GST_INFO("Copied %u bytes, sample %p, flags %#x", sample->size, sample, sample->flags);
return STATUS_SUCCESS;