queryBitmapInfo in Java API returns no image address
Posted: 28. Jun 2018, 23:29
I'm developing a Java frontend for VirtualBox machines and I managed to set it up to launch the machine inside the process and attach my framebuffer to it. It's receiving changes and updates, queryBitmapInfo returns all information correctly, except for the address out parameter.
The array I'm using to hold the value is large enough for the whole screen but all of the values in the array remain 0, even after the machine has booted up and is running the guest OS. VirtualBox also seems to freeze for longer periods while the machine is running inside my application.
(I'm also running my app as root as I was unable to set the setuid bit up correctly, but running VBox as root doesn't have any issues, so I don't think it's related.)
How can I receive images from the machine in Java?
VirtualBox version: 5.2.12 r122591 (Qt5.9.5)
VBox API: Java XPCOM 5.2
OS: Ubuntu 18.04 x64, Java 8
My code in notifyChange:
Edit: Posted to the dev mailing list: https://www.virtualbox.org/pipermail/vb ... 15041.html
Update: Found how to solve this issue
The array I'm using to hold the value is large enough for the whole screen but all of the values in the array remain 0, even after the machine has booted up and is running the guest OS. VirtualBox also seems to freeze for longer periods while the machine is running inside my application.
(I'm also running my app as root as I was unable to set the setuid bit up correctly, but running VBox as root doesn't have any issues, so I don't think it's related.)
How can I receive images from the machine in Java?
VirtualBox version: 5.2.12 r122591 (Qt5.9.5)
VBox API: Java XPCOM 5.2
OS: Ubuntu 18.04 x64, Java 8
My code in notifyChange:
Code: Select all
display.querySourceBitmap(0L, holder);
byte[] arr = bb.array(); //640 * 480 * 4 bytes backing a ByteBuffer
long[] w = new long[1], h = new long[1], bpp = new long[1], bpl = new long[1], pf = new long[1];
holder.value.getTypedWrapped().queryBitmapInfo(arr, w, h, bpp, bpl, pf);
System.out.println("Arr0:" + arr[0]);
System.out.println("whbppbplpf: " + w[0] + " " + h[0] + " " + bpp[0] + " " + bpl[0] + " " + pf[0]);
Update: Found how to solve this issue