return;
}
-static void wrapper_default_int (int a)
-{
- return;
-}
-
static int wrapper_default_int_void (void)
{
return 0;
static ci_adv_Err
wrapper_default_int_int (int i)
{
+ return 0;
}
static ci_adv_Err
wrapper_default_intp (int *p)
{
+ return 0;
}
static int
{
}
+static gboolean
+wrapper_default_af_assist_light_needed(void)
+{
+return FALSE;
+}
static ci_adv_Err wrapper_default_AeSetManualIso(int sensitivity)
{
return;
}
-static void
-lib_3a_int (int a)
-{
- cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
- return;
-}
-
static int
lib_3a_int_void (void)
{
lib_3a_AeGetExposureProgram(advci_ae_exposure_program *program)
{
cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
- ci_adv_ae_get_exposure_program(program);
+ ci_adv_ae_get_exposure_program((ia_3a_ae_exposure_program *)program);
}
static void
lib_3a_isp_set_fd (int fd, const char *sensor_id)
{
int sensor_type;
- advci_window window;
+ ia_3a_window window;
cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
if (ci_adv_init(sensor_id, fd, NULL) == 0) {
static gboolean lib_3a_af_is_complete(void)
{
- ia_3a_af_status status;
+ advci_af_status status;
gboolean completed = FALSE;
lib_3a_AfGetStillAfStatus(&status);
- if (status == ia_3a_af_status_error) {
+ if (status == advci_af_status_error) {
cam_lib_3a_dbg("==== still AF failed \n");
completed = TRUE;
}
- else if (status == ia_3a_af_status_success) {
+ else if (status == advci_af_status_success) {
cam_lib_3a_dbg("==== still AF success");
completed = TRUE;
- } else if (status == ia_3a_af_status_cancelled) {
+ } else if (status == advci_af_status_cancelled) {
cam_lib_3a_dbg("==== still AF cancelled \n");
completed = TRUE;
}
lib_3a_AfGetMeteringMode(advci_af_metering_mode *mode)
{
cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
- ci_adv_af_get_metering_mode(mode);
+ ci_adv_af_get_metering_mode((ia_3a_af_metering_mode *)mode);
}
static void
lib_3a_Ae_Af_GetWindow(advci_window *window)
{
cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
- ia_3a_ae_get_window(window);
+ ia_3a_ae_get_window((ia_3a_window *)window);
}
static void
__func__, window->x_left,window->x_right,
window->y_top , window->y_bottom, window->weight);
- ci_adv_ae_set_window(window);
- ci_adv_af_set_windows(1, window);
+ ci_adv_ae_set_window((ia_3a_window *)window);
+ ci_adv_af_set_windows(1, (ia_3a_window *)window);
}
static void
lib_3a_AeAfAwb_process( struct timeval *frame_timestamp)
{
int status;
- //cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
+ // cam_lib_3a_dbg("%s:%d\n", __func__, __LINE__);
status = ci_adv_process_frame(TRUE,frame_timestamp);
}
static void
static void
lib_ae_is_flash_needed(gboolean *useflash)
{
- ci_adv_ae_is_flash_necessary(useflash);
+ ci_adv_ae_is_flash_necessary((_Bool *)useflash);
cam_lib_3a_dbg("%s:%d useflash: %d\n", __func__, __LINE__, *useflash);
}
static void
lib_3a_GetMakerNote(advci_mknote_mode mknMode, advci_mknote *note)
{
- note = ci_adv_get_maker_note(mknMode);
+ note = (advci_mknote *)ci_adv_get_maker_note((ia_3a_mknote_mode)mknMode);
}
static void
{
if (mknData != NULL)
{
- ci_adv_put_maker_note(mknData);
+ ci_adv_put_maker_note((ia_3a_mknote *)mknData);
}
}
ci_adv_reset_maker_note();
}
+static gboolean
+lib_3a_af_assist_light_needed(void)
+{
+ bool bNeed = FALSE;
+ ci_adv_err ret = ci_adv_af_need_assist_light(&bNeed);
+ cam_lib_3a_dbg("%s:%d assist_light_needed: %d\n", __func__, __LINE__, bNeed);
+
+ return bNeed;
+}
void
lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci)
mfldadvci->ae_calc_with_flash = lib_3a_calc_with_flash;
mfldadvci->ae_is_flash_needed = lib_ae_is_flash_needed;
+ mfldadvci->af_assist_light_needed = lib_3a_af_assist_light_needed;
mfldadvci->ae_apply_results = lib_3a_ae;
mfldadvci->ae_calc_with_flash = wrapper_default_calc_with_flash;
mfldadvci->ae_is_flash_needed = wrapper_default_is_flash_needed;
+ mfldadvci->af_assist_light_needed = wrapper_default_af_assist_light_needed;
mfldadvci->ae_apply_results = wrapper_default_ae;
void (*af_start)(void);
void (*af_stop)(void);
gboolean (*af_is_complete)(void);
+ gboolean (*af_assist_light_needed)(void);
void (*awb_apply_results)(void);
void (*awb_calc_flash)(void);
void (*GetMakerNote) (advci_mknote_mode mknMode, advci_mknote * note);
void (*PutMakerNote)(advci_mknote *mknData);
void (*ResetMakerNote)(void);
- int fd;
};
-
void lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci);
void wrapper_default_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci);
int sensor_type;
struct timeval timestamp;
int focus_done;
+ gboolean enable_torch;
};
struct buffer
case CAM_LIGHT_FLASH_MODE_FILL_IN:
case CAM_LIGHT_FLASH_MODE_RED_EYE:
case CAM_LIGHT_FLASH_MODE_OFF:
- ret = cam_driver_set_flash_mode(fd,ATOMISP_FLASH_MODE_OFF);
+ if(!mfld_driver.enable_torch)
+ ret = cam_driver_set_flash_mode(fd,ATOMISP_FLASH_MODE_OFF);
break;
}
set_ae_flash_mode(fd,mode);
cam_set_flash (int fd, int on)
{
cam_driver_dbg ("%s\n", __func__);
- return CAM_ERR_NONE;
+ cam_err_t ret = CAM_ERR_NONE;
+ mfld_driver.enable_torch = on;
+ if( cam_driver_set_torch(fd, on)== CAM_ERR_NONE)
+ mfld_driver.enable_torch = on;
+ else
+ mfld_driver.enable_torch = FALSE;
+ return ret;
}
/* Ask the suggested flash intensity value.
mfld_driver.dvs_vector.y = 0;
mfld_driver.focus_done = 0;
+ mfld_driver.enable_torch = FALSE;
mfldadvci = advci;
/* Initalize the 3A library */
pthread_cancel (mfld_driver.thread);
mfld_driver.g_3a_started = 0;
}
-
/* Do other driver related deinit here */
+ led_flash_off(fd);
return CAM_ERR_NONE;
}
discard_first_frame(fd, buffer, 2);
mfld_driver.first_frame = 0;
}
-
/* Still AF start */
if (mfld_driver.start_still_af) {
if (mfld_driver.af_enabled && mfld_driver.still_af_count > 0)
mfld_driver.still_af_count = 1;
mfld_driver.af_start_time = mfld_driver.timestamp;
+ if (mfldadvci->af_assist_light_needed()) {
+ mfld_driver.enable_torch = TRUE;
+ cam_driver_set_torch(fd, TRUE);
+ }
if (mfld_driver.af_enabled)
mfldadvci->af_start ();
}
if (complete == 0) {
mfldadvci->af_stop();
cam_driver_dbg ("AF: Focus Failed %s\n", __func__);
+ if(mfld_driver.enable_torch) {
+ mfld_driver.enable_torch= FALSE;
+ cam_driver_set_torch(fd, FALSE);
+ }
}
}
else
// stop still AF processing if running
if (mfld_driver.still_af_count) {
mfldadvci->af_stop();
+ if(mfld_driver.enable_torch) {
+ mfld_driver.enable_torch= FALSE;
+ cam_driver_set_torch(fd, FALSE);
+ }
mfld_driver.still_af_count = 0;
}
- if (flash_en == TRUE){
+ if ((flash_en == TRUE) && (mfld_driver.enable_torch == FALSE)){
run_flash_sequence (fd, buffer);
+ led_flash_off(fd);
}
else{
//cam_driver_set_indication_intensity(fd, INDICATOR_INTENSITY);
//cam_driver_set_flash_mode(fd,ATOMISP_FLASH_MODE_INDICATOR);
ret = run_normal_sequence(fd, buffer);
/* restore flash mode */
- cam_driver_set_flash_mode(fd,ATOMISP_FLASH_MODE_OFF);
+ if (mfld_driver.enable_torch == FALSE)
+ cam_driver_set_flash_mode(fd,ATOMISP_FLASH_MODE_OFF);
}
} else {
ret = run_normal_sequence(fd, buffer);
void
led_flash_off (int fd)
{
- cam_err_t ret;
- cam_driver_dbg("%s\n",__func__);
+ cam_driver_dbg("%s\n",__func__);
+ cam_driver_set_attribute(fd, V4L2_CID_FLASH_MODE, ATOMISP_FLASH_MODE_OFF, "Flash mode");
+ cam_driver_set_attribute (fd, V4L2_CID_FLASH_INDICATOR_INTENSITY, 0, "indication intensity");
+ cam_driver_set_attribute (fd, V4L2_CID_FLASH_TORCH_INTENSITY, 0, "Torch intensity");
+ cam_driver_set_led_flash (fd, V4L2_CID_FLASH_STROBE, 0);
- ret = cam_driver_set_led_flash (fd, V4L2_CID_FLASH_STROBE, 0);
- if (ret != CAM_ERR_NONE)
- {
- cam_driver_dbg ("%s: Error flash ioctl %d\n", __func__, 0);
- }
}
cam_err_t
return cam_driver_set_attribute (fd, V4L2_CID_FLASH_INDICATOR_INTENSITY, intensity, "indication intensity");
}
+
+cam_err_t
+cam_driver_set_torch(int fd, int on)
+{
+ cam_driver_dbg ("%s: state %d\n", __func__, on);
+ cam_err_t ret;
+ if (on) {
+ ret = cam_driver_set_attribute(fd, V4L2_CID_FLASH_MODE, ATOMISP_FLASH_MODE_TORCH, "Flash mode");
+ if (ret == CAM_ERR_NONE)
+ ret = cam_driver_set_attribute (fd, V4L2_CID_FLASH_TORCH_INTENSITY, TORCH_INTENSITY, "Torch intensity");
+ }
+ else {
+ ret = cam_driver_set_attribute(fd, V4L2_CID_FLASH_MODE, ATOMISP_FLASH_MODE_OFF, "Flash mode");
+ if(ret == CAM_ERR_NONE)
+ ret = cam_driver_set_attribute (fd, V4L2_CID_FLASH_TORCH_INTENSITY, 0, "Torch intensity");
+ }
+ cam_driver_dbg ("%s: ret %d\n", __func__, ret);
+ return ret;
+}
#define OFF 0
#define INDICATOR_INTENSITY 10 /* 10% */
+#define TORCH_INTENSITY 20 /* 20% */
+
void cam_err_print (cam_err_t err);
cam_err_t cam_driver_set_mipi_interrupt(int fd, int enable);
cam_err_t cam_driver_set_indication_intensity (int fd,int intensity);
+cam_err_t cam_driver_set_torch(int fd, int on);
#endif /* _MFLD_DRIVER_H */
camerasrc->enable_torch = value;
else
camerasrc->enable_torch = FALSE;
+
if (bclass->set_strobe_state)
- bclass->set_strobe_state(camerasrc, camerasrc->enable_torch);
+ ret = bclass->set_strobe_state(camerasrc, camerasrc->enable_torch);
GST_OBJECT_UNLOCK (camerasrc);
}
GST_V4L2CAMSRC_CHECK_NOT_ACTIVE (v4l2camsrc);
/* close device */
+ gst_v4l2camsrc_libmfldcam_deinit (v4l2camsrc);
+
close (v4l2camsrc->video_fd);
pollfd.fd = v4l2camsrc->video_fd;
gst_poll_remove_fd (v4l2camsrc->poll, &pollfd);
v4l2camsrc->video_fd = -1;
- gst_v4l2camsrc_libmfldcam_deinit (v4l2camsrc);
return TRUE;
}
{
GstMFLDV4l2CamSrc *v4l2camsrc;
gint fd;
+ cam_err_t err = CAM_ERR_NONE;
v4l2camsrc = GST_V4L2CAMSRC (camsrc);
fd = v4l2camsrc->video_fd;
- cam_set_flash (fd, state);
+ err = cam_set_flash (fd, state);
+ return(err == CAM_ERR_NONE);
}
gboolean
gst_libmfldcam_capture_correction_update (GstMFLDV4l2CamSrc * v4l2camsrc)
+* Fri Nov 30 2012 Marko Ollonen <marko.ollonen@ixonos.com> submit/trunk/20121129.125759@70ce86b
+- atom isp strobe light control added.
+
* Fri Nov 30 2012 Marko Ollonen <marko.ollonen@ixonos.com> submit/trunk/20121129.125759@9854069
- strobe light control added to camera control interface.