[Libva] [PATCH] vainfo: Query supported profiles before entrypoints
Xiang, Haihao
haihao.xiang at intel.com
Sun Jan 23 17:42:12 PST 2011
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
test/vainfo/vainfo.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/test/vainfo/vainfo.c b/test/vainfo/vainfo.c
index 96b7142..20e80a1 100644
--- a/test/vainfo/vainfo.c
+++ b/test/vainfo/vainfo.c
@@ -38,6 +38,7 @@
#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, va_status, vaErrorStr(va_status)); \
+ free(profile_list); \
exit(ret); \
}
@@ -87,7 +88,9 @@ int main(int argc, const char* argv[])
VAProfile profile;
VAEntrypoint entrypoint, entrypoints[10];
int num_entrypoint;
-
+ int num_max_profiles, num_profiles, i;
+ VAProfile *profile_list = NULL;
+
if (name)
name++;
else
@@ -119,22 +122,35 @@ int main(int argc, const char* argv[])
driver = vaQueryVendorString(va_dpy);
printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>");
+ num_max_profiles = vaMaxNumProfiles(va_dpy);
+ profile_list = calloc(num_max_profiles, sizeof(*profile_list));
+
+ if (NULL == profile_list) {
+ fprintf(stderr, "%s: Can't allocate free space for profile list\n");
+ return 4;
+ }
+
+ va_status = vaQueryConfigProfiles(va_dpy, profile_list, &num_profiles);
+ CHECK_VASTATUS(va_status, "vaQueryConfigProfiles", 5);
+
printf("%s: Supported profile and entrypoints\n", name);
- for (profile = VAProfileMPEG2Simple; profile <= VAProfileH263Baseline; profile++) {
+ for (i = 0; i < num_profiles; i++) {
char *profile_str;
-
+
+ profile = profile_list[i];
va_status = vaQueryConfigEntrypoints(va_dpy, profile, entrypoints,
&num_entrypoint);
if (va_status == VA_STATUS_ERROR_UNSUPPORTED_PROFILE)
continue;
- CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints", 4);
+ CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints", 6);
profile_str = profile_string(profile);
for (entrypoint = 0; entrypoint < num_entrypoint; entrypoint++)
printf(" %-32s: %s\n", profile_str, entrypoint_string(entrypoints[entrypoint]));
}
+ free(profile_list);
vaTerminate(va_dpy);
return 0;
--
1.7.0.4
More information about the Libva
mailing list