mfplat: Set AM_MEDIA_TYPE bTemporalCompression and bFixedSizeSamples.

This commit is contained in:
Rémi Bernon 2024-05-09 12:13:27 +02:00 committed by Alexandre Julliard
parent 772ad6e8a9
commit 0b5c04c517
2 changed files with 18 additions and 0 deletions

View file

@ -4133,6 +4133,7 @@ static UINT32 get_am_media_type_video_format_size(const GUID *format_type, IMFMe
static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, IMFMediaType *media_type)
{
struct uncompressed_video_format *video_format = mf_get_video_format(&am_type->subtype);
HRESULT hr;
if (IsEqualGUID(&am_type->formattype, &FORMAT_WaveFormatEx))
@ -4161,6 +4162,8 @@ static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, IMFMediaT
format->bmiHeader.biSize += am_type->cbFormat - sizeof(*format);
am_type->subtype = get_am_subtype_for_mf_subtype(am_type->subtype);
am_type->bFixedSizeSamples = !!video_format;
am_type->bTemporalCompression = !video_format;
}
else if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo2))
{
@ -4173,6 +4176,8 @@ static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, IMFMediaT
format->bmiHeader.biSize += am_type->cbFormat - sizeof(*format);
am_type->subtype = get_am_subtype_for_mf_subtype(am_type->subtype);
am_type->bFixedSizeSamples = !!video_format;
am_type->bTemporalCompression = !video_format;
}
else
{
@ -4199,6 +4204,7 @@ HRESULT WINAPI MFInitAMMediaTypeFromMFMediaType(IMFMediaType *media_type, GUID f
|| FAILED(hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &am_type->subtype)))
goto done;
am_type->bTemporalCompression = !media_type_get_uint32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT);
am_type->bFixedSizeSamples = media_type_get_uint32(media_type, &MF_MT_FIXED_SIZE_SAMPLES);
am_type->lSampleSize = media_type_get_uint32(media_type, &MF_MT_SAMPLE_SIZE);

View file

@ -7382,6 +7382,9 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&am_type.majortype, &MFMediaType_Audio), "got %s.\n", debugstr_guid(&am_type.majortype));
ok(IsEqualGUID(&am_type.subtype, &MFAudioFormat_PCM), "got %s.\n", debugstr_guid(&am_type.subtype));
ok(am_type.bFixedSizeSamples == 0, "got %u\n", am_type.bFixedSizeSamples);
ok(am_type.bTemporalCompression == 1, "got %u\n", am_type.bTemporalCompression);
ok(am_type.lSampleSize == 0, "got %lu\n", am_type.lSampleSize);
ok(IsEqualGUID(&am_type.formattype, &FORMAT_WaveFormatEx), "got %s.\n", debugstr_guid(&am_type.formattype));
ok(am_type.cbFormat == sizeof(WAVEFORMATEX), "got %lu\n", am_type.cbFormat);
CoTaskMemFree(am_type.pbFormat);
@ -7418,6 +7421,9 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&am_type.majortype, &MFMediaType_Video), "got %s.\n", debugstr_guid(&am_type.majortype));
ok(IsEqualGUID(&am_type.subtype, &MEDIASUBTYPE_RGB32), "got %s.\n", debugstr_guid(&am_type.subtype));
ok(am_type.bFixedSizeSamples == 1, "got %u\n", am_type.bFixedSizeSamples);
ok(am_type.bTemporalCompression == 0, "got %u\n", am_type.bTemporalCompression);
ok(am_type.lSampleSize == 0, "got %lu\n", am_type.lSampleSize);
ok(IsEqualGUID(&am_type.formattype, &FORMAT_VideoInfo), "got %s.\n", debugstr_guid(&am_type.formattype));
ok(am_type.cbFormat == sizeof(VIDEOINFOHEADER), "got %lu\n", am_type.cbFormat);
CoTaskMemFree(am_type.pbFormat);
@ -7425,6 +7431,9 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&am_type.majortype, &MFMediaType_Video), "got %s.\n", debugstr_guid(&am_type.majortype));
ok(IsEqualGUID(&am_type.subtype, &MEDIASUBTYPE_RGB32), "got %s.\n", debugstr_guid(&am_type.subtype));
ok(am_type.bFixedSizeSamples == 1, "got %u\n", am_type.bFixedSizeSamples);
ok(am_type.bTemporalCompression == 0, "got %u\n", am_type.bTemporalCompression);
ok(am_type.lSampleSize == 0, "got %lu\n", am_type.lSampleSize);
ok(IsEqualGUID(&am_type.formattype, &FORMAT_VideoInfo2), "got %s.\n", debugstr_guid(&am_type.formattype));
ok(am_type.cbFormat == sizeof(VIDEOINFOHEADER2), "got %lu\n", am_type.cbFormat);
CoTaskMemFree(am_type.pbFormat);
@ -7432,6 +7441,9 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&am_type.majortype, &MFMediaType_Video), "got %s.\n", debugstr_guid(&am_type.majortype));
ok(IsEqualGUID(&am_type.subtype, &MFVideoFormat_RGB32), "got %s.\n", debugstr_guid(&am_type.subtype));
ok(am_type.bFixedSizeSamples == 0, "got %u\n", am_type.bFixedSizeSamples);
ok(am_type.bTemporalCompression == 1, "got %u\n", am_type.bTemporalCompression);
ok(am_type.lSampleSize == 0, "got %lu\n", am_type.lSampleSize);
ok(IsEqualGUID(&am_type.formattype, &FORMAT_MFVideoFormat), "got %s.\n", debugstr_guid(&am_type.formattype));
ok(am_type.cbFormat == sizeof(MFVIDEOFORMAT), "got %lu\n", am_type.cbFormat);
CoTaskMemFree(am_type.pbFormat);