[vlc-commits] avcodec: add vlc_va_GetChroma() helper
Rémi Denis-Courmont
git at videolan.org
Thu Apr 23 20:42:16 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Apr 23 19:49:31 2015 +0300| [793671b61ffa2dd59725eb6bbfcf86077335c5b5] | committer: Rémi Denis-Courmont
avcodec: add vlc_va_GetChroma() helper
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=793671b61ffa2dd59725eb6bbfcf86077335c5b5
---
modules/codec/avcodec/va.c | 41 +++++++++++++++++++++++++++++++++++++++++
modules/codec/avcodec/va.h | 9 +++++++++
2 files changed, 50 insertions(+)
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index ba7e0a7..2da49ce 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -25,9 +25,50 @@
#include <vlc_common.h>
#include <vlc_modules.h>
+#include <vlc_fourcc.h>
+#include <libavutil/pixfmt.h>
#include <libavcodec/avcodec.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)
{
vlc_va_t *va = va_arg(ap, vlc_va_t *);
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 6c791ba..fe5b947 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -43,6 +43,15 @@ struct vlc_va_t {
};
/**
+ * 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.
* @param obj parent VLC object
* @param fmt VLC format of the content to decode
More information about the vlc-commits
mailing list