winegstreamer: Merge video_mpeg1 into video field.

This commit is contained in:
Ziqing Hui 2024-04-03 10:17:22 +08:00 committed by Alexandre Julliard
parent 8ff54f9d34
commit bb77968851
4 changed files with 21 additions and 28 deletions

View file

@ -394,13 +394,10 @@ unsigned int wg_format_get_max_size(const struct wg_format *format)
return format->u.video.width * format->u.video.height * 3;
case WG_MAJOR_TYPE_VIDEO_MPEG1:
case WG_MAJOR_TYPE_VIDEO_WMV:
/* Estimated max size of a compressed video frame.
* There's no way to no way to know the real upper bound,
* so let's just use the decompressed size and hope it works. */
return wg_format_get_max_size_video_raw(WG_VIDEO_FORMAT_YV12,
format->u.video_mpeg1.width, format->u.video_mpeg1.height);
case WG_MAJOR_TYPE_VIDEO_WMV:
return wg_format_get_max_size_video_raw(WG_VIDEO_FORMAT_YV12,
format->u.video.width, format->u.video.height);
@ -701,11 +698,11 @@ static bool amt_from_wg_format_video_mpeg1(AM_MEDIA_TYPE *mt, const struct wg_fo
mt->pbFormat = (BYTE *)video_format;
memset(video_format, 0, sizeof(*video_format));
if ((frame_time = MulDiv(10000000, format->u.video_mpeg1.fps_d, format->u.video_mpeg1.fps_n)) != -1)
if ((frame_time = MulDiv(10000000, format->u.video.fps_d, format->u.video.fps_n)) != -1)
video_format->hdr.AvgTimePerFrame = frame_time;
video_format->hdr.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
video_format->hdr.bmiHeader.biWidth = format->u.video_mpeg1.width;
video_format->hdr.bmiHeader.biHeight = format->u.video_mpeg1.height;
video_format->hdr.bmiHeader.biWidth = format->u.video.width;
video_format->hdr.bmiHeader.biHeight = format->u.video.height;
video_format->hdr.bmiHeader.biPlanes = 1;
video_format->hdr.bmiHeader.biBitCount = 12;
video_format->hdr.bmiHeader.biCompression = mt->subtype.Data1;
@ -1034,10 +1031,10 @@ static bool amt_to_wg_format_video_mpeg1(const AM_MEDIA_TYPE *mt, struct wg_form
}
format->major_type = WG_MAJOR_TYPE_VIDEO_MPEG1;
format->u.video_mpeg1.width = video_format->hdr.bmiHeader.biWidth;
format->u.video_mpeg1.height = video_format->hdr.bmiHeader.biHeight;
format->u.video_mpeg1.fps_n = 10000000;
format->u.video_mpeg1.fps_d = video_format->hdr.AvgTimePerFrame;
format->u.video.width = video_format->hdr.bmiHeader.biWidth;
format->u.video.height = video_format->hdr.bmiHeader.biHeight;
format->u.video.fps_n = 10000000;
format->u.video.fps_d = video_format->hdr.AvgTimePerFrame;
return true;
}

View file

@ -907,7 +907,7 @@ HRESULT mpeg_video_codec_create(IUnknown *outer, IUnknown **out)
static const struct wg_format input_format =
{
.major_type = WG_MAJOR_TYPE_VIDEO_MPEG1,
.u.video_mpeg1 = {},
.u.video = {},
};
struct wg_transform_attrs attrs = {0};
wg_transform_t transform;

View file

@ -120,7 +120,8 @@ struct wg_format
* CINEPAK: width, height, fps_n, fps_d.
* H264: width, height, fps_n, fps_d, profile, level, codec_data_len, codec_data.
* WMV: width, height, fps_n, fps_d, codec_data_len, codec_data.
* INDEO: width, height, fps_n, fps_d, version. */
* INDEO: width, height, fps_n, fps_d, version.
* MPEG1: width, height, fps_n, fps_d. */
struct
{
wg_video_format format;
@ -136,11 +137,6 @@ struct wg_format
uint32_t codec_data_len;
unsigned char codec_data[64];
} video;
struct
{
int32_t width, height;
uint32_t fps_n, fps_d;
} video_mpeg1;
} u;
};

View file

@ -384,10 +384,10 @@ static void wg_format_from_caps_video_mpeg1(struct wg_format *format, const GstC
}
format->major_type = WG_MAJOR_TYPE_VIDEO_MPEG1;
format->u.video_mpeg1.width = width;
format->u.video_mpeg1.height = height;
format->u.video_mpeg1.fps_n = fps_n;
format->u.video_mpeg1.fps_d = fps_d;
format->u.video.width = width;
format->u.video.height = height;
format->u.video.fps_n = fps_n;
format->u.video.fps_d = fps_d;
}
void wg_format_from_caps(struct wg_format *format, const GstCaps *caps)
@ -844,12 +844,12 @@ static GstCaps *wg_format_to_caps_video_mpeg1(const struct wg_format *format)
gst_caps_set_simple(caps, "mpegversion", G_TYPE_INT, 1, NULL);
gst_caps_set_simple(caps, "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
gst_caps_set_simple(caps, "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
if (format->u.video_mpeg1.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_mpeg1.width, NULL);
if (format->u.video_mpeg1.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_mpeg1.height, NULL);
if (format->u.video_mpeg1.fps_d || format->u.video.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_mpeg1.fps_n, format->u.video_mpeg1.fps_d, NULL);
if (format->u.video.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video.width, NULL);
if (format->u.video.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video.height, NULL);
if (format->u.video.fps_d || format->u.video.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video.fps_n, format->u.video.fps_d, NULL);
return caps;
}