diff options
Diffstat (limited to 'test/vainfo.c')
-rw-r--r-- | test/vainfo.c | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/test/vainfo.c b/test/vainfo.c index 1dde61b..fb0d221 100644 --- a/test/vainfo.c +++ b/test/vainfo.c @@ -29,6 +29,44 @@ #include <string.h> #include <stdlib.h> + +#define CHECK_VASTATUS(va_status,func, ret) \ +if (va_status != VA_STATUS_SUCCESS) { \ + fprintf(stderr,"%s failed with error code %d (%s),exit\n",func, vaErrorStr(va_status)); \ + exit(ret); \ +} + +static char * profile_string(VAProfile profile) +{ + switch (profile) { + case VAProfileMPEG2Simple: return "VAProfileMPEG2Simple"; + case VAProfileMPEG2Main: return "VAProfileMPEG2Main"; + case VAProfileMPEG4Simple: return "VAProfileMPEG4Simple"; + case VAProfileMPEG4AdvancedSimple: return "VAProfileMPEG4AdvancedSimple"; + case VAProfileMPEG4Main: return "VAProfileMPEG4Main"; + case VAProfileH264Baseline: return "VAProfileH264Baseline"; + case VAProfileH264Main: return "VAProfileH264Main"; + case VAProfileH264High: return "VAProfileH264High"; + case VAProfileVC1Simple: return "VAProfileVC1Simple"; + case VAProfileVC1Main: return "VAProfileVC1Main"; + case VAProfileVC1Advanced: return "VAProfileVC1Advanced"; + case VAProfileH263Baseline: return "VAProfileH263Baseline"; + } +} + + +static char * entrypoint_string(VAEntrypoint entrypoint) +{ + switch (entrypoint) { + case VAEntrypointVLD:return "VAEntrypointVLD"; + case VAEntrypointIZZ:return "VAEntrypointIZZ"; + case VAEntrypointIDCT:return "VAEntrypointIDCT"; + case VAEntrypointMoComp:return "VAEntrypointMoComp"; + case VAEntrypointDeblocking:return "VAEntrypointDeblocking"; + case VAEntrypointEncSlice:return "VAEntrypointEncSlice"; + } +} + int main(int argc, const char* argv[]) { Display *dpy; @@ -37,8 +75,11 @@ int main(int argc, const char* argv[]) int major_version, minor_version; const char *driver; const char *display = getenv("DISPLAY"); - const char *name = rindex(argv[0], '/'); - + const char *name = rindex(argv[0], '/'); + VAProfile profile; + VAEntrypoint entrypoint, entrypoints[10]; + int num_entrypoint; + if (name) name++; else @@ -59,16 +100,27 @@ int main(int argc, const char* argv[]) } va_status = vaInitialize(va_dpy, &major_version, &minor_version); - if (VA_STATUS_SUCCESS != va_status ) - { - fprintf(stderr, "%s: vaInitialize failed with error code %d (%s)\n", - name, va_status, vaErrorStr(va_status)); - return 3; - } + CHECK_VASTATUS(va_status, "vaInitialize", 3); + printf("%s: VA API version: %d.%d\n", name, major_version, minor_version); driver = vaQueryVendorString(va_dpy); printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>"); + + printf("%s: Supported profile and entrypoints\n", name); + for (profile = VAProfileMPEG2Simple; profile <= VAProfileH263Baseline; profile++) { + char *profile_str; + + va_status = vaQueryConfigEntrypoints(va_dpy, profile, entrypoints, + &num_entrypoint); + CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints", 4); + + profile_str = profile_string(profile); + for (entrypoint = 0; entrypoint < num_entrypoint; entrypoint++) + printf(" %32s:%s\n", profile_str, entrypoint_string(entrypoints[entrypoint])); + } + vaTerminate(va_dpy); + return 0; } |