Morning,
On 12/04/13 01:17, Edison Wang wrote:
> Thanks for taking time to write a detailed reply.
>
> I don't think it will have any of the JJ-prefixed classes but the layout
> should be similar to the layout on jjmpeg-1.0 (it will have the trunk,
> and an Android Library Project that uses it to produce the java bindings
> that can be used, which will simply build the code) but I think the
> build system should definitely better. Isolate ffmpeg into separate .so
> library files when build etc. I am not sure what will end up happen yet.
I guess you would have noticed that I recently added some android
support to the head version. It works by dlopening the raw libraries
directly. I didn't commit the ffmpeg build script yet although it's
just a slight modification to the one in the v1 branch. It mostly 'just
works' but there is a bit of a pain with some detail I can't recall
right now (something configure gets wrong) but that might be due to it
being an older FFmpeg build too. IIRC there is also a pain with the way
android doesn't add the application lib directory to the ld load path
(ffs ...), so one needs to manually open the libraries in the correct
order. What is the point of a lib directory specifically intended for
shared libraries, and then not adding it to the path?
Using the stuff generated isn't too hard with other android projects,
just need to include all the shared libraries in the Android.mk and put
the jar file in libs. I don't know if there is a "shared library" way
to do it on android between separate applications, or if that is even
desirable. An extra 4mb to the download isn't much these days.
> My goal is to make so that there is an easy way for people to build the
> low level code that controls jjmpeg. The high level code will not there
> for LGPL compliance (which is the same reason your samples and
> jjmpeg-1.0, the code in jjmpeg-android and jjmpeg demos are excellent
> examples but GPL-ed).
Ok yeah, makes sense.
The build system is perfect for me as in a couple of seconds I can
rebuild everything for every platform I have compilers for (gnu
x86/amd64, ms x86/amd64, gnu arm 32, android arm 32). I don't consider
any microsoft platform a viable development environment so i'll never
support it other than as a 'legacy target'.
BTW let me say i'm kind of in two minds about your fork - in some way
i'd like to influence it a bit and include stuff back into jjmpeg, but
I'm also considering that i'd rather just let it "go free" and let you
have a go with whatever you want to do and i'll keep working in
isolation as it already does what i need and I have other more
interesting stuff to play with.
> I read your blog on the project that you are working on, it looks very
> promising, and I wish you the best with it. :)
I'm always working on something, ... but I never seem to finish
anything. Once the fun and/or learning bits are out of the way I
usually lose interest (i prefer to be paid to do boring bits!), but it's
a bit early to tell on that one. I'll eventually drop the code at some
point; finished or otherwise. It's at the point (apart from sound) it
needs a lot of fluffy ui work which I tend to find a bit boring and
time-consuming. Or frustrating if it involves fighting with the fancy
and ill-behaving widgets everyone expects.
> As for the community, I'm more or less referring to the devs that just
> want simple ffmpeg with java bindings to use (I found yours to be one of
> the most complete).
Well there's been a good few downloads, just no free software using it
that I know of.
I rambled on a bit here with some history and thoughts on C binding to
Java ...
Many libraries seem to be over-engineered for no apparent reason other
than because they can. I'm also much more fond of pull interfaces
rather than callback/listener ones, since it's much easier to implement
callbacks ontop of that than the other way around, and often it's easier
just writing stuff to use a pull version. FFmpeg already has a mostly
good and usable api (AVDictionary though?), so wrapping it in objects
wasn't that difficult (tracking changes is more of a hassle mind you
particularly since the libav fork, which is why i don't care to very often).
I found xuggle impossible to compile even on GNU let alone a
cross-compile, and the callback interface a bit of a pain to use anyway
although all the kids seem to like that approach. The design based on a
giant hard-to-compile c++ library then wrapped in jni just seemed odd
and sub-optimal. It's memory management is crazily complex too. jjmpeg
pretty much came into existence as I needed a 64-bit microsoft version
of xuggle and really had no other practical option.
The code generator is a bit crap ... but it works and I think the
approach is sound. Leaving the C-specific stuff like address offset
calculations to a C compiler is a lot saner than trying to compile it
separately and then wrap it in Java-side accessors. JNI is simple and
sane enough that it doesn't need wrapping in some 'framework' to be
usable. The problem with frameworks is they only solve the problems
they're designed to solve - every c library has a different
convention/approach to their apis, and all you end up with is some
horrible to use tool that you end up developing and then fighting with
rather than solving the problem at hand. The jjmpeg codegen is bad but
at least it's tailor made and not cluttered with 'general support' that
is not needed.
I think JOCL is great, but it's binding is based on a gigantic compiler
and code generator framework which is a pain to configure and use and
builds very slowly, and despite all that work and effort and code it is
still too tied to the open* api conventions to be able to use it as a
general binding tool. They have figured out the distribution and
deployment angle though.
I've also done some C# native binding previously and although on paper
all that support for native interfacing looks great ... it's actually a
huge pain if you're doing more than a couple of simple functions (funny
that: pretty much any microsoft technology in a nutshell, great for rad
prototyping, but that is all). Once you add structures it becomes a
maintenance headache. You end up needing a custom c to c# compiler and
buggerising around no end. And the mashalling mechanism for structures
is ... poor. This is why I think JNA also sucks - seems like a good
idea but it isn't.
Z