Commit 45df2fec authored by Sylvain Berfini's avatar Sylvain Berfini

Added autofocus function for android camera into MSFilter

parent 5d342746
......@@ -552,6 +552,7 @@ typedef enum _MSFilterInterfaceId MSFilterInterfaceId;
#define MS_FILTER_SET_VAD_PROB_START MS_FILTER_BASE_METHOD(23,int)
#define MS_FILTER_SET_VAD_PROB_CONTINUE MS_FILTER_BASE_METHOD(24,int)
#define MS_FILTER_SET_MAX_GAIN MS_FILTER_BASE_METHOD(25,int)
#define MS_VIDEO_CAPTURE_SET_AUTOFOCUS MS_FILTER_BASE_METHOD(26,int)
#define MS_CONF_SPEEX_PREPROCESS_MIC MS_FILTER_EVENT(MS_CONF_ID, 1, void*)
#define MS_CONF_CHANNEL_VOLUME MS_FILTER_EVENT(MS_CONF_ID, 3, void*)
......
......@@ -75,6 +75,13 @@ public class AndroidVideoApi5JniWrapper {
return selectNearestResolutionAvailableForCamera(cameraId, requestedW, requestedH);
}
static public void activateAutoFocus(Object cam){
//TODO
Log.d("Turning on autofocus", "(" + cam + ")");
Camera camera = (Camera) cam;
camera.autoFocus(null);
}
public static Object startRecording(int cameraId, int width, int height, int fps, int rotation, final long nativePtr) {
Log.d("mediastreamer", "startRecording(" + cameraId + ", " + width + ", " + height + ", " + fps + ", " + rotation + ", " + nativePtr + ")");
Camera camera = Camera.open();
......
......@@ -97,6 +97,16 @@ static int video_capture_set_fps(MSFilter *f, void *arg){
return 0;
}
static int video_capture_set_autofocus(MSFilter *f, void* data){
JNIEnv *env = ms_get_jni_env();
AndroidReaderContext* d = (AndroidReaderContext*) f->data;
jclass helperClass = getHelperClass(env);
jmethodID method = env->GetStaticMethodID(helperClass,"activateAutoFocus", "(Ljava/lang/Object;)V");
env->CallStaticObjectMethod(helperClass, method, d->androidCamera);
return 0;
}
static int video_capture_get_fps(MSFilter *f, void *arg){
AndroidReaderContext* d = (AndroidReaderContext*) f->data;
*((float*)arg) = d->fps;
......@@ -334,7 +344,8 @@ static MSFilterMethod video_capture_methods[]={
{ MS_FILTER_GET_PIX_FMT, &video_capture_get_pix_fmt},
{ MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID , &video_set_native_preview_window },//preview is managed by capture filter
{ MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID , &video_get_native_preview_window },
{ MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION, &video_set_device_rotation },
{ MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION, &video_set_device_rotation },
{ MS_VIDEO_CAPTURE_SET_AUTOFOCUS, &video_capture_set_autofocus },
{ 0,0 }
};
......@@ -418,6 +429,7 @@ static void video_capture_detect(MSWebCamManager *obj){
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_capture_AndroidVideoApi5JniWrapper_setAndroidSdkVersion
(JNIEnv *env, jclass c, jint version) {
android_sdk_version = version;
......
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