[vlc-commits] dxva2: favor the format used by the vout for decoding
Steve Lhomme
git at videolan.org
Mon Mar 27 09:13:56 CEST 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Mar 22 14:12:52 2017 +0100| [aae4d6eb9dcaecc4687530f1c5a72a679bc6f8d7] | committer: Jean-Baptiste Kempf
dxva2: favor the format used by the vout for decoding
This is the same we already do for D3D11. It should work better with P010 which
doesn't come first in the list of possible decoders.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aae4d6eb9dcaecc4687530f1c5a72a679bc6f8d7
---
modules/codec/avcodec/dxva2.c | 40 +++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 8bfdecd..f2ff497 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -377,7 +377,12 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys->d3ddev = NULL;
if (p_sys!=NULL)
+ {
+ D3DSURFACE_DESC src;
+ if (SUCCEEDED(IDirect3DSurface9_GetDesc(p_sys->surface, &src)))
+ sys->render = src.Format;
IDirect3DSurface9_GetDevice(p_sys->surface, (IDirect3DDevice9**) &dx_sys->d3ddev );
+ }
sys->i_chroma = d3d9va_fourcc(ctx->sw_pix_fmt);
@@ -668,22 +673,27 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
}
/* */
- for (unsigned j = 0; d3d_formats[j].name; j++) {
- const d3d_format_t *format = &d3d_formats[j];
-
- /* */
- bool is_supported = false;
- for (unsigned k = 0; !is_supported && k < output_count; k++) {
- is_supported = format->format == output_list[k];
+ for (unsigned pass = 0; pass < 2 && err != VLC_SUCCESS; ++pass)
+ {
+ for (unsigned j = 0; d3d_formats[j].name; j++) {
+ const d3d_format_t *format = &d3d_formats[j];
+
+ /* */
+ bool is_supported = false;
+ for (unsigned k = 0; !is_supported && k < output_count; k++) {
+ is_supported = format->format == output_list[k];
+ }
+ if (!is_supported)
+ continue;
+ if (pass == 0 && format->format != va->sys->render)
+ continue;
+
+ /* We have our solution */
+ msg_Dbg(va, "Using decoder output '%s'", format->name);
+ va->sys->render = format->format;
+ err = VLC_SUCCESS;
+ break;
}
- if (!is_supported)
- continue;
-
- /* We have our solution */
- msg_Dbg(va, "Using decoder output '%s'", format->name);
- va->sys->render = format->format;
- err = VLC_SUCCESS;
- break;
}
CoTaskMemFree(output_list);
return err;
More information about the vlc-commits
mailing list