summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-03-03 10:11:58 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-03-03 10:16:09 +0100
commit0b71390aac4b0b7971d5c279a87005e4c33d1b45 (patch)
tree882f5020551933673cac0feb968e4344372d5e97 /test
parent4f2686b7969078f76eaa535872013a0934c2f096 (diff)
downloadlibva-0b71390aac4b0b7971d5c279a87005e4c33d1b45.tar.gz
va: drop VAEntrypointMax enumeration.
This is an oversight, and that was supposed to be removed earlier. User applications cannot rely on this value to statically allocate an array of possible VA entrypoints. The correct interface is to use vaMaxNumEntrypoints() and dynamically allocate that array. Rationale: VA entrypoints values are maintained sparsely, so this can yield to a large number overall. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/encode/h264encode.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/encode/h264encode.c b/test/encode/h264encode.c
index 7a110b3..b2030bc 100644
--- a/test/encode/h264encode.c
+++ b/test/encode/h264encode.c
@@ -917,8 +917,8 @@ static int process_cmdline(int argc, char *argv[])
static int init_va(void)
{
VAProfile profile_list[]={VAProfileH264High,VAProfileH264Main,VAProfileH264Baseline,VAProfileH264ConstrainedBaseline};
- VAEntrypoint entrypoints[VAEntrypointMax]={0};
- int num_entrypoints,slice_entrypoint;
+ VAEntrypoint *entrypoints;
+ int num_entrypoints, slice_entrypoint;
int support_encode = 0;
int major_ver, minor_ver;
VAStatus va_status;
@@ -928,6 +928,13 @@ static int init_va(void)
va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
CHECK_VASTATUS(va_status, "vaInitialize");
+ num_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ entrypoints = malloc(num_entrypoints * sizeof(*entrypoints));
+ if (!entrypoints) {
+ fprintf(stderr, "error: failed to initialize VA entrypoints array\n");
+ exit(1);
+ }
+
/* use the highest profile */
for (i = 0; i < sizeof(profile_list)/sizeof(profile_list[0]); i++) {
if ((h264_profile != ~0) && h264_profile != profile_list[i])
@@ -1101,6 +1108,7 @@ static int init_va(void)
printf("Support VAConfigAttribEncMacroblockInfo\n");
}
+ free(entrypoints);
return 0;
}