summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelly Ledford <kelly.ledford@intel.com>2017-09-13 17:34:11 -0700
committerXiang, Haihao <haihao.xiang@intel.com>2017-09-27 12:49:34 +0800
commitb70a7239ef5ed253c2161d7cf27b590e8cfb3175 (patch)
tree6817db9fc544ebaf0e3ad82c7b230a21aabc32c8
parent2067ad48b08517875a65e480ddcdb6f3df62b940 (diff)
downloadlibva-b70a7239ef5ed253c2161d7cf27b590e8cfb3175.tar.gz
va: Add functions for converting common enums to strings
Signed-off-by: Kelly Ledford <kelly.ledford@intel.com>
-rw-r--r--va/Makefile.am2
-rw-r--r--va/va_str.c134
-rw-r--r--va/va_str.h47
3 files changed, 183 insertions, 0 deletions
diff --git a/va/Makefile.am b/va/Makefile.am
index 6ea9199..4e94172 100644
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -33,6 +33,7 @@ libva_source_c = \
va.c \
va_compat.c \
va_fool.c \
+ va_str.c \
va_trace.c \
$(NULL)
@@ -55,6 +56,7 @@ libva_source_h = \
va_fei_h264.h \
va_enc_mpeg2.h \
va_enc_vp9.h \
+ va_str.h \
va_tpi.h \
va_version.h \
va_vpp.h \
diff --git a/va/va_str.c b/va/va_str.c
new file mode 100644
index 0000000..af8180b
--- /dev/null
+++ b/va/va_str.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2017 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "va_str.h"
+
+#define TOSTR(enumCase) case enumCase: return #enumCase
+
+const char *vaProfileStr(VAProfile profile)
+{
+ switch (profile) {
+ TOSTR(VAProfileNone);
+ TOSTR(VAProfileMPEG2Simple);
+ TOSTR(VAProfileMPEG2Main);
+ TOSTR(VAProfileMPEG4Simple);
+ TOSTR(VAProfileMPEG4AdvancedSimple);
+ TOSTR(VAProfileMPEG4Main);
+ TOSTR(VAProfileH264Main);
+ TOSTR(VAProfileH264High);
+ TOSTR(VAProfileVC1Simple);
+ TOSTR(VAProfileVC1Main);
+ TOSTR(VAProfileVC1Advanced);
+ TOSTR(VAProfileH263Baseline);
+ TOSTR(VAProfileH264ConstrainedBaseline);
+ TOSTR(VAProfileJPEGBaseline);
+ TOSTR(VAProfileVP8Version0_3);
+ TOSTR(VAProfileH264MultiviewHigh);
+ TOSTR(VAProfileH264StereoHigh);
+ TOSTR(VAProfileHEVCMain);
+ TOSTR(VAProfileHEVCMain10);
+ TOSTR(VAProfileVP9Profile0);
+ TOSTR(VAProfileVP9Profile1);
+ TOSTR(VAProfileVP9Profile2);
+ TOSTR(VAProfileVP9Profile3);
+ }
+ return "<unknown profile>";
+}
+
+
+const char *vaEntrypointStr(VAEntrypoint entrypoint)
+{
+ switch (entrypoint) {
+ TOSTR(VAEntrypointVLD);
+ TOSTR(VAEntrypointIZZ);
+ TOSTR(VAEntrypointIDCT);
+ TOSTR(VAEntrypointMoComp);
+ TOSTR(VAEntrypointDeblocking);
+ TOSTR(VAEntrypointEncSlice);
+ TOSTR(VAEntrypointEncPicture);
+ TOSTR(VAEntrypointEncSliceLP);
+ TOSTR(VAEntrypointVideoProc);
+ TOSTR(VAEntrypointFEI);
+ }
+ return "<unknown entrypoint>";
+}
+
+const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
+{
+ switch (configAttribType) {
+ TOSTR(VAConfigAttribRTFormat);
+ TOSTR(VAConfigAttribSpatialResidual);
+ TOSTR(VAConfigAttribSpatialClipping);
+ TOSTR(VAConfigAttribIntraResidual);
+ TOSTR(VAConfigAttribEncryption);
+ TOSTR(VAConfigAttribRateControl);
+ TOSTR(VAConfigAttribDecSliceMode);
+ TOSTR(VAConfigAttribEncPackedHeaders);
+ TOSTR(VAConfigAttribEncInterlaced);
+ TOSTR(VAConfigAttribEncMaxRefFrames);
+ TOSTR(VAConfigAttribEncMaxSlices);
+ TOSTR(VAConfigAttribEncSliceStructure);
+ TOSTR(VAConfigAttribEncMacroblockInfo);
+ TOSTR(VAConfigAttribEncJPEG);
+ TOSTR(VAConfigAttribEncQualityRange);
+ TOSTR(VAConfigAttribEncSkipFrame);
+ TOSTR(VAConfigAttribEncROI);
+ TOSTR(VAConfigAttribEncRateControlExt);
+ }
+ return "<unknown config attribute type>";
+}
+
+const char *vaBufferTypeStr(VABufferType bufferType)
+{
+ switch (bufferType) {
+ TOSTR(VAPictureParameterBufferType);
+ TOSTR(VAIQMatrixBufferType);
+ TOSTR(VABitPlaneBufferType);
+ TOSTR(VASliceGroupMapBufferType);
+ TOSTR(VASliceParameterBufferType);
+ TOSTR(VASliceDataBufferType);
+ TOSTR(VAMacroblockParameterBufferType);
+ TOSTR(VAResidualDataBufferType);
+ TOSTR(VADeblockingParameterBufferType);
+ TOSTR(VAImageBufferType);
+ TOSTR(VAProtectedSliceDataBufferType);
+ TOSTR(VAQMatrixBufferType);
+ TOSTR(VAHuffmanTableBufferType);
+ TOSTR(VAProbabilityBufferType);
+ TOSTR(VAEncCodedBufferType);
+ TOSTR(VAEncSequenceParameterBufferType);
+ TOSTR(VAEncPictureParameterBufferType);
+ TOSTR(VAEncSliceParameterBufferType);
+ TOSTR(VAEncPackedHeaderParameterBufferType);
+ TOSTR(VAEncPackedHeaderDataBufferType);
+ TOSTR(VAEncMiscParameterBufferType);
+ TOSTR(VAEncMacroblockParameterBufferType);
+ TOSTR(VAEncMacroblockMapBufferType);
+ TOSTR(VAProcPipelineParameterBufferType);
+ TOSTR(VAProcFilterParameterBufferType);
+ }
+ return "<unknown buffer type>";
+}
+
+#undef TOSTR
diff --git a/va/va_str.h b/va/va_str.h
new file mode 100644
index 0000000..e8e02f6
--- /dev/null
+++ b/va/va_str.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _VA_STR_H_
+#define _VA_STR_H_
+
+#include <va/va.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *vaProfileStr(VAProfile profile);
+
+const char *vaEntrypointStr(VAEntrypoint entrypoint);
+
+const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType);
+
+const char *vaBufferTypeStr(VABufferType bufferType);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VA_STR_H_ */