Commit a04acb2b authored by Justin Kim's avatar Justin Kim

ahc2src: conditional build

parent a31a56ab
......@@ -1778,23 +1778,29 @@ int main () {
dnl *** Android Media ***
translit(dnm, m, l) AM_CONDITIONAL(USE_ANDROID_MEDIA, true)
HAVE_ANDROID_MEDIA="no"
HAVE_ANDROID_CAMERA2_NDK="no"
ANDROID_CAMERA2_NDK_LIBS="-lcamera2ndk -lmediandk"
AG_GST_CHECK_FEATURE(ANDROID_MEDIA, [Android Media], androidmedia, [
case "$host" in
*android*)
AC_CHECK_HEADER(jni.h, HAVE_ANDROID_MEDIA="yes", HAVE_ANDROID_MEDIA="no")
AC_CHECK_HEADER([camera/NdkCameraError.h], [
HAVE_ANDROID_CAMERA2_NDK="yes"
AC_DEFINE([HAVE_ANDROID_CAMERA2_NDK], 1,
[Define to 1 if you have Android Camera 2 API in Android NDK])
AC_SUBST(ANDROID_CAMERA2_NDK_LIBS)
], [
HAVE_ANDROID_CAMERA2_NDK="no"
])
;;
*)
HAVE_ANDROID_MEDIA="no"
HAVE_ANDROID_CAMERA2_NDK="no"
;;
esac
])
dnl *** Android Camera2 NDK ***
translit(dnm, m, l) AM_CONDITIONAL(USE_ANDROID_CAMERA2_NDK, true)
HAVE_ANDROID_CAMERA2_NDK="no"
AG_GST_CHECK_FEATURE(ANDROID_CAMERA2_NDK, [Android Camera2 NDK], androidcamera2ndk, [
AC_CHECK_HEADER(camera/NdkCameraDevice.h, HAVE_ANDROID_CAMERA2_NDK="yes", HAVE_ANDROID_CAMERA2_NDK="no")
])
AM_CONDITIONAL(HAVE_ANDROID_CAMERA2_NDK, test "x$HAVE_ANDROID_CAMERA2_NDK" = "xyes")
dnl *** AppleMedia (OS X and iOS) ***
translit(dnm, m, l) AM_CONDITIONAL(USE_APPLE_MEDIA, true)
......
plugin_LTLIBRARIES = libgstandroidmedia.la \
if USE_ANDROID_CAMERA2_NDK
libgstandroidcamera2ndk.la \
endif
$(NULL)
plugin_LTLIBRARIES = libgstandroidmedia.la
libgstandroidmedia_la_SOURCES = \
gstahcsrc.c \
......@@ -18,9 +14,12 @@ libgstandroidmedia_la_SOURCES = \
gst-android-hardware-sensor.c \
gstjniutils.c
if HAVE_ANDROID_CAMERA2_NDK
libgstandroidmedia_la_SOURCES += gstahc2src.c
endif
noinst_HEADERS = \
gstahcsrc.h \
gstahc2src.h \
gstahssrc.h \
gstamcaudiodec.h \
gstamc-constants.h \
......@@ -35,6 +34,10 @@ noinst_HEADERS = \
gstjniutils.h \
gstsensors.h
if HAVE_ANDROID_CAMERA2_NDK
noinst_HEADERS += gstahc2src.h
endif
libgstandroidmedia_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
......@@ -55,39 +58,12 @@ libgstandroidmedia_la_LIBADD = \
$(GST_LIBS) \
$(ORC_LIBS)
libgstandroidmedia_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstandroidmediandk_la_SOURCES = \
gstahc2src.c \
$(NULL)
libgstandroidmediandk_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(ORC_CFLAGS) \
-DGST_USE_UNSTABLE_API \
$(NULL)
if USE_ANDROID_CAMERA2_NDK
libgstandroidcamera2ndk_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstphotography-$(GST_API_VERSION).la \
$(GST_PLUGINS_BASE_LIBS) \
-lgstaudio-@GST_API_VERSION@ \
-lgstpbutils-@GST_API_VERSION@ \
-lgstvideo-@GST_API_VERSION@ \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(ORC_LIBS) \
-lcamera2ndk \
-lmediandk \
$(NULL)
libgstandroidcamera2ndk = $(GST_PLUGIN_LDFLAGS)
if HAVE_ANDROID_CAMERA2_NDK
libgstandroidmedia_la_LIBADD += $(ANDROID_CAMERA2_NDK_LIBS)
endif
libgstandroidmedia_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
androidmedia_java_classesdir = $(datadir)/gst-android/ndk-build/androidmedia/
androidmedia_java_classes_DATA = \
org/freedesktop/gstreamer/androidmedia/GstAhcCallback.java \
......
......@@ -2100,6 +2100,7 @@ gst_ahc2_src_photography_init (gpointer g_iface, gpointer iface_data)
iface->set_zoom = gst_ahc2_src_set_zoom;
}
#if 0
static gboolean
plugin_init (GstPlugin * plugin)
{
......@@ -2111,10 +2112,4 @@ plugin_init (GstPlugin * plugin)
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
androidcamera2ndk,
"Android Camera2 NDK plugin",
plugin_init,
PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
#endif
......@@ -31,6 +31,9 @@
#include "gstahcsrc.h"
#include "gstahssrc.h"
#ifdef HAVE_ANDROID_CAMERA2_NDK
#include "gstahc2src.h"
#endif
#include "gstamc.h"
#include "gstamc-constants.h"
......@@ -3417,6 +3420,15 @@ plugin_init (GstPlugin * plugin)
if (ahs_init (plugin))
init_ok = TRUE;
#ifdef HAVE_ANDROID_CAMERA2_NDK
if (gst_element_register (plugin, "ahc2src", GST_RANK_NONE,
GST_TYPE_AHC2_SRC)) {
init_ok = TRUE;
} else {
GST_ERROR ("Failed to register android camera2 source");
}
#endif
return init_ok;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment