2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "cam_debug.h"
22 #include "cam_property.h"
23 #include "cam_typeconverter.h"
25 typedef struct _CamMMHandle {
31 static unsigned int g_caps = 0;
32 static int g_caps_cb_cnt = 0;
35 static void __get_effect_cb(camera_attr_effect_mode_e effect, void *user_data);
38 void rec_detail_error_get(int err_no)
41 case RECORDER_ERROR_INVALID_PARAMETER:
42 DEBUG_TRACE("RECORDER_ERROR_INVALID_PARAMETER");
44 case RECORDER_ERROR_INVALID_STATE:
45 DEBUG_TRACE("RECORDER_ERROR_INVALID_STATE");
47 case RECORDER_ERROR_OUT_OF_MEMORY:
48 DEBUG_TRACE("RECORDER_ERROR_OUT_OF_MEMORY");
50 case RECORDER_ERROR_DEVICE:
51 DEBUG_TRACE("RECORDER_ERROR_DEVICE");
53 case RECORDER_ERROR_INVALID_OPERATION:
54 DEBUG_TRACE("RECORDER_ERROR_INVALID_OPERATION");
56 case RECORDER_ERROR_SOUND_POLICY:
57 DEBUG_TRACE("RECORDER_ERROR_SOUND_POLICY");
59 case RECORDER_ERROR_NONE:
60 DEBUG_TRACE("NO ERROR");
63 DEBUG_TRACE("unknown error,err_no = %d", err_no);
68 void cam_detail_error_get(int err_no)
71 case CAMERA_ERROR_INVALID_PARAMETER:
72 DEBUG_TRACE("CAMERA_ERROR_INVALID_PARAMETER");
74 case CAMERA_ERROR_INVALID_STATE:
75 DEBUG_TRACE("CAMERA_ERROR_INVALID_STATE");
77 case CAMERA_ERROR_OUT_OF_MEMORY:
78 DEBUG_TRACE("CAMERA_ERROR_OUT_OF_MEMORY");
80 case CAMERA_ERROR_DEVICE:
81 DEBUG_TRACE("CAMERA_ERROR_DEVICE");
83 case CAMERA_ERROR_INVALID_OPERATION:
84 DEBUG_TRACE("CAMERA_ERROR_INVALID_OPERATION");
86 case CAMERA_ERROR_SOUND_POLICY:
87 DEBUG_TRACE("CAMERA_ERROR_SOUND_POLICY");
89 case CAMERA_ERROR_NONE:
90 DEBUG_TRACE("NO ERROR");
93 DEBUG_TRACE("unknown error,err_no = %d", err_no);
99 static CamMMHandle *g_mm_handle = NULL;
101 int cam_mm_get_cam_state(void)
103 g_return_val_if_fail(g_mm_handle, FALSE);
104 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
106 camera_state_e state = 0;
107 ret = camera_get_state(g_mm_handle->hcam, &state);
108 if (ret == CAMERA_ERROR_NONE)
114 int cam_mm_get_state(void)
116 g_return_val_if_fail(g_mm_handle, FALSE);
118 camera_state_e state = 0;
119 struct appdata *ad = (struct appdata *)cam_appdata_get();
120 CamAppData *camapp = ad->camapp_handle;
121 if (camapp->camera_mode == CAM_CAMERA_MODE) {
122 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
123 ret = camera_get_state(g_mm_handle->hcam, (camera_state_e *)&state);
124 if (ret == CAMERA_ERROR_NONE)
129 if (camapp->camera_mode == CAM_CAMCORDER_MODE) {
130 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
131 ret = recorder_get_state(g_mm_handle->hrec, (recorder_state_e *)&state);
132 if (ret == RECORDER_ERROR_NONE)
141 int cam_mm_get_rec_state(void)
143 g_return_val_if_fail(g_mm_handle, FALSE);
144 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
146 recorder_state_e state = 0;
147 ret = recorder_get_state(g_mm_handle->hrec, (recorder_state_e *)&state);
148 if (ret == RECORDER_ERROR_NONE)
154 gboolean cam_mm_get_video_device(int *device)
156 g_return_val_if_fail(g_mm_handle, FALSE);
158 if (g_mm_handle->hdev < CAMERA_DEVICE_CAMERA0 || g_mm_handle->hdev > CAMERA_DEVICE_CAMERA1)
161 *device = g_mm_handle->hdev;
162 DEBUG_TRACE("%d,%d",g_mm_handle->hdev,*device);
166 gboolean cam_mm_get_video_size(int *width, int *height)
169 g_return_val_if_fail(g_mm_handle, FALSE);
170 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
171 ret = camera_get_preview_resolution(g_mm_handle->hcam, width, height);
173 if (ret != CAMERA_ERROR_NONE) {
174 DEBUG_TRACE("camera_get_preview_resolution error code = %d" , ret);
181 gboolean cam_mm_set_video_size(int width, int height)
184 g_return_val_if_fail(g_mm_handle, FALSE);
185 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
187 ret = camera_set_preview_resolution(g_mm_handle->hcam, width, height);
189 if (ret != CAMERA_ERROR_NONE) {
190 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
196 gboolean cam_mm_get_zoom(int *value)
199 g_return_val_if_fail(g_mm_handle, FALSE);
200 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
201 ret = camera_attr_get_zoom(g_mm_handle->hcam, value);
209 gboolean cam_mm_set_zoom(int value)
212 g_return_val_if_fail(g_mm_handle, FALSE);
213 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
215 ret = camera_attr_set_zoom(g_mm_handle->hcam, value);
223 gboolean cam_mm_set_fps(camera_attr_fps_e value)
226 g_return_val_if_fail(g_mm_handle, FALSE);
227 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
229 ret = camera_attr_set_preview_fps(g_mm_handle->hcam, value);
230 if (ret != CAMERA_ERROR_NONE) {
231 cam_detail_error_get(ret);
237 gboolean cam_mm_get_focus_mode(int *value)
240 g_return_val_if_fail(g_mm_handle, FALSE);
241 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
243 ret = camera_attr_get_af_mode(g_mm_handle->hcam, (camera_attr_af_mode_e *)value);
244 if (ret != CAMERA_ERROR_NONE) {
252 gboolean cam_mm_set_focus_mode(int value)
255 ret = camera_attr_set_af_mode(g_mm_handle->hcam, (camera_attr_af_mode_e)value);
256 if (ret != CAMERA_ERROR_NONE) {
263 gboolean cam_mm_get_zoom_valid_intrange(int *min, int *max)
266 g_return_val_if_fail(g_mm_handle, FALSE);
267 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
269 ret = camera_attr_get_zoom_range(g_mm_handle->hcam, min, max);
270 if (ret != CAMERA_ERROR_NONE) {
279 gboolean cam_mm_set_af_area(int x, int y, int w, int h)
282 g_return_val_if_fail(g_mm_handle, FALSE);
283 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
285 DEBUG_TRACE("\n Touch AF area ![ x,y,width,height: %d,%d,%d,%d ]\n", x, y, w, h);
287 ret = camera_attr_set_af_area(g_mm_handle->hcam, x, y);
288 if (ret != CAMERA_ERROR_NONE) {
289 DEBUG_TRACE("camera_attr_set_af_area failed [%d]\n", ret);
296 gboolean cam_mm_get_detect_mode(int *value)
298 #ifndef TODO_SURRPORT
299 /*TODO:framework not surrport it*/
304 gboolean cam_mm_set_detect_mode(int value)
306 /*TODO:libmm-camcorder not surrport it*/
312 gboolean cam_mm_get_image_enc_quality(int *value)
315 g_return_val_if_fail(g_mm_handle, FALSE);
316 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
318 ret = camera_attr_get_image_quality(g_mm_handle->hcam, value);
319 if (ret != CAMERA_ERROR_NONE) {
327 gboolean cam_mm_set_image_enc_quality(int value)
330 g_return_val_if_fail(g_mm_handle, FALSE);
331 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
333 ret = camera_attr_set_image_quality(g_mm_handle->hcam, value);
334 if (ret != CAMERA_ERROR_NONE) {
342 gboolean cam_mm_get_flash(int *value)
345 g_return_val_if_fail(g_mm_handle, FALSE);
346 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
348 ret = camera_attr_get_flash_mode(g_mm_handle->hcam, (camera_attr_flash_mode_e *)value);
349 if (ret != CAMERA_ERROR_NONE) {
356 gboolean cam_mm_set_flash(int value)
359 g_return_val_if_fail(g_mm_handle, FALSE);
360 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
362 ret = camera_attr_set_flash_mode(g_mm_handle->hcam, (camera_attr_flash_mode_e)value);
363 if (ret != CAMERA_ERROR_NONE) {
370 gboolean cam_mm_get_effect(int *value)
373 g_return_val_if_fail(g_mm_handle, FALSE);
374 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
376 ret = camera_attr_get_effect(g_mm_handle->hcam, (camera_attr_effect_mode_e *)value);
377 if (ret != CAMERA_ERROR_NONE) {
385 gboolean cam_mm_set_effect(int value)
388 g_return_val_if_fail(g_mm_handle, FALSE);
389 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
391 ret = camera_attr_set_effect(g_mm_handle->hcam, (camera_attr_effect_mode_e)value);
392 if (ret != CAMERA_ERROR_NONE) {
400 gboolean cam_mm_set_audio_recording(gboolean b_on)
404 g_return_val_if_fail(g_mm_handle, FALSE);
405 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
407 ret = recorder_attr_set_mute(g_mm_handle->hrec, FALSE);
409 ret = recorder_attr_set_mute(g_mm_handle->hrec, TRUE);
411 if (ret != RECORDER_ERROR_NONE) {
412 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
419 gboolean cam_mm_set_image_count(int value)
425 gboolean cam_mm_get_image_size(int *width, int *height)
428 g_return_val_if_fail(g_mm_handle, FALSE);
429 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
431 ret = camera_get_capture_resolution(g_mm_handle->hcam, width, height);
433 if (ret != CAMERA_ERROR_NONE) {
434 DEBUG_TRACE("set attr failed - code[%x] name[%s]\n", ret);
440 gboolean cam_mm_set_image_size(int width, int height)
443 g_return_val_if_fail(g_mm_handle, FALSE);
444 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
446 g_return_val_if_fail(g_mm_handle, FALSE);
447 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
449 ret = camera_set_capture_resolution(g_mm_handle->hcam, width, height);
451 if (ret != CAMERA_ERROR_NONE) {
452 DEBUG_TRACE("cam_mm_set_image_size failed");
458 gboolean cam_mm_set_video_encoder_bitrate(int bitrate)
460 recorder_error_e ret;
461 g_return_val_if_fail(g_mm_handle, FALSE);
462 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
464 ret = recorder_attr_set_video_encoder_bitrate(g_mm_handle->hrec, bitrate);
465 if (ret != RECORDER_ERROR_NONE) {
471 gboolean cam_mm_set_audio_encoder_bitrate(int bitrate)
473 recorder_error_e ret;
474 g_return_val_if_fail(g_mm_handle, FALSE);
475 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
477 ret = recorder_attr_set_audio_encoder_bitrate(g_mm_handle->hrec, bitrate);
478 if (ret != RECORDER_ERROR_NONE) {
484 gboolean cam_mm_set_display_device(int display_device, void *xid)
487 g_return_val_if_fail(g_mm_handle, FALSE);
488 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
490 ret = camera_set_display(g_mm_handle->hcam, display_device, xid);
491 if (ret != CAMERA_ERROR_NONE) {
498 gboolean cam_mm_set_display_rotate(int rotate)
501 g_return_val_if_fail(g_mm_handle, FALSE);
502 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
504 ret = camera_set_x11_display_rotation(g_mm_handle->hcam, rotate);
505 if (ret != CAMERA_ERROR_NONE) {
512 gboolean cam_mm_set_camera_rotate(int camera_rotate)
515 g_return_val_if_fail(g_mm_handle, FALSE);
516 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
518 #ifdef CAMERA_MACHINE_I686
519 ret = camera_attr_set_stream_rotation(g_mm_handle->hcam, 0);
521 ret = camera_attr_set_stream_rotation(g_mm_handle->hcam, camera_rotate);
523 if (ret != CAMERA_ERROR_NONE) {
524 cam_detail_error_get(ret);
531 gboolean cam_mm_get_display_geometry_method(int *value)
534 g_return_val_if_fail(g_mm_handle, FALSE);
535 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
537 ret = camera_get_x11_display_mode(g_mm_handle->hcam, (camera_display_mode_e *)value);
538 if (ret != CAMERA_ERROR_NONE) {
545 gboolean cam_mm_set_display_geometry_method(int value)
548 g_return_val_if_fail(g_mm_handle, FALSE);
549 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
551 ret = camera_set_x11_display_mode(g_mm_handle->hcam, (camera_display_mode_e)value);
552 if (ret != CAMERA_ERROR_NONE) {
558 gboolean cam_mm_set_display_visible(gboolean visible)
562 g_return_val_if_fail(g_mm_handle, FALSE);
563 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
565 ret = camera_set_x11_display_visible(g_mm_handle->hcam, visible);
566 if (ret != RECORDER_ERROR_NONE) {
573 gboolean cam_mm_set_filename(const gchar *filename)
576 /*char *err_name = NULL;*/
578 g_return_val_if_fail(g_mm_handle, FALSE);
579 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
582 ret = recorder_set_filename(g_mm_handle->hrec, filename);
583 if (ret != RECORDER_ERROR_NONE) {
594 gboolean cam_mm_get_filename(char **filename, gint *size)
598 g_return_val_if_fail(g_mm_handle, FALSE);
599 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
601 ret = recorder_get_filename(g_mm_handle->hrec, filename);
602 if (ret != RECORDER_ERROR_NONE) {
609 #ifdef ENABLE_CAPTURE_ANIMATION
610 gboolean cam_mm_get_screennail(MMCamcorderCaptureDataType **scrnl)
613 char *err_name = NULL;
615 MMCamcorderCaptureDataType *capture_struct = NULL;
617 /* This is not the size of screennail buffer, this is a size of MMCamcorderCaptureDataType struct */
618 g_return_val_if_fail(g_mm_handle, FALSE);
619 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
621 ret = mm_camcorder_get_attributes(g_mm_handle->hmm, &err_name,
622 "captured-screennail",
623 &capture_struct, &size, NULL);
625 if (ret != CAMERA_ERROR_NONE) {
626 printf("set attr failed - code[%x] name[%s]\n", ret, err_name);
633 *scrnl = capture_struct;
640 gboolean cam_mm_get_max_size(int *value)
642 recorder_error_e ret;
643 g_return_val_if_fail(g_mm_handle, FALSE);
644 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
645 ret = recorder_attr_get_time_limit(g_mm_handle->hrec, value);
646 if (ret != RECORDER_ERROR_NONE) {
654 gboolean cam_mm_get_max_time(int *value)
656 recorder_error_e ret;
657 g_return_val_if_fail(g_mm_handle, FALSE);
658 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
660 ret = recorder_attr_get_time_limit(g_mm_handle->hrec, value);
661 if (ret != RECORDER_ERROR_NONE) {
669 gboolean cam_mm_set_max_size(int max_val)
671 recorder_error_e ret;
672 g_return_val_if_fail(g_mm_handle, FALSE);
673 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
675 ret = recorder_attr_set_size_limit(g_mm_handle->hrec, max_val);
676 if (ret != RECORDER_ERROR_NONE) {
682 gboolean cam_mm_get_tag_enable(int *value)
685 g_return_val_if_fail(g_mm_handle, FALSE);
686 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
688 ret = camera_attr_is_enabled_tag(g_mm_handle->hcam, (bool *)value);
689 if (ret != CAMERA_ERROR_NONE) {
697 gboolean cam_mm_set_tag_enable(gboolean bvalue)
700 g_return_val_if_fail(g_mm_handle, FALSE);
701 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
703 ret = camera_attr_enable_tag(g_mm_handle->hcam, (bool)bvalue);
704 if (ret != CAMERA_ERROR_NONE) {
711 gboolean cam_mm_set_tag_img_orient(int orient)
713 g_return_val_if_fail(g_mm_handle, FALSE);
714 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
716 ret = camera_attr_set_tag_orientation(g_mm_handle->hcam, (camera_attr_tag_orientation_e)orient);
717 if (ret != CAMERA_ERROR_NONE) {
718 cam_detail_error_get(ret);
726 gboolean cam_mm_set_file_format(int format)
728 recorder_error_e ret;
729 g_return_val_if_fail(g_mm_handle, FALSE);
730 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
731 ret = recorder_set_file_format(g_mm_handle->hrec, format);
732 if (ret != RECORDER_ERROR_NONE) {
739 gboolean cam_mm_set_video_profile(void)
743 g_return_val_if_fail(g_mm_handle, FALSE);
744 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
746 e = recorder_attr_set_audio_device(g_mm_handle->hrec, RECORDER_AUDIO_DEVICE_MIC);
747 if (e != RECORDER_ERROR_NONE) {
748 DEBUG_TRACE("set attr failed - code[%x]\n", e);
749 rec_detail_error_get(e);
753 e = recorder_set_file_format(g_mm_handle->hrec, RECORDER_FILE_FORMAT_3GP);
754 if (e != RECORDER_ERROR_NONE) {
755 DEBUG_TRACE("set attr failed - code[%x]\n", e);
756 rec_detail_error_get(e);
762 gboolean cam_mm_set_codec(int audio_codec, int video_codec)
766 g_return_val_if_fail(g_mm_handle, FALSE);
767 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
769 e = recorder_set_audio_encoder(g_mm_handle->hrec, audio_codec);
770 if (e != RECORDER_ERROR_NONE) {
771 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
772 rec_detail_error_get(ret);
775 e = recorder_set_video_encoder(g_mm_handle->hrec, video_codec);
776 if (e != RECORDER_ERROR_NONE) {
777 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
783 gboolean cam_mm_set_audio_source(int sample_rate, int format, int channel)
787 g_return_val_if_fail(g_mm_handle, FALSE);
788 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
789 e = recorder_attr_set_audio_samplerate(g_mm_handle->hrec, sample_rate);
790 if (e != RECORDER_ERROR_NONE) {
791 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
794 e = recorder_attr_set_audio_channel(g_mm_handle->hrec, channel);
795 if (e != RECORDER_ERROR_NONE) {
796 DEBUG_TRACE("set attr failed - code[%x]\n", ret);
802 gboolean cam_mm_set_video_source_format(int format)
804 if (format <= CAMERA_PIXEL_FORMAT_INVALID || format > CAMERA_PIXEL_FORMAT_JPEG)
808 g_return_val_if_fail(g_mm_handle, FALSE);
809 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
810 err = camera_set_preview_format(g_mm_handle->hcam, format);
811 if (err != CAMERA_ERROR_NONE) {
818 gboolean cam_mm_get_video_source_format(const char *attribute_name, int *format)
820 DEBUG_TRACE("attribute_name = %s", attribute_name);
822 g_return_val_if_fail(g_mm_handle, FALSE);
823 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
824 err = camera_get_preview_format(g_mm_handle->hcam, format);
825 if (err != CAMERA_ERROR_NONE) {
832 gboolean cam_mm_get_front_cam_display_rotate_value(int *value, int *rotate)
835 g_return_val_if_fail(g_mm_handle, FALSE);
836 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
837 err = camera_attr_get_lens_orientation(g_mm_handle->hcam, value);
840 *rotate = CAMERA_ROTATION_NONE;
843 *rotate = CAMERA_ROTATION_90;
846 *rotate = CAMERA_ROTATION_180;
849 *rotate = CAMERA_ROTATION_270;
852 *rotate = CAMERA_ROTATION_NONE;
855 if (err != CAMERA_ERROR_NONE) {
864 gboolean cam_mm_set_capture_format(int value)
867 g_return_val_if_fail(g_mm_handle, FALSE);
868 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
870 err = camera_set_capture_format(g_mm_handle->hcam, value);
871 if (err != CAMERA_ERROR_NONE) {
879 gboolean cam_mm_get_shutter_sound(int *value)
881 /*todo:for lawer policy, capi could not surport it*/
882 #ifndef TODO_SURRPORT
883 return cam_mm_get_attr_int(MMCAM_SHUTTER_SOUND, value);
889 gboolean cam_mm_set_shutter_sound(int value)
891 /*todo:for lawer policy, capi could not surport it*/
892 #ifndef TODO_SURRPORT
893 return cam_mm_set_attr_int(MMCAM_SHUTTER_SOUND, value);
900 gboolean cam_mm_reset_recording_motion_fps()
903 g_return_val_if_fail(g_mm_handle, FALSE);
904 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
906 ret = recorder_attr_set_recording_motion_rate(g_mm_handle->hrec, DEFAULT_REC_FPS);
907 if (ret != RECORDER_ERROR_NONE) {
914 gboolean cam_mm_preview_start(int mode)
916 g_return_val_if_fail(g_mm_handle, FALSE);
917 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
919 struct appdata *ad = (struct appdata *)cam_appdata_get();
920 g_return_val_if_fail(ad, FALSE);
922 int ret = (mode == CAM_CAMERA_MODE) ? CAMERA_ERROR_NONE : RECORDER_ERROR_NONE;
923 if (CAM_CAMERA_MODE == mode) {
925 ret = camera_start_preview(g_mm_handle->hcam);
926 if (ret != CAMERA_ERROR_NONE) {
927 if (ret == CAMERA_ERROR_SOUND_POLICY) {
928 ad->is_calling = CAMERA_ERROR_SOUND_POLICY;
929 } else if (ret == CAMERA_ERROR_SECURITY_RESTRICTED) {
930 cam_app_mdm_syspopup(ad);
933 cam_critical(LOG_MM, "camera_start_preview failed");
937 cam_debug(LOG_MM, " ret : %d", ret);
939 }else if (CAM_CAMCORDER_MODE == mode) {
941 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
943 ret = recorder_prepare(g_mm_handle->hrec);
944 if (ret != RECORDER_ERROR_NONE) {
945 if (ret == RECORDER_ERROR_SOUND_POLICY) {
946 ad->is_calling = RECORDER_ERROR_SOUND_POLICY;
947 } else if (ret == RECORDER_ERROR_SECURITY_RESTRICTED) {
948 cam_app_mdm_syspopup(ad);
951 cam_critical(LOG_MM, "camera_start_preview failed");
955 cam_debug(LOG_MM, " ret : %d", ret);
962 gboolean cam_mm_preview_stop(int mode)
965 g_return_val_if_fail(g_mm_handle, FALSE);
966 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
968 if (CAM_CAMERA_MODE == mode) {
969 state = cam_mm_get_cam_state();
970 cam_debug(LOG_MM, " camera state : %d", state);
971 /*todo:please consider recorder and camera*/
976 case CAMERA_STATE_NONE:
979 case CAMERA_STATE_CREATED:
980 /* stop state return TRUE; */
982 case CAMERA_STATE_PREVIEW:
983 CHECK_MM_ERROR(camera_stop_preview(g_mm_handle->hcam));
985 case CAMERA_STATE_CAPTURING:
993 }else if (CAM_CAMCORDER_MODE == mode) {
995 state = cam_mm_get_rec_state();
996 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
997 cam_debug(LOG_MM, " camera state : %d", state);
998 /*todo:please consider recorder and camera*/
1003 case RECORDER_STATE_NONE:
1006 case RECORDER_STATE_CREATED:
1007 /* stop state return TRUE; */
1009 case RECORDER_STATE_READY:
1010 CHECK_MM_ERROR(recorder_unprepare(g_mm_handle->hrec));
1012 case RECORDER_STATE_RECORDING:
1015 case RECORDER_STATE_PAUSED:
1028 gboolean cam_mm_is_created(void)
1030 debug_fenter(LOG_MM);
1037 gboolean cam_mm_create(int camera_type, int mode)
1039 CAM_TA_ACUM_ITEM_BEGIN("----cam_mm_create", 0);
1041 ("--------------------------------START----------------------------");
1042 DEBUG_TRACE("camera_type = %d" ,camera_type);
1044 cam_critical(LOG_MM, "The mm handle is already created");
1047 g_return_val_if_fail(g_mm_handle == NULL, FALSE);
1050 e = camera_create(camera_type, &hcam);
1051 if (e != CAMERA_ERROR_NONE) {
1052 DEBUG_TRACE("[ERROR] camera_create - error(%d)", e);
1055 g_return_val_if_fail(hcam, FALSE);
1056 recorder_h hrec = NULL;
1057 if (mode == CAM_CAMCORDER_MODE) {
1058 recorder_error_e re;
1059 re = recorder_create_videorecorder(hcam, &hrec);
1060 if (re != RECORDER_ERROR_NONE) {
1061 DEBUG_TRACE("[ERROR] camera_create - error(%d)", e);
1062 recorder_destroy(hrec);
1063 camera_destroy(hcam);
1066 g_return_val_if_fail(hcam, FALSE);
1068 g_mm_handle = g_new0(CamMMHandle, 1);
1070 g_mm_handle->hcam = hcam;
1071 g_mm_handle->hdev = camera_type;
1072 g_mm_handle->hrec = hrec;
1074 DEBUG_TRACE("camera_type = %d" , g_mm_handle->hdev);
1076 DEBUG_TRACE("--------------END---------------");
1077 CAM_TA_ACUM_ITEM_BEGIN("----cam_mm_create", 0);
1079 return g_mm_handle ? TRUE : FALSE;
1083 gboolean cam_mm_destory(void)
1086 g_return_val_if_fail(g_mm_handle, FALSE);
1087 struct appdata *ad = (struct appdata *)cam_appdata_get();
1088 g_return_val_if_fail(ad, FALSE);
1089 CamAppData *camapp = ad->camapp_handle;
1090 g_return_val_if_fail(camapp, FALSE);
1091 if (camapp->camera_mode == CAM_CAMCORDER_MODE) {
1092 if (g_mm_handle->hrec) {
1093 state = cam_mm_get_state();
1094 DEBUG_TRACE("camera state : %d\n",
1096 if (state != RECORDER_STATE_CREATED) { /*no need delete*/
1097 /*TODO:now capi, have to change with camera and rec handle*/
1099 ("[cam_mm_destory] Camera state is not match : %d\n",
1103 CHECK_MM_ERROR(recorder_destroy(g_mm_handle->hrec));/*TODO:there is issue about in rec,to delete rec and cam handle*/
1104 CHECK_MM_ERROR(camera_destroy(g_mm_handle->hcam));
1105 g_mm_handle->hcam = 0;
1106 g_mm_handle->hrec = 0;
1107 g_mm_handle->hdev = -1;
1110 } else if (camapp->camera_mode == CAM_CAMERA_MODE) {
1111 state = cam_mm_get_state();
1112 DEBUG_TRACE("camera state : %d\n",
1114 if (state != CAMERA_STATE_CREATED) {
1116 ("[cam_mm_destory] Camera state is not match : %d\n",
1120 CHECK_MM_ERROR(camera_destroy(g_mm_handle->hcam));
1122 g_mm_handle->hcam = 0;
1123 g_mm_handle->hrec = 0;
1124 g_mm_handle->hdev = -1;
1127 g_free(g_mm_handle);
1133 gboolean cam_mm_continuous_capture_start(int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data)
1135 g_return_val_if_fail(g_mm_handle, FALSE);
1136 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1138 cam_debug(LOG_MM, "");
1139 CAM_TA_ACUM_ITEM_END(" camera key to capture start", 0);
1141 if (cam_mm_get_state() == CAMERA_STATE_PREVIEW) {
1142 CAM_TA_ACUM_ITEM_BEGIN("camera_start_continuous_capture", 0);
1143 CHECK_MM_ERROR(camera_start_continuous_capture(g_mm_handle->hcam, count, interval, capturing_cb, completed_cb, user_data));
1144 CAM_TA_ACUM_ITEM_END("camera_start_continuous_capture", 0);
1146 printf("[%s:%d] operation failed - state:%d \n", __func__,
1147 __LINE__, cam_mm_get_state());
1154 gboolean cam_mm_capture_start(camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data)
1156 g_return_val_if_fail(g_mm_handle, FALSE);
1157 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1159 cam_debug(LOG_MM, "");
1160 CAM_TA_ACUM_ITEM_END(" camera key to capture start", 0);
1162 if (cam_mm_get_state() == CAMERA_STATE_PREVIEW
1163 || cam_mm_get_state() == RECORDER_STATE_RECORDING) {
1164 CAM_TA_ACUM_ITEM_BEGIN("camera_start_capture", 0);
1165 CHECK_MM_ERROR(camera_start_capture(g_mm_handle->hcam, capturing_cb, completed_cb, user_data));
1166 CAM_TA_ACUM_ITEM_END("mm_camcorder_capture_start", 0);
1168 printf("[%s:%d] operation failed - state:%d \n", __func__,
1169 __LINE__, cam_mm_get_state());
1175 gboolean cam_mm_capture_stop(gboolean skip_preview, CamMode mode)
1177 int state = CAMERA_STATE_NONE;/*TODO:now the value is same to record*/
1179 g_return_val_if_fail(g_mm_handle, FALSE);
1180 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1182 cam_debug(LOG_MM, " start");
1184 state = cam_mm_get_state();
1185 if (state == RECORDER_STATE_READY && skip_preview == FALSE && mode == CAM_CAMCORDER_MODE) {
1186 CHECK_MM_ERROR(recorder_prepare(g_mm_handle->hrec));
1188 printf("[%s:%d] operation failed - state:%d \n", __func__,
1189 __LINE__, cam_mm_get_state());
1193 cam_debug(LOG_MM, " done");
1198 gboolean cam_mm_rec_start()
1201 g_return_val_if_fail(g_mm_handle, FALSE);
1202 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1204 state = cam_mm_get_state();
1205 if ((state == RECORDER_STATE_READY)
1206 || (state == RECORDER_STATE_PAUSED)) {
1207 CHECK_MM_ERROR(recorder_start(g_mm_handle->hrec));
1209 DEBUG_TRACE("operation failed - state:%d \n", state);
1215 gboolean cam_mm_rec_stop(gboolean to_stop)
1218 g_return_val_if_fail(g_mm_handle, FALSE);
1219 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1221 state = cam_mm_get_state();
1222 if ((state == RECORDER_STATE_RECORDING)
1223 || (state == RECORDER_STATE_PAUSED)) {
1225 CHECK_MM_ERROR(recorder_commit(g_mm_handle->hrec));
1227 CHECK_MM_ERROR(recorder_commit(g_mm_handle->hrec));
1228 CHECK_MM_ERROR(recorder_unprepare(g_mm_handle->hrec));
1231 printf("[%s:%d] operation failed - state:%d \n", __func__,
1238 gboolean cam_mm_rec_pause()
1241 g_return_val_if_fail(g_mm_handle, FALSE);
1242 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1244 state = cam_mm_get_state();
1245 if ((state == RECORDER_STATE_RECORDING)) {
1246 CHECK_MM_ERROR(recorder_pause(g_mm_handle->hrec));
1248 printf("[%s:%d] operation failed - state:%d \n", __func__,
1255 gboolean cam_mm_rec_cancel()
1258 g_return_val_if_fail(g_mm_handle, FALSE);
1259 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1261 state = cam_mm_get_state();
1262 if ((state == RECORDER_STATE_RECORDING)
1263 || (state == RECORDER_STATE_PAUSED)) {
1264 CHECK_MM_ERROR(recorder_cancel(g_mm_handle->hrec));
1266 printf("[%s:%d] operation failed - state:%d \n", __func__,
1273 gboolean cam_mm_session_init(sound_session_type_e session_type)
1275 int ret = SOUND_MANAGER_ERROR_NONE;
1276 if (ret != sound_manager_set_session_type(session_type)) {
1277 DEBUG_TRACE("[%s:%d] operation failed - session_type:%d \n",
1278 __func__, __LINE__, session_type);
1284 gboolean cam_mm_start_focusing(gint af_mode)
1288 g_return_val_if_fail(g_mm_handle, FALSE);
1289 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1291 cam_debug(LOG_UI, "");
1292 state = cam_mm_get_state();
1293 if (state == CAMERA_STATE_PREVIEW
1294 || state == CAMERA_STATE_CREATED) {
1297 CHECK_MM_ERROR(camera_start_focusing(g_mm_handle->hcam, TRUE));
1300 CHECK_MM_ERROR(camera_start_focusing(g_mm_handle->hcam, FALSE));
1303 DEBUG_TRACE("Start focus operation failed - invalid state:%d \n", state);
1310 gboolean cam_mm_stop_focusing()
1314 g_return_val_if_fail(g_mm_handle, FALSE);
1315 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1317 cam_debug(LOG_UI, "");
1319 state = cam_mm_get_state();
1320 if (state == CAMERA_STATE_PREVIEW
1321 || state == CAMERA_STATE_CREATED
1322 || state == RECORDER_STATE_RECORDING) {
1323 /*TODO:please think rec mod, but now the rec and cam mode state value is same*/
1324 CHECK_MM_ERROR(camera_cancel_focusing(g_mm_handle->hcam));
1327 ("[%s:%d] Stop focus operation failed - invalid state:%d \n",
1328 __func__, __LINE__, state);
1335 gboolean cam_mm_set_error_cb(camera_error_cb error_cb, void *data)
1338 g_return_val_if_fail(g_mm_handle, FALSE);
1339 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1340 e = camera_set_error_cb(g_mm_handle->hcam, error_cb, data);
1341 if (e != CAMERA_ERROR_NONE) {
1342 DEBUG_TRACE("[ERROR] camera_set_error_cb - error(%d)", e);
1349 gboolean cam_mm_unset_error_cb(void)
1352 g_return_val_if_fail(g_mm_handle, FALSE);
1353 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1354 e = camera_unset_error_cb(g_mm_handle->hcam);
1355 if (e != CAMERA_ERROR_NONE) {
1356 DEBUG_TRACE("[ERROR] camera_unset_error_cb - error(%d)", e);
1363 gboolean cam_mm_set_state_changed_cb(camera_state_changed_cb state_cb, void *data)
1366 g_return_val_if_fail(g_mm_handle, FALSE);
1367 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1369 e = camera_set_state_changed_cb(g_mm_handle->hcam, state_cb, data);
1370 if (e != CAMERA_ERROR_NONE) {
1371 DEBUG_TRACE("[ERROR] camera_set_state_changed_cb - error(%d)", e);
1377 gboolean cam_mm_unset_state_changed_cb(void)
1380 g_return_val_if_fail(g_mm_handle, FALSE);
1381 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1383 e = camera_unset_state_changed_cb(g_mm_handle->hcam);
1384 if (e != CAMERA_ERROR_NONE) {
1385 DEBUG_TRACE("[ERROR] camera_unset_state_changed_cb - error(%d)", e);
1392 gboolean cam_mm_set_focus_changed_cb(camera_focus_changed_cb focus_cb, void *data)
1395 g_return_val_if_fail(g_mm_handle, FALSE);
1396 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1398 e = camera_set_focus_changed_cb(g_mm_handle->hcam, focus_cb, data);
1399 if (e != CAMERA_ERROR_NONE) {
1400 DEBUG_TRACE("[ERROR] camera_set_focus_changed_cb - error(%d)", e);
1406 gboolean cam_mm_unset_focus_changed_cb(void)
1409 g_return_val_if_fail(g_mm_handle, FALSE);
1410 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1412 e = camera_unset_focus_changed_cb(g_mm_handle->hcam);
1413 if (e != CAMERA_ERROR_NONE) {
1414 DEBUG_TRACE("[ERROR] camera_unset_focus_changed_cb - error(%d)", e);
1420 gboolean cam_mm_set_preview_cb(camera_preview_cb preview_cb, void *data)
1423 g_return_val_if_fail(g_mm_handle, FALSE);
1424 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1426 e = camera_set_preview_cb(g_mm_handle->hcam, preview_cb, data);
1427 if (e != CAMERA_ERROR_NONE) {
1428 DEBUG_TRACE("[ERROR] camera_set_preview_cb - error(%d)", e);
1435 gboolean cam_mm_unset_preview_cb(void)
1438 g_return_val_if_fail(g_mm_handle, FALSE);
1439 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1441 e = camera_unset_preview_cb(g_mm_handle->hcam);
1442 if (e != CAMERA_ERROR_NONE) {
1443 DEBUG_TRACE("[ERROR] camera_unset_preview_cb - error(%d)", e);
1450 #ifndef CAPI_CAMERA_NEW/*TODO:the capi have changed, but they have not upload pkg,if uploaded, delete these*/
1451 gboolean cam_mm_set_capturing_cb(camera_capturing_cb capture_cb, void *data)
1454 g_return_val_if_fail(g_mm_handle, FALSE);
1455 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1457 e = camera_set_capturing_cb(g_mm_handle->hcam, capture_cb, data);
1458 if (e != CAMERA_ERROR_NONE) {
1459 DEBUG_TRACE("[ERROR] cam_mm_set_capturing_cb - error(%d)", e);
1465 gboolean cam_mm_unset_capturing_cb(void)
1468 g_return_val_if_fail(g_mm_handle, FALSE);
1469 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1471 e = camera_unset_capturing_cb(g_mm_handle->hcam);
1472 if (e != CAMERA_ERROR_NONE) {
1473 DEBUG_TRACE("[ERROR] camera_unset_capturing_cb - error(%d)", e);
1479 gboolean cam_mm_set_capture_completed_cb(camera_capture_completed_cb capture_completed_cb, void *data)
1482 g_return_val_if_fail(g_mm_handle, FALSE);
1483 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1485 e = camera_set_capture_completed_cb(g_mm_handle->hcam, capture_completed_cb, data);
1486 if (e != CAMERA_ERROR_NONE) {
1487 DEBUG_TRACE("[ERROR] cam_mm_set_capture_completed_cb - error(%d)", e);
1493 gboolean cam_mm_unset_capture_completed_cb(void)
1496 g_return_val_if_fail(g_mm_handle, FALSE);
1497 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1499 e = camera_unset_capture_completed_cb(g_mm_handle->hcam);
1500 if (e != CAMERA_ERROR_NONE) {
1501 DEBUG_TRACE("[ERROR] camera_unset_capture_completed_cb - error(%d)", e);
1509 gboolean cam_mm_set_camera_interrupted_cb(camera_interrupted_cb callback, void *data){
1512 g_return_val_if_fail(g_mm_handle, FALSE);
1513 g_return_val_if_fail(g_mm_handle->hcam, FALSE);
1515 e = camera_set_interrupted_cb(g_mm_handle->hcam, callback, data);
1516 if (e != CAMERA_ERROR_NONE) {
1517 DEBUG_TRACE("[ERROR] recorder_set_state_changed_cb - error(%d)", e);
1522 gboolean cam_mm_set_recorder_interrupted_cb(recorder_interrupted_cb callback, void *data){
1525 g_return_val_if_fail(g_mm_handle, FALSE);
1526 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1528 e = recorder_set_interrupted_cb(g_mm_handle->hrec, callback, data);
1529 if (e != RECORDER_ERROR_NONE) {
1530 DEBUG_TRACE("[ERROR] recorder_set_state_changed_cb - error(%d)", e);
1536 gboolean cam_mm_recorder_set_state_changed_cb(recorder_state_changed_cb callback, void* user_data)
1539 g_return_val_if_fail(g_mm_handle, FALSE);
1540 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1542 e = recorder_set_state_changed_cb(g_mm_handle->hrec, callback, user_data);
1543 if (e != RECORDER_ERROR_NONE) {
1544 DEBUG_TRACE("[ERROR] recorder_set_state_changed_cb - error(%d)", e);
1545 rec_detail_error_get(e);
1552 gboolean cam_mm_recorder_unset_state_changed_cb(void)
1555 g_return_val_if_fail(g_mm_handle, FALSE);
1556 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1558 e = recorder_unset_state_changed_cb(g_mm_handle->hrec);
1559 if (e != RECORDER_ERROR_NONE) {
1560 DEBUG_TRACE("[ERROR] recorder_set_state_changed_cb - error(%d)", e);
1561 rec_detail_error_get(e);
1568 gboolean cam_mm_recorder_set_recording_status_cb(recorder_recording_status_cb callback, void* user_data)
1571 g_return_val_if_fail(g_mm_handle, FALSE);
1572 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1574 e = recorder_set_recording_status_cb(g_mm_handle->hrec, callback, user_data);
1575 if (e != RECORDER_ERROR_NONE) {
1576 DEBUG_TRACE("[ERROR] recorder_set_recording_status_cb - error(%d)", e);
1577 rec_detail_error_get(e);
1584 gboolean cam_mm_recorder_unset_recording_status_cb(void)
1587 g_return_val_if_fail(g_mm_handle, FALSE);
1588 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1590 e = recorder_unset_recording_status_cb(g_mm_handle->hrec);
1591 if (e != RECORDER_ERROR_NONE) {
1592 DEBUG_TRACE("[ERROR] recorder_unset_recording_status_cb - error(%d)", e);
1593 rec_detail_error_get(e);
1600 gboolean cam_mm_recorder_set_recording_limit_reached_cb(recorder_recording_limit_reached_cb callback, void* user_data)
1603 g_return_val_if_fail(g_mm_handle, FALSE);
1604 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1606 e = recorder_set_recording_limit_reached_cb(g_mm_handle->hrec, callback, user_data);
1607 if (e != RECORDER_ERROR_NONE) {
1608 DEBUG_TRACE("[ERROR] recorder_set_recording_status_cb - error(%d)", e);
1609 rec_detail_error_get(e);
1616 gboolean cam_mm_recorder_unset_recording_limit_reached_cb(void)
1619 g_return_val_if_fail(g_mm_handle, FALSE);
1620 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1622 e = recorder_unset_recording_limit_reached_cb(g_mm_handle->hrec);
1623 if (e != RECORDER_ERROR_NONE) {
1624 DEBUG_TRACE("[ERROR] recorder_unset_recording_status_cb - error(%d)", e);
1625 rec_detail_error_get(e);
1632 gboolean cam_mm_set_recording_motion(double rate)
1634 g_return_val_if_fail(g_mm_handle, FALSE);
1635 g_return_val_if_fail(g_mm_handle->hrec, FALSE);
1638 err = recorder_attr_set_recording_motion_rate(g_mm_handle->hrec, rate);
1639 if (err != RECORDER_ERROR_NONE) {
1640 DEBUG_TRACE("recorder_attr_set_recording_motion_rate failed");
1644 err = recorder_set_video_encoder(g_mm_handle->hrec, RECORDER_VIDEO_CODEC_H264);
1645 if (err != RECORDER_ERROR_NONE) {
1646 DEBUG_TRACE("recorder_set_video_encoder failed");
1650 err = recorder_attr_set_video_encoder_bitrate(g_mm_handle->hrec, 10000000);
1651 if (err != RECORDER_ERROR_NONE) {
1652 DEBUG_TRACE("recorder_attr_set_video_encoder_bitrate failed");
1656 err = recorder_set_file_format(g_mm_handle->hrec, RECORDER_FILE_FORMAT_3GP);
1659 "High speed recording. mm_camcorder_set_attributes fail. %d)", err);
1665 gboolean cam_mm_get_caps_minmax(unsigned int type, int *min, int *max)
1667 if (!cam_mm_is_created()) {
1668 cam_debug(LOG_CAM, "cam_mm_is_created() false");
1672 gboolean ret = TRUE;
1673 int tempmin, tempmax = 0;
1676 case CAM_CP_FUNC_ZOOM:
1678 if (camera_attr_get_zoom_range(g_mm_handle->hcam, &tempmin, &tempmax)
1679 != CAMERA_ERROR_NONE) {
1680 cam_debug(LOG_CAM, "camera_attr_get_zoom_range() is false");
1687 cam_debug(LOG_CAM, "not support get_minmax() about this type[%d]", type);
1704 gboolean cam_mm_get_caps_range(unsigned int type, unsigned int *caps, void *user_data)
1706 if (!cam_mm_is_created()) {
1707 cam_debug(LOG_CAM, "cam_mm_is_created() false");
1713 gboolean ret = TRUE;
1716 case CAM_CP_FUNC_EFFECT_MODE:
1718 if (camera_attr_foreach_supported_effect(g_mm_handle->hcam,
1719 (camera_attr_supported_effect_cb)__get_effect_cb, user_data) != CAMERA_ERROR_NONE ) {
1720 cam_debug(LOG_CAM, "camera_attr_foreach_supported_effect() is fail");
1727 cam_debug(LOG_CAM, "not support get_range() about this type[%d]", type);
1737 const int cam_mm_get_caps_cb_cnt()
1739 return g_caps_cb_cnt;
1742 static void __get_effect_cb(camera_attr_effect_mode_e effect, void *user_data)
1744 cam_retm_if(effect < CAMERA_ATTR_EFFECT_NONE|| effect > CAMERA_ATTR_EFFECT_SKETCH, "input is invalid");
1746 unsigned int uRet = cam_effect_dev_convert_caps(effect);