From 894f3d1fa1d06104c4c7aac8c365c29d9d972bb4 Mon Sep 17 00:00:00 2001 From: Marko Ollonen Date: Sat, 17 Nov 2012 11:26:44 +0200 Subject: [PATCH] Af stop when making image capture with flash, default exposure mode changed. Change-Id: I52d9a132a5edb3aa2897732278d3bf74602e9d2e --- gst-libs/atomisphal/gstv4l2mfldadvci.c | 31 ++++++++++++++++++++++++++++--- gst-libs/atomisphal/gstv4l2mfldadvci.h | 4 +++- gst-libs/atomisphal/mfld_cam.c | 12 +++++++++--- packaging/mfldv4l2camsrc.changes | 3 +++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/gst-libs/atomisphal/gstv4l2mfldadvci.c b/gst-libs/atomisphal/gstv4l2mfldadvci.c index 9ad9744..3c02bbb 100644 --- a/gst-libs/atomisphal/gstv4l2mfldadvci.c +++ b/gst-libs/atomisphal/gstv4l2mfldadvci.c @@ -20,7 +20,6 @@ #include "gstv4l2mfldadvci.h" #include #include -#include #include #include "ci_adv_pub.h" @@ -250,6 +249,7 @@ lib_3a_isp_set_fd (int fd, const char *sensor_id) ci_adv_ae_set_exposure_program(ia_3a_ae_exposure_program_auto); ci_adv_ae_set_mode(ia_3a_ae_mode_auto); + ci_adv_ae_set_metering_mode(ia_3a_ae_metering_mode_center); ci_adv_af_set_range (ia_3a_af_range_full); ci_adv_awb_set_mode(ia_3a_awb_mode_auto); ci_adv_af_set_mode(ia_3a_af_mode_auto); @@ -293,10 +293,35 @@ static void lib_3a_AfVersion(int * major, int * minor) static void lib_3a_AfGetStillAfStatus(ia_3a_af_status *status) { - cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__); *status = ci_adv_af_get_status(); } +static bool lib_3a_af_is_complete(void) +{ + + ia_3a_af_status status; + bool completed = FALSE; + + lib_3a_AfGetStillAfStatus(&status); + + if (status == ia_3a_af_status_error) { + cam_lib_3a_dbg("==== still AF failed \n"); + completed = TRUE; + } + else if (status == ia_3a_af_status_success) { + cam_lib_3a_dbg("==== still AF success"); + completed = TRUE; + } else if (status == ia_3a_af_status_cancelled) { + cam_lib_3a_dbg("==== still AF cancelled \n"); + completed = TRUE; + } + else { + cam_lib_3a_dbg("==== still AF continue %d \n", status); + } + + return completed; +} + static void lib_3a_RerVersion(int * major, int * minor) { cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__); @@ -511,7 +536,7 @@ lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci) mfldadvci->af_start = lib_3a_af_start; mfldadvci->af_stop = lib_3a_af_stop; - mfldadvci->af_is_complete = lib_3a_int_void; + mfldadvci->af_is_complete = lib_3a_af_is_complete; mfldadvci->awb_apply_results = lib_3a_awb_apply_results; mfldadvci->awb_calc_flash = lib_3a_void; diff --git a/gst-libs/atomisphal/gstv4l2mfldadvci.h b/gst-libs/atomisphal/gstv4l2mfldadvci.h index b3d67c9..1764979 100644 --- a/gst-libs/atomisphal/gstv4l2mfldadvci.h +++ b/gst-libs/atomisphal/gstv4l2mfldadvci.h @@ -30,6 +30,8 @@ #define LIBMFLDADVCI_VERSION 20110128 #include +#include + #include "atomisp.h" @@ -85,7 +87,7 @@ struct _GstV4l2MFLDAdvCI void (*af_start)(void); void (*af_stop)(void); - int (*af_is_complete)(void); + bool (*af_is_complete)(void); void (*awb_apply_results)(void); void (*awb_calc_flash)(void); diff --git a/gst-libs/atomisphal/mfld_cam.c b/gst-libs/atomisphal/mfld_cam.c index 72d25e2..5d73ca9 100644 --- a/gst-libs/atomisphal/mfld_cam.c +++ b/gst-libs/atomisphal/mfld_cam.c @@ -1608,7 +1608,7 @@ run_normal_sequence(int fd, struct v4l2_buffer *buffer) /* Still AF processing */ if (mfld_driver.still_af_count) { - int complete = 1; /* AF status */ + bool complete = TRUE; /* AF status */ if (mfld_driver.af_enabled) complete = mfldadvci->af_is_complete (); @@ -1637,10 +1637,16 @@ cam_capture_frames (int fd, struct v4l2_buffer *buffer, cam_capture_init (fd, buffer, capture_settings); - if (mfld_driver.mode == CAM_CAPTURE_MODE_STILL_CAPTURE ) { + if ((mfld_driver.mode == CAM_CAPTURE_MODE_STILL_CAPTURE ) && + (mfld_driver.sensor_type == SENSOR_TYPE_RAW) ) { /* check flash here not in always when capturing frames */ flash_en = get_flash_status (); - if (flash_en == TRUE) { + // stop still AF processing if running + if (mfld_driver.still_af_count) { + mfldadvci->af_stop(); + mfld_driver.still_af_count = 0; + } + if (flash_en == TRUE){ run_flash_sequence (fd, buffer); } else{ diff --git a/packaging/mfldv4l2camsrc.changes b/packaging/mfldv4l2camsrc.changes index 97015bb..cf14f6d 100644 --- a/packaging/mfldv4l2camsrc.changes +++ b/packaging/mfldv4l2camsrc.changes @@ -1,3 +1,6 @@ +* Sat Nov 17 2012 Marko Ollonen accepted/trunk/20121112.215039@ec2d54a +- Af stop when making image capture, default exposure mode changed. + * Fri Nov 16 2012 Marko Ollonen accepted/trunk/20121112.215039@fe4db92 - fix flash and clean up -- 2.7.4