diff options
Diffstat (limited to 'include/cam.h')
-rwxr-xr-x | include/cam.h | 393 |
1 files changed, 393 insertions, 0 deletions
diff --git a/include/cam.h b/include/cam.h new file mode 100755 index 0000000..096aa48 --- /dev/null +++ b/include/cam.h @@ -0,0 +1,393 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __DEF_CAM_H__ +#define __DEF_CAM_H__ + + +#include <Elementary.h> +#include <Ecore.h> +#include <Ecore_X.h> +#include <dlfcn.h> +#include <utilX.h> + +#include "cam_property.h" +#include "cam_app.h" +#include "edc_string.h" +#include <fcntl.h> + +#include <vconf.h> +#include <ui-gadget.h> +#include <app.h> +#include <media_content.h> +#include <sensors.h> + + +#define DISABLE_FOR_DEMO 0 + +#ifdef USE_FIFO_THREAD +#define CAM_FIFO_PATH "/tmp/cam_cmd_fifo" + +#define CAM_FIFO_CMD_EXIT "EXIT" +#define CAM_FIFO_CMD_START "START" + +#define CAM_CAPTURE_AUTO_START "CAPTURE_AUTO_START" + +#define MAX_NUM_OF_FIFO_TOKEN 6 +#endif + +#define PACKAGE "ug-camera-efl" +#define GRP_MAIN "main" + +#define EDJ_PATH "/usr/ug/res/edje/"PACKAGE +#define CAM_IMAGE_PATH "/usr/ug/res/images/"PACKAGE"/src_images/" + +#define CAM_MAIN_LAYOUT_EDJ_NAME EDJ_PATH"/cam_main_layout.edj" + +#define CAM_RECORDING_EDJ_NAME EDJ_PATH"/cam_recording_edje.edj" +#define CAM_RECORDING_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_inverse.edj" +#define CAM_RECORDING_VERTICAL_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical.edj" +#define CAM_RECORDING_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical_inverse.edj" + +#define CAM_TOOLBAR_LAYOUT_EDJ_NAME EDJ_PATH"/cam_toolbar_layout.edj" +#define CAM_TOOLBAR_LAYOUT_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_inverse.edj" +#define CAM_TOOLBAR_LAYOUT_VERTICAL_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical.edj" +#define CAM_TOOLBAR_LAYOUT_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical_inverse.edj" + +#define CAM_SETTING_POPUP_STYLE_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera.edj" +#define CAM_SETTING_POPUP_STYLE_WITH_RADIO_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera_with_radio.edj" +#define CAM_SETTING_POPUP_LAYOUT_EDJ_NAME EDJ_PATH"/cam_setting_popup_layout.edj" +#define CAM_SLIDER_STYLE_EDJ_NAME EDJ_PATH"/style_slider_camera.edj" +#define CAM_LABEL_STYLE_EDJ_NAME EDJ_PATH"/style_label_camera.edj" +#define CAM_BUTTON_STYLE_EDJ_NAME EDJ_PATH"/style_button_camera.edj" + + +#define CAM_SHOTCUTS_EDIT_CTXPOPUP_EDJ_NAME EDJ_PATH"/cam_ctxpopup_shortcuts.edj" + +#define CAM_UTILS_EDJ_NAME EDJ_PATH"/cam_utils.edj" +#define CAM_INDICATOR_EDJ_NAME EDJ_PATH"/cam_indicator_layout.edj" + +#define CAM_EV_EDJ_NAME EDJ_PATH"/cam_ev_layout.edj" +#define CAM_EV_EDJ_INVERSE_NAME EDJ_PATH"/cam_ev_layout_inverse.edj" +#define CAM_EV_EDJ_VERTICAL_NAME EDJ_PATH"/cam_ev_layout_vertical.edj" +#define CAM_EV_EDJ_VERTICAL_INVERSE_NAME EDJ_PATH"/cam_ev_layout_vertical_inverse.edj" + +#define CAM_ZOOM_EDJ_NAME EDJ_PATH"/cam_zoom_layout.edj" +#define CAM_ZOOM_EDJ_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_inverse.edj" +#define CAM_ZOOM_EDJ_VERTICAL_NAME EDJ_PATH"/cam_zoom_layout_vertical.edj" +#define CAM_ZOOM_EDJ_VERTICAL_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_vertical_inverse.edj" + +#define CAM_IMAGE_EDJ_NAME EDJ_PATH"/cam_images.edj" + +#define IMAGE_VIEWER_VIEW_MODE_KEY_NAME "View Mode" +#define IMAGE_VIEWER_FILE_PATH_KEY_NAME "Path" +#define IMAGE_VIEWER_SET_AS_TYPE "Setas type" +#define IMAGE_VIEWER_RESOLUTION "Resolution" +#define IMAGE_VIEWER_UG_NAME "image-viewer-efl" + +#define LOCATION_UG_NAME "setting-location-efl" + +#define PREVIEW_WIDTH 640 +#define PREVIEW_HEIGHT 480 + +#define WINDOW_W 640 /* 400 */ /*1280*/ +#define WINDOW_H 480 /* 240 */ /*720*/ + +#define SERVICE_MIME_TYPE_IMAGE_1 "image/jpg" +#define SERVICE_MIME_TYPE_IMAGE_2 "image/jpeg" +#define SERVICE_MIME_TYPE_VIDEO_1 "video/3gp" +#define SERVICE_MIME_TYPE_VIDEO_2 "video/3gpp" + + +#define DEFAULT_WIN_ANGLE (270) + +#define CAM_FILE_PATH_MAX 1024 +#define EFL_TEMP_CODE +/* #define USE_CAMERA_APP_SHUTTER_SOUND 1 */ +#define ENABLE_CAPTURE_ANIMATION + +struct appdata { + Evas *evas; + Ecore_Evas *ee; + Evas_Object *ug_base; + Evas_Object *win_main; + Ecore_X_Window main_xid; + Ecore_Pipe *main_pipe; + CamUgState ug_state; + + app_device_orientation_e rot_current; + app_device_orientation_e rot_previous; + + int angle_pre; + int angle; + int rotate_angle; + gboolean is_rotating; + gboolean is_processing; /*note: programm busy flag, now just used for bust shot processing popup*/ + gboolean is_capture_animation_processing; + + int camcorder_rotate; + + Evas_Object *gesture; /* gesture layout */ + +#ifdef ENABLE_CAPTURE_ANIMATION + Evas_Object *shutter_screen; + CamRectangle shutter_src_rect; + CamRectangle shutter_des_rect; + Evas_Object *rect_image; +#endif + + int win_width; + int win_height; + + int camfw_video_width; + int camfw_video_height; + + double af_start_x; /* area start coordination */ + double af_start_y; /* area start coordination */ + int af_x; + int af_y; + double camera_focus_w; /* size of focus image */ + double camera_focus_h; /* size of focus image */ + + int touch_lcd_x; /* lcd x */ + int touch_lcd_y; /* lcd y */ + + int preview_offset_x; + int preview_offset_y; + int preview_w; + int preview_h; + + int target_direction; + Evas_Object *toolbar_edje; + + Evas_Object *toolbar_edje_landscape; + Evas_Object *toolbar_edje_portrait; + Evas_Object *toolbar_edje_landscape_inverse; + Evas_Object *toolbar_edje_portrait_inverse; + char *toolbar_edj_file; + struct { + struct { + Evas_Object *edje; + Evas_Object *edje_landscape; + Evas_Object *edje_portrait; + Evas_Object *edje_landscape_inverse; + Evas_Object *edje_portrait_inverse; + + Evas_Object *thumbnail_image; + } quickview_item; + + } toolbar; + + cam_menubar_data toolbar_menu_arrays[CAM_MENU_BAR_LEFT_MAX_NUM]; + + + + Evas_Object *shutterbtn; + Evas_Object *shutterbtn_camera_icon; + Evas_Object *recordingbtn; + Evas_Object *recording_stop_btn; + Evas_Object *backbtn; + Evas_Object *caf_button; + + Evas_Object *focus_edje; + Evas_Object *indicator_edje; + Evas_Object *ev_edje; + Evas_Object *ev_icon_minus_edje; + Evas_Object *ev_icon_plus_edje; + Evas_Object *pinch_edje; + Evas_Object *zoom_edje; + Evas_Object *zoom_text_min_edje; + Evas_Object *zoom_text_max_edje; + Evas_Object *recording_edje; + Evas_Object *capturebtn_edje; + + Evas_Object *guideline_edje; + + Evas_Object *progressbar_edje; + Evas_Object *progressbar; + + Evas_Object *gps_radio; /* radio button */ + Evas_Object *guideline_radio; /* radio button */ + Evas_Object *autocontrast_radio; + Evas_Object *antishake_radio; + Evas_Object *outdoor_visibility_radio; + Evas_Object *burst_shot_mode_radio; + Evas_Object *capture_by_voice_radio; + Evas_Object *save_as_flip_radio; + Elm_Object_Item *setting_select_item; + + Evas_Object *genlist; + Evas_Object *sub_genlist; + Evas_Object *sub_menu_group; + int sub_menu_type; + int sub_menu_index; + + bool show_setting_popup_after_rotate; + bool show_edit_shortcuts_popup_after_rotate; + + Evas_Object *toolbar_setting_popup; + Evas_Object *toolbar_setting_popup_area; + + Evas_Object *setting_ctxpopup; + Evas_Object *ctxpopup_area; + + Evas_Object *edit_shortcuts_popup; + Evas_Object *edit_shortcuts_popup_ctx; + Evas_Object *edit_shortcuts_popup_scroll; + Evas_Object *edit_shortcuts_popup_description;/*note: text part*/ + + Evas_Object *tip_popup; + int tip_popup_type; + + /* continous */ + struct { + Evas_Object *layout_edje; + Evas_Object *gengrid; + Eina_List *item_list; + } conti_review; + + /* panorama */ + Evas_Object *progress_popup; + Evas_Object *progress_popup_bar; + + Ecore_Event_Handler *key_up; + Ecore_Event_Handler *key_down; + Ecore_Event_Handler *mouse_up; + Ecore_Event_Handler *mouse_down; + + Ecore_Idler *recording_commit; + + /* Idle handler of capture callback. wh01.cho@samsung.com. 2010-12-15. */ + Ecore_Idler *still_captured_idle; + Ecore_Idler *capture_idle; + GList *capture_cb_list; + + Ecore_Timer *rec_icon_updater; + Ecore_Timer *rec_time_updater; + Ecore_Timer *rec_pause_timer; + + Ecore_Timer *check_af_timer; + Ecore_Timer *continuous_shot_timer; + Ecore_Timer *shutter_long_tap_timer; /*long tap timer for AF*/ + gboolean emit_continuous_shutter; /*record: continous have been emitted*/ + gboolean continuous_shot_by_hard_key; /* continuous shot triggered by hard key */ + + Evas_Object *waring_popup; + Evas_Object *confirm_popup; + int recording_state; + + /* auto shot */ + Ecore_Idler *auto_shot_idle; + + /* best shot */ + + Evas_Object *bestshot_thumbnails_edje; + + /* general */ + Ecore_Timer *timeout_checker; + Ecore_Timer *setting_toolbar_hide_timer; + + Ecore_Timer *gps_animation_timer; + Ecore_Timer *battery_animation_timer; + + Ecore_Timer *continuous_af_timer; + Ecore_Timer *focus_guide_hide_timer; + + int toolbar_hided; + + bool timer_activated; + Ecore_Timer *timer_timer; + int timer_count; + Evas_Object *timer_icon_edje; + + CamAppData *camapp_handle; + ShortCutData *shortcut_data; /*save now moving or touch shortcut*/ + ShortCutData *swap_data; /*save now covering shortcuts*/ + + /* Launching Mode */ + int launching_mode; + /* ug service mime type*/ + char *service_mime; + /* exe args */ + CamExeArgs *exe_args; + + /* Thread for file register */ + pthread_t file_reg_thread; + pthread_mutex_t file_reg_mutex; + pthread_cond_t file_reg_cond; + GQueue *file_reg_queue; + + pthread_t camera_start_thread; + + ui_gadget_h camera_ug; + + ui_gadget_h imageviewer_ug; + gboolean ug_is_deleting_process; /*note: now ug is deleting process, and run into camera preview process*/ + service_h imageviewer_service; + + ui_gadget_h location_ug; + + int mm_state; + gboolean isGrabed; + + Ecore_Idler *update_thumbnail_idler; + + Ecore_Timer *longpress_timer; + gboolean up_key; + + int cancel_key_press; + int is_recording; + + gboolean path_in_return; + int displayed_setting_popup; + int enable_mode_change; + int stop_continuous_shot; + /*check out low battery */ + gboolean battery_status; + /*check torch light*/ + gboolean torchlight_on; + + gboolean is_calling; + + int fw_error_type; +#ifdef USE_CAMERA_APP_SHUTTER_SOUND + int play_rec_sound; +#endif + int last_camera_zoom_mode; + + /* guide screen */ + Evas_Object *shot_mode_guide_popup; + + service_h service_handle; + cam_menu_composer* setting_menu_composer; + cam_menu_composer* sub_menu_composer; + + /*note: remained_count*/ + int remained_count; + sensor_h sensor; + CamErrorType error_type; +}; + + + +extern void *handle; +gboolean open_cam_ext_handle(); +void close_cam_ext_handle(); +gboolean cam_toolbar_menu_config_init(void *data, int mode); +gboolean cam_toolbar_menu_config_update(void *data); + +#endif /* __DEF_CAM_H__ */ |