Commit 3e5d683c authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Add WMV support to wg_format.

parent 1ddf00ab
...@@ -554,6 +554,7 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) ...@@ -554,6 +554,7 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format)
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
FIXME("Format %u not implemented!\n", format->major_type); FIXME("Format %u not implemented!\n", format->major_type);
/* fallthrough */ /* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
......
...@@ -36,7 +36,9 @@ ...@@ -36,7 +36,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(quartz); WINE_DEFAULT_DEBUG_CHANNEL(quartz);
static const GUID MEDIASUBTYPE_CVID = {mmioFOURCC('c','v','i','d'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_CVID = {mmioFOURCC('c','v','i','d'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
static const GUID MEDIASUBTYPE_VC1S = {mmioFOURCC('V','C','1','S'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
static const GUID MEDIASUBTYPE_MP3 = {WAVE_FORMAT_MPEGLAYER3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_MP3 = {WAVE_FORMAT_MPEGLAYER3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
static const GUID MEDIASUBTYPE_WMV_Unknown = {0x7ce12ca9, 0xbfbf, 0x43d9, {0x9d, 0x00, 0x82, 0xb8, 0xed, 0x54, 0x31, 0x6b}};
struct parser struct parser
{ {
...@@ -362,6 +364,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) ...@@ -362,6 +364,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format)
case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_MPEG4:
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
FIXME("Format %u not implemented!\n", format->major_type); FIXME("Format %u not implemented!\n", format->major_type);
return 0; return 0;
...@@ -532,6 +535,7 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool ...@@ -532,6 +535,7 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool
case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_MPEG4:
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
FIXME("Format %u not implemented!\n", format->major_type); FIXME("Format %u not implemented!\n", format->major_type);
/* fallthrough */ /* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
...@@ -723,12 +727,55 @@ static bool amt_to_wg_format_video(const AM_MEDIA_TYPE *mt, struct wg_format *fo ...@@ -723,12 +727,55 @@ static bool amt_to_wg_format_video(const AM_MEDIA_TYPE *mt, struct wg_format *fo
return false; return false;
} }
static bool amt_to_wg_format_video_wmv(const AM_MEDIA_TYPE *mt, struct wg_format *format)
{
const VIDEOINFOHEADER *video_format = (const VIDEOINFOHEADER *)mt->pbFormat;
if (!IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo))
{
FIXME("Unknown format type %s.\n", debugstr_guid(&mt->formattype));
return false;
}
if (mt->cbFormat < sizeof(VIDEOINFOHEADER) || !mt->pbFormat)
{
ERR("Unexpected format size %lu.\n", mt->cbFormat);
return false;
}
format->major_type = WG_MAJOR_TYPE_VIDEO_WMV;
format->u.video_wmv.width = video_format->bmiHeader.biWidth;
format->u.video_wmv.height = video_format->bmiHeader.biHeight;
format->u.video_wmv.fps_n = 10000000;
format->u.video_wmv.fps_d = video_format->AvgTimePerFrame;
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV1))
format->u.video_wmv.version = 1;
else if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV2))
format->u.video_wmv.version = 2;
else
format->u.video_wmv.version = 3;
return true;
}
bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format) bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format)
{ {
memset(format, 0, sizeof(*format)); memset(format, 0, sizeof(*format));
if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Video)) if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Video))
{
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV1)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV2)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMVA)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMVP)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WVP2)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV_Unknown)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WVC1)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV3)
|| IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_VC1S))
return amt_to_wg_format_video_wmv(mt, format);
return amt_to_wg_format_video(mt, format); return amt_to_wg_format_video(mt, format);
}
if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio)) if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio))
{ {
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload)) if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload))
......
...@@ -42,6 +42,7 @@ struct wg_format ...@@ -42,6 +42,7 @@ struct wg_format
WG_MAJOR_TYPE_VIDEO, WG_MAJOR_TYPE_VIDEO,
WG_MAJOR_TYPE_VIDEO_CINEPAK, WG_MAJOR_TYPE_VIDEO_CINEPAK,
WG_MAJOR_TYPE_VIDEO_H264, WG_MAJOR_TYPE_VIDEO_H264,
WG_MAJOR_TYPE_VIDEO_WMV,
} major_type; } major_type;
union union
...@@ -126,6 +127,12 @@ struct wg_format ...@@ -126,6 +127,12 @@ struct wg_format
uint32_t profile; uint32_t profile;
uint32_t level; uint32_t level;
} video_h264; } video_h264;
struct
{
int32_t width, height;
uint32_t fps_n, fps_d;
uint32_t version;
} video_wmv;
} u; } u;
}; };
......
...@@ -554,6 +554,25 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -554,6 +554,25 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
return caps; return caps;
} }
static GstCaps *wg_format_to_caps_video_wmv(const struct wg_format *format)
{
GstCaps *caps;
if (!(caps = gst_caps_new_empty_simple("video/x-wmv")))
return NULL;
if (format->u.video_wmv.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_wmv.width, NULL);
if (format->u.video_wmv.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_wmv.height, NULL);
if (format->u.video_wmv.fps_d || format->u.video_wmv.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_wmv.fps_n, format->u.video_wmv.fps_d, NULL);
if (format->u.video_wmv.version)
gst_caps_set_simple(caps, "wmvversion", G_TYPE_INT, format->u.video_wmv.version, NULL);
return caps;
}
GstCaps *wg_format_to_caps(const struct wg_format *format) GstCaps *wg_format_to_caps(const struct wg_format *format)
{ {
switch (format->major_type) switch (format->major_type)
...@@ -574,6 +593,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) ...@@ -574,6 +593,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format)
return wg_format_to_caps_video_cinepak(format); return wg_format_to_caps_video_cinepak(format);
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
return wg_format_to_caps_video_h264(format); return wg_format_to_caps_video_h264(format);
case WG_MAJOR_TYPE_VIDEO_WMV:
return wg_format_to_caps_video_wmv(format);
} }
assert(0); assert(0);
return NULL; return NULL;
...@@ -590,6 +611,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b) ...@@ -590,6 +611,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b)
case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_MPEG4:
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
GST_FIXME("Format %u not implemented!", a->major_type); GST_FIXME("Format %u not implemented!", a->major_type);
/* fallthrough */ /* fallthrough */
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
......
...@@ -439,6 +439,7 @@ NTSTATUS wg_transform_create(void *args) ...@@ -439,6 +439,7 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_VIDEO: case WG_MAJOR_TYPE_VIDEO:
break; break;
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
case WG_MAJOR_TYPE_VIDEO_WMV:
GST_FIXME("Format %u not implemented!", input_format.major_type); GST_FIXME("Format %u not implemented!", input_format.major_type);
gst_caps_unref(raw_caps); gst_caps_unref(raw_caps);
goto out; goto out;
...@@ -480,6 +481,7 @@ NTSTATUS wg_transform_create(void *args) ...@@ -480,6 +481,7 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
case WG_MAJOR_TYPE_VIDEO_WMV:
GST_FIXME("Format %u not implemented!", output_format.major_type); GST_FIXME("Format %u not implemented!", output_format.major_type);
goto out; goto out;
} }
......
...@@ -1577,6 +1577,8 @@ static const char *get_major_type_string(enum wg_major_type type) ...@@ -1577,6 +1577,8 @@ static const char *get_major_type_string(enum wg_major_type type)
return "cinepak"; return "cinepak";
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
return "h264"; return "h264";
case WG_MAJOR_TYPE_VIDEO_WMV:
return "wmv";
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
return "unknown"; return "unknown";
} }
...@@ -1930,6 +1932,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface, ...@@ -1930,6 +1932,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface,
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
FIXME("Format %u not implemented!\n", format.major_type); FIXME("Format %u not implemented!\n", format.major_type);
break; break;
case WG_MAJOR_TYPE_UNKNOWN: case WG_MAJOR_TYPE_UNKNOWN:
...@@ -1970,6 +1973,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o ...@@ -1970,6 +1973,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o
case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_AUDIO_WMA:
case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_CINEPAK:
case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_H264:
case WG_MAJOR_TYPE_VIDEO_WMV:
FIXME("Format %u not implemented!\n", format.major_type); FIXME("Format %u not implemented!\n", format.major_type);
/* fallthrough */ /* fallthrough */
case WG_MAJOR_TYPE_AUDIO: case WG_MAJOR_TYPE_AUDIO:
......
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