Building gst-plugins-good/ext/jpeg
Ryan Melville
ryan.melville at updatelogic.com
Fri May 4 14:12:27 PDT 2012
> I have not added a new lib myself. Please take a look how faad is integrated and try to follow that. If you success,
> it would be great if you could contribute the solution. On the other hand I wonder if you could get away with adding
> the libjpeg-devel related files (headers and pkg-config files) and copy the libjpeg library from the phone to the ndk
> like we do for other media libs.
>
> Stefan
Thank you for the tips, Stefan. It got me going in the right direction.
I believe I've been successful; here are my notes for posterity...
* Problem
I needed libgstjpeg.so from gst-plugins-good/ext/jpeg but it wasn't building by default in the gstreamer-0.10_ndk_build package by default.
* My Solution
First, I noticed that my build output showed:
configure: *** checking feature: jpeg library ***
configure: *** for plug-ins: jpeg ***
checking for jpeg_set_defaults in -ljpeg-mmx... no
checking for jpeg_set_defaults in -ljpeg... no
configure: *** These plugins will not be built: jpeg
libgstjpeg is dependent upon libjpeg, which doesn't seem to be in the Android NDK nor gstreamer-0.10_ndk_build package. It seems to be in the Android OS source tree (ICS; system/external/jpeg) and so I would expect the library to be on ICS devices at run-time, but I need it and the headers at compile/link time, of course. And I don't want to have to have the entire Android OS source tree around every time I build my project...
So I created my own my_stuff/android/android-14/system/external/jpeg directory containing *.h from the original, a prebuilt lib/armeabi/libjpeg.so (prebuilt via building the entire Android OS source tree) and I adjusted the Android.mk. One could probably pull libjpeg.so from an existing device as well to avoid having to build the entire Android OS source tree.
I basically added this near the top of the existing jpeg/Android.mk (after the standard LOCAL_PATH and CLEAR_VARS lines); most of this came from the Android NDK docs on "Prebuilt" libraries:
ifneq ($(SYSROOT),)
NDK_BUILD := true
else
NDK_BUILD := false
endif
ifeq ($(NDK_BUILD),true)
LOCAL_MODULE := libjpeg
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libjpeg.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(PREBUILT_SHARED_LIBRARY)
else
[...rest of original file...]
endif
Then, I enabled the ext/jpeg plugin in gst-plugins-good/Android.mk by adding "ext/jpeg/Android.mk" to the end of the GST_PLUGINS_GOOD_BUILT_SOURCES list and "-include $(GST_PLUGINS_GOOD_TOP)/ext/jpeg/Android.mk" to the list of included Android.mk files near the bottom.
I also add to add a rule to make ext/jpeg/Android.mk at the end of the gst-plugins-good/ext/jpeg/Makefile.am file. I copied this from a different plugin that was building correctly after getting a "No rule to make target Android.mk" build error:
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstjpeg -:SHARED libgstjpeg \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstjpeg_la_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstjpeg_la_CFLAGS) \
-:LDFLAGS $(libgstjpeg_la_LDFLAGS) \
$(libgstjpeg_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
> $@
Lastly, I had to add inclusion of the libjpeg Android.mk file to my project's Android.mk file (equivalent of gstreamer-0.10_ndk_build/jni/Android.mk):
#include $(JPEG_TOP)/Android.mk
Where "JPEG_TOP" was set to my previously mentioned "my_stuff/android/android-14/system/external/jpeg" directory.
Now, libjpeg is detected and libgstjpeg.so is built.
Regards,
Ryan
More information about the gstreamer-android
mailing list