From: Ziqing Hui zhui@codeweavers.com
Framerate is fps_n / fps_d. So fps_d should not be zero. --- dlls/winegstreamer/quartz_parser.c | 24 ++++++++++++++++++++---- dlls/winegstreamer/wg_format.c | 13 +++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index b2ea5525ddc..a1baafdab68 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -725,8 +725,16 @@ static bool amt_to_wg_format_video(const AM_MEDIA_TYPE *mt, struct wg_format *fo format->major_type = WG_MAJOR_TYPE_VIDEO; format->u.video.width = video_format->bmiHeader.biWidth; format->u.video.height = video_format->bmiHeader.biHeight; - format->u.video.fps_n = 10000000; - format->u.video.fps_d = video_format->AvgTimePerFrame; + if (video_format->AvgTimePerFrame) + { + format->u.video.fps_n = 10000000; + format->u.video.fps_d = video_format->AvgTimePerFrame; + } + else + { + format->u.video.fps_n = 0; + format->u.video.fps_d = 1; + }
for (i = 0; i < ARRAY_SIZE(format_map); ++i) { @@ -759,8 +767,16 @@ static bool amt_to_wg_format_video_wmv(const AM_MEDIA_TYPE *mt, struct wg_format 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 (video_format->AvgTimePerFrame) + { + format->u.video.fps_n = 10000000; + format->u.video.fps_d = video_format->AvgTimePerFrame; + } + else + { + format->u.video.fps_n = 0; + format->u.video.fps_d = 1; + }
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMV1)) { diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index fca11666ce1..05e46d78560 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -422,6 +422,11 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format) return NULL;
gst_video_info_set_format(&info, video_format, format->u.video.width, abs(format->u.video.height)); + if (format->u.video.fps_d) + { + GST_VIDEO_INFO_FPS_N(&info) = format->u.video.fps_n; + GST_VIDEO_INFO_FPS_D(&info) = format->u.video.fps_d; + } if ((caps = gst_video_info_to_caps(&info))) { for (i = 0; i < gst_caps_get_size(caps); ++i) @@ -430,7 +435,7 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format) gst_structure_remove_fields(gst_caps_get_structure(caps, i), "width", NULL); if (!format->u.video.height) gst_structure_remove_fields(gst_caps_get_structure(caps, i), "height", NULL); - if (!format->u.video.fps_d && !format->u.video.fps_n) + if (!format->u.video.fps_d) gst_structure_remove_fields(gst_caps_get_structure(caps, i), "framerate", NULL); } } @@ -448,7 +453,7 @@ static GstCaps *wg_format_to_caps_video_cinepak(const struct wg_format *format) 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) + if (format->u.video_cinepak.fps_d) gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_cinepak.fps_n, format->u.video_cinepak.fps_d, NULL);
return caps; @@ -505,7 +510,7 @@ static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_h264.width, NULL); if (format->u.video_h264.height) gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_h264.height, NULL); - if (format->u.video_h264.fps_n || format->u.video_h264.fps_d) + if (format->u.video_h264.fps_d) gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_h264.fps_n, format->u.video_h264.fps_d, NULL);
switch (format->u.video_h264.profile) @@ -583,7 +588,7 @@ static GstCaps *wg_format_to_caps_video_wmv(const struct wg_format *format) 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) + if (format->u.video_wmv.fps_d) 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);