Module: wine Branch: master Commit: b3a46a94a36728f21d40587a1b42432d990e2ec9 URL: https://gitlab.winehq.org/wine/wine/-/commit/b3a46a94a36728f21d40587a1b42432...
Author: Ziqing Hui zhui@codeweavers.com Date: Wed Apr 3 09:07:22 2024 +0800
winegstreamer: Merge video_cinepak into video field.
---
dlls/winegstreamer/quartz_parser.c | 8 ++++---- dlls/winegstreamer/unixlib.h | 12 +++++------- dlls/winegstreamer/wg_format.c | 26 +++++++++++++------------- 3 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 9b17b0afddd..b78a37c25f6 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -391,7 +391,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) /* Both ffmpeg's encoder and a Cinepak file seen in the wild report * 24 bpp. ffmpeg sets biSizeImage as below; others may be smaller, * but as long as every sample fits into our allocator, we're fine. */ - return format->u.video_cinepak.width * format->u.video_cinepak.height * 3; + return format->u.video.width * format->u.video.height * 3;
case WG_MAJOR_TYPE_VIDEO_MPEG1: /* Estimated max size of a compressed video frame. @@ -609,11 +609,11 @@ static bool amt_from_wg_format_video_cinepak(AM_MEDIA_TYPE *mt, const struct wg_ mt->pbFormat = (BYTE *)video_format;
memset(video_format, 0, sizeof(*video_format)); - if ((frame_time = MulDiv(10000000, format->u.video_cinepak.fps_d, format->u.video_cinepak.fps_n)) != -1) + if ((frame_time = MulDiv(10000000, format->u.video.fps_d, format->u.video.fps_n)) != -1) video_format->AvgTimePerFrame = frame_time; video_format->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - video_format->bmiHeader.biWidth = format->u.video_cinepak.width; - video_format->bmiHeader.biHeight = format->u.video_cinepak.height; + video_format->bmiHeader.biWidth = format->u.video.width; + video_format->bmiHeader.biHeight = format->u.video.height; video_format->bmiHeader.biPlanes = 1; video_format->bmiHeader.biBitCount = 24; video_format->bmiHeader.biCompression = mt->subtype.Data1; diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index d77a0346d46..7270c54bb54 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -119,9 +119,14 @@ struct wg_format unsigned char codec_data[64]; } audio;
+ /* Valid members for different video formats: + * + * Uncompressed(RGB and YUV): width, height, fps_n, fps_d, padding. + * CINEPAK: width, height, fps_n, fps_d. */ struct { wg_video_format format; + /* Positive height indicates top-down video; negative height * indicates bottom-up video. */ int32_t width, height; @@ -129,13 +134,6 @@ struct wg_format RECT padding; } video; struct - { - uint32_t width; - uint32_t height; - uint32_t fps_n; - uint32_t fps_d; - } video_cinepak; - struct { int32_t width, height; uint32_t fps_n, fps_d; diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 6d10952f16d..50f8f53891b 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -287,10 +287,10 @@ static void wg_format_from_caps_video_cinepak(struct wg_format *format, const Gs }
format->major_type = WG_MAJOR_TYPE_VIDEO_CINEPAK; - format->u.video_cinepak.width = width; - format->u.video_cinepak.height = height; - format->u.video_cinepak.fps_n = fps_n; - format->u.video_cinepak.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; }
static void wg_format_from_caps_video_wmv(struct wg_format *format, const GstCaps *caps) @@ -622,12 +622,12 @@ static GstCaps *wg_format_to_caps_video_cinepak(const struct wg_format *format) if (!(caps = gst_caps_new_empty_simple("video/x-cinepak"))) return NULL;
- if (format->u.video_cinepak.width) - gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_cinepak.width, NULL); - if (format->u.video_cinepak.height) - gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_cinepak.height, NULL); - if (format->u.video_cinepak.fps_d || format->u.video_cinepak.fps_n) - gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_cinepak.fps_n, format->u.video_cinepak.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; } @@ -848,7 +848,7 @@ static GstCaps *wg_format_to_caps_video_mpeg1(const struct wg_format *format) 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_cinepak.fps_n) + 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); return caps; } @@ -916,8 +916,8 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b)
case WG_MAJOR_TYPE_VIDEO_CINEPAK: /* Do not compare FPS. */ - return a->u.video_cinepak.width == b->u.video_cinepak.width - && a->u.video_cinepak.height == b->u.video_cinepak.height; + return a->u.video.width == b->u.video.width + && a->u.video.height == b->u.video.height;
case WG_MAJOR_TYPE_VIDEO_WMV: /* Do not compare FPS. */