Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/libva/test/vainfo/vainfo.c

Issue 10375035: Add libva to chromium third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 #ifndef ANDROID
26 #include <va/va_x11.h>
27 #else
28 #include "va/va_android.h"
29 #define Display unsigned int
30 #endif
31
32 #include <stdarg.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include <stdlib.h>
36
37
38 #define CHECK_VASTATUS(va_status,func, ret) \
39 if (va_status != VA_STATUS_SUCCESS) { \
40 fprintf(stderr,"%s failed with error code %d (%s),exit\n",func, va_status, v aErrorStr(va_status)); \
41 exit(ret); \
42 }
43
44 static char * profile_string(VAProfile profile)
45 {
46 switch (profile) {
47 case VAProfileMPEG2Simple: return "VAProfileMPEG2Simple";
48 case VAProfileMPEG2Main: return "VAProfileMPEG2Main";
49 case VAProfileMPEG4Simple: return "VAProfileMPEG4Simple";
50 case VAProfileMPEG4AdvancedSimple: return "VAProfileMPEG4AdvancedSim ple";
51 case VAProfileMPEG4Main: return "VAProfileMPEG4Main";
52 case VAProfileH264Baseline: return "VAProfileH264Baseline";
53 case VAProfileH264Main: return "VAProfileH264Main";
54 case VAProfileH264High: return "VAProfileH264High";
55 case VAProfileVC1Simple: return "VAProfileVC1Simple";
56 case VAProfileVC1Main: return "VAProfileVC1Main";
57 case VAProfileVC1Advanced: return "VAProfileVC1Advanced";
58 case VAProfileH263Baseline: return "VAProfileH263Baseline";
59 case VAProfileH264ConstrainedBaseline: return "VAProfileH264Constrai nedBaseline";
60 case VAProfileJPEGBaseline: return "VAProfileJPEGBaseline";
61 }
62 return "<unknown profile>";
63 }
64
65
66 static char * entrypoint_string(VAEntrypoint entrypoint)
67 {
68 switch (entrypoint) {
69 case VAEntrypointVLD:return "VAEntrypointVLD";
70 case VAEntrypointIZZ:return "VAEntrypointIZZ";
71 case VAEntrypointIDCT:return "VAEntrypointIDCT";
72 case VAEntrypointMoComp:return "VAEntrypointMoComp";
73 case VAEntrypointDeblocking:return "VAEntrypointDeblocking";
74 case VAEntrypointEncSlice:return "VAEntrypointEncSlice";
75 case VAEntrypointEncPicture:return "VAEntrypointEncPicture";
76 }
77 return "<unknown entrypoint>";
78 }
79
80 int main(int argc, const char* argv[])
81 {
82 Display *dpy;
83 VADisplay va_dpy;
84 VAStatus va_status;
85 int major_version, minor_version;
86 const char *driver;
87 const char *display = getenv("DISPLAY");
88 const char *name = strrchr(argv[0], '/');
89 VAProfile profile;
90 VAEntrypoint entrypoint, entrypoints[10];
91 int num_entrypoint;
92
93 if (name)
94 name++;
95 else
96 name = argv[0];
97
98 #ifndef ANDROID
99 dpy = XOpenDisplay(NULL);
100 #else
101 dpy = (Display*)malloc(sizeof(Display));
102 #endif
103 if (NULL == dpy)
104 {
105 fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? d isplay : "");
106 return 1;
107 }
108
109 va_dpy = vaGetDisplay(dpy);
110 if (NULL == va_dpy)
111 {
112 fprintf(stderr, "%s: vaGetDisplay() failed\n", name);
113 return 2;
114 }
115
116 va_status = vaInitialize(va_dpy, &major_version, &minor_version);
117 CHECK_VASTATUS(va_status, "vaInitialize", 3);
118
119 printf("%s: VA-API version: %d.%d (libva %s)\n",
120 name, major_version, minor_version, LIBVA_VERSION_S);
121
122 driver = vaQueryVendorString(va_dpy);
123 printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>");
124
125 printf("%s: Supported profile and entrypoints\n", name);
126 for (profile = VAProfileMPEG2Simple; profile <= VAProfileH264ConstrainedBase line; profile++) {
127 char *profile_str;
128
129 va_status = vaQueryConfigEntrypoints(va_dpy, profile, entrypoints,
130 &num_entrypoint);
131 if (va_status == VA_STATUS_ERROR_UNSUPPORTED_PROFILE)
132 continue;
133
134 CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints", 4);
135
136 profile_str = profile_string(profile);
137 for (entrypoint = 0; entrypoint < num_entrypoint; entrypoint++)
138 printf(" %-32s: %s\n", profile_str, entrypoint_string(entrypoint s[entrypoint]));
139 }
140
141 vaTerminate(va_dpy);
142
143 return 0;
144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698