Java wrapper for libuvc
cybercastle / jlibuvc Goto Github PK
View Code? Open in Web Editor NEWJava wrapper for libuvc
License: GNU General Public License v2.0
Java wrapper for libuvc
License: GNU General Public License v2.0
...
IntPointer curPan = new IntPointer();
IntPointer curTilt = new IntPointer();
UVCController.uvc_get_pantilt_abs(devh, curPan, curTilt, UVCController.UVCReqCode.UVC_GET_INFO);
System.out.println(curPan.get(0));
curPan.get(0) always returns null pointer.
UVC_GET_CUR crashes
Not sure what to do about this.
I have the UVC device in AutoExposure, but my attempt to read that state reports 0.
public boolean isAutoExposure(UVCDeviceHandle devH) throws Exception {
ByteBuffer bBuff = ByteBuffer.allocate(1);
int errCode = 0;
UVCController.uvc_get_ae_mode(devH,bBuff,errCode);
byte autoAE = bBuff.get(0);
System.out.println(autoAE);
return (autoAE!=0);
}
any suggestions on how to get this to report correctly? I assume I am misunderstanding how to read the ByteBuffer and convert to boolean.
I tried to build jLibuvc, but encountered:
/home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/jniUVCController.cpp: In function ‘jint Java_cl_cc_jlibuvc_UVCController_uvc_1start_1streaming(JNIEnv*, jclass, jobject, jobject, jobject, jobject, jbyte)’:
/home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/jniUVCController.cpp:3541:99: error: invalid conversion from ‘void (*)(uvc_frame*)’ to ‘void (*)(uvc_frame*, void*)’ [-fpermissive]
int rvalue = uvc_start_streaming(ptr0, ptr1, (ptr2 == NULL ? NULL : ptr2->ptr), ptr3, arg4);
^
In file included from /home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/jniUVCController.cpp:62:0:
/usr/local/include/libuvc/libuvc.h:512:13: error: initializing argument 3 of ‘uvc_error_t uvc_start_streaming(uvc_device_handle_t*, uvc_stream_ctrl_t*, void (*)(uvc_frame*, void*), void*, uint8_t)’ [-fpermissive]
uvc_error_t uvc_start_streaming(
^
Generating /home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/jniUVCController.cpp
Compiling /home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/linux-x86_64/libjniUVCController.so
g++ -I/usr/local/jdk1.7.0_60/include -I/usr/local/jdk1.7.0_60/include/linux /home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/jniUVCController.cpp -luvc -Wl,-rpath,$ORIGIN/ -march=x86-64 -m64 -Wall -O3 -fPIC -shared -s -o /home/bram/project/jLibuvc/target/classes/cl/cc/jlibuvc/linux-x86_64/libjniUVCController.so
to me this looks like UVCFrameCallback does not match
typedef void(uvc_frame_callback_t)(struct uvc_frame *frame, void *user_ptr);
but I'm not familiar with these structures.
attempting to open a non-existing device with ...
System.out.println("Open Device: " + UVCController.uvc_open(dev, devh));
crashes the JRE
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000012a0b88a7, pid=33115, tid=4867
#
# JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libuvc.dylib+0x48a7] uvc_open+0x17
...
is there a way to handle this more gracefully? can i check whether the dev is valid before i blow it up by trying? any workarounds are greatly appreciated.
hi, i am eager to use the following C call
uvc_error_t uvc_get_device_list (uvc_context_t * ctx, uvc_device_t *** list)
via javacpp and I am struggling with the part that returns the list. my initial stab at this one is ...
public static native int uvc_get_device_list(UVCContext ctx, @Cast("uvc_device_t***") list);
but that really was just a first guess. any suggestions on how to make this call work? thanks
the libuvc installation with dylib exists /opt/local/lib/ and works well with my libuvc examples in C. i am trying to get the java wrapper to work in its most simplified form and am running into link error ...
public static void main(String... arg) throws InterruptedException {
System.load("/opt/local/lib/libuvc.dylib");
System.out.println(""We weighed anchor in anger, set sail for revenge ..."");
UVCContext ctx = new UVCController.UVCContext();
int res = UVCController.uvc_init(ctx, null);
}
UVCController.uvc_init() throws ...
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniUVCController in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:550)
at org.bytedeco.javacpp.Loader.load(Loader.java:415)
at org.bytedeco.javacpp.Loader.load(Loader.java:358)
at cl.cc.jlibuvc.UVCController.(UVCController.java:123)
at Load.main(Load.java:22)
any suggestions greatly appreciated ...
Setup: Windows 10, Java 14, libusb and libuvc install, created c:\usr\local for lib and include and placed the includes and libucv.lib. Commented out libjpeg lines. mvn clean package:
Creating library jniUVCController.lib and object jniUVCController.exp
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_zoom_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_stream_ctrl_format_size
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_focus_simple_range
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_focus_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_analog_video_lock_status
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_digital_multiplier_limit
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_start_streaming
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_exposure_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_exposure_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_find_device
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_focus_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_contrast_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_white_balance_temperature_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_any2rgb
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_white_balance_component
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_brightness
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_saturation
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_roll_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_exit
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_hue_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_probe_stream_ctrl
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_hue
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_digital_multiplier_limit
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_white_balance_component_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_digital_multiplier
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_bus_number
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_zoom_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_white_balance_temperature
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_ae_priority
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_device_address
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_saturation
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_ae_mode
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_sharpness
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_analog_video_standard
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_power_line_frequency
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_hue_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_white_balance_component
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_device_descriptor
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_open
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_focus_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_scanning_mode
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_input_select
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_pantilt_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_focus_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_backlight_compensation
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_ref_device
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_digital_window
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_close
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_focus_simple_range
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_ae_priority
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_brightness
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_focus_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_white_balance_temperature_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_unref_device
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_analog_video_lock_status
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_iris_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_backlight_compensation
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_exposure_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_pantilt_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_hue
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_digital_roi
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_iris_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_digital_roi
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_gain
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_roll_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_roll_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_init
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_print_diag
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_gamma
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_contrast_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_iris_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_free_frame
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_free_device_list
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_zoom_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_input_select
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_white_balance_temperature
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_white_balance_component_auto
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_contrast
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_pantilt_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_focus_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_sharpness
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_pantilt_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_gamma
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_stop_streaming
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_exposure_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_allocate_frame
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_device_list
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_power_line_frequency
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_privacy
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_zoom_abs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_format_descs
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_scanning_mode
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_free_device_descriptor
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_gain
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_digital_multiplier
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_privacy
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_roll_rel
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_ae_mode
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_contrast
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_get_digital_window
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_analog_video_standard
jniUVCController.obj : error LNK2001: unresolved external symbol _uvc_set_iris_abs
jniUVCController.dll : fatal error LNK1120: 102 unresolved externals
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.862 s
[INFO] Finished at: 2020-07-09T23:04:44-07:00
[INFO] ------------------------------------------------------------------------
i can get a usb handle for a device handle in libuvc with
libusb_device_handle* uvc_get_libusb_handle (uvc_device_handle_t* devh)
but I don't know how to handle the return part in jLibuvc ... any recommendations for how to get the usb device info? thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.