Commit bf1642fb authored by Matthieu Tanon's avatar Matthieu Tanon

Merge branch 'master' into dev_lime_v2

parents 1f37bb14 63430038
...@@ -42,6 +42,11 @@ public class AndroidVideoApi5JniWrapper { ...@@ -42,6 +42,11 @@ public class AndroidVideoApi5JniWrapper {
public static native void putImage(long nativePtr, byte[] buffer); public static native void putImage(long nativePtr, byte[] buffer);
static public int detectCamerasCount() {
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
return cameras.length;
}
static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) { static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) {
Log.d("detectCameras\n"); Log.d("detectCameras\n");
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras(); AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
......
...@@ -24,6 +24,11 @@ import android.graphics.ImageFormat; ...@@ -24,6 +24,11 @@ import android.graphics.ImageFormat;
import android.hardware.Camera; import android.hardware.Camera;
public class AndroidVideoApi8JniWrapper { public class AndroidVideoApi8JniWrapper {
static public int detectCamerasCount() {
return AndroidVideoApi5JniWrapper.detectCamerasCount();
}
static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) { static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) {
return AndroidVideoApi5JniWrapper.detectCameras(indexes, frontFacing, orientation); return AndroidVideoApi5JniWrapper.detectCameras(indexes, frontFacing, orientation);
} }
......
...@@ -31,6 +31,11 @@ import android.os.Build; ...@@ -31,6 +31,11 @@ import android.os.Build;
@TargetApi(Build.VERSION_CODES.GINGERBREAD) @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public class AndroidVideoApi9JniWrapper { public class AndroidVideoApi9JniWrapper {
static public int detectCamerasCount() {
return AndroidVideoApi5JniWrapper.detectCamerasCount();
}
static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) { static public int detectCameras(int[] indexes, int[] frontFacing, int[] orientation) {
return AndroidVideoApi5JniWrapper.detectCameras(indexes, frontFacing, orientation); return AndroidVideoApi5JniWrapper.detectCameras(indexes, frontFacing, orientation);
} }
......
...@@ -425,16 +425,17 @@ static void video_capture_detect(MSWebCamManager *obj){ ...@@ -425,16 +425,17 @@ static void video_capture_detect(MSWebCamManager *obj){
JNIEnv *env = ms_get_jni_env(); JNIEnv *env = ms_get_jni_env();
jclass helperClass = getHelperClassGlobalRef(env); jclass helperClass = getHelperClassGlobalRef(env);
if (helperClass==NULL) return; if (helperClass == NULL) return;
// create 3 int arrays - assuming 2 webcams at most jmethodID countMethod = env->GetStaticMethodID(helperClass,"detectCamerasCount", "()I");
jintArray indexes = (jintArray)env->NewIntArray(2); int count = env->CallStaticIntMethod(helperClass, countMethod);
jintArray frontFacing = (jintArray)env->NewIntArray(2);
jintArray orientation = (jintArray)env->NewIntArray(2);
jmethodID method = env->GetStaticMethodID(helperClass,"detectCameras", "([I[I[I)I"); jintArray indexes = (jintArray)env->NewIntArray(count);
jintArray frontFacing = (jintArray)env->NewIntArray(count);
jintArray orientation = (jintArray)env->NewIntArray(count);
int count = env->CallStaticIntMethod(helperClass, method, indexes, frontFacing, orientation); jmethodID method = env->GetStaticMethodID(helperClass,"detectCameras", "([I[I[I)I");
env->CallStaticIntMethod(helperClass, method, indexes, frontFacing, orientation);
ms_message("%d cards detected", count); ms_message("%d cards detected", count);
for(int i=0; i<count; i++) { for(int i=0; i<count; i++) {
......
...@@ -44,6 +44,33 @@ static void log_handler(int lev, const char *fmt, va_list args) { ...@@ -44,6 +44,33 @@ static void log_handler(int lev, const char *fmt, va_list args) {
} }
} }
int mediastreamer2_tester_set_log_file(const char *filename) {
if (log_file) {
fclose(log_file);
}
log_file = fopen(filename, "w");
if (!log_file) {
ms_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
return -1;
}
ms_message("Redirecting traces to file [%s]", filename);
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma deprecated(message_state_changed_cb)
#endif
bctbx_set_log_file(log_file);
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
return 0;
}
int silent_arg_func(const char *arg) { int silent_arg_func(const char *arg) {
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL); ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL);
return 0; return 0;
...@@ -93,32 +120,6 @@ void mediastreamer2_tester_uninit(void) { ...@@ -93,32 +120,6 @@ void mediastreamer2_tester_uninit(void) {
bc_tester_uninit(); bc_tester_uninit();
} }
int mediastreamer2_tester_set_log_file(const char *filename) {
if (log_file) {
fclose(log_file);
}
log_file = fopen(filename, "w");
if (!log_file) {
ms_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
return -1;
}
ms_message("Redirecting traces to file [%s]", filename);
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma deprecated(message_state_changed_cb)
#endif
bctbx_set_log_file(log_file);
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
return 0;
}
#if defined(_WIN32) && !defined(MS2_WINDOWS_DESKTOP) #if defined(_WIN32) && !defined(MS2_WINDOWS_DESKTOP)
#define BUILD_ENTRY_POINT 0 #define BUILD_ENTRY_POINT 0
#else #else
......
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