winegstreamer: Use the "format" field to determine the subtype and bit depth.

The "bits" field does not directly describe the total bit depth.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-09-14 12:43:27 -05:00 committed by Alexandre Julliard
parent 9ef5825941
commit 450d443b89
1 changed files with 29 additions and 10 deletions

View File

@ -207,14 +207,33 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
amt->pUnk = NULL; amt->pUnk = NULL;
ZeroMemory(vih, sizeof(*vih)); ZeroMemory(vih, sizeof(*vih));
amt->majortype = MEDIATYPE_Video; amt->majortype = MEDIATYPE_Video;
if (GST_VIDEO_INFO_IS_RGB(&vinfo)) {
bih->biBitCount = GST_VIDEO_FORMAT_INFO_BITS(vinfo.finfo); if (GST_VIDEO_INFO_IS_RGB(&vinfo))
switch (bih->biBitCount) { {
case 16: amt->subtype = MEDIASUBTYPE_RGB555; break; switch (vinfo.finfo->format)
case 24: amt->subtype = MEDIASUBTYPE_RGB24; break; {
case 32: amt->subtype = MEDIASUBTYPE_RGB32; break; case GST_VIDEO_FORMAT_BGRA:
amt->subtype = MEDIASUBTYPE_ARGB32;
bih->biBitCount = 32;
break;
case GST_VIDEO_FORMAT_BGRx:
amt->subtype = MEDIASUBTYPE_RGB32;
bih->biBitCount = 32;
break;
case GST_VIDEO_FORMAT_BGR:
amt->subtype = MEDIASUBTYPE_RGB24;
bih->biBitCount = 24;
break;
case GST_VIDEO_FORMAT_BGR16:
amt->subtype = MEDIASUBTYPE_RGB565;
bih->biBitCount = 16;
break;
case GST_VIDEO_FORMAT_BGR15:
amt->subtype = MEDIASUBTYPE_RGB555;
bih->biBitCount = 16;
break;
default: default:
FIXME("Unknown bpp %u\n", bih->biBitCount); FIXME("Unhandled type %s.\n", vinfo.finfo->name);
heap_free(vih); heap_free(vih);
return FALSE; return FALSE;
} }