utils: simplify string of VAProfile/VAEntrypoint.

This commit is contained in:
Gwenole Beauchesne 2012-01-13 12:09:07 +01:00
parent 4340372996
commit ba810c2ed6

View file

@ -29,6 +29,13 @@
#define DEBUG 1 #define DEBUG 1
#include "gstvaapidebug.h" #include "gstvaapidebug.h"
#define CONCAT(a, b) CONCAT_(a, b)
#define CONCAT_(a, b) a##b
#define STRINGIFY(x) STRINGIFY_(x)
#define STRINGIFY_(x) #x
#define STRCASEP(p, x) STRCASE(CONCAT(p, x))
#define STRCASE(x) case x: return STRINGIFY(x)
/* Check VA status for success or print out an error */ /* Check VA status for success or print out an error */
gboolean gboolean
vaapi_check_status(VAStatus status, const char *msg) vaapi_check_status(VAStatus status, const char *msg)
@ -44,25 +51,25 @@ vaapi_check_status(VAStatus status, const char *msg)
const char *string_of_VAProfile(VAProfile profile) const char *string_of_VAProfile(VAProfile profile)
{ {
switch (profile) { switch (profile) {
#define PROFILE(profile) \ #define MAP(profile) \
case VAProfile##profile: return "VAProfile" #profile STRCASEP(VAProfile, profile)
PROFILE(MPEG2Simple); MAP(MPEG2Simple);
PROFILE(MPEG2Main); MAP(MPEG2Main);
PROFILE(MPEG4Simple); MAP(MPEG4Simple);
PROFILE(MPEG4AdvancedSimple); MAP(MPEG4AdvancedSimple);
PROFILE(MPEG4Main); MAP(MPEG4Main);
#if VA_CHECK_VERSION(0,32,0) #if VA_CHECK_VERSION(0,32,0)
PROFILE(JPEGBaseline); MAP(JPEGBaseline);
PROFILE(H263Baseline); MAP(H263Baseline);
PROFILE(H264ConstrainedBaseline); MAP(H264ConstrainedBaseline);
#endif #endif
PROFILE(H264Baseline); MAP(H264Baseline);
PROFILE(H264Main); MAP(H264Main);
PROFILE(H264High); MAP(H264High);
PROFILE(VC1Simple); MAP(VC1Simple);
PROFILE(VC1Main); MAP(VC1Main);
PROFILE(VC1Advanced); MAP(VC1Advanced);
#undef PROFILE #undef MAP
default: break; default: break;
} }
return "<unknown>"; return "<unknown>";
@ -72,14 +79,14 @@ const char *string_of_VAProfile(VAProfile profile)
const char *string_of_VAEntrypoint(VAEntrypoint entrypoint) const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
{ {
switch (entrypoint) { switch (entrypoint) {
#define ENTRYPOINT(entrypoint) \ #define MAP(entrypoint) \
case VAEntrypoint##entrypoint: return "VAEntrypoint" #entrypoint STRCASEP(VAEntrypoint, entrypoint)
ENTRYPOINT(VLD); MAP(VLD);
ENTRYPOINT(IZZ); MAP(IZZ);
ENTRYPOINT(IDCT); MAP(IDCT);
ENTRYPOINT(MoComp); MAP(MoComp);
ENTRYPOINT(Deblocking); MAP(Deblocking);
#undef ENTRYPOINT #undef MAP
default: break; default: break;
} }
return "<unknown>"; return "<unknown>";