libs: utils: avoid macro evaluation when stringify

string_of_va_chroma_format() gets a wrong string format description.
For example, the YUV420_10BPP get a string of 0x00000100 as output.

It's because VA_RT_FORMAT_xxx values are macro definitions. And
STRINGIFY(VA_RT_FORMAT_xxx) will expand to its real value
0x00000XXX.

To avoid the macro evaluation, it is changed to show only the color
format without VA_RT_FORMAT_ prefix.
This commit is contained in:
He Junyan 2019-04-15 13:55:26 +02:00 committed by Víctor Manuel Jáquez Leal
parent 7c0ec687cd
commit 3c86fd12cb

View file

@ -34,9 +34,13 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* string case an enum */
#define STRCASEP(p, x) STRCASE(G_PASTE(p, x))
#define STRCASE(x) case x: return G_STRINGIFY(x)
/* string case a macro */
#define STRCASEM(p, x) case G_PASTE(p, x): return G_STRINGIFY(x)
#if VA_CHECK_VERSION (0,40,0)
static gchar *
strip_msg (const char *message)
@ -294,7 +298,7 @@ string_of_va_chroma_format (guint chroma_format)
{
switch (chroma_format) {
#define MAP(value) \
STRCASEP(VA_RT_FORMAT_, value)
STRCASEM(VA_RT_FORMAT_, value)
MAP (YUV420);
MAP (YUV422);
MAP (YUV444);