Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 145944 Details for
Bug 206525
Recently introduced bug affects display of Java streaming video
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
gcc -o testxv_yuv testxv_yuv.c -m32 -L/usr/lib -lX11 -lXext -lXv
testxv_yuv.c (text/x-csrc), 11.59 KB, created by
david schuller
on 2007-01-18 21:37:05 UTC
(
hide
)
Description:
gcc -o testxv_yuv testxv_yuv.c -m32 -L/usr/lib -lX11 -lXext -lXv
Filename:
MIME Type:
Creator:
david schuller
Created:
2007-01-18 21:37:05 UTC
Size:
11.59 KB
patch
obsolete
>/* ------------------------------------------- > * --- XV Testcode --- > * --- by AW ---*/ > > >#include <stdlib.h> >#include <stdio.h> >#include <unistd.h> >#include <string.h> >#include <time.h> >#include <sys/ipc.h> >#include <sys/shm.h> >#include <X11/Xlib.h> >#include <X11/Xutil.h> >#include <X11/Xatom.h> >#include <X11/extensions/Xv.h> >#include <X11/extensions/Xvlib.h> >#include <X11/extensions/XShm.h> > >#define XV_BLNK 0x0 >#define XV_I420 0x30323449 >#define XV_YV12 0x32315659 >#define XV_RGB2 0x32424752 >#define XV_YUY2 0x32595559 >#define XV_RGBA 0x41424752 >#define XV_RGBT 0x54424752 >#define XV_UYVY 0x59565955 > >/* > image format list for port 73 (Radeon 7000) > 0x0 ( ) packed > 0x30323449 (I420) planar > 0x32315659 (YV12) planar > 0x32424752 (RGB2) packed > 0x32595559 (YUY2) packed > 0x41424752 (RGBA) packed > 0x54424752 (RGBT) packed > 0x59565955 (UYVY) packed > > image format list for port 73 (Intel 945GM) > 0x30323449 (I420) planar > 0x32315659 (YV12) planar > 0x32595559 (YUY2) packed > 0x59565955 (UYVY) packed >*/ > > >extern int XShmQueryExtension(Display*); >extern int XShmGetEventBase(Display*); >extern XvImage *XvShmCreateImage(Display*, XvPortID, int, char*, int, int, XShmSegmentInfo*); > >int main (int argc, char* argv[]) { > int yuv_width = 1024; > int yuv_height = 768; > int image_format = XV_UYVY; > > int xv_port = -1; > int adaptor, attributes, formats; > unsigned int encodings; > int i, j, k, ret, p; > int _x, _y; > unsigned int _d, _w, _bw, _h; > long secsb, secsa, frames; > > XvAdaptorInfo *ai; > XvEncodingInfo *ei; > XvAttribute *at; > XvImageFormatValues *fo; > > XvImage *yuv_image; > > > unsigned int p_version, p_release, > p_request_base, p_event_base, p_error_base; > unsigned int p_num_adaptors; > > Display *dpy; > Window window, _dw; > XSizeHints hint; > XSetWindowAttributes xswa; > XVisualInfo vinfo; > int screen; > unsigned long mask; > XEvent event; > GC gc; > > /** for shm */ > int shmem_flag = 0; > XShmSegmentInfo yuv_shminfo; > int CompletionType; > > > printf("testxv_yuv RGBA | RGBT | RGB2 | YUY2 | UYVY | YV12 | I420\n"); > if (argc < 2) { > return -1; > } > printf("starting up video testapp...\n\n"); > > > adaptor = -1; > > dpy = XOpenDisplay(NULL); > if (dpy == NULL) { > printf("Cannot open Display.\n"); > exit (-1); > } > > screen = DefaultScreen(dpy); > > /** find best display */ > if (XMatchVisualInfo(dpy, screen, 24, TrueColor, &vinfo)) { > printf(" found 24bit TrueColor\n"); > } else > if (XMatchVisualInfo(dpy, screen, 16, TrueColor, &vinfo)) { > printf(" found 16bit TrueColor\n"); > } else > if (XMatchVisualInfo(dpy, screen, 15, TrueColor, &vinfo)) { > printf(" found 15bit TrueColor\n"); > } else > if (XMatchVisualInfo(dpy, screen, 8, PseudoColor, &vinfo)) { > printf(" found 8bit PseudoColor\n"); > } else > if (XMatchVisualInfo(dpy, screen, 8, GrayScale, &vinfo)) { > printf(" found 8bit GrayScale\n"); > } else > if (XMatchVisualInfo(dpy, screen, 8, StaticGray, &vinfo)) { > printf(" found 8bit StaticGray\n"); > } else > if (XMatchVisualInfo(dpy, screen, 1, StaticGray, &vinfo)) { > printf(" found 1bit StaticGray\n"); > } else { > printf("requires 16 bit display\n"); > exit (-1); > } > > CompletionType = -1; > > hint.x = 1; > hint.y = 1; > hint.width = yuv_width; > hint.height = yuv_height; > hint.flags = PPosition | PSize; > > xswa.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), vinfo.visual, AllocNone); > xswa.event_mask = StructureNotifyMask | ExposureMask; > xswa.background_pixel = 0; > xswa.border_pixel = 0; > > mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; > > window = XCreateWindow(dpy, DefaultRootWindow(dpy), > 0, 0, > yuv_width, > yuv_height, > 0, vinfo.depth, > InputOutput, > vinfo.visual, > mask, &xswa); > > XStoreName(dpy, window, "firstxv"); > XSetIconName(dpy, window, "firstxv"); > > XSelectInput(dpy, window, StructureNotifyMask); > > /** Map window */ > XMapWindow(dpy, window); > > /** Wait for map. */ > do { > XNextEvent(dpy, &event); > } > while (event.type != MapNotify || event.xmap.event != window); > > if (XShmQueryExtension(dpy)) shmem_flag = 1; > if (!shmem_flag) { > printf("no shmem available.\n"); > exit (-1); > } > > if (shmem_flag==1) CompletionType = XShmGetEventBase(dpy) + ShmCompletion; > > > /**--------------------------------- XV ------------------------------------*/ >// printf("beginning to parse the Xvideo extension...\n\n"); > > /** query and print Xvideo properties */ > ret = XvQueryExtension(dpy, &p_version, &p_release, &p_request_base, > &p_event_base, &p_error_base); > if (ret != Success) { > if (ret == XvBadExtension) > printf("XvBadExtension returned at XvQueryExtension.\n"); > else > if (ret == XvBadAlloc) > printf("XvBadAlloc returned at XvQueryExtension.\n"); > else > printf("other error happened at XvQueryExtension.\n"); > } >// printf("========================================\n"); >// printf("XvQueryExtension returned the following:\n"); >// printf("p_version : %u\n", p_version); >// printf("p_release : %u\n", p_release); >// printf("p_request_base : %u\n", p_request_base); >// printf("p_event_base : %u\n", p_event_base); >// printf("p_error_base : %u\n", p_error_base); >// printf("========================================\n"); > > ret = XvQueryAdaptors(dpy, DefaultRootWindow(dpy), > &p_num_adaptors, &ai); > > if (ret != Success) { > if (ret == XvBadExtension) > printf("XvBadExtension returned at XvQueryExtension.\n"); > else > if (ret == XvBadAlloc) > printf("XvBadAlloc returned at XvQueryExtension.\n"); > else > printf("other error happaned at XvQueryAdaptors.\n"); > } > printf("=======================================\n"); >// printf("XvQueryAdaptors returned the following:\n"); > printf("%d adaptors available.\n", p_num_adaptors); > for (i = 0; i < p_num_adaptors; i++) { > printf(" name: %s\n" > " type: %s%s%s%s%s\n" > " ports: %ld\n" > " first port: %ld\n", > ai[i].name, > (ai[i].type & XvInputMask) ? "input | " : "", > (ai[i].type & XvOutputMask) ? "output | " : "", > (ai[i].type & XvVideoMask) ? "video | " : "", > (ai[i].type & XvStillMask) ? "still | " : "", > (ai[i].type & XvImageMask) ? "image | " : "", > ai[i].num_ports, > ai[i].base_id); > xv_port = ai[i].base_id; > >// printf("adaptor %d ; format list:\n", i); >// for (j = 0; j < ai[i].num_formats; j++) { >// printf(" depth=%d, visual=%ld\n", >// ai[i].formats[j].depth, >// ai[i].formats[j].visual_id); >// } > for (p = ai[i].base_id; p < ai[i].base_id+ai[i].num_ports; p++) { > >// printf(" encoding list for port %d\n", p); > if (XvQueryEncodings(dpy, p, &encodings, &ei) != Success) { > printf("XvQueryEncodings failed.\n"); > continue; > } >// for (j = 0; j < encodings; j++) { >// printf(" id=%ld, name=%s, size=%ldx%ld, numerator=%d, denominator=%d\n", >// ei[j].encoding_id, ei[j].name, ei[j].width, ei[j].height, >// ei[j].rate.numerator, ei[j].rate.denominator); >// } > XvFreeEncodingInfo(ei); > >// printf(" attribute list for port %d\n", p); >// at = XvQueryPortAttributes(dpy, p, &attributes); >// for (j = 0; j < attributes; j++) { >// printf(" name: %s\n" >// " flags: %s%s\n" >// " min_color: %i\n" >// " max_color: %i\n", >// at[j].name, >// (at[j].flags & XvGettable) ? " get" : "", >// (at[j].flags & XvSettable) ? " set" : "", >// at[j].min_value, at[j].max_value); >// } >// if (at) >// XFree(at); > > printf(" image format list for port %d\n", p); > fo = XvListImageFormats(dpy, p, &formats); > for (j = 0; j < formats; j++) { > printf(" 0x%x (%4.4s) %s\n", > fo[j].id, > (char *)&fo[j].id, > (fo[j].format == XvPacked) ? "packed" : "planar"); > } > if (fo) > XFree(fo); > } > printf("\n"); > } > if (p_num_adaptors > 0) > XvFreeAdaptorInfo(ai); > if (xv_port == -1) > exit (0); > > gc = XCreateGC(dpy, window, 0, 0); > > > /* DJMS decide image format type */ >// printf("argc is %d\n", argc); > printf(argv[1]); > printf("\n"); > if (strncmp(argv[1], "BLNK", 4) == 0) { > printf("Image format will be BLNK\n"); > image_format = XV_BLNK; > } else > if (strncmp(argv[1], "I420", 4) == 0) { > printf("Image format will be I420\n"); > image_format = XV_I420; > } else > if (strncmp(argv[1], "YV12", 4) == 0) { > printf("Image format will be YV12\n"); > image_format = XV_YV12; > } else > if (strncmp(argv[1], "RGB2", 4) == 0) { > printf("Image format will be RGB2\n"); > image_format = XV_RGB2; > } else > if (strncmp(argv[1], "YUY2", 4) == 0) { > printf("Image format will be YUY2\n"); > image_format = XV_YUY2; > } else > if (strncmp(argv[1], "RGBA", 4) == 0) { > printf("Image format will be RGBA\n"); > image_format = XV_RGBA; > } else > if (strncmp(argv[1], "RGBT", 4) == 0) { > printf("Image format will be RGBT\n"); > image_format = XV_RGBT; > } else { > printf("Image format will be UYVY\n"); > image_format = XV_UYVY; > } > > yuv_image = XvShmCreateImage(dpy, xv_port, image_format, 0, yuv_width, yuv_height, &yuv_shminfo); > yuv_shminfo.shmid = shmget(IPC_PRIVATE, yuv_image->data_size, IPC_CREAT | 0777); > yuv_shminfo.shmaddr = yuv_image->data = shmat(yuv_shminfo.shmid, 0, 0); > yuv_shminfo.readOnly = False; ># > > if (!XShmAttach(dpy, &yuv_shminfo)) { > printf("XShmAttach failed !\n"); > exit (-1); > } > >/* > for (i = 0; i < (yuv_image->data_size)/4; i++) { > yuv_image->data[i] = i; > } > for (i = (yuv_image->data_size)/4; i < (yuv_image->data_size)/2; i++) { > yuv_image->data[i] = i; > yuv_image->data[i+1] = yuv_image->data_size - i; > i++; > } > for (i = (yuv_image->data_size)/2; i < ((yuv_image->data_size)*3)/4; i++) { > yuv_image->data[i] = i; > yuv_image->data[i+1] = yuv_image->data_size + 128 + i; > i++; > } > for (i = ((yuv_image->data_size)*3)/4; i < yuv_image->data_size; i++) { > yuv_image->data[i] = i; > yuv_image->data[i+1] = (yuv_image->data_size +64) - i; > i++; > } >*/ > > for (i = 0; i < (yuv_image->data_size)/4; i++) { > yuv_image->data[i] = i; > } > for (i = (yuv_image->data_size)/4; i < (yuv_image->data_size)/2; i++) { > yuv_image->data[i] = i; > yuv_image->data[i+1] = i; > yuv_image->data[i+2] = i+128; > yuv_image->data[i+3] = i; > i++; > i++; > i++; > } > for (i = (yuv_image->data_size)/2; i < ((yuv_image->data_size)*3)/4; i++) { > yuv_image->data[i] = 128 + i; > yuv_image->data[i+1] = i; > yuv_image->data[i+2] = 128 + i; > yuv_image->data[i+3] = i; > i++; > i++; > i++; > } > for (i = ((yuv_image->data_size)*3)/4; i < yuv_image->data_size; i++) { > yuv_image->data[i] = 128+ i; > yuv_image->data[i+1] = i; > yuv_image->data[i+2] = i; > yuv_image->data[i+3] = 128 + i; > i++; > i++; > i++; > } > > printf("data array size is %d bytes\n", yuv_image->data_size); > printf("number of pixels %d\n", yuv_width * yuv_height); > > while (1) { > frames = secsa = secsb = 0; > time(&secsa); > while (frames < 255) { > XGetGeometry(dpy, window, &_dw, &_x, &_y, &_w, &_h, &_bw, &_d); > > XvShmPutImage(dpy, xv_port, window, gc, yuv_image, > 0, 0, yuv_image->width, yuv_image->height, > 0, 0, _w, _h, True); > usleep(20000); > >// for (i = 0; i < yuv_image->height; i++) { >// for (j = 0; j < yuv_image->width; j++) { >// yuv_image->data[yuv_image->width*i + j] = 8*(i*j)+frames; >// } >// } > > frames++; > } > time(&secsb); > printf("%ld frames in %ld seconds; %.4f fps\n", frames, secsb-secsa, (double) frames/(secsb-secsa)); > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 206525
:
144662
|
144663
|
144664
|
144665
|
144666
|
145420
|
145421
|
145483
| 145944