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 144666 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.
Source file for streaming video calls
NativeCanvas.cpp (text/x-c++src), 5.83 KB, created by
david schuller
on 2007-01-02 19:31:59 UTC
(
hide
)
Description:
Source file for streaming video calls
Filename:
MIME Type:
Creator:
david schuller
Created:
2007-01-02 19:31:59 UTC
Size:
5.83 KB
patch
obsolete
>/* > * Copyright 1999 Sun Microsystems, Inc., > * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. > * All rights reserved. > * > */ > >#include "NativeHeaders.h" >#include <jawt_md.h> >#include <X11/extensions/Xvlib.h> >#include <X11/keysym.h> > >#ifndef XV_UYVY >#define XV_UYVY 0x59565955 >#endif > >/* > * Class: MyCanvas > * Method: paint > * Signature: (Ljava/awt/Graphics;)V > */ > >JNIEXPORT void JNICALL Java_edu_cornell_macchess_nativecom_XWindowsCanvas_paint >(JNIEnv* env, jobject canvas, jobject graphics) >{ > JAWT awt; > JAWT_DrawingSurface* ds; > JAWT_DrawingSurfaceInfo* dsi; > JAWT_X11DrawingSurfaceInfo* dsi_x11; > //jboolean result; > jint lock; > GC gc; > > //short i; > //char testString[] = "^^^ rendered from native code ^^^"; > > /* Get the AWT */ > awt.version = JAWT_VERSION_1_3; > if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { > printf("AWT Not found\n"); > return; > } > > /* Get the drawing surface */ > ds = awt.GetDrawingSurface(env, canvas); > if (ds == NULL) { > printf("NULL drawing surface\n"); > return; > } > > /* Lock the drawing surface */ > lock = ds->Lock(ds); > if((lock & JAWT_LOCK_ERROR) != 0) { > printf("Error locking surface\n"); > awt.FreeDrawingSurface(ds); > return; > } > > /* Get the drawing surface info */ > dsi = ds->GetDrawingSurfaceInfo(ds); > if (dsi == NULL) { > printf("Error getting surface info\n"); > ds->Unlock(ds); > awt.FreeDrawingSurface(ds); > return; > } > > /* Get the platform-specific drawing info */ > dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo; > > > /* Get the object's current buffer */ > jclass cls = (env)->GetObjectClass(canvas); > jfieldID fid = (env)->GetFieldID(cls, "buffer", "[B"); > jbyteArray barr = (jbyteArray)((env)->GetObjectField(canvas, fid)); > jboolean isCopy; > jbyte *buf = (jbyte*)((env)->GetPrimitiveArrayCritical(barr, &isCopy)); > > > // Testing to see whether Java is not giving direct memory access > // if(isCopy) > // fprintf(stderr, "java is making copies of the memory buffer: %d\n", (int)isCopy); > //else fprintf(stderr, "Java is not making copies, we have direct access"); > > /* Now paint */ > > unsigned int num_adaptors; > XvAdaptorInfo *info; > XvQueryAdaptors(dsi_x11->display, DefaultRootWindow(dsi_x11->display), &num_adaptors, &info); > gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0); > XvImage *xv_image=XvCreateImage(dsi_x11->display,info[0].base_id, XV_UYVY, (char*)buf, 1024, 768); > if(xv_image == NULL) > { > jclass newExcCls = env->FindClass("edu/cornell/macchess/nativecom/NativeException"); > if (newExcCls == 0) // Unable to find the new exception class, give up. > return; > env->ThrowNew(newExcCls, "xvCreateImage Failed! (Returned Null)"); > return; > } > XvPutImage(dsi_x11->display, info[0].base_id, dsi_x11->drawable, gc, xv_image, > 0,0,1024,768, > 0,0,1024,768); > > /* > * figure out how big the canvas is on-screen > * UPDATE: We can't resize the canvas this easily, because > * it requires resizing all drawn objects, such as crosshairs, etc > * > * jclass cls = env->GetObjectClass(jobj); > * jfieldID fid = env->GetFieldID(cls, "keyFrame", "I"); > * int keyFrame = env -> GetIntField(jobj, fid); > * env->SetIntField(jobj, fid, -1); > */ > > > (env) -> ReleasePrimitiveArrayCritical(barr, buf, 0); > > /* > > XSetBackground(dsi_x11->display, gc, 0); > for (i=0; i<36;i++) > { > XSetForeground(dsi_x11->display, gc, 10*i); > XFillRectangle(dsi_x11->display, dsi_x11->drawable, gc, > 10*i, 5, 90, 90); > } > XSetForeground(dsi_x11->display, gc, 155); > testString[1] = (char)((++p)%256); > XDrawImageString(dsi_x11->display, dsi_x11->drawable, gc, > 100, 110, testString, strlen(testString)); > > */ > > /* Free the adaptor info */ > XvFreeAdaptorInfo(info); > > /* Free the graphics context */ > XFreeGC(dsi_x11->display, gc); > > > /* Free the drawing surface info */ > ds->FreeDrawingSurfaceInfo(dsi); > > /* Unlock the drawing surface */ > ds->Unlock(ds); > > /* Free the drawing surface */ > awt.FreeDrawingSurface(ds); >} > >/* > * Class: edu_cornell_macchess_nativecom_XWindowsCanvas > * Method: refresh > * Signature: ()V > * Description: > * Here we unfortunately have to hack together a refresh. > * This is how it works - since the window "fixes itself" anytime it > * it is covered by something and then uncovered, I decided to do just that - > * xrefresh is a program that maps an invisible xwindow to the screen, and then > * immediately unmaps it. I yanked and simplified a bit of code from it. It tells > * the windowing system to draw a small 1 pixel window in the center of the > * screen, and when it unmaps, voila we have a forced refresh.... > * > * UPDATE: code changed to take a coordinate parameter due to dual monitor setup > * --Ismail Degani, March 24th, 2005 > */ >JNIEXPORT void JNICALL Java_edu_cornell_macchess_nativecom_XWindowsCanvas_refresh > (JNIEnv *, jobject, jint x, jint y) >{ > Visual visual; > XSetWindowAttributes xswa; > Display *dpy; > unsigned long mask = 0; > int screen; > Window win; > if ((dpy = XOpenDisplay(NULL)) == NULL) { > fprintf (stderr, "unable to open display\n"); > return; > } > screen = DefaultScreen (dpy); > //xswa.background_pixmap = ParentRelative; > //mask |= CWBackPixmap; > xswa.override_redirect = True; > xswa.backing_store = NotUseful; > xswa.save_under = False; > mask |= (CWOverrideRedirect | CWBackingStore | CWSaveUnder); > visual.visualid = CopyFromParent; > win = XCreateWindow(dpy, DefaultRootWindow(dpy), x, y, 1, 1, > 0, DefaultDepth(dpy, screen), InputOutput, &visual, mask, &xswa); > XMapWindow (dpy, win); > /* the following will free the color that we might have allocateded */ > XCloseDisplay (dpy); >} >
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