winegstreamer: Add WG_MAJOR_TYPE_VIDEO_INDEO video type.

This commit is contained in:
Shaun Ren 2023-01-13 16:33:29 -05:00 committed by Alexandre Julliard
parent 115fbf632a
commit 32bb602393
6 changed files with 68 additions and 0 deletions

View file

@ -38,6 +38,7 @@ DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0
DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70);
DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1);
DEFINE_MEDIATYPE_GUID(MFVideoFormat_VC1S,MAKEFOURCC('V','C','1','S'));
DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50,MAKEFOURCC('I','V','5','0'));
struct class_factory
{
@ -557,6 +558,7 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format)
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
FIXME("Format %u not implemented!\n", format->major_type);
/* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN:
@ -810,6 +812,33 @@ static void mf_media_type_to_wg_format_video_h264(IMFMediaType *type, struct wg_
format->u.video_h264.level = level;
}
static void mf_media_type_to_wg_format_video_indeo(IMFMediaType *type, uint32_t version, struct wg_format *format)
{
UINT64 frame_rate, frame_size;
memset(format, 0, sizeof(*format));
format->major_type = WG_MAJOR_TYPE_VIDEO_INDEO;
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size)))
{
format->u.video_indeo.width = frame_size >> 32;
format->u.video_indeo.height = (UINT32)frame_size;
}
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate)
{
format->u.video_indeo.fps_n = frame_rate >> 32;
format->u.video_indeo.fps_d = (UINT32)frame_rate;
}
else
{
format->u.video_indeo.fps_n = 1;
format->u.video_indeo.fps_d = 1;
}
format->u.video_indeo.version = version;
}
void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format)
{
GUID major_type, subtype;
@ -843,6 +872,8 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format)
{
if (IsEqualGUID(&subtype, &MFVideoFormat_H264))
mf_media_type_to_wg_format_video_h264(type, format);
else if (IsEqualGUID(&subtype, &MFVideoFormat_IV50))
mf_media_type_to_wg_format_video_indeo(type, 5, format);
else
mf_media_type_to_wg_format_video(type, &subtype, format);
}

View file

@ -377,6 +377,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format)
case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
FIXME("Format %u not implemented!\n", format->major_type);
return 0;
@ -548,6 +549,7 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool
case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
FIXME("Format %u not implemented!\n", format->major_type);
/* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN:

View file

@ -43,6 +43,7 @@ struct wg_format
WG_MAJOR_TYPE_VIDEO_CINEPAK,
WG_MAJOR_TYPE_VIDEO_H264,
WG_MAJOR_TYPE_VIDEO_WMV,
WG_MAJOR_TYPE_VIDEO_INDEO,
} major_type;
union
@ -133,6 +134,12 @@ struct wg_format
uint32_t fps_n, fps_d;
uint32_t version;
} video_wmv;
struct
{
int32_t width, height;
uint32_t fps_n, fps_d;
uint32_t version;
} video_indeo;
} u;
};

View file

@ -573,6 +573,25 @@ static GstCaps *wg_format_to_caps_video_wmv(const struct wg_format *format)
return caps;
}
static GstCaps *wg_format_to_caps_video_indeo(const struct wg_format *format)
{
GstCaps *caps;
if (!(caps = gst_caps_new_empty_simple("video/x-indeo")))
return NULL;
if (format->u.video_indeo.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_indeo.width, NULL);
if (format->u.video_indeo.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_indeo.height, NULL);
if (format->u.video_indeo.fps_d || format->u.video_indeo.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_indeo.fps_n, format->u.video_indeo.fps_d, NULL);
if (format->u.video_indeo.version)
gst_caps_set_simple(caps, "indeoversion", G_TYPE_INT, format->u.video_indeo.version, NULL);
return caps;
}
GstCaps *wg_format_to_caps(const struct wg_format *format)
{
switch (format->major_type)
@ -595,6 +614,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format)
return wg_format_to_caps_video_h264(format);
case WG_MAJOR_TYPE_VIDEO_WMV:
return wg_format_to_caps_video_wmv(format);
case WG_MAJOR_TYPE_VIDEO_INDEO:
return wg_format_to_caps_video_indeo(format);
}
assert(0);
return NULL;
@ -612,6 +633,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b)
case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
GST_FIXME("Format %u not implemented!", a->major_type);
/* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN:

View file

@ -427,6 +427,7 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_AUDIO_MPEG4:
case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_INDEO:
if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps))
|| !transform_append_element(transform, element, &first, &last))
{
@ -482,6 +483,7 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_UNKNOWN:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
GST_FIXME("Format %u not implemented!", output_format.major_type);
goto out;
}

View file

@ -1579,6 +1579,8 @@ static const char *get_major_type_string(enum wg_major_type type)
return "h264";
case WG_MAJOR_TYPE_VIDEO_WMV:
return "wmv";
case WG_MAJOR_TYPE_VIDEO_INDEO:
return "indeo";
case WG_MAJOR_TYPE_UNKNOWN:
return "unknown";
}
@ -1934,6 +1936,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface,
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
FIXME("Format %u not implemented!\n", format.major_type);
break;
case WG_MAJOR_TYPE_UNKNOWN:
@ -1975,6 +1978,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_INDEO:
FIXME("Format %u not implemented!\n", format.major_type);
/* fallthrough */
case WG_MAJOR_TYPE_AUDIO: