Commit 654dc115 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Merge video_h264 into video field.

parent b3a46a94
...@@ -800,33 +800,33 @@ static void mf_media_type_to_wg_format_video_h264(IMFMediaType *type, struct wg_ ...@@ -800,33 +800,33 @@ static void mf_media_type_to_wg_format_video_h264(IMFMediaType *type, struct wg_
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size)))
{ {
format->u.video_h264.width = frame_size >> 32; format->u.video.width = frame_size >> 32;
format->u.video_h264.height = (UINT32)frame_size; format->u.video.height = (UINT32)frame_size;
} }
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate) if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate)
{ {
format->u.video_h264.fps_n = frame_rate >> 32; format->u.video.fps_n = frame_rate >> 32;
format->u.video_h264.fps_d = (UINT32)frame_rate; format->u.video.fps_d = (UINT32)frame_rate;
} }
else else
{ {
format->u.video_h264.fps_n = 1; format->u.video.fps_n = 1;
format->u.video_h264.fps_d = 1; format->u.video.fps_d = 1;
} }
if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_PROFILE, &profile))) if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_PROFILE, &profile)))
format->u.video_h264.profile = profile; format->u.video.profile = profile;
if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_LEVEL, &level))) if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_LEVEL, &level)))
format->u.video_h264.level = level; format->u.video.level = level;
if (SUCCEEDED(IMFMediaType_GetAllocatedBlob(type, &MF_MT_MPEG_SEQUENCE_HEADER, &codec_data, &codec_data_len))) if (SUCCEEDED(IMFMediaType_GetAllocatedBlob(type, &MF_MT_MPEG_SEQUENCE_HEADER, &codec_data, &codec_data_len)))
{ {
if (codec_data_len <= sizeof(format->u.video_h264.codec_data)) if (codec_data_len <= sizeof(format->u.video.codec_data))
{ {
format->u.video_h264.codec_data_len = codec_data_len; format->u.video.codec_data_len = codec_data_len;
memcpy(format->u.video_h264.codec_data, codec_data, codec_data_len); memcpy(format->u.video.codec_data, codec_data, codec_data_len);
} }
else else
{ {
......
...@@ -122,7 +122,8 @@ struct wg_format ...@@ -122,7 +122,8 @@ struct wg_format
/* Valid members for different video formats: /* Valid members for different video formats:
* *
* Uncompressed(RGB and YUV): width, height, fps_n, fps_d, padding. * Uncompressed(RGB and YUV): width, height, fps_n, fps_d, padding.
* CINEPAK: width, height, fps_n, fps_d. */ * CINEPAK: width, height, fps_n, fps_d.
* H264: width, height, fps_n, fps_d, profile, level, codec_data_len, codec_data. */
struct struct
{ {
wg_video_format format; wg_video_format format;
...@@ -132,16 +133,11 @@ struct wg_format ...@@ -132,16 +133,11 @@ struct wg_format
int32_t width, height; int32_t width, height;
uint32_t fps_n, fps_d; uint32_t fps_n, fps_d;
RECT padding; RECT padding;
} video;
struct
{
int32_t width, height;
uint32_t fps_n, fps_d;
uint32_t profile; uint32_t profile;
uint32_t level; uint32_t level;
uint32_t codec_data_len; uint32_t codec_data_len;
unsigned char codec_data[64]; unsigned char codec_data[64];
} video_h264; } video;
struct struct
{ {
wg_wmv_video_format format; wg_wmv_video_format format;
......
...@@ -680,20 +680,20 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -680,20 +680,20 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "byte-stream", NULL); gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "byte-stream", NULL);
gst_caps_set_simple(caps, "alignment", G_TYPE_STRING, "au", NULL); gst_caps_set_simple(caps, "alignment", G_TYPE_STRING, "au", NULL);
if (format->u.video_h264.width) if (format->u.video.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_h264.width, NULL); gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video.width, NULL);
if (format->u.video_h264.height) if (format->u.video.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_h264.height, NULL); gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video.height, NULL);
if (format->u.video_h264.fps_n || format->u.video_h264.fps_d) if (format->u.video.fps_n || format->u.video.fps_d)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_h264.fps_n, format->u.video_h264.fps_d, NULL); gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video.fps_n, format->u.video.fps_d, NULL);
switch (format->u.video_h264.profile) switch (format->u.video.profile)
{ {
case eAVEncH264VProfile_Main: profile = "main"; break; case eAVEncH264VProfile_Main: profile = "main"; break;
case eAVEncH264VProfile_High: profile = "high"; break; case eAVEncH264VProfile_High: profile = "high"; break;
case eAVEncH264VProfile_444: profile = "high-4:4:4"; break; case eAVEncH264VProfile_444: profile = "high-4:4:4"; break;
default: default:
GST_FIXME("H264 profile attribute %u not implemented.", format->u.video_h264.profile); GST_FIXME("H264 profile attribute %u not implemented.", format->u.video.profile);
/* fallthrough */ /* fallthrough */
case eAVEncH264VProfile_unknown: case eAVEncH264VProfile_unknown:
profile = "baseline"; profile = "baseline";
...@@ -701,7 +701,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -701,7 +701,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
} }
gst_caps_set_simple(caps, "profile", G_TYPE_STRING, profile, NULL); gst_caps_set_simple(caps, "profile", G_TYPE_STRING, profile, NULL);
switch (format->u.video_h264.level) switch (format->u.video.level)
{ {
case eAVEncH264VLevel1: level = "1"; break; case eAVEncH264VLevel1: level = "1"; break;
case eAVEncH264VLevel1_1: level = "1.1"; break; case eAVEncH264VLevel1_1: level = "1.1"; break;
...@@ -720,7 +720,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -720,7 +720,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
case eAVEncH264VLevel5_1: level = "5.1"; break; case eAVEncH264VLevel5_1: level = "5.1"; break;
case eAVEncH264VLevel5_2: level = "5.2"; break; case eAVEncH264VLevel5_2: level = "5.2"; break;
default: default:
GST_FIXME("H264 level attribute %u not implemented.", format->u.video_h264.level); GST_FIXME("H264 level attribute %u not implemented.", format->u.video.level);
/* fallthrough */ /* fallthrough */
case 0: case 0:
level = NULL; level = NULL;
...@@ -729,9 +729,9 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -729,9 +729,9 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
if (level) if (level)
gst_caps_set_simple(caps, "level", G_TYPE_STRING, level, NULL); gst_caps_set_simple(caps, "level", G_TYPE_STRING, level, NULL);
if (format->u.video_h264.codec_data_len) if (format->u.video.codec_data_len)
{ {
if (!(buffer = gst_buffer_new_and_alloc(format->u.video_h264.codec_data_len))) if (!(buffer = gst_buffer_new_and_alloc(format->u.video.codec_data_len)))
{ {
gst_caps_unref(caps); gst_caps_unref(caps);
return NULL; return NULL;
...@@ -739,7 +739,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) ...@@ -739,7 +739,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format)
GST_BUFFER_PTS(buffer) = 0; GST_BUFFER_PTS(buffer) = 0;
GST_BUFFER_DTS(buffer) = 0; GST_BUFFER_DTS(buffer) = 0;
gst_buffer_fill(buffer, 0, format->u.video_h264.codec_data, format->u.video_h264.codec_data_len); gst_buffer_fill(buffer, 0, format->u.video.codec_data, format->u.video.codec_data_len);
gst_caps_set_simple(caps, "streamheader", GST_TYPE_BUFFER, buffer, NULL); gst_caps_set_simple(caps, "streamheader", GST_TYPE_BUFFER, buffer, NULL);
gst_buffer_unref(buffer); gst_buffer_unref(buffer);
} }
......
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