Re: [Libxine-java-devel] Experimental libxine-java port to use JNA
Status: Beta
Brought to you by:
freckle
From: Matthias R. <mri...@in...> - 2008-06-27 09:55:17
|
On 26.06.2008, at 11:03, Aekold Helbrass wrote: > Hi, Matthias!! > > I played a bit with it, and have few improvements: > 1. all video-related parts can be removed, it still works: > stream = XineLib.INSTANCE.xine_stream_new(xine, ao_port, null); ok. > > 2. it's for exiting when stream ends: > while (XineLib.INSTANCE.xine_get_status(stream) == 2) { > try { > Thread.sleep(5); > } catch (Exception e){}; > } > so you need to add method to XineLib: > int xine_get_status(Pointer stream); you're doing a periodic call through JNA every 5 ms which is not efficient. The xine-event handling works: when the stream is finished, you get a callback and there is no busy waiting (which is ALWAYS bad by design). I've provided XineController.playOnce() if you just want to wait until the stream is over. Or you can register a XineEventCallback, which is called whenever something changes, like e.g. the stream ends. > > > and now i have few questions: > 1. there are lots of defined integers in xine.h, did you noticed any > way to map it using JNA or we need to hardcode it? Nope. But a good editor with Block-Editing can help a lot in this. I didn't see anything which would help on JNA page. SWIG does it automatically, though. > 2. there are some problems with my cpp andestanding, like uint32_t > return types. It's something like Java class with definition lower in > code? but i can't find any definitions... ? uint32_t denotes an unsigned integer variable which uses 32 bits. I guess I've mapped it to a Java int which is 32 bits but signed. If the value is above 2^31 ( ca. 2 000 000 000) we will get a wrong value back from the C part. m. > > > On 6/25/08, Matthias Ringwald <mri...@in...> wrote: >> Hi >> >> In the process of evaluating the Java Native Access for libxine- >> java, I've >> created an audio-only port of it. >> It's available in the SVN at >> https://libxine-java.svn.sourceforge.net/svnroot/libxine-java/branches/libxine-java-jna >> >> It needs the jna.jar which can be downloaded into the libs folder >> by: ant >> libs >> >> The MuXine.java example is simliar to the one from libxine-java >> using SWIG >> & JNI. >> >> Only a limited subset of xine is available yet. Be careful! :) >> >> I'm not sure, if using JNA is a viable option in general, but it >> might be >> for some projects. >> >> Matthias >> |