Re: Two patches for jjmpeg

85 views
Skip to first unread message

Michael Zucchi

unread,
Feb 10, 2012, 2:07:53 AM2/10/12
to Giulio Bernardi, jjmpeg-...@googlegroups.com
Hi Giulio,

I just thought i'd let you know that I finally got around to looking at
this. I've used a bit of your patch but mostly rolled my own based on a
makefile design I used in another project. I just want to type 'make'
and have it work, not add very long command line arguments that would
just require a script to execute for different targets. I did put the
macos stuff in but I have no way of testing that. I also left some of
the target-specific config in the target-specific makefiles; but you
have to put it somewhere.

Although i changed the dlopen order, I decided not to include the
library path stuff: java already has a library path mechanism, and so
does every operating system which supports dynamic libraries. I'm not
sure what you're trying to achieve, a user fiddling with
ffmpeg.library.path is just as likely to change the library as changing
LD_LIBRARY_PATH is, and besides, even an LGPL project requires the
ability to change the LGPL part of the project, e.g. by changing the .so
file, or the java class files.

OTOH I doubt that stuff is likely to change any time soon so you
shouldn't have trouble maintaining your own patch for that if you really
must.

If you decide to keep your own variation of the build system, i'd still
appreciate if you can (at some point) check the included darwin and
win-i386 targets are ok as I don't have the setup for those.

Regards,
Michael


On 11/01/12 13:02, Giulio Bernardi wrote:
> Hello NotZed,
>
> Thank you for jjmpeg. I'm trying to use it in a project and I made some
> changes, and was wondering whether you might be interested in these two
> patches.
>
> My main goal is to have a media player-like component in a closed source
> software. For this reason I need to compile ffmpeg libs without the GPL
> and nonfree parts, ship the libraries with the software and ensure that
> those libraries get loaded, and not the ones from the installed system.
>
> Moreover, the systems I need to support are Linux, Windows and Mac OS X
> (all of them on i686 and x86_64).
>
> The first patch (libprefix.diff) adds support for a "ffmpeg.library.path"
> java property, which specifies the path of the native libraries.
> If it is defined, AVNative tries to load jjmpeg lib from that path, and
> passes the path to initNative() native function.
> init_local() uses that path for DLOPEN(), so that ffmpeg libraries are
> loaded from there.
> Please note that if ffmpeg.library.path isn't defined, the behaviour is
> exactly the same as before.
> I had to change the order of loaded libraries: first avutil, then
> avcodec;
> the reason is that avcodec depends on avutil so if avcodec is loaded
> first,
> the dynamic loader would load the system-default libavutil.so instead of
> the one in the supplied directory.
> This patch is to be applied from the jjmpeg directory, with "patch -p0"
>
> The second patch (macwin32.diff) adds support for Windows (32 bit) and
> Mac OS X (32 and 64 bit). I made some changes to the makefiles to try
> to reduce the need of hardcoded paths.
> I added the jni/darwin headers, and modified jjmpeg-jni.h to take into
> account the different extension (.dylib) of mac libraries.
> About the makefiles:
> I removed hardcoded prefixes for the cross-toolchain, using variables
> instead. This way, I use this settings to compile all jjmpeg native
> libraries, with the host being Linux-x86_64:
>
> LINUX_X86_64_PREFIX=
> LINUX_i686_PREFIX=
> WIN_i686_PREFIX=i686-pc-mingw32-
> WIN_x86_64_PREFIX=x86_64-w64-mingw32-
> DARWIN_x86_64_PREFIX=x86_64-apple-darwin9-
> DARWIN_i686_PREFIX=i686-apple-darwin9-
>
> I made all Makefiles use FFMPEG_HOME, even on linux: since I need to
> ship custom-built ffmpeg libraries I need to point to "include" dir of
> my just compiled ffmpeg, not to /usr/include/ffmpeg. However, if no
> FFMPEG_HOME is defined, /usr/include/ffmpeg is the default.
> Another couple of words about FFMPEG_HOME: my ffmpeg build directory
> contains a subdirectory per target (linux-i686, linux-x86_64 and so on),
> each containing its headers in usr/include. So, if FFMPEG_HOME is not
> defined, but FFMPEG_BASE is, Makefiles will take as FFMPEG_HOME the value
> of FFMPEG_BASE+(target directory)+/usr/include.
> And finally I added a "distclean" target to main Makefile, to remove also
> all generated wrappers and headers
>
> With these changes, I build native libraries with this command:
> make all FFMPEG_BASE=/home/giulio/ffmpeg \
> JDK_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64 \
> LINUX_X86_64_PREFIX= \
> LINUX_i686_PREFIX= \
> WIN_i686_PREFIX=i686-pc-mingw32- \
> WIN_x86_64_PREFIX=x86_64-w64-mingw32- \
> DARWIN_x86_64_PREFIX=x86_64-apple-darwin9- \
> DARWIN_i686_PREFIX=i686-apple-darwin9-
>
> This patch must be applied from the jjmpeg directory, with "patch -p1".
> It must be applied after the first one.
>
> One last word: i named the 32-bit directories for windows and mac os x
> as "win-x86" and "darwin-x86". I didn't name them "win-32" or "darwin-32"
> because I think "32" isn't accurate enough (e.g. linux and darwin run on
> powerpc and arm, that are 32 bit processors too). Personally I would use
> "i686" (or "i386") for all ia-32 targets, and x86_64 for all amd64
> targets,
> but obviously this is just my personal opinion :)
>
> Thank you again for jjmpeg,
> Giulio

Reply all
Reply to author
Forward
0 new messages