On Fri Jul 5 06:26:44 2024 +0000, Rémi Bernon wrote:
Also of note, it also looks like `IMFMediaStream` is not currently
D3D-aware. I think we would need to implement `IMFMediaSourceEx` so we can call `IMFMediaSourceEx::SetD3DManager`. I guess we will want to do this if we want to receive YUV output in a D3D texture for potential color conversion by the GPU. Yes, possibly, but the media source is also not supposed to decode buffers and that should be done by the MF decoder + processor pipeline, and these components are now D3D-aware.
The sample received by the application is created by an internally
managed `IMFVideoSampleAllocatorEx`, whilst the samples from `IMFMediaStream` are created by the media stream itself. The source reader only uses `IMFVideoSampleAllocatorEx` when it has been initialized with a device manager, in which case it also passes it to its pipeline and initialize any D3D-aware component. The media source shouldn't decode its buffers, and except in the case where you are playing a file with raw video in it (which pretty much never happens in any real situation), you would normally always have a pipeline after it. When using a video decoder or processor, the D3D-aware video processor will allocate its output samples, and we don't need to copy these buffers at all in the source reader. To cover the case with raw video we could either keep an optional copy here if there is no pipeline, or, like you described implement `IMFMediaSourceEx::SetD3DManager`.
Do we know when IMFMediaSourceEx is available on Windows?