summaryrefslogtreecommitdiff
path: root/app/xvinfo/xvinfo.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-10-24 15:27:09 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-10-24 15:27:09 +0000
commit5954421ac06cae78f77ea73b07ba9fd01b16af6d (patch)
tree2489e0b4ea65d99dfbaae53e5ab480c4279b11c1 /app/xvinfo/xvinfo.c
parent8e3ef613b18f5994bd0394841c50cda0371fd236 (diff)
Update to xvinfo 1.1.0
Diffstat (limited to 'app/xvinfo/xvinfo.c')
-rw-r--r--app/xvinfo/xvinfo.c100
1 files changed, 61 insertions, 39 deletions
diff --git a/app/xvinfo/xvinfo.c b/app/xvinfo/xvinfo.c
index e9a4c3608..ea3b662f5 100644
--- a/app/xvinfo/xvinfo.c
+++ b/app/xvinfo/xvinfo.c
@@ -11,7 +11,7 @@
static void
PrintUsage(void)
{
- fprintf(stderr, "Usage: xvinfo [-display host:dpy]\n");
+ fprintf(stderr, "Usage: xvinfo [-display host:dpy] [-short]\n");
exit(0);
}
@@ -28,14 +28,22 @@ int main(int argc, char *argv[])
XvFormat *format;
XvImageFormatValues *formats;
char * disname = NULL;
+ char shortmode = 0;
- if((argc != 1) && (argc != 3))
+ if((argc > 4))
PrintUsage();
if(argc != 1) {
- if(strcmp(argv[1], "-display"))
- PrintUsage();
- disname = argv[2];
+ for ( i = 1; i < argc; i ++ ) {
+ if(! strcmp(argv[i], "-display")) {
+ disname = argv[i + 1];
+ i ++;
+ } else if(! strcmp(argv[i], "-short") )
+ shortmode = 1;
+ else {
+ PrintUsage();
+ }
+ }
}
@@ -96,10 +104,12 @@ int main(int argc, char *argv[])
format = ainfo[j].formats;
- fprintf(stdout, " supported visuals:\n");
- for(k = 0; k < ainfo[j].num_formats; k++, format++) {
- fprintf(stdout, " depth %i, visualID 0x%2lx\n",
+ if ( ! shortmode ) {
+ fprintf(stdout, " supported visuals:\n");
+ for(k = 0; k < ainfo[j].num_formats; k++, format++) {
+ fprintf(stdout, " depth %i, visualID 0x%2lx\n",
format->depth, format->visual_id);
+ }
}
attributes = XvQueryPortAttributes(dpy, ainfo[j].base_id, &nattr);
@@ -114,13 +124,18 @@ int main(int argc, char *argv[])
attributes[k].max_value);
if(attributes[k].flags & XvSettable)
- fprintf(stdout, " client settable attribute\n");
+ if ( ! shortmode )
+ fprintf(stdout, " client settable attribute\n");
+ else fprintf(stdout, " settable");
if(attributes[k].flags & XvGettable) {
Atom the_atom;
int value;
+
+ if ( ! shortmode )
+ fprintf(stdout, " client gettable attribute");
+ else fprintf(stdout, ", gettable");
- fprintf(stdout, " client gettable attribute");
the_atom = XInternAtom(dpy, attributes[k].name, True);
if(the_atom != None){
@@ -128,8 +143,10 @@ int main(int argc, char *argv[])
ainfo[j].base_id, the_atom, &value)))
fprintf(stdout, " (current value is %i)", value);
}
- fprintf(stdout, "\n");
+ fprintf(stdout, "\n");
}
+ else if (shortmode)
+ fprintf(stdout, "\n");
}
XFree(attributes);
@@ -168,7 +185,7 @@ int main(int argc, char *argv[])
}
if(ImageEncodings && (ainfo[j].type & XvImageMask)) {
- char imageName[5] = {0, 0, 0, 0, 0};
+ char imageName[5];
for(n = 0; n < nencode; n++) {
if(!strcmp(encodings[n].name, "XV_IMAGE")) {
@@ -186,7 +203,10 @@ int main(int argc, char *argv[])
numImages);
for(n = 0; n < numImages; n++) {
- memcpy(imageName, &(formats[n].id), 4);
+ sprintf(imageName, "%c%c%c%c", formats[n].id & 0xff,
+ (formats[n].id >> 8) & 0xff,
+ (formats[n].id >> 16) & 0xff,
+ (formats[n].id >> 24) & 0xff);
fprintf(stdout, " id: 0x%x", formats[n].id);
if(isprint(imageName[0]) && isprint(imageName[1]) &&
isprint(imageName[2]) && isprint(imageName[3]))
@@ -195,59 +215,61 @@ int main(int argc, char *argv[])
} else {
fprintf(stdout, "\n");
}
- fprintf(stdout, " guid: ");
- fprintf(stdout, "%02x", (unsigned char)
+ if ( ! shortmode ) {
+ fprintf(stdout, " guid: ");
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[0]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[1]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[2]);
- fprintf(stdout, "%02x-", (unsigned char)
+ fprintf(stdout, "%02x-", (unsigned char)
formats[n].guid[3]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[4]);
- fprintf(stdout, "%02x-", (unsigned char)
+ fprintf(stdout, "%02x-", (unsigned char)
formats[n].guid[5]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[6]);
- fprintf(stdout, "%02x-", (unsigned char)
+ fprintf(stdout, "%02x-", (unsigned char)
formats[n].guid[7]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[8]);
- fprintf(stdout, "%02x-", (unsigned char)
+ fprintf(stdout, "%02x-", (unsigned char)
formats[n].guid[9]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[10]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[11]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[12]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[13]);
- fprintf(stdout, "%02x", (unsigned char)
+ fprintf(stdout, "%02x", (unsigned char)
formats[n].guid[14]);
- fprintf(stdout, "%02x\n", (unsigned char)
+ fprintf(stdout, "%02x\n", (unsigned char)
formats[n].guid[15]);
- fprintf(stdout, " bits per pixel: %i\n",
+ fprintf(stdout, " bits per pixel: %i\n",
formats[n].bits_per_pixel);
- fprintf(stdout, " number of planes: %i\n",
+ fprintf(stdout, " number of planes: %i\n",
formats[n].num_planes);
- fprintf(stdout, " type: %s (%s)\n",
- (formats[n].type == XvRGB) ? "RGB" : "YUV",
- (formats[n].format == XvPacked) ? "packed" : "planar");
+ fprintf(stdout, " type: %s (%s)\n",
+ (formats[n].type == XvRGB) ? "RGB" : "YUV",
+ (formats[n].format == XvPacked) ? "packed" : "planar");
- if(formats[n].type == XvRGB) {
- fprintf(stdout, " depth: %i\n",
+ if(formats[n].type == XvRGB) {
+ fprintf(stdout, " depth: %i\n",
formats[n].depth);
- fprintf(stdout, " red, green, blue masks: "
+ fprintf(stdout, " red, green, blue masks: "
"0x%x, 0x%x, 0x%x\n",
formats[n].red_mask,
formats[n].green_mask,
formats[n].blue_mask);
- } else {
+ } else {
+ }
}