Commit 1b4b7667 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Paul Saman

vdpau: fallback to NV12 if YV12 is unsupported (fixes #8495)

(cherry picked from commit 501bf022f353922c14f1d718874a3bc06931d3fc)
Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent fb581c0d
...@@ -57,9 +57,11 @@ struct vlc_va_sys_t ...@@ -57,9 +57,11 @@ struct vlc_va_sys_t
{ {
VdpDevice device; VdpDevice device;
VdpDecoderProfile profile; VdpDecoderProfile profile;
VdpYCbCrFormat format;
AVVDPAUContext context; AVVDPAUContext context;
VdpVideoSurface surfaces[MAX_SURFACES]; VdpVideoSurface surfaces[MAX_SURFACES];
uint32_t available; uint32_t available;
vlc_fourcc_t chroma;
uint16_t width; uint16_t width;
uint16_t height; uint16_t height;
void *display; void *display;
...@@ -133,7 +135,7 @@ static int Copy (vlc_va_t *va, picture_t *pic, AVFrame *ff) ...@@ -133,7 +135,7 @@ static int Copy (vlc_va_t *va, picture_t *pic, AVFrame *ff)
pitches[i] = pic->p[i].i_pitch; pitches[i] = pic->p[i].i_pitch;
} }
err = sys->VideoSurfaceGetBitsYCbCr (*surface, VDP_YCBCR_FORMAT_YV12, err = sys->VideoSurfaceGetBitsYCbCr (*surface, sys->format,
planes, pitches); planes, pitches);
if (err != VDP_STATUS_OK) if (err != VDP_STATUS_OK)
{ {
...@@ -193,7 +195,7 @@ static int Init (vlc_va_t *va, void **ctxp, vlc_fourcc_t *chromap, ...@@ -193,7 +195,7 @@ static int Init (vlc_va_t *va, void **ctxp, vlc_fourcc_t *chromap,
} }
*ctxp = &sys->context; *ctxp = &sys->context;
*chromap = VLC_CODEC_YV12; *chromap = sys->chroma;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -425,12 +427,23 @@ static int Open (vlc_va_t *va, int codec, const es_format_t *fmt) ...@@ -425,12 +427,23 @@ static int Open (vlc_va_t *va, int codec, const es_format_t *fmt)
"YUV 4:2:0", width, height); "YUV 4:2:0", width, height);
if (sys->VideoSurfaceQueryGetPutBitsYCbCrCapabilities (device, if (sys->VideoSurfaceQueryGetPutBitsYCbCrCapabilities (device,
VDP_CHROMA_TYPE_420, VDP_YCBCR_FORMAT_YV12, &support) != VDP_STATUS_OK) VDP_CHROMA_TYPE_420, VDP_YCBCR_FORMAT_YV12, &support)
support = VDP_FALSE; == VDP_STATUS_OK && support == VDP_TRUE)
if (!support) {
sys->format = VDP_YCBCR_FORMAT_YV12;
sys->chroma = VLC_CODEC_YV12;
}
else
if (sys->VideoSurfaceQueryGetPutBitsYCbCrCapabilities (device,
VDP_CHROMA_TYPE_420, VDP_YCBCR_FORMAT_NV12, &support)
== VDP_STATUS_OK && support == VDP_TRUE)
{
sys->format = VDP_YCBCR_FORMAT_NV12;
sys->chroma = VLC_CODEC_NV12;
}
else
{ {
msg_Err (va, "video surface reading not supported: %s as %s", msg_Err (va, "video surface reading not supported: %s", "YUV 4:2:0");
"YUV 4:2:0", "YV12");
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment