Re: [PATCH v2 0/4] MR10654: winegstreamer: Fix wg_parser/native video stride mismatch.
There really is no way to get pitch info from an `IMFMediaBuffer`, right? Am I missing something?
You are right. When working with an `IMFMediaBuffer` that doesn't implement `IMF2DBuffer`, the stride is suppose to come from the `MF_MT_DEFAULT_STRIDE` attribute within the media type. Otherwise you can fallback to using `MFGetStrideForBitmapInfoHeader`. It's actually pretty well documented here: https://learn.microsoft.com/en-us/windows/win32/medfound/uncompressed-video-... I also found an MS example using a YV12 image here: https://learn.microsoft.com/en-us/windows/win32/medfound/image-stride It seems a stride value here is solely for the `Y` plane and they just halve it for the `U` and `V` planes. Ideally we would use `IMF2DBuffer2::Lock2DSize` everywhere, as when using `IMFMediaBuffer`, we have to perform an expensive `memcpy` to and from the 2D buffer to a temporary 1D buffer. `Lock2DSize` also has `MF2DBuffer_LockFlags` which allows you to specify if your intent is to read and/or write from the buffer. This is useful, for example, if the buffer is backed by a DXGI surface, as it means we can skip a transfer to/from the GPU (depending on if you are just reading or just writing respectively). FWIW, commit d8a271c053bb23171355854d7af155b3bda7e8a9 was written to fix River City Girls on the DMO path (which goes via `wg_transform`). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10654#note_136446
participants (1)
-
Brendan McGrath (@redmcg)