I'm going to need to add a few more compressed formats, WMV which is straightforward, but also AAC (so MPEG v2/v4 audio), and I think wg_format could be cleaned up a bit like this beforehand.
Then, AAC could either be added as a separate `AUDIO_MPEG4` format, or, with an version field, to the (renamed) `AUDIO_MPEG` format, though it doesn't share any of the current `AUDIO_MPEG1` properties. FWIW GStreamer caps is `audio/mpeg` for both, with an `mpegversion` that can be 1, 2 or 4. Could be very well added as `AUDIO_AAC` too, I don't really mind.
-- v2: winegstreamer: Reorder video format struct in wg_format. winegstreamer: Rename WG_MAJOR_TYPE_H264 to WG_MAJOR_TYPE_VIDEO_H264. winegstreamer: Rename WG_MAJOR_TYPE_WMA to WG_MAJOR_TYPE_AUDIO_WMA. winegstreamer: Rename WG_MAJOR_TYPE_MPEG1_AUDIO to WG_MAJOR_TYPE_AUDIO_MPEG1. winegstreamer: Move CINEPAK encoded format to a separate major type.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/mfplat.c | 1 + dlls/winegstreamer/quartz_parser.c | 49 ++++++++++++++++++++++++------ dlls/winegstreamer/unixlib.h | 10 ++++-- dlls/winegstreamer/wg_format.c | 35 +++++++++++++++++---- dlls/winegstreamer/wg_parser.c | 1 - dlls/winegstreamer/wg_transform.c | 2 ++ dlls/winegstreamer/wm_reader.c | 4 +++ 7 files changed, 83 insertions(+), 19 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index d6620c0d08a..7c58ed93bfd 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -490,6 +490,7 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 1ba24580cf6..12091d75398 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -300,12 +300,6 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) return ALIGN(width, 4) * ALIGN(height, 2) /* Y plane */ + ALIGN(width, 4) * ((height + 1) / 2); /* U/V plane */
- case WG_VIDEO_FORMAT_CINEPAK: - /* 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 width * height * 3; - case WG_VIDEO_FORMAT_UNKNOWN: FIXME("Cannot guess maximum sample size for unknown video format.\n"); return 0; @@ -313,6 +307,12 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) break; }
+ case WG_MAJOR_TYPE_VIDEO_CINEPAK: + /* 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; + case WG_MAJOR_TYPE_AUDIO: { unsigned int rate = format->u.audio.rate, channels = format->u.audio.channels; @@ -390,7 +390,6 @@ static const GUID *wg_video_format_get_mediasubtype(enum wg_video_format format) case WG_VIDEO_FORMAT_YUY2: return &MEDIASUBTYPE_YUY2; case WG_VIDEO_FORMAT_YV12: return &MEDIASUBTYPE_YV12; case WG_VIDEO_FORMAT_YVYU: return &MEDIASUBTYPE_YVYU; - case WG_VIDEO_FORMAT_CINEPAK: return &MEDIASUBTYPE_CVID; }
assert(0); @@ -414,7 +413,6 @@ static DWORD wg_video_format_get_compression(enum wg_video_format format) case WG_VIDEO_FORMAT_YUY2: return mmioFOURCC('Y','U','Y','2'); case WG_VIDEO_FORMAT_YV12: return mmioFOURCC('Y','V','1','2'); case WG_VIDEO_FORMAT_YVYU: return mmioFOURCC('Y','V','Y','U'); - case WG_VIDEO_FORMAT_CINEPAK: return mmioFOURCC('C','V','I','D'); }
assert(0); @@ -438,7 +436,6 @@ static WORD wg_video_format_get_depth(enum wg_video_format format) case WG_VIDEO_FORMAT_YUY2: return 16; case WG_VIDEO_FORMAT_YV12: return 12; case WG_VIDEO_FORMAT_YVYU: return 16; - case WG_VIDEO_FORMAT_CINEPAK: return 24; }
assert(0); @@ -495,6 +492,36 @@ static bool amt_from_wg_format_video(AM_MEDIA_TYPE *mt, const struct wg_format * return true; }
+static bool amt_from_wg_format_video_cinepak(AM_MEDIA_TYPE *mt, const struct wg_format *format) +{ + VIDEOINFO *video_format; + uint32_t frame_time; + + if (!(video_format = CoTaskMemAlloc(sizeof(*video_format)))) + return false; + + mt->majortype = MEDIATYPE_Video; + mt->subtype = MEDIASUBTYPE_CVID; + mt->bTemporalCompression = TRUE; + mt->lSampleSize = 1; + mt->formattype = FORMAT_VideoInfo; + mt->cbFormat = sizeof(VIDEOINFOHEADER); + 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) + 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.biPlanes = 1; + video_format->bmiHeader.biBitCount = 24; + video_format->bmiHeader.biCompression = mt->subtype.Data1; + video_format->bmiHeader.biSizeImage = wg_format_get_max_size(format); + + return true; +} + bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm) { memset(mt, 0, sizeof(*mt)); @@ -516,6 +543,9 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool
case WG_MAJOR_TYPE_VIDEO: return amt_from_wg_format_video(mt, format, wm); + + case WG_MAJOR_TYPE_VIDEO_CINEPAK: + return amt_from_wg_format_video_cinepak(mt, format); }
assert(0); @@ -656,7 +686,6 @@ static bool amt_to_wg_format_video(const AM_MEDIA_TYPE *mt, struct wg_format *fo {&MEDIASUBTYPE_YUY2, WG_VIDEO_FORMAT_YUY2}, {&MEDIASUBTYPE_YV12, WG_VIDEO_FORMAT_YV12}, {&MEDIASUBTYPE_YVYU, WG_VIDEO_FORMAT_YVYU}, - {&MEDIASUBTYPE_CVID, WG_VIDEO_FORMAT_CINEPAK}, };
const VIDEOINFOHEADER *video_format = (const VIDEOINFOHEADER *)mt->pbFormat; diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index e2eef2a4932..5692b0e6f11 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -36,6 +36,7 @@ struct wg_format { WG_MAJOR_TYPE_UNKNOWN, WG_MAJOR_TYPE_VIDEO, + WG_MAJOR_TYPE_VIDEO_CINEPAK, WG_MAJOR_TYPE_AUDIO, WG_MAJOR_TYPE_MPEG1_AUDIO, WG_MAJOR_TYPE_WMA, @@ -63,8 +64,6 @@ struct wg_format WG_VIDEO_FORMAT_YUY2, WG_VIDEO_FORMAT_YV12, WG_VIDEO_FORMAT_YVYU, - - WG_VIDEO_FORMAT_CINEPAK, } format; int32_t width, height; uint32_t fps_n, fps_d; @@ -106,6 +105,13 @@ struct wg_format unsigned char codec_data[64]; } wma; 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 3b568ea2fec..5f87163cb72 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -225,12 +225,11 @@ static void wg_format_from_caps_video_cinepak(struct wg_format *format, const Gs fps_d = 1; }
- format->major_type = WG_MAJOR_TYPE_VIDEO; - format->u.video.format = WG_VIDEO_FORMAT_CINEPAK; - format->u.video.width = width; - format->u.video.height = height; - format->u.video.fps_n = fps_n; - format->u.video.fps_d = fps_d; + 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; }
void wg_format_from_caps(struct wg_format *format, const GstCaps *caps) @@ -407,6 +406,23 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format) return caps; }
+static GstCaps *wg_format_to_caps_video_cinepak(const struct wg_format *format) +{ + GstCaps *caps; + + 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); + + return caps; +} + static GstCaps *wg_format_to_caps_wma(const struct wg_format *format) { GstBuffer *buffer; @@ -523,6 +539,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) return wg_format_to_caps_audio(format); case WG_MAJOR_TYPE_VIDEO: return wg_format_to_caps_video(format); + case WG_MAJOR_TYPE_VIDEO_CINEPAK: + return wg_format_to_caps_video_cinepak(format); } assert(0); return NULL; @@ -554,6 +572,11 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b) && a->u.video.width == b->u.video.width && abs(a->u.video.height) == abs(b->u.video.height) && EqualRect( &a->u.video.padding, &b->u.video.padding ); + + 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; }
assert(0); diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index f0487fd1ffa..3e428cdebe8 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -236,7 +236,6 @@ static NTSTATUS wg_parser_stream_enable(void *args) case WG_VIDEO_FORMAT_YV12: case WG_VIDEO_FORMAT_YVYU: case WG_VIDEO_FORMAT_UNKNOWN: - case WG_VIDEO_FORMAT_CINEPAK: break; }
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index e703e93b07e..6fd3a097ed0 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -425,6 +425,7 @@ NTSTATUS wg_transform_create(void *args) /* fallthrough */ case WG_MAJOR_TYPE_MPEG1_AUDIO: case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_VIDEO_CINEPAK: if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps)) || !transform_append_element(transform, element, &first, &last)) { @@ -475,6 +476,7 @@ NTSTATUS wg_transform_create(void *args) case WG_MAJOR_TYPE_MPEG1_AUDIO: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_UNKNOWN: GST_FIXME("Format %u not implemented!", output_format.major_type); goto out; diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 95d6d8e0180..610338554f1 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1511,6 +1511,8 @@ static const char *get_major_type_string(enum wg_major_type type) return "audio"; case WG_MAJOR_TYPE_VIDEO: return "video"; + case WG_MAJOR_TYPE_VIDEO_CINEPAK: + return "cinepak"; case WG_MAJOR_TYPE_UNKNOWN: return "unknown"; case WG_MAJOR_TYPE_MPEG1_AUDIO: @@ -1975,6 +1977,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface, case WG_MAJOR_TYPE_MPEG1_AUDIO: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format.major_type); break; case WG_MAJOR_TYPE_UNKNOWN: @@ -2013,6 +2016,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o case WG_MAJOR_TYPE_MPEG1_AUDIO: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format.major_type); /* fallthrough */ case WG_MAJOR_TYPE_AUDIO:
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/mfplat.c | 2 +- dlls/winegstreamer/quartz_parser.c | 40 +++++++++++++-------------- dlls/winegstreamer/quartz_transform.c | 4 +-- dlls/winegstreamer/unixlib.h | 4 +-- dlls/winegstreamer/wg_format.c | 22 +++++++-------- dlls/winegstreamer/wg_transform.c | 4 +-- dlls/winegstreamer/wm_reader.c | 8 +++--- 7 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 7c58ed93bfd..379f5dd77ee 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -487,9 +487,9 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) { switch (format->major_type) { + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_WMA: - case WG_MAJOR_TYPE_MPEG1_AUDIO: case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 12091d75398..322675a5e73 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -208,12 +208,12 @@ static bool amt_from_wg_format_audio(AM_MEDIA_TYPE *mt, const struct wg_format * return false; }
-static bool amt_from_wg_format_mpeg1_audio(AM_MEDIA_TYPE *mt, const struct wg_format *format) +static bool amt_from_wg_format_audio_mpeg1(AM_MEDIA_TYPE *mt, const struct wg_format *format) { mt->majortype = MEDIATYPE_Audio; mt->formattype = FORMAT_WaveFormatEx;
- switch (format->u.mpeg1_audio.layer) + switch (format->u.audio_mpeg1.layer) { case 1: case 2: @@ -228,10 +228,10 @@ static bool amt_from_wg_format_mpeg1_audio(AM_MEDIA_TYPE *mt, const struct wg_fo mt->cbFormat = sizeof(*wave_format); mt->pbFormat = (BYTE *)wave_format; wave_format->wfx.wFormatTag = WAVE_FORMAT_MPEG; - wave_format->wfx.nChannels = format->u.mpeg1_audio.channels; - wave_format->wfx.nSamplesPerSec = format->u.mpeg1_audio.rate; + wave_format->wfx.nChannels = format->u.audio_mpeg1.channels; + wave_format->wfx.nSamplesPerSec = format->u.audio_mpeg1.rate; wave_format->wfx.cbSize = sizeof(*wave_format) - sizeof(WAVEFORMATEX); - wave_format->fwHeadLayer = format->u.mpeg1_audio.layer; + wave_format->fwHeadLayer = format->u.audio_mpeg1.layer; return true; }
@@ -247,8 +247,8 @@ static bool amt_from_wg_format_mpeg1_audio(AM_MEDIA_TYPE *mt, const struct wg_fo mt->cbFormat = sizeof(*wave_format); mt->pbFormat = (BYTE *)wave_format; wave_format->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3; - wave_format->wfx.nChannels = format->u.mpeg1_audio.channels; - wave_format->wfx.nSamplesPerSec = format->u.mpeg1_audio.rate; + wave_format->wfx.nChannels = format->u.audio_mpeg1.channels; + wave_format->wfx.nSamplesPerSec = format->u.audio_mpeg1.rate; wave_format->wfx.cbSize = sizeof(*wave_format) - sizeof(WAVEFORMATEX); /* FIXME: We can't get most of the MPEG data from the caps. We may have * to manually parse the header. */ @@ -345,8 +345,8 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) break; }
- case WG_MAJOR_TYPE_MPEG1_AUDIO: - switch (format->u.mpeg1_audio.layer) + case WG_MAJOR_TYPE_AUDIO_MPEG1: + switch (format->u.audio_mpeg1.layer) { case 1: return 56000; @@ -535,12 +535,12 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool case WG_MAJOR_TYPE_UNKNOWN: return false;
- case WG_MAJOR_TYPE_MPEG1_AUDIO: - return amt_from_wg_format_mpeg1_audio(mt, format); - case WG_MAJOR_TYPE_AUDIO: return amt_from_wg_format_audio(mt, format);
+ case WG_MAJOR_TYPE_AUDIO_MPEG1: + return amt_from_wg_format_audio_mpeg1(mt, format); + case WG_MAJOR_TYPE_VIDEO: return amt_from_wg_format_video(mt, format, wm);
@@ -636,10 +636,10 @@ static bool amt_to_wg_format_audio_mpeg1(const AM_MEDIA_TYPE *mt, struct wg_form return false; }
- format->major_type = WG_MAJOR_TYPE_MPEG1_AUDIO; - format->u.mpeg1_audio.channels = audio_format->wfx.nChannels; - format->u.mpeg1_audio.rate = audio_format->wfx.nSamplesPerSec; - format->u.mpeg1_audio.layer = audio_format->fwHeadLayer; + format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG1; + format->u.audio_mpeg1.channels = audio_format->wfx.nChannels; + format->u.audio_mpeg1.rate = audio_format->wfx.nSamplesPerSec; + format->u.audio_mpeg1.layer = audio_format->fwHeadLayer; return true; }
@@ -658,10 +658,10 @@ static bool amt_to_wg_format_audio_mpeg1_layer3(const AM_MEDIA_TYPE *mt, struct return false; }
- format->major_type = WG_MAJOR_TYPE_MPEG1_AUDIO; - format->u.mpeg1_audio.channels = audio_format->wfx.nChannels; - format->u.mpeg1_audio.rate = audio_format->wfx.nSamplesPerSec; - format->u.mpeg1_audio.layer = 3; + format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG1; + format->u.audio_mpeg1.channels = audio_format->wfx.nChannels; + format->u.audio_mpeg1.rate = audio_format->wfx.nSamplesPerSec; + format->u.audio_mpeg1.layer = 3; return true; }
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c index b4640b497ec..9a713b120d2 100644 --- a/dlls/winegstreamer/quartz_transform.c +++ b/dlls/winegstreamer/quartz_transform.c @@ -700,8 +700,8 @@ HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out) }; static const struct wg_format input_format = { - .major_type = WG_MAJOR_TYPE_MPEG1_AUDIO, - .u.mpeg1_audio = + .major_type = WG_MAJOR_TYPE_AUDIO_MPEG1, + .u.audio_mpeg1 = { .layer = 2, .channels = 1, diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 5692b0e6f11..6c3843eb517 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -38,7 +38,7 @@ struct wg_format WG_MAJOR_TYPE_VIDEO, WG_MAJOR_TYPE_VIDEO_CINEPAK, WG_MAJOR_TYPE_AUDIO, - WG_MAJOR_TYPE_MPEG1_AUDIO, + WG_MAJOR_TYPE_AUDIO_MPEG1, WG_MAJOR_TYPE_WMA, WG_MAJOR_TYPE_H264, } major_type; @@ -92,7 +92,7 @@ struct wg_format uint32_t layer; uint32_t rate; uint32_t channels; - } mpeg1_audio; + } audio_mpeg1; struct { uint32_t version; diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 5f87163cb72..5ecb2f779d6 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -198,10 +198,10 @@ static void wg_format_from_caps_audio_mpeg1(struct wg_format *format, const GstC return; }
- format->major_type = WG_MAJOR_TYPE_MPEG1_AUDIO; - format->u.mpeg1_audio.layer = layer; - format->u.mpeg1_audio.channels = channels; - format->u.mpeg1_audio.rate = rate; + format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG1; + format->u.audio_mpeg1.layer = layer; + format->u.audio_mpeg1.channels = channels; + format->u.audio_mpeg1.rate = rate; }
static void wg_format_from_caps_video_cinepak(struct wg_format *format, const GstCaps *caps) @@ -330,7 +330,7 @@ static void wg_channel_mask_to_gst(GstAudioChannelPosition *positions, uint32_t } }
-static GstCaps *wg_format_to_caps_mpeg1_audio(const struct wg_format *format) +static GstCaps *wg_format_to_caps_audio_mpeg1(const struct wg_format *format) { GstCaps *caps;
@@ -338,9 +338,9 @@ static GstCaps *wg_format_to_caps_mpeg1_audio(const struct wg_format *format) return NULL;
gst_caps_set_simple(caps, "mpegversion", G_TYPE_INT, 1, NULL); - gst_caps_set_simple(caps, "layer", G_TYPE_INT, format->u.mpeg1_audio.layer, NULL); - gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.mpeg1_audio.rate, NULL); - gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.mpeg1_audio.channels, NULL); + gst_caps_set_simple(caps, "layer", G_TYPE_INT, format->u.audio_mpeg1.layer, NULL); + gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.audio_mpeg1.rate, NULL); + gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.audio_mpeg1.channels, NULL); gst_caps_set_simple(caps, "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
return caps; @@ -529,14 +529,14 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) { case WG_MAJOR_TYPE_UNKNOWN: return gst_caps_new_any(); - case WG_MAJOR_TYPE_MPEG1_AUDIO: - return wg_format_to_caps_mpeg1_audio(format); case WG_MAJOR_TYPE_WMA: return wg_format_to_caps_wma(format); case WG_MAJOR_TYPE_H264: return wg_format_to_caps_h264(format); case WG_MAJOR_TYPE_AUDIO: return wg_format_to_caps_audio(format); + case WG_MAJOR_TYPE_AUDIO_MPEG1: + return wg_format_to_caps_audio_mpeg1(format); case WG_MAJOR_TYPE_VIDEO: return wg_format_to_caps_video(format); case WG_MAJOR_TYPE_VIDEO_CINEPAK: @@ -553,7 +553,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b)
switch (a->major_type) { - case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_H264: GST_FIXME("Format %u not implemented!", a->major_type); diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 6fd3a097ed0..6d07d884ada 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -423,7 +423,7 @@ NTSTATUS wg_transform_create(void *args) || !transform_append_element(transform, element, &first, &last)) goto out; /* fallthrough */ - case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_VIDEO_CINEPAK: if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps)) @@ -473,7 +473,7 @@ NTSTATUS wg_transform_create(void *args) gst_util_set_object_arg(G_OBJECT(element), "n-threads", "0"); break;
- case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_VIDEO_CINEPAK: diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 610338554f1..ad0f6037c72 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1509,14 +1509,14 @@ static const char *get_major_type_string(enum wg_major_type type) { case WG_MAJOR_TYPE_AUDIO: return "audio"; + case WG_MAJOR_TYPE_AUDIO_MPEG1: + return "mpeg1-audio"; case WG_MAJOR_TYPE_VIDEO: return "video"; case WG_MAJOR_TYPE_VIDEO_CINEPAK: return "cinepak"; case WG_MAJOR_TYPE_UNKNOWN: return "unknown"; - case WG_MAJOR_TYPE_MPEG1_AUDIO: - return "mpeg1-audio"; case WG_MAJOR_TYPE_WMA: return "wma"; case WG_MAJOR_TYPE_H264: @@ -1974,7 +1974,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface, format.u.audio.format = WG_AUDIO_FORMAT_S16LE; break;
- case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: @@ -2013,7 +2013,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o *count = ARRAY_SIZE(video_formats); break;
- case WG_MAJOR_TYPE_MPEG1_AUDIO: + case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK:
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/mfplat.c | 24 ++++++++--------- dlls/winegstreamer/quartz_parser.c | 4 +-- dlls/winegstreamer/unixlib.h | 4 +-- dlls/winegstreamer/wg_format.c | 42 +++++++++++++++--------------- dlls/winegstreamer/wg_transform.c | 4 +-- dlls/winegstreamer/wm_reader.c | 8 +++--- dlls/winegstreamer/wma_decoder.c | 2 +- 7 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 379f5dd77ee..1c8b2ebfc6d 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -488,8 +488,8 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) switch (format->major_type) { case WG_MAJOR_TYPE_AUDIO_MPEG1: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: - case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ @@ -601,7 +601,7 @@ static void mf_media_type_to_wg_format_video(IMFMediaType *type, const GUID *sub FIXME("Unrecognized video subtype %s.\n", debugstr_guid(subtype)); }
-static void mf_media_type_to_wg_format_wma(IMFMediaType *type, const GUID *subtype, struct wg_format *format) +static void mf_media_type_to_wg_format_audio_wma(IMFMediaType *type, const GUID *subtype, struct wg_format *format) { UINT32 rate, depth, channels, block_align, bytes_per_second, codec_data_len; BYTE codec_data[64]; @@ -652,15 +652,15 @@ static void mf_media_type_to_wg_format_wma(IMFMediaType *type, const GUID *subty return; }
- format->major_type = WG_MAJOR_TYPE_WMA; - format->u.wma.version = version; - format->u.wma.bitrate = bytes_per_second * 8; - format->u.wma.rate = rate; - format->u.wma.depth = depth; - format->u.wma.channels = channels; - format->u.wma.block_align = block_align; - format->u.wma.codec_data_len = codec_data_len; - memcpy(format->u.wma.codec_data, codec_data, codec_data_len); + format->major_type = WG_MAJOR_TYPE_AUDIO_WMA; + format->u.audio_wma.version = version; + format->u.audio_wma.bitrate = bytes_per_second * 8; + format->u.audio_wma.rate = rate; + format->u.audio_wma.depth = depth; + format->u.audio_wma.channels = channels; + format->u.audio_wma.block_align = block_align; + format->u.audio_wma.codec_data_len = codec_data_len; + memcpy(format->u.audio_wma.codec_data, codec_data, codec_data_len); }
static void mf_media_type_to_wg_format_h264(IMFMediaType *type, struct wg_format *format) @@ -718,7 +718,7 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) IsEqualGUID(&subtype, &MFAudioFormat_WMAudioV8) || IsEqualGUID(&subtype, &MFAudioFormat_WMAudioV9) || IsEqualGUID(&subtype, &MFAudioFormat_WMAudio_Lossless)) - mf_media_type_to_wg_format_wma(type, &subtype, format); + mf_media_type_to_wg_format_audio_wma(type, &subtype, format); else mf_media_type_to_wg_format_audio(type, &subtype, format); } diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 322675a5e73..d9248f81d81 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -359,8 +359,8 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) } break;
+ case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: - case WG_MAJOR_TYPE_WMA: FIXME("Format %u not implemented!\n", format->major_type); return 0;
@@ -528,8 +528,8 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool
switch (format->major_type) { + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: - case WG_MAJOR_TYPE_WMA: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 6c3843eb517..31e7d8359cd 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -39,7 +39,7 @@ struct wg_format WG_MAJOR_TYPE_VIDEO_CINEPAK, WG_MAJOR_TYPE_AUDIO, WG_MAJOR_TYPE_AUDIO_MPEG1, - WG_MAJOR_TYPE_WMA, + WG_MAJOR_TYPE_AUDIO_WMA, WG_MAJOR_TYPE_H264, } major_type;
@@ -103,7 +103,7 @@ struct wg_format uint32_t block_align; uint32_t codec_data_len; unsigned char codec_data[64]; - } wma; + } audio_wma; struct { uint32_t width; diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 5ecb2f779d6..261dc9a03e8 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -423,36 +423,36 @@ static GstCaps *wg_format_to_caps_video_cinepak(const struct wg_format *format) return caps; }
-static GstCaps *wg_format_to_caps_wma(const struct wg_format *format) +static GstCaps *wg_format_to_caps_audio_wma(const struct wg_format *format) { GstBuffer *buffer; GstCaps *caps;
if (!(caps = gst_caps_new_empty_simple("audio/x-wma"))) return NULL; - if (format->u.wma.version) - gst_caps_set_simple(caps, "wmaversion", G_TYPE_INT, format->u.wma.version, NULL); - - if (format->u.wma.bitrate) - gst_caps_set_simple(caps, "bitrate", G_TYPE_INT, format->u.wma.bitrate, NULL); - if (format->u.wma.rate) - gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.wma.rate, NULL); - if (format->u.wma.depth) - gst_caps_set_simple(caps, "depth", G_TYPE_INT, format->u.wma.depth, NULL); - if (format->u.wma.channels) - gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.wma.channels, NULL); - if (format->u.wma.block_align) - gst_caps_set_simple(caps, "block_align", G_TYPE_INT, format->u.wma.block_align, NULL); - - if (format->u.wma.codec_data_len) + if (format->u.audio_wma.version) + gst_caps_set_simple(caps, "wmaversion", G_TYPE_INT, format->u.audio_wma.version, NULL); + + if (format->u.audio_wma.bitrate) + gst_caps_set_simple(caps, "bitrate", G_TYPE_INT, format->u.audio_wma.bitrate, NULL); + if (format->u.audio_wma.rate) + gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.audio_wma.rate, NULL); + if (format->u.audio_wma.depth) + gst_caps_set_simple(caps, "depth", G_TYPE_INT, format->u.audio_wma.depth, NULL); + if (format->u.audio_wma.channels) + gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.audio_wma.channels, NULL); + if (format->u.audio_wma.block_align) + gst_caps_set_simple(caps, "block_align", G_TYPE_INT, format->u.audio_wma.block_align, NULL); + + if (format->u.audio_wma.codec_data_len) { - if (!(buffer = gst_buffer_new_and_alloc(format->u.wma.codec_data_len))) + if (!(buffer = gst_buffer_new_and_alloc(format->u.audio_wma.codec_data_len))) { gst_caps_unref(caps); return NULL; }
- gst_buffer_fill(buffer, 0, format->u.wma.codec_data, format->u.wma.codec_data_len); + gst_buffer_fill(buffer, 0, format->u.audio_wma.codec_data, format->u.audio_wma.codec_data_len); gst_caps_set_simple(caps, "codec_data", GST_TYPE_BUFFER, buffer, NULL); gst_buffer_unref(buffer); } @@ -529,14 +529,14 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) { case WG_MAJOR_TYPE_UNKNOWN: return gst_caps_new_any(); - case WG_MAJOR_TYPE_WMA: - return wg_format_to_caps_wma(format); case WG_MAJOR_TYPE_H264: return wg_format_to_caps_h264(format); case WG_MAJOR_TYPE_AUDIO: return wg_format_to_caps_audio(format); case WG_MAJOR_TYPE_AUDIO_MPEG1: return wg_format_to_caps_audio_mpeg1(format); + case WG_MAJOR_TYPE_AUDIO_WMA: + return wg_format_to_caps_audio_wma(format); case WG_MAJOR_TYPE_VIDEO: return wg_format_to_caps_video(format); case WG_MAJOR_TYPE_VIDEO_CINEPAK: @@ -554,7 +554,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b) switch (a->major_type) { case WG_MAJOR_TYPE_AUDIO_MPEG1: - case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: GST_FIXME("Format %u not implemented!", a->major_type); /* fallthrough */ diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 6d07d884ada..8a590a042a0 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -424,7 +424,7 @@ NTSTATUS wg_transform_create(void *args) goto out; /* fallthrough */ case WG_MAJOR_TYPE_AUDIO_MPEG1: - case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_VIDEO_CINEPAK: if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps)) || !transform_append_element(transform, element, &first, &last)) @@ -474,8 +474,8 @@ NTSTATUS wg_transform_create(void *args) break;
case WG_MAJOR_TYPE_AUDIO_MPEG1: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: - case WG_MAJOR_TYPE_WMA: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_UNKNOWN: GST_FIXME("Format %u not implemented!", output_format.major_type); diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index ad0f6037c72..ba3bff79761 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1511,14 +1511,14 @@ static const char *get_major_type_string(enum wg_major_type type) return "audio"; case WG_MAJOR_TYPE_AUDIO_MPEG1: return "mpeg1-audio"; + case WG_MAJOR_TYPE_AUDIO_WMA: + return "wma"; case WG_MAJOR_TYPE_VIDEO: return "video"; case WG_MAJOR_TYPE_VIDEO_CINEPAK: return "cinepak"; case WG_MAJOR_TYPE_UNKNOWN: return "unknown"; - case WG_MAJOR_TYPE_WMA: - return "wma"; case WG_MAJOR_TYPE_H264: return "h264"; } @@ -1975,7 +1975,7 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface, break;
case WG_MAJOR_TYPE_AUDIO_MPEG1: - case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format.major_type); @@ -2014,7 +2014,7 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o break;
case WG_MAJOR_TYPE_AUDIO_MPEG1: - case WG_MAJOR_TYPE_WMA: + case WG_MAJOR_TYPE_AUDIO_WMA: case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: FIXME("Format %u not implemented!\n", format.major_type); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index 6d8917c9c07..1391a7b60e1 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -870,7 +870,7 @@ HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out) .rate = 44100, }, }; - static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_WMA}; + static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_AUDIO_WMA}; struct wg_transform *transform; struct wma_decoder *decoder; HRESULT hr;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/h264_decoder.c | 2 +- dlls/winegstreamer/mfplat.c | 24 ++++++++++++------------ dlls/winegstreamer/quartz_parser.c | 4 ++-- dlls/winegstreamer/unixlib.h | 4 ++-- dlls/winegstreamer/wg_format.c | 28 ++++++++++++++-------------- dlls/winegstreamer/wg_transform.c | 4 ++-- dlls/winegstreamer/wm_reader.c | 8 ++++---- 7 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 44c6d992b55..7fbe46c22a4 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -698,7 +698,7 @@ HRESULT h264_decoder_create(REFIID riid, void **ret) .height = 1080, }, }; - static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_H264}; + static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_VIDEO_H264}; struct wg_transform *transform; struct h264_decoder *decoder; HRESULT hr; diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 1c8b2ebfc6d..7e83d570f06 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -489,8 +489,8 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) { case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: + case WG_MAJOR_TYPE_VIDEO_H264: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: @@ -663,36 +663,36 @@ static void mf_media_type_to_wg_format_audio_wma(IMFMediaType *type, const GUID memcpy(format->u.audio_wma.codec_data, codec_data, codec_data_len); }
-static void mf_media_type_to_wg_format_h264(IMFMediaType *type, struct wg_format *format) +static void mf_media_type_to_wg_format_video_h264(IMFMediaType *type, struct wg_format *format) { UINT64 frame_rate, frame_size; UINT32 profile, level;
memset(format, 0, sizeof(*format)); - format->major_type = WG_MAJOR_TYPE_H264; + format->major_type = WG_MAJOR_TYPE_VIDEO_H264;
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) { - format->u.h264.width = frame_size >> 32; - format->u.h264.height = (UINT32)frame_size; + format->u.video_h264.width = frame_size >> 32; + format->u.video_h264.height = (UINT32)frame_size; }
if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate) { - format->u.h264.fps_n = frame_rate >> 32; - format->u.h264.fps_d = (UINT32)frame_rate; + format->u.video_h264.fps_n = frame_rate >> 32; + format->u.video_h264.fps_d = (UINT32)frame_rate; } else { - format->u.h264.fps_n = 1; - format->u.h264.fps_d = 1; + format->u.video_h264.fps_n = 1; + format->u.video_h264.fps_d = 1; }
if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_PROFILE, &profile))) - format->u.h264.profile = profile; + format->u.video_h264.profile = profile;
if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_MPEG2_LEVEL, &level))) - format->u.h264.level = level; + format->u.video_h264.level = level; }
void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) @@ -725,7 +725,7 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) else if (IsEqualGUID(&major_type, &MFMediaType_Video)) { if (IsEqualGUID(&subtype, &MFVideoFormat_H264)) - mf_media_type_to_wg_format_h264(type, format); + mf_media_type_to_wg_format_video_h264(type, format); else mf_media_type_to_wg_format_video(type, &subtype, format); } diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index d9248f81d81..55e5988e880 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -360,7 +360,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) break;
case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_H264: FIXME("Format %u not implemented!\n", format->major_type); return 0;
@@ -529,7 +529,7 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool switch (format->major_type) { case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_H264: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 31e7d8359cd..9ec992368b9 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -37,10 +37,10 @@ struct wg_format WG_MAJOR_TYPE_UNKNOWN, WG_MAJOR_TYPE_VIDEO, WG_MAJOR_TYPE_VIDEO_CINEPAK, + WG_MAJOR_TYPE_VIDEO_H264, WG_MAJOR_TYPE_AUDIO, WG_MAJOR_TYPE_AUDIO_MPEG1, WG_MAJOR_TYPE_AUDIO_WMA, - WG_MAJOR_TYPE_H264, } major_type;
union @@ -117,7 +117,7 @@ struct wg_format uint32_t fps_n, fps_d; uint32_t profile; uint32_t level; - } h264; + } video_h264; } u; };
diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 261dc9a03e8..b67c820dd71 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -460,7 +460,7 @@ static GstCaps *wg_format_to_caps_audio_wma(const struct wg_format *format) return caps; }
-static GstCaps *wg_format_to_caps_h264(const struct wg_format *format) +static GstCaps *wg_format_to_caps_video_h264(const struct wg_format *format) { const char *profile, *level; GstCaps *caps; @@ -470,20 +470,20 @@ static GstCaps *wg_format_to_caps_h264(const struct wg_format *format) gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "byte-stream", NULL); gst_caps_set_simple(caps, "alignment", G_TYPE_STRING, "au", NULL);
- if (format->u.h264.width) - gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.h264.width, NULL); - if (format->u.h264.height) - gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.h264.height, NULL); - if (format->u.h264.fps_n || format->u.h264.fps_d) - gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.h264.fps_n, format->u.h264.fps_d, NULL); + if (format->u.video_h264.width) + 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) + 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.h264.profile) + switch (format->u.video_h264.profile) { case eAVEncH264VProfile_Main: profile = "main"; break; case eAVEncH264VProfile_High: profile = "high"; break; case eAVEncH264VProfile_444: profile = "high-4:4:4"; break; default: - GST_FIXME("H264 profile attribute %u not implemented.", format->u.h264.profile); + GST_FIXME("H264 profile attribute %u not implemented.", format->u.video_h264.profile); /* fallthrough */ case eAVEncH264VProfile_unknown: profile = NULL; @@ -492,7 +492,7 @@ static GstCaps *wg_format_to_caps_h264(const struct wg_format *format) if (profile) gst_caps_set_simple(caps, "profile", G_TYPE_STRING, profile, NULL);
- switch (format->u.h264.level) + switch (format->u.video_h264.level) { case eAVEncH264VLevel1: level = "1"; break; case eAVEncH264VLevel1_1: level = "1.1"; break; @@ -511,7 +511,7 @@ static GstCaps *wg_format_to_caps_h264(const struct wg_format *format) case eAVEncH264VLevel5_1: level = "5.1"; break; case eAVEncH264VLevel5_2: level = "5.2"; break; default: - GST_FIXME("H264 level attribute %u not implemented.", format->u.h264.level); + GST_FIXME("H264 level attribute %u not implemented.", format->u.video_h264.level); /* fallthrough */ case 0: level = NULL; @@ -529,8 +529,6 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) { case WG_MAJOR_TYPE_UNKNOWN: return gst_caps_new_any(); - case WG_MAJOR_TYPE_H264: - return wg_format_to_caps_h264(format); case WG_MAJOR_TYPE_AUDIO: return wg_format_to_caps_audio(format); case WG_MAJOR_TYPE_AUDIO_MPEG1: @@ -541,6 +539,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) return wg_format_to_caps_video(format); case WG_MAJOR_TYPE_VIDEO_CINEPAK: return wg_format_to_caps_video_cinepak(format); + case WG_MAJOR_TYPE_VIDEO_H264: + return wg_format_to_caps_video_h264(format); } assert(0); return NULL; @@ -555,7 +555,7 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b) { case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_H264: GST_FIXME("Format %u not implemented!", a->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 8a590a042a0..486562fdff6 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -411,7 +411,7 @@ NTSTATUS wg_transform_create(void *args)
switch (input_format.major_type) { - case WG_MAJOR_TYPE_H264: + case WG_MAJOR_TYPE_VIDEO_H264: /* Call of Duty: Black Ops 3 doesn't care about the ProcessInput/ProcessOutput * return values, it calls them in a specific order and expects the decoder * transform to be able to queue its input buffers. We need to use a buffer list @@ -475,8 +475,8 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: + case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_UNKNOWN: GST_FIXME("Format %u not implemented!", output_format.major_type); goto out; diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index ba3bff79761..f4210379a30 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1517,10 +1517,10 @@ static const char *get_major_type_string(enum wg_major_type type) return "video"; case WG_MAJOR_TYPE_VIDEO_CINEPAK: return "cinepak"; + case WG_MAJOR_TYPE_VIDEO_H264: + return "h264"; case WG_MAJOR_TYPE_UNKNOWN: return "unknown"; - case WG_MAJOR_TYPE_H264: - return "h264"; } assert(0); return NULL; @@ -1976,8 +1976,8 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface,
case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: + case WG_MAJOR_TYPE_VIDEO_H264: FIXME("Format %u not implemented!\n", format.major_type); break; case WG_MAJOR_TYPE_UNKNOWN: @@ -2015,8 +2015,8 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o
case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: + case WG_MAJOR_TYPE_VIDEO_H264: FIXME("Format %u not implemented!\n", format.major_type); /* fallthrough */ case WG_MAJOR_TYPE_AUDIO:
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/unixlib.h | 57 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 28 deletions(-)
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 9ec992368b9..7996f5c76cc 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -34,41 +34,17 @@ struct wg_format { enum wg_major_type { - WG_MAJOR_TYPE_UNKNOWN, - WG_MAJOR_TYPE_VIDEO, - WG_MAJOR_TYPE_VIDEO_CINEPAK, - WG_MAJOR_TYPE_VIDEO_H264, + WG_MAJOR_TYPE_UNKNOWN = 0, WG_MAJOR_TYPE_AUDIO, WG_MAJOR_TYPE_AUDIO_MPEG1, WG_MAJOR_TYPE_AUDIO_WMA, + WG_MAJOR_TYPE_VIDEO, + WG_MAJOR_TYPE_VIDEO_CINEPAK, + WG_MAJOR_TYPE_VIDEO_H264, } major_type;
union { - struct - { - enum wg_video_format - { - WG_VIDEO_FORMAT_UNKNOWN, - - WG_VIDEO_FORMAT_BGRA, - WG_VIDEO_FORMAT_BGRx, - WG_VIDEO_FORMAT_BGR, - WG_VIDEO_FORMAT_RGB15, - WG_VIDEO_FORMAT_RGB16, - - WG_VIDEO_FORMAT_AYUV, - WG_VIDEO_FORMAT_I420, - WG_VIDEO_FORMAT_NV12, - WG_VIDEO_FORMAT_UYVY, - WG_VIDEO_FORMAT_YUY2, - WG_VIDEO_FORMAT_YV12, - WG_VIDEO_FORMAT_YVYU, - } format; - int32_t width, height; - uint32_t fps_n, fps_d; - RECT padding; - } video; struct { enum wg_audio_format @@ -104,6 +80,31 @@ struct wg_format uint32_t codec_data_len; unsigned char codec_data[64]; } audio_wma; + + struct + { + enum wg_video_format + { + WG_VIDEO_FORMAT_UNKNOWN, + + WG_VIDEO_FORMAT_BGRA, + WG_VIDEO_FORMAT_BGRx, + WG_VIDEO_FORMAT_BGR, + WG_VIDEO_FORMAT_RGB15, + WG_VIDEO_FORMAT_RGB16, + + WG_VIDEO_FORMAT_AYUV, + WG_VIDEO_FORMAT_I420, + WG_VIDEO_FORMAT_NV12, + WG_VIDEO_FORMAT_UYVY, + WG_VIDEO_FORMAT_YUY2, + WG_VIDEO_FORMAT_YV12, + WG_VIDEO_FORMAT_YVYU, + } format; + int32_t width, height; + uint32_t fps_n, fps_d; + RECT padding; + } video; struct { uint32_t width;
v2: Drop the raw audio / video format changes for now.
On Wed Sep 28 21:16:15 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 9/28/22 16:13, Zebediah Figura wrote: > On 9/27/22 03:32, Rémi Bernon wrote: >> +/* List all supported raw video formats, with their metadata. >> + * >> + * Each element should be X(wg, guid, depth, type), with: >> + * wg: suffix of the GStreamer constant, and enum wg_video_format >> value. >> + * guid: suffix of the corresponding MEDIASUBTYPE / MFVideoFormat >> guid. >> + * depth: the number of bits of each video sample. >> + * type: whether the video format is RGB or YUV. >> + * >> + */ >> +#define FOR_EACH_WG_VIDEO_FORMAT(F) \ >> + F(BGRA, ARGB32, 32, RGB) \ >> + F(BGRx, RGB32, 32, RGB) \ >> + F(BGR, RGB24, 24, RGB) \ >> + F(RGB15, RGB555, 16, RGB) \ >> + F(RGB16, RGB565, 16, RGB) \ >> + F(AYUV, AYUV, 32, YUV) \ >> + F(I420, I420, 12, YUV) \ >> + F(NV12, NV12, 12, YUV) \ >> + F(UYVY, UYVY, 16, YUV) \ >> + F(YUY2, YUY2, 16, YUV) \ >> + F(YV12, YV12, 12, YUV) \ >> + F(YVYU, YVYU, 16, YUV) \ >> + >> +enum wg_video_format >> +{ >> + WG_VIDEO_FORMAT_UNKNOWN = 0, >> +#define X(x, g, d, t) WG_VIDEO_FORMAT_ ## x, >> + FOR_EACH_WG_VIDEO_FORMAT(X) >> +#undef X >> +}; > > I don't hate this, but I'm also less than thrilled about it. > > One of the nice things about spelling things out explicitly is that it's > easy for someone unfamiliar with the code to grep for constants to see > how they're converted. > > This also puts some burden on the reader to mentally preprocess the code > first. It's probably not a big deal, since it's not difficult to > understand what it's doing, but I'm not really sure it's worthwhile in > this case. > > FWIW, I think the other patches in this series are fine (namely 2, 3, 4, 7). I don't easily see patch 1/7 as being an improvement if not required for this patch, but the renames seem like an improvement.
As we're using separate major types for encoded formats I think CINEPAK has nothing to do with the raw video formats, even though it only requires the same set of properties as raw formats. For instance I don't think signed height makes any sense, the data doesn't have a stride.
On 9/30/22 04:47, Rémi Bernon (@rbernon) wrote:
On Wed Sep 28 21:16:15 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 9/28/22 16:13, Zebediah Figura wrote: > On 9/27/22 03:32, Rémi Bernon wrote: >> +/* List all supported raw video formats, with their metadata. >> + * >> + * Each element should be X(wg, guid, depth, type), with: >> + * wg: suffix of the GStreamer constant, and enum wg_video_format >> value. >> + * guid: suffix of the corresponding MEDIASUBTYPE / MFVideoFormat >> guid. >> + * depth: the number of bits of each video sample. >> + * type: whether the video format is RGB or YUV. >> + * >> + */ >> +#define FOR_EACH_WG_VIDEO_FORMAT(F) \ >> + F(BGRA, ARGB32, 32, RGB) \ >> + F(BGRx, RGB32, 32, RGB) \ >> + F(BGR, RGB24, 24, RGB) \ >> + F(RGB15, RGB555, 16, RGB) \ >> + F(RGB16, RGB565, 16, RGB) \ >> + F(AYUV, AYUV, 32, YUV) \ >> + F(I420, I420, 12, YUV) \ >> + F(NV12, NV12, 12, YUV) \ >> + F(UYVY, UYVY, 16, YUV) \ >> + F(YUY2, YUY2, 16, YUV) \ >> + F(YV12, YV12, 12, YUV) \ >> + F(YVYU, YVYU, 16, YUV) \ >> + >> +enum wg_video_format >> +{ >> + WG_VIDEO_FORMAT_UNKNOWN = 0, >> +#define X(x, g, d, t) WG_VIDEO_FORMAT_ ## x, >> + FOR_EACH_WG_VIDEO_FORMAT(X) >> +#undef X >> +}; > > I don't hate this, but I'm also less than thrilled about it. > > One of the nice things about spelling things out explicitly is that it's > easy for someone unfamiliar with the code to grep for constants to see > how they're converted. > > This also puts some burden on the reader to mentally preprocess the code > first. It's probably not a big deal, since it's not difficult to > understand what it's doing, but I'm not really sure it's worthwhile in > this case. > > FWIW, I think the other patches in this series are fine (namely 2, 3, 4, 7). I don't easily see patch 1/7 as being an improvement if not required for this patch, but the renames seem like an improvement.
As we're using separate major types for encoded formats I think CINEPAK has nothing to do with the raw video formats, even though it only requires the same set of properties as raw formats. For instance I don't think signed height makes any sense, the data doesn't have a stride.
Sure, but it's mostly been a matter of convenience. Also perhaps clarity, in terms of avoiding fields being ignored for certain formats—but that's also not something I'm especially afraid of, especially in the case of cinepak where all of the fields can be shared, signed height notwithstanding.
Am I expected to do more changes here? I think I addressed the comments above.
On 10/11/22 04:12, Rémi Bernon (@rbernon) wrote:
Am I expected to do more changes here? I think I addressed the comments above.
No, I'm sorry, this and 971 both just got buried during wineconf, I'm currently trying to work through all the review I missed.
This merge request was approved by Zebediah Figura.