mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:41:12 +00:00
winegstreamer: Complete H264 current output type reported attributes.
This commit is contained in:
parent
a6d77cfd06
commit
6599f2ff90
1 changed files with 16 additions and 17 deletions
|
@ -115,9 +115,9 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID *subtype,
|
static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID *subtype,
|
||||||
IMFMediaType **media_type)
|
IMFMediaType *output_type, IMFMediaType **media_type)
|
||||||
{
|
{
|
||||||
IMFMediaType *default_type = decoder->output_type;
|
IMFMediaType *default_type = decoder->output_type, *stream_type = output_type ? output_type : decoder->stream_type;
|
||||||
IMFVideoMediaType *video_type;
|
IMFVideoMediaType *video_type;
|
||||||
UINT32 value, width, height;
|
UINT32 value, width, height;
|
||||||
MFVideoArea aperture;
|
MFVideoArea aperture;
|
||||||
|
@ -127,31 +127,31 @@ static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID
|
||||||
if (FAILED(hr = MFCreateVideoMediaTypeFromSubtype(subtype, &video_type)))
|
if (FAILED(hr = MFCreateVideoMediaTypeFromSubtype(subtype, &video_type)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &ratio)))
|
if (FAILED(IMFMediaType_GetUINT64(stream_type, &MF_MT_FRAME_SIZE, &ratio)))
|
||||||
ratio = (UINT64)1920 << 32 | 1080;
|
ratio = (UINT64)1920 << 32 | 1080;
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, ratio)))
|
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, ratio)))
|
||||||
goto done;
|
goto done;
|
||||||
width = ratio >> 32;
|
width = ratio >> 32;
|
||||||
height = ratio;
|
height = ratio;
|
||||||
|
|
||||||
if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_RATE, &ratio)))
|
if (FAILED(IMFMediaType_GetUINT64(stream_type, &MF_MT_FRAME_RATE, &ratio)))
|
||||||
ratio = (UINT64)30000 << 32 | 1001;
|
ratio = (UINT64)30000 << 32 | 1001;
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_RATE, ratio)))
|
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_RATE, ratio)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_PIXEL_ASPECT_RATIO, &ratio)))
|
if (FAILED(IMFMediaType_GetUINT64(stream_type, &MF_MT_PIXEL_ASPECT_RATIO, &ratio)))
|
||||||
ratio = (UINT64)1 << 32 | 1;
|
ratio = (UINT64)1 << 32 | 1;
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio)))
|
if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (FAILED(hr = MFCalculateImageSize(subtype, width, height, &value)))
|
if (!output_type || FAILED(IMFMediaType_GetUINT32(output_type, &MF_MT_SAMPLE_SIZE, &value)))
|
||||||
goto done;
|
hr = MFCalculateImageSize(subtype, width, height, &value);
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_SAMPLE_SIZE, value)))
|
if (FAILED(hr) || FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_SAMPLE_SIZE, value)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (FAILED(hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, width, (LONG *)&value)))
|
if (!output_type || FAILED(IMFMediaType_GetUINT32(output_type, &MF_MT_DEFAULT_STRIDE, &value)))
|
||||||
goto done;
|
hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, width, (LONG *)&value);
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_DEFAULT_STRIDE, value)))
|
if (FAILED(hr) || FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_DEFAULT_STRIDE, value)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value)))
|
if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value)))
|
||||||
|
@ -174,7 +174,7 @@ static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_FIXED_SIZE_SAMPLES, value)))
|
if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_FIXED_SIZE_SAMPLES, value)))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (SUCCEEDED(IMFMediaType_GetBlob(decoder->stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
if (SUCCEEDED(IMFMediaType_GetBlob(stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
||||||
(BYTE *)&aperture, sizeof(aperture), &value)))
|
(BYTE *)&aperture, sizeof(aperture), &value)))
|
||||||
{
|
{
|
||||||
if (FAILED(hr = IMFVideoMediaType_SetBlob(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
if (FAILED(hr = IMFVideoMediaType_SetBlob(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE,
|
||||||
|
@ -394,7 +394,7 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
|
||||||
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
||||||
if (index >= decoder->output_type_count)
|
if (index >= decoder->output_type_count)
|
||||||
return MF_E_NO_MORE_TYPES;
|
return MF_E_NO_MORE_TYPES;
|
||||||
return create_output_media_type(decoder, decoder->output_types[index], type);
|
return create_output_media_type(decoder, decoder->output_types[index], NULL, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
||||||
|
@ -521,17 +521,16 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i
|
||||||
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type)
|
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type)
|
||||||
{
|
{
|
||||||
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
|
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
|
||||||
|
GUID subtype;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, id %#lx, type %p\n", iface, id, type);
|
TRACE("iface %p, id %#lx, type %p\n", iface, id, type);
|
||||||
|
|
||||||
if (!decoder->output_type)
|
if (!decoder->output_type)
|
||||||
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
||||||
|
if (FAILED(hr = IMFMediaType_GetGUID(decoder->output_type, &MF_MT_SUBTYPE, &subtype)))
|
||||||
if (FAILED(hr = MFCreateMediaType(type)))
|
|
||||||
return hr;
|
return hr;
|
||||||
|
return create_output_media_type(decoder, &subtype, decoder->output_type, type);
|
||||||
return IMFMediaType_CopyAllItems(decoder->output_type, (IMFAttributes *)*type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
|
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
|
||||||
|
|
Loading…
Reference in a new issue