vdpau/avcodec: track chroma type in context

This stores the VDPAU video surface chroma type within the
corresponding VLC video context. This will be used in the following
changes.
This commit is contained in:
Rémi Denis-Courmont 2022-04-29 21:39:57 +03:00 committed by Jean-Baptiste Kempf
parent ae8a7532b6
commit 448a6ba69c
2 changed files with 6 additions and 3 deletions

View File

@ -91,7 +91,7 @@ struct vlc_video_context_operations
enum vlc_video_context_type
{
VLC_VIDEO_CONTEXT_VAAPI = 1, //!< private: vaapi_vctx* or empty
VLC_VIDEO_CONTEXT_VDPAU, //!< empty
VLC_VIDEO_CONTEXT_VDPAU, //!< private: chroma type (YUV) or empty (RGB)
VLC_VIDEO_CONTEXT_DXVA2, //!< private: d3d9_video_context_t*
VLC_VIDEO_CONTEXT_D3D11VA, //!< private: d3d11_video_context_t*
VLC_VIDEO_CONTEXT_AWINDOW, //!< private: android_video_context_t*

View File

@ -146,7 +146,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum AVPixelFormat hwfmt, c
(void) desc;
void *func;
VdpStatus err;
VdpChromaType type;
VdpChromaType type, *chroma;
uint32_t width, height;
if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height))
@ -193,13 +193,16 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum AVPixelFormat hwfmt, c
return VLC_ENOMEM;
sys->vctx = vlc_video_context_Create(dec_device, VLC_VIDEO_CONTEXT_VDPAU,
0, &vdpau_vctx_ops);
sizeof (VdpChromaType),
&vdpau_vctx_ops);
if (sys->vctx == NULL)
{
free(sys);
return VLC_ENOMEM;
}
chroma = vlc_video_context_GetPrivate(sys->vctx, VLC_VIDEO_CONTEXT_VDPAU);
*chroma = type;
sys->type = type;
sys->width = width;
sys->height = height;