winegstreamer: Use accessor macros for GstVideoInfo fields.

As the documentation prescribes.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-16 14:40:14 -05:00 committed by Alexandre Julliard
parent 57492f55fd
commit 3178f1d0af
1 changed files with 9 additions and 9 deletions

View File

@ -176,15 +176,13 @@ static gboolean amt_from_gst_caps_video_raw(const GstCaps *caps, AM_MEDIA_TYPE *
{ {
VIDEOINFOHEADER *vih; VIDEOINFOHEADER *vih;
BITMAPINFOHEADER *bih; BITMAPINFOHEADER *bih;
gint32 width, height, nom, denom; gint32 width, height;
GstVideoInfo vinfo; GstVideoInfo vinfo;
if (!gst_video_info_from_caps (&vinfo, caps)) if (!gst_video_info_from_caps (&vinfo, caps))
return FALSE; return FALSE;
width = vinfo.width; width = GST_VIDEO_INFO_WIDTH(&vinfo);
height = vinfo.height; height = GST_VIDEO_INFO_HEIGHT(&vinfo);
nom = vinfo.fps_n;
denom = vinfo.fps_d;
vih = CoTaskMemAlloc(sizeof(*vih)); vih = CoTaskMemAlloc(sizeof(*vih));
bih = &vih->bmiHeader; bih = &vih->bmiHeader;
@ -201,7 +199,7 @@ static gboolean amt_from_gst_caps_video_raw(const GstCaps *caps, AM_MEDIA_TYPE *
if (GST_VIDEO_INFO_IS_RGB(&vinfo)) if (GST_VIDEO_INFO_IS_RGB(&vinfo))
{ {
switch (vinfo.finfo->format) switch (GST_VIDEO_INFO_FORMAT(&vinfo))
{ {
case GST_VIDEO_FORMAT_BGRA: case GST_VIDEO_FORMAT_BGRA:
amt->subtype = MEDIASUBTYPE_ARGB32; amt->subtype = MEDIASUBTYPE_ARGB32;
@ -224,14 +222,15 @@ static gboolean amt_from_gst_caps_video_raw(const GstCaps *caps, AM_MEDIA_TYPE *
bih->biBitCount = 16; bih->biBitCount = 16;
break; break;
default: default:
FIXME("Unhandled type %s.\n", vinfo.finfo->name); FIXME("Unhandled type %s.\n", GST_VIDEO_INFO_NAME(&vinfo));
CoTaskMemFree(vih); CoTaskMemFree(vih);
return FALSE; return FALSE;
} }
bih->biCompression = BI_RGB; bih->biCompression = BI_RGB;
} else { } else {
amt->subtype = MEDIATYPE_Video; amt->subtype = MEDIATYPE_Video;
if (!(amt->subtype.Data1 = gst_video_format_to_fourcc(vinfo.finfo->format))) { if (!(amt->subtype.Data1 = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&vinfo))))
{
CoTaskMemFree(vih); CoTaskMemFree(vih);
return FALSE; return FALSE;
} }
@ -248,7 +247,8 @@ static gboolean amt_from_gst_caps_video_raw(const GstCaps *caps, AM_MEDIA_TYPE *
bih->biCompression = amt->subtype.Data1; bih->biCompression = amt->subtype.Data1;
} }
bih->biSizeImage = width * height * bih->biBitCount / 8; bih->biSizeImage = width * height * bih->biBitCount / 8;
if ((vih->AvgTimePerFrame = (REFERENCE_TIME)MulDiv(10000000, denom, nom)) == -1) if ((vih->AvgTimePerFrame = (REFERENCE_TIME)MulDiv(10000000,
GST_VIDEO_INFO_FPS_D(&vinfo), GST_VIDEO_INFO_FPS_N(&vinfo))) == -1)
vih->AvgTimePerFrame = 0; /* zero division or integer overflow */ vih->AvgTimePerFrame = 0; /* zero division or integer overflow */
bih->biSize = sizeof(*bih); bih->biSize = sizeof(*bih);
bih->biWidth = width; bih->biWidth = width;