From 826e2508e547d892851b6c140bbe940b14518321 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 23 Dec 2019 09:44:31 -0600 Subject: [PATCH] winegstreamer: Recognize the "video/x-cinepak" type. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39809 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/gstdemux.c | 41 ++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 869a15b619a..e67efd58ebf 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(gstreamer); +static const GUID MEDIASUBTYPE_CVID = {mmioFOURCC('c','v','i','d'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; + static pthread_key_t wine_gst_key; struct gstdemux @@ -331,6 +333,7 @@ static gboolean amt_from_gst_caps_audio_mpeg(const GstCaps *caps, AM_MEDIA_TYPE static gboolean amt_from_gst_caps(const GstCaps *caps, AM_MEDIA_TYPE *mt) { const char *type = gst_structure_get_name(gst_caps_get_structure(caps, 0)); + GstStructure *structure = gst_caps_get_structure(caps, 0); if (!strcmp(type, "audio/x-raw")) return amt_from_gst_caps_audio_raw(caps, mt); @@ -338,6 +341,38 @@ static gboolean amt_from_gst_caps(const GstCaps *caps, AM_MEDIA_TYPE *mt) return amt_from_gst_caps_video_raw(caps, mt); else if (!strcmp(type, "audio/mpeg")) return amt_from_gst_caps_audio_mpeg(caps, mt); + else if (!strcmp(type, "video/x-cinepak")) + { + VIDEOINFOHEADER *vih; + gint i; + + memset(mt, 0, sizeof(AM_MEDIA_TYPE)); + mt->majortype = MEDIATYPE_Video; + mt->subtype = MEDIASUBTYPE_CVID; + mt->bTemporalCompression = TRUE; + mt->lSampleSize = 1; + mt->formattype = FORMAT_VideoInfo; + if (!(vih = CoTaskMemAlloc(sizeof(VIDEOINFOHEADER)))) + return FALSE; + mt->cbFormat = sizeof(VIDEOINFOHEADER); + mt->pbFormat = (BYTE *)vih; + + memset(vih, 0, sizeof(VIDEOINFOHEADER)); + vih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + if (gst_structure_get_int(structure, "width", &i)) + vih->bmiHeader.biWidth = i; + if (gst_structure_get_int(structure, "height", &i)) + vih->bmiHeader.biHeight = i; + vih->bmiHeader.biPlanes = 1; + /* 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. */ + vih->bmiHeader.biBitCount = 24; + vih->bmiHeader.biCompression = mmioFOURCC('c','v','i','d'); + vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth + * vih->bmiHeader.biHeight * vih->bmiHeader.biBitCount / 8; + return TRUE; + } else { FIXME("Unhandled type %s.\n", debugstr_a(type)); @@ -853,12 +888,6 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux * arg = gst_caps_get_structure(caps, 0); typename = gst_structure_get_name(arg); - if (strcmp(typename, "audio/x-raw") && strcmp(typename, "video/x-raw")) - { - FIXME("Unknown type \'%s\'\n", typename); - return; - } - if (!(pin = create_pin(This, nameW))) { ERR("Failed to allocate memory.\n");