Commit 793671b6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

avcodec: add vlc_va_GetChroma() helper

parent 072dac3f
...@@ -25,9 +25,50 @@ ...@@ -25,9 +25,50 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#include <vlc_fourcc.h>
#include <libavutil/pixfmt.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include "va.h" #include "va.h"
vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt)
{
/* NOTE: At the time of writing this comment, the return value was only
* used to probe support as decoder output. So incorrect values were not
* fatal, especially not if a software format. */
switch (hwfmt)
{
case AV_PIX_FMT_VAAPI_VLD:
return VLC_CODEC_YV12;
case AV_PIX_FMT_DXVA2_VLD:
return VLC_CODEC_YV12;
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(53, 14, 0))
case AV_PIX_FMT_VDA_VLD:
return VLC_CODEC_UYVY;
#endif
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 4, 0))
case AV_PIX_FMT_VDPAU:
switch (swfmt)
{
case AV_PIX_FMT_YUVJ444P:
case AV_PIX_FMT_YUV444P:
return VLC_CODEC_VDPAU_VIDEO_444;
case AV_PIX_FMT_YUVJ422P:
case AV_PIX_FMT_YUV422P:
return VLC_CODEC_VDPAU_VIDEO_422;
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUV420P:
return VLC_CODEC_VDPAU_VIDEO_420;
default:
return 0;
}
break;
#endif
default:
return 0;
}
}
static int vlc_va_Start(void *func, va_list ap) static int vlc_va_Start(void *func, va_list ap)
{ {
vlc_va_t *va = va_arg(ap, vlc_va_t *); vlc_va_t *va = va_arg(ap, vlc_va_t *);
......
...@@ -42,6 +42,15 @@ struct vlc_va_t { ...@@ -42,6 +42,15 @@ struct vlc_va_t {
int (*extract)(vlc_va_t *, picture_t *pic, uint8_t *data); int (*extract)(vlc_va_t *, picture_t *pic, uint8_t *data);
}; };
/**
* Determines the VLC video chroma value for a pair of hardware acceleration
* PixelFormat and software PixelFormat.
* @param hwfmt the hardware acceleration pixel format
* @param swfmt the software pixel format
* @return a VLC chroma value, or 0 on error.
*/
vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt);
/** /**
* Creates an accelerated video decoding back-end for libavcodec. * Creates an accelerated video decoding back-end for libavcodec.
* @param obj parent VLC object * @param obj parent VLC object
......
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