Set missed condition variable for TV product
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_attribute.c
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23 /*=======================================================================================
24 |  INCLUDE FILES                                                                        |
25 =======================================================================================*/
26 #include "mm_camcorder_internal.h"
27 #include "mm_camcorder_gstcommon.h"
28
29 #include <gst/video/colorbalance.h>
30 #include <gst/video/videooverlay.h>
31
32 /*-----------------------------------------------------------------------
33 |    MACRO DEFINITIONS:                                                 |
34 -----------------------------------------------------------------------*/
35 #define MMCAMCORDER_DEFAULT_CAMERA_WIDTH        640
36 #define MMCAMCORDER_DEFAULT_CAMERA_HEIGHT       480
37 #define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL 1000
38 #define MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL  89.0
39
40 /*---------------------------------------------------------------------------------------
41 |    GLOBAL VARIABLE DEFINITIONS for internal                                           |
42 ---------------------------------------------------------------------------------------*/
43
44 /*-----------------------------------------------------------------------
45 |    LOCAL VARIABLE DEFINITIONS for internal                            |
46 -----------------------------------------------------------------------*/
47 /*      Readonly attributes list.
48 *       If you want to make some attributes read only, write down here.
49 *       It will make them read only after composing whole attributes.
50 */
51
52 static int readonly_attributes[] = {
53         MM_CAM_CAMERA_DEVICE_COUNT,
54         MM_CAM_CAMERA_DEVICE_NAME,
55         MM_CAM_CAMERA_FACING_DIRECTION,
56         MM_CAM_CAMERA_SHUTTER_SPEED,
57         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
58         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
59         MM_CAM_CAPTURED_SCREENNAIL,
60         MM_CAM_RECOMMEND_DISPLAY_ROTATION,
61         MM_CAM_SUPPORT_ZSL_CAPTURE,
62         MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
63         MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
64         MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_INTERNAL_CB,
65         MM_CAM_PLATFORM_PRIVILEGE_CAMERA,
66         MM_CAM_VIDEOSRC_ELEMENT_NAME,
67         MM_CAM_AUDIOSRC_ELEMENT_NAME
68 };
69
70 /*-----------------------------------------------------------------------
71 |    LOCAL FUNCTION PROTOTYPES:                                         |
72 -----------------------------------------------------------------------*/
73 /* STATIC INTERNAL FUNCTION */
74 static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height);
75 static int  __mmcamcorder_set_conf_to_valid_info(MMHandleType handle);
76 static int  __mmcamcorder_release_conf_valid_info(MMHandleType handle);
77 static int  __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
78
79 /*=======================================================================
80 |  FUNCTION DEFINITIONS                                                 |
81 =======================================================================*/
82 /*-----------------------------------------------------------------------
83 |    GLOBAL FUNCTION DEFINITIONS:                                       |
84 -----------------------------------------------------------------------*/
85 MMHandleType
86 _mmcamcorder_alloc_attribute(MMHandleType handle)
87 {
88         MMCAM_LOG_INFO("");
89
90         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
91         MMHandleType attrs = NULL;
92         MMAttrsConstructInfo *attrs_const_info;
93         unsigned int attr_count = 0;
94         unsigned int idx;
95         int ret = MM_ERROR_NONE;
96
97         static int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE};
98         static int flip_list[] = { MM_FLIP_NONE };
99         static int rotation_list[] = { MM_VIDEO_INPUT_ROTATION_NONE };
100         static int visible_values[] = { 0, 1 }; /*0: off, 1:on*/
101         static int tag_orientation_values[] = {
102                         1,      /*The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
103                         2,      /*the 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
104                         3,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
105                         4,      /*the 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
106                         5,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
107                         6,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
108                         7,      /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
109                         8,      /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
110                 };
111
112         if (hcamcorder == NULL) {
113                 MMCAM_LOG_ERROR("handle is NULL");
114                 return 0;
115         }
116
117         /* Create attribute constructor */
118         MMCAM_LOG_INFO("start");
119
120         /* alloc 'MMAttrsConstructInfo' */
121         attr_count = MM_CAM_ATTRIBUTE_NUM;
122         attrs_const_info = malloc(attr_count * sizeof(MMAttrsConstructInfo));
123         if (!attrs_const_info) {
124                 MMCAM_LOG_ERROR("Fail to alloc constructor.");
125                 return 0;
126         }
127
128         /* alloc default attribute info */
129         hcamcorder->cam_attrs_const_info = (mm_cam_attr_construct_info *)malloc(sizeof(mm_cam_attr_construct_info) * attr_count);
130         if (hcamcorder->cam_attrs_const_info == NULL) {
131                 MMCAM_LOG_ERROR("failed to alloc default attribute info");
132                 free(attrs_const_info);
133                 attrs_const_info = NULL;
134                 return 0;
135         }
136
137         /* basic attributes' info */
138         mm_cam_attr_construct_info temp_info[] = {
139                 /* 0 */
140                 {
141                         MM_CAM_MODE,                        /* ID */
142                         "mode",                             /* Name */
143                         MM_ATTRS_TYPE_INT,                 /* Type */
144                         MM_ATTRS_FLAG_RW,                   /* Flag */
145                         {(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE},     /* Default value */
146                         MM_ATTRS_VALID_TYPE_INT_RANGE,      /* Validity type */
147                         {.int_min = MM_CAMCORDER_MODE_VIDEO_CAPTURE},    /* Validity val1 (min, *array,...) */
148                         {.int_max = MM_CAMCORDER_MODE_AUDIO},            /* Validity val2 (max, count, ...) */
149                         NULL,                               /* Runtime setting function of the attribute */
150                 },
151                 {
152                         MM_CAM_AUDIO_DEVICE,
153                         "audio-device",
154                         MM_ATTRS_TYPE_INT,
155                         MM_ATTRS_FLAG_RW,
156                         {(void*)MM_AUDIO_DEVICE_MIC},
157                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
158                         {NULL},
159                         {0},
160                         NULL,
161                 },
162                 {
163                         MM_CAM_CAMERA_DEVICE_COUNT,
164                         "camera-device-count",
165                         MM_ATTRS_TYPE_INT,
166                         MM_ATTRS_FLAG_RW,
167                         {(void*)MM_VIDEO_DEVICE_NUM},
168                         MM_ATTRS_VALID_TYPE_INT_RANGE,
169                         {.int_min = MM_VIDEO_DEVICE_NONE},
170                         {.int_max = MM_VIDEO_DEVICE_NUM},
171                         NULL,
172                 },
173                 {
174                         MM_CAM_AUDIO_ENCODER,
175                         "audio-encoder",
176                         MM_ATTRS_TYPE_INT,
177                         MM_ATTRS_FLAG_RW,
178                         {(void*)MM_AUDIO_CODEC_AMR},
179                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
180                         {NULL},
181                         {0},
182                         NULL,
183                 },
184                 {
185                         MM_CAM_VIDEO_ENCODER,
186                         "video-encoder",
187                         MM_ATTRS_TYPE_INT,
188                         MM_ATTRS_FLAG_RW,
189                         {(void*)MM_VIDEO_CODEC_MPEG4},
190                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
191                         {NULL},
192                         {0},
193                         NULL,
194                 },
195                 {
196                         MM_CAM_IMAGE_ENCODER,
197                         "image-encoder",
198                         MM_ATTRS_TYPE_INT,
199                         MM_ATTRS_FLAG_RW,
200                         {(void*)MM_IMAGE_CODEC_JPEG},
201                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
202                         {NULL},
203                         {0},
204                         NULL,
205                 },
206                 {
207                         MM_CAM_FILE_FORMAT,
208                         "file-format",
209                         MM_ATTRS_TYPE_INT,
210                         MM_ATTRS_FLAG_RW,
211                         {(void*)MM_FILE_FORMAT_MP4},
212                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
213                         {NULL},
214                         {0},
215                         NULL,
216                 },
217                 {
218                         MM_CAM_CAMERA_DEVICE_NAME,
219                         "camera-device-name",
220                         MM_ATTRS_TYPE_STRING,
221                         MM_ATTRS_FLAG_RW,
222                         {NULL},
223                         MM_ATTRS_VALID_TYPE_NONE,
224                         {0},
225                         {0},
226                         NULL,
227                 },
228                 {
229                         MM_CAM_AUDIO_SAMPLERATE,
230                         "audio-samplerate",
231                         MM_ATTRS_TYPE_INT,
232                         MM_ATTRS_FLAG_RW,
233                         {(void*)8000},
234                         MM_ATTRS_VALID_TYPE_INT_RANGE,
235                         {.int_min = 0},
236                         {.int_max = _MMCAMCORDER_MAX_INT},
237                         NULL,
238                 },
239                 {
240                         MM_CAM_AUDIO_FORMAT,
241                         "audio-format",
242                         MM_ATTRS_TYPE_INT,
243                         MM_ATTRS_FLAG_RW,
244                         {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE},
245                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
246                         {depth},
247                         {ARRAY_SIZE(depth)},
248                         NULL,
249                 },
250                 /* 10 */
251                 {
252                         MM_CAM_AUDIO_CHANNEL,
253                         "audio-channel",
254                         MM_ATTRS_TYPE_INT,
255                         MM_ATTRS_FLAG_RW,
256                         {(void*)2},
257                         MM_ATTRS_VALID_TYPE_INT_RANGE,
258                         {.int_min = 1},
259                         {.int_max = 2},
260                         NULL,
261                 },
262                 {
263                         MM_CAM_AUDIO_VOLUME,
264                         "audio-volume",
265                         MM_ATTRS_TYPE_DOUBLE,
266                         MM_ATTRS_FLAG_RW,
267                         {.value_double = 1.0},
268                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
269                         {.double_min = 0.0},
270                         {.double_max = 10.0},
271                         _mmcamcorder_commit_audio_volume,
272                 },
273                 {
274                         MM_CAM_AUDIO_INPUT_ROUTE,
275                         "audio-input-route",
276                         MM_ATTRS_TYPE_INT,
277                         MM_ATTRS_FLAG_RW,
278                         {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
279                         MM_ATTRS_VALID_TYPE_INT_RANGE,
280                         {.int_min = MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
281                         {.int_max = MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY},
282                         _mmcamcorder_commit_audio_input_route,
283                 },
284                 {
285                         MM_CAM_FILTER_SCENE_MODE,
286                         "filter-scene-mode",
287                         MM_ATTRS_TYPE_INT,
288                         MM_ATTRS_FLAG_RW,
289                         {(void*)0},
290                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
291                         {0},
292                         {0},
293                         _mmcamcorder_commit_filter_scene_mode,
294                 },
295                 {
296                         MM_CAM_FILTER_BRIGHTNESS,
297                         "filter-brightness",
298                         MM_ATTRS_TYPE_INT,
299                         MM_ATTRS_FLAG_RW,
300                         {(void*)1},
301                         MM_ATTRS_VALID_TYPE_INT_RANGE,
302                         {.int_min = 0},
303                         {.int_max = -1},
304                         _mmcamcorder_commit_filter,
305                 },
306                 {
307                         MM_CAM_FILTER_CONTRAST,
308                         "filter-contrast",
309                         MM_ATTRS_TYPE_INT,
310                         MM_ATTRS_FLAG_RW,
311                         {(void*)0},
312                         MM_ATTRS_VALID_TYPE_INT_RANGE,
313                         {.int_min = 0},
314                         {.int_max = -1},
315                         _mmcamcorder_commit_filter,
316                 },
317                 {
318                         MM_CAM_FILTER_WB,
319                         "filter-wb",
320                         MM_ATTRS_TYPE_INT,
321                         MM_ATTRS_FLAG_RW,
322                         {(void*)0},
323                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
324                         {0},
325                         {0},
326                         _mmcamcorder_commit_filter,
327                 },
328                 {
329                         MM_CAM_FILTER_COLOR_TONE,
330                         "filter-color-tone",
331                         MM_ATTRS_TYPE_INT,
332                         MM_ATTRS_FLAG_RW,
333                         {(void*)0},
334                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
335                         {0},
336                         {0},
337                         _mmcamcorder_commit_filter,
338                 },
339                 {
340                         MM_CAM_FILTER_SATURATION,
341                         "filter-saturation",
342                         MM_ATTRS_TYPE_INT,
343                         MM_ATTRS_FLAG_RW,
344                         {(void*)0},
345                         MM_ATTRS_VALID_TYPE_INT_RANGE,
346                         {.int_min = 0},
347                         {.int_max = -1},
348                         _mmcamcorder_commit_filter,
349                 },
350                 {
351                         MM_CAM_FILTER_HUE,
352                         "filter-hue",
353                         MM_ATTRS_TYPE_INT,
354                         MM_ATTRS_FLAG_RW,
355                         {(void*)0},
356                         MM_ATTRS_VALID_TYPE_INT_RANGE,
357                         {.int_min = 0},
358                         {.int_max = -1},
359                         _mmcamcorder_commit_filter,
360                 },
361                 /* 20 */
362                 {
363                         MM_CAM_FILTER_SHARPNESS,
364                         "filter-sharpness",
365                         MM_ATTRS_TYPE_INT,
366                         MM_ATTRS_FLAG_RW,
367                         {(void*)0},
368                         MM_ATTRS_VALID_TYPE_INT_RANGE,
369                         {.int_min = 0},
370                         {.int_max = -1},
371                         _mmcamcorder_commit_filter,
372                 },
373                 {
374                         MM_CAM_CAMERA_FORMAT,
375                         "camera-format",
376                         MM_ATTRS_TYPE_INT,
377                         MM_ATTRS_FLAG_RW,
378                         {(void*)MM_PIXEL_FORMAT_YUYV},
379                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
380                         {0},
381                         {0},
382                         _mmcamcorder_commit_camera_format,
383                 },
384                 {
385                         MM_CAM_CAMERA_RECORDING_MOTION_RATE,
386                         "camera-recording-motion-rate",
387                         MM_ATTRS_TYPE_DOUBLE,
388                         MM_ATTRS_FLAG_RW,
389                         {.value_double = 1.0},
390                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
391                         {.double_min = 0.0},
392                         {.double_max = _MMCAMCORDER_MAX_DOUBLE},
393                         _mmcamcorder_commit_camera_recording_motion_rate,
394                 },
395                 {
396                         MM_CAM_CAMERA_FPS,
397                         "camera-fps",
398                         MM_ATTRS_TYPE_INT,
399                         MM_ATTRS_FLAG_RW,
400                         {(void*)30},
401                         MM_ATTRS_VALID_TYPE_INT_RANGE,
402                         {0},
403                         {1024},
404                         _mmcamcorder_commit_camera_fps,
405                 },
406                 {
407                         MM_CAM_CAMERA_WIDTH,
408                         "camera-width",
409                         MM_ATTRS_TYPE_INT,
410                         MM_ATTRS_FLAG_RW,
411                         {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
412                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
413                         {0},
414                         {0},
415                         _mmcamcorder_commit_camera_width,
416                 },
417                 {
418                         MM_CAM_CAMERA_HEIGHT,
419                         "camera-height",
420                         MM_ATTRS_TYPE_INT,
421                         MM_ATTRS_FLAG_RW,
422                         {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
423                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
424                         {0},
425                         {0},
426                         _mmcamcorder_commit_camera_height,
427                 },
428                 {
429                         MM_CAM_CAMERA_DIGITAL_ZOOM,
430                         "camera-digital-zoom",
431                         MM_ATTRS_TYPE_INT,
432                         MM_ATTRS_FLAG_RW,
433                         {(void*)10},
434                         MM_ATTRS_VALID_TYPE_INT_RANGE,
435                         {.int_min = 0},
436                         {.int_max = -1},
437                         _mmcamcorder_commit_camera_zoom,
438                 },
439                 {
440                         MM_CAM_CAMERA_OPTICAL_ZOOM,
441                         "camera-optical-zoom",
442                         MM_ATTRS_TYPE_INT,
443                         MM_ATTRS_FLAG_RW,
444                         {(void*)0},
445                         MM_ATTRS_VALID_TYPE_INT_RANGE,
446                         {.int_min = 0},
447                         {.int_max = -1},
448                         _mmcamcorder_commit_camera_zoom,
449                 },
450                 {
451                         MM_CAM_CAMERA_FOCUS_MODE,
452                         "camera-focus-mode",
453                         MM_ATTRS_TYPE_INT,
454                         MM_ATTRS_FLAG_RW,
455                         {(void*)MM_CAMCORDER_FOCUS_MODE_NONE},
456                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
457                         {0},
458                         {0},
459                         _mmcamcorder_commit_camera_focus_mode,
460                 },
461                 {
462                         MM_CAM_CAMERA_AF_SCAN_RANGE,
463                         "camera-af-scan-range",
464                         MM_ATTRS_TYPE_INT,
465                         MM_ATTRS_FLAG_RW,
466                         {(void*)0},
467                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
468                         {0},
469                         {0},
470                         _mmcamcorder_commit_camera_af_scan_range,
471                 },
472                 /* 30 */
473                 {
474                         MM_CAM_CAMERA_EXPOSURE_MODE,
475                         "camera-exposure-mode",
476                         MM_ATTRS_TYPE_INT,
477                         MM_ATTRS_FLAG_RW,
478                         {(void*)0},
479                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
480                         {0},
481                         {0},
482                         _mmcamcorder_commit_camera_capture_mode,
483                 },
484                 {
485                         MM_CAM_CAMERA_EXPOSURE_VALUE,
486                         "camera-exposure-value",
487                         MM_ATTRS_TYPE_INT,
488                         MM_ATTRS_FLAG_RW,
489                         {(void*)0},
490                         MM_ATTRS_VALID_TYPE_INT_RANGE,
491                         {.int_min = 0},
492                         {.int_max = -1},
493                         _mmcamcorder_commit_camera_capture_mode,
494                 },
495                 {
496                         MM_CAM_CAMERA_F_NUMBER,
497                         "camera-f-number",
498                         MM_ATTRS_TYPE_INT,
499                         MM_ATTRS_FLAG_RW,
500                         {(void*)0},
501                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
502                         {0},
503                         {0},
504                         _mmcamcorder_commit_camera_capture_mode,
505                 },
506                 {
507                         MM_CAM_CAMERA_SHUTTER_SPEED,
508                         "camera-shutter-speed",
509                         MM_ATTRS_TYPE_INT,
510                         MM_ATTRS_FLAG_RW,
511                         {(void*)0},
512                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
513                         {0},
514                         {0},
515                         _mmcamcorder_commit_camera_capture_mode,
516                 },
517                 {
518                         MM_CAM_CAMERA_ISO,
519                         "camera-iso",
520                         MM_ATTRS_TYPE_INT,
521                         MM_ATTRS_FLAG_RW,
522                         {(void*)0},
523                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
524                         {0},
525                         {0},
526                         _mmcamcorder_commit_camera_capture_mode,
527                 },
528                 {
529                         MM_CAM_CAMERA_WDR,
530                         "camera-wdr",
531                         MM_ATTRS_TYPE_INT,
532                         MM_ATTRS_FLAG_RW,
533                         {(void*)0},
534                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
535                         {0},
536                         {0},
537                         _mmcamcorder_commit_camera_wdr,
538                 },
539                 {
540                         MM_CAM_CAMERA_ANTI_HANDSHAKE,
541                         "camera-anti-handshake",
542                         MM_ATTRS_TYPE_INT,
543                         MM_ATTRS_FLAG_RW,
544                         {(void*)0},
545                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
546                         {0},
547                         {0},
548                         _mmcamcorder_commit_camera_anti_handshake,
549                 },
550                 {
551                         MM_CAM_CAMERA_FPS_AUTO,
552                         "camera-fps-auto",
553                         MM_ATTRS_TYPE_INT,
554                         MM_ATTRS_FLAG_RW,
555                         {(void*)FALSE},
556                         MM_ATTRS_VALID_TYPE_INT_RANGE,
557                         {.int_min = 0},
558                         {.int_max = 1},
559                         _mmcamcorder_commit_camera_fps,
560                 },
561                 {
562                         MM_CAM_CAMERA_DELAY_ATTR_SETTING,
563                         "camera-delay-attr-setting",
564                         MM_ATTRS_TYPE_INT,
565                         MM_ATTRS_FLAG_RW,
566                         {(void*)FALSE},
567                         MM_ATTRS_VALID_TYPE_INT_RANGE,
568                         {.int_min = 0},
569                         {.int_max = 1},
570                         NULL,
571                 },
572                 {
573                         MM_CAM_AUDIO_ENCODER_BITRATE,
574                         "audio-encoder-bitrate",
575                         MM_ATTRS_TYPE_INT,
576                         MM_ATTRS_FLAG_RW,
577                         {(void*)0},
578                         MM_ATTRS_VALID_TYPE_INT_RANGE,
579                         {.int_min = 0},
580                         {.int_max = _MMCAMCORDER_MAX_INT},
581                         _mmcamcorder_commit_encoder_bitrate,
582                 },
583                 /* 40 */
584                 {
585                         MM_CAM_VIDEO_ENCODER_BITRATE,
586                         "video-encoder-bitrate",
587                         MM_ATTRS_TYPE_INT,
588                         MM_ATTRS_FLAG_RW,
589                         {(void*)0},
590                         MM_ATTRS_VALID_TYPE_INT_RANGE,
591                         {.int_min = 0},
592                         {.int_max = _MMCAMCORDER_MAX_INT},
593                         _mmcamcorder_commit_encoder_bitrate,
594                 },
595                 {
596                         MM_CAM_IMAGE_ENCODER_QUALITY,
597                         "image-encoder-quality",
598                         MM_ATTRS_TYPE_INT,
599                         MM_ATTRS_FLAG_RW,
600                         {(void*)95},
601                         MM_ATTRS_VALID_TYPE_INT_RANGE,
602                         {.int_min = 0},
603                         {.int_max = -1},
604                         _mmcamcorder_commit_image_encoder_quality,
605                 },
606                 {
607                         MM_CAM_CAPTURE_FORMAT,
608                         "capture-format",
609                         MM_ATTRS_TYPE_INT,
610                         MM_ATTRS_FLAG_RW,
611                         {(void*)MM_PIXEL_FORMAT_ENCODED},
612                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
613                         {0},
614                         {0},
615                         NULL,
616                 },
617                 {
618                         MM_CAM_CAPTURE_WIDTH,
619                         "capture-width",
620                         MM_ATTRS_TYPE_INT,
621                         MM_ATTRS_FLAG_RW,
622                         {(void*)1600},
623                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
624                         {0},
625                         {0},
626                         _mmcamcorder_commit_capture_width ,
627                 },
628                 {
629                         MM_CAM_CAPTURE_HEIGHT,
630                         "capture-height",
631                         MM_ATTRS_TYPE_INT,
632                         MM_ATTRS_FLAG_RW,
633                         {(void*)1200},
634                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
635                         {0},
636                         {0},
637                         _mmcamcorder_commit_capture_height,
638                 },
639                 {
640                         MM_CAM_CAPTURE_COUNT,
641                         "capture-count",
642                         MM_ATTRS_TYPE_INT,
643                         MM_ATTRS_FLAG_RW,
644                         {(void*)1},
645                         MM_ATTRS_VALID_TYPE_INT_RANGE,
646                         {.int_min = 0},
647                         {.int_max = -1},
648                         _mmcamcorder_commit_capture_count,
649                 },
650                 {
651                         MM_CAM_CAPTURE_INTERVAL,
652                         "capture-interval",
653                         MM_ATTRS_TYPE_INT,
654                         MM_ATTRS_FLAG_RW,
655                         {(void*)0},
656                         MM_ATTRS_VALID_TYPE_INT_RANGE,
657                         {.int_min = 0},
658                         {.int_max = _MMCAMCORDER_MAX_INT},
659                         NULL,
660                 },
661                 {
662                         MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
663                         "capture-break-cont-shot",
664                         MM_ATTRS_TYPE_INT,
665                         MM_ATTRS_FLAG_RW,
666                         {(void*)FALSE},
667                         MM_ATTRS_VALID_TYPE_INT_RANGE,
668                         {.int_min = 0},
669                         {.int_max = 1},
670                         _mmcamcorder_commit_capture_break_cont_shot,
671                 },
672                 {
673                         MM_CAM_DISPLAY_HANDLE,
674                         "display-handle",
675                         MM_ATTRS_TYPE_DATA,
676                         MM_ATTRS_FLAG_RW,
677                         {NULL},
678                         MM_ATTRS_VALID_TYPE_NONE,
679                         {0},
680                         {0},
681                         _mmcamcorder_commit_display_handle,
682                 },
683                 {
684                         MM_CAM_DISPLAY_DEVICE,
685                         "display-device",
686                         MM_ATTRS_TYPE_INT,
687                         MM_ATTRS_FLAG_RW,
688                         {(void*)MM_DISPLAY_DEVICE_MAINLCD},
689                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
690                         {0},
691                         {0},
692                         NULL,
693                 },
694                 /* 50 */
695                 {
696                         MM_CAM_DISPLAY_SURFACE,
697                         "display-surface",
698                         MM_ATTRS_TYPE_INT,
699                         MM_ATTRS_FLAG_RW,
700                         {(void*)MM_DISPLAY_SURFACE_OVERLAY},
701                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
702                         {0},
703                         {0},
704                         NULL,
705                 },
706                 {
707                         MM_CAM_DISPLAY_RECT_X,
708                         "display-rect-x",
709                         MM_ATTRS_TYPE_INT,
710                         MM_ATTRS_FLAG_RW,
711                         {(void*)0},
712                         MM_ATTRS_VALID_TYPE_INT_RANGE,
713                         {.int_min = 0},
714                         {.int_max = _MMCAMCORDER_MAX_INT},
715                         _mmcamcorder_commit_display_rect,
716                 },
717                 {
718                         MM_CAM_DISPLAY_RECT_Y,
719                         "display-rect-y",
720                         MM_ATTRS_TYPE_INT,
721                         MM_ATTRS_FLAG_RW,
722                         {(void*)0},
723                         MM_ATTRS_VALID_TYPE_INT_RANGE,
724                         {.int_min = 0},
725                         {.int_max = _MMCAMCORDER_MAX_INT},
726                         _mmcamcorder_commit_display_rect,
727                 },
728                 {
729                         MM_CAM_DISPLAY_RECT_WIDTH,
730                         "display-rect-width",
731                         MM_ATTRS_TYPE_INT,
732                         MM_ATTRS_FLAG_RW,
733                         {(void*)0},
734                         MM_ATTRS_VALID_TYPE_INT_RANGE,
735                         {.int_min = 1},
736                         {.int_max = _MMCAMCORDER_MAX_INT},
737                         _mmcamcorder_commit_display_rect,
738                 },
739                 {
740                         MM_CAM_DISPLAY_RECT_HEIGHT,
741                         "display-rect-height",
742                         MM_ATTRS_TYPE_INT,
743                         MM_ATTRS_FLAG_RW,
744                         {(void*)0},
745                         MM_ATTRS_VALID_TYPE_INT_RANGE,
746                         {.int_min = 1},
747                         {.int_max = _MMCAMCORDER_MAX_INT},
748                         _mmcamcorder_commit_display_rect,
749                 },
750                 {
751                         MM_CAM_DISPLAY_SOURCE_X,
752                         "display-src-x",
753                         MM_ATTRS_TYPE_INT,
754                         MM_ATTRS_FLAG_RW,
755                         {(void*)0},
756                         MM_ATTRS_VALID_TYPE_INT_RANGE,
757                         {.int_min = 0},
758                         {.int_max = _MMCAMCORDER_MAX_INT},
759                         NULL,
760                 },
761                 {
762                         MM_CAM_DISPLAY_SOURCE_Y,
763                         "display-src-y",
764                         MM_ATTRS_TYPE_INT,
765                         MM_ATTRS_FLAG_RW,
766                         {(void*)0},
767                         MM_ATTRS_VALID_TYPE_INT_RANGE,
768                         {.int_min = 0},
769                         {.int_max = _MMCAMCORDER_MAX_INT},
770                         NULL,
771                 },
772                 {
773                         MM_CAM_DISPLAY_SOURCE_WIDTH,
774                         "display-src-width",
775                         MM_ATTRS_TYPE_INT,
776                         MM_ATTRS_FLAG_RW,
777                         {(void*)0},
778                         MM_ATTRS_VALID_TYPE_INT_RANGE,
779                         {.int_min = 0},
780                         {.int_max = _MMCAMCORDER_MAX_INT},
781                         NULL,
782                 },
783                 {
784                         MM_CAM_DISPLAY_SOURCE_HEIGHT,
785                         "display-src-height",
786                         MM_ATTRS_TYPE_INT,
787                         MM_ATTRS_FLAG_RW,
788                         {(void*)0},
789                         MM_ATTRS_VALID_TYPE_INT_RANGE,
790                         {.int_min = 0},
791                         {.int_max = _MMCAMCORDER_MAX_INT},
792                         NULL,
793                 },
794                 {
795                         MM_CAM_DISPLAY_ROTATION,
796                         "display-rotation",
797                         MM_ATTRS_TYPE_INT,
798                         MM_ATTRS_FLAG_RW,
799                         {(void*)MM_DISPLAY_ROTATION_NONE},
800                         MM_ATTRS_VALID_TYPE_INT_RANGE,
801                         {.int_min = MM_DISPLAY_ROTATION_NONE},
802                         {.int_max = MM_DISPLAY_ROTATION_270},
803                         _mmcamcorder_commit_display_rotation,
804                 },
805                 /* 60 */
806                 {
807                         MM_CAM_DISPLAY_VISIBLE,
808                         "display-visible",
809                         MM_ATTRS_TYPE_INT,
810                         MM_ATTRS_FLAG_RW,
811                         {(void*)1},
812                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
813                         {visible_values},
814                         {ARRAY_SIZE(visible_values)},
815                         _mmcamcorder_commit_display_visible,
816                 },
817                 {
818                         MM_CAM_DISPLAY_SCALE,
819                         "display-scale",
820                         MM_ATTRS_TYPE_INT,
821                         MM_ATTRS_FLAG_RW,
822                         {(void*)0},
823                         MM_ATTRS_VALID_TYPE_INT_RANGE,
824                         {.int_min = MM_DISPLAY_SCALE_DEFAULT},
825                         {.int_max = MM_DISPLAY_SCALE_TRIPLE_LENGTH},
826                         _mmcamcorder_commit_display_scale,
827                 },
828                 {
829                         MM_CAM_DISPLAY_GEOMETRY_METHOD,
830                         "display-geometry-method",
831                         MM_ATTRS_TYPE_INT,
832                         MM_ATTRS_FLAG_RW,
833                         {(void*)0},
834                         MM_ATTRS_VALID_TYPE_INT_RANGE,
835                         {.int_min = MM_DISPLAY_METHOD_LETTER_BOX},
836                         {.int_max = MM_DISPLAY_METHOD_CUSTOM_ROI},
837                         _mmcamcorder_commit_display_geometry_method,
838                 },
839                 {
840                         MM_CAM_TARGET_FILENAME,
841                         "target-filename",
842                         MM_ATTRS_TYPE_STRING,
843                         MM_ATTRS_FLAG_RW,
844                         {NULL},
845                         MM_ATTRS_VALID_TYPE_NONE,
846                         {0},
847                         {0},
848                         _mmcamcorder_commit_target_filename,
849                 },
850                 {
851                         MM_CAM_TARGET_MAX_SIZE,
852                         "target-max-size",
853                         MM_ATTRS_TYPE_INT,
854                         MM_ATTRS_FLAG_RW,
855                         {(void*)0},
856                         MM_ATTRS_VALID_TYPE_INT_RANGE,
857                         {.int_min = 0},
858                         {.int_max = _MMCAMCORDER_MAX_INT},
859                         _mmcamcorder_commit_recording_max_limit,
860                 },
861                 {
862                         MM_CAM_TARGET_TIME_LIMIT,
863                         "target-time-limit",
864                         MM_ATTRS_TYPE_INT,
865                         MM_ATTRS_FLAG_RW,
866                         {(void*)0},
867                         MM_ATTRS_VALID_TYPE_INT_RANGE,
868                         {.int_min = 0},
869                         {.int_max = _MMCAMCORDER_MAX_INT},
870                         _mmcamcorder_commit_recording_max_limit,
871                 },
872                 {
873                         MM_CAM_TAG_ENABLE,
874                         "tag-enable",
875                         MM_ATTRS_TYPE_INT,
876                         MM_ATTRS_FLAG_RW,
877                         {(void*)FALSE},
878                         MM_ATTRS_VALID_TYPE_INT_RANGE,
879                         {.int_min = FALSE},
880                         {.int_max = TRUE},
881                         _mmcamcorder_commit_tag,
882                 },
883                 {
884                         MM_CAM_TAG_IMAGE_DESCRIPTION,
885                         "tag-image-description",
886                         MM_ATTRS_TYPE_STRING,
887                         MM_ATTRS_FLAG_RW,
888                         {NULL},
889                         MM_ATTRS_VALID_TYPE_NONE,
890                         {0},
891                         {0},
892                         _mmcamcorder_commit_tag,
893                 },
894                 {
895                         MM_CAM_TAG_ORIENTATION,
896                         "tag-orientation",
897                         MM_ATTRS_TYPE_INT,
898                         MM_ATTRS_FLAG_RW,
899                         {(void*)1},
900                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
901                         {tag_orientation_values},
902                         {ARRAY_SIZE(tag_orientation_values)},
903                         _mmcamcorder_commit_tag,
904                 },
905                 {
906                         MM_CAM_TAG_SOFTWARE,
907                         "tag-software",
908                         MM_ATTRS_TYPE_STRING,
909                         MM_ATTRS_FLAG_RW,
910                         {NULL},
911                         MM_ATTRS_VALID_TYPE_NONE,
912                         {0},
913                         {0},
914                         _mmcamcorder_commit_tag,
915                 },
916                 /* 70 */
917                 {
918                         MM_CAM_TAG_LATITUDE,
919                         "tag-latitude",
920                         MM_ATTRS_TYPE_DOUBLE,
921                         MM_ATTRS_FLAG_RW,
922                         {.value_double = 0.0},
923                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
924                         {.double_min = -360.0},
925                         {.double_max = 360.0},
926                         _mmcamcorder_commit_tag,
927                 },
928                 {
929                         MM_CAM_TAG_LONGITUDE,
930                         "tag-longitude",
931                         MM_ATTRS_TYPE_DOUBLE,
932                         MM_ATTRS_FLAG_RW,
933                         {.value_double = 0.0},
934                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
935                         {.double_min = -360.0},
936                         {.double_max = 360.0},
937                         _mmcamcorder_commit_tag,
938                 },
939                 {
940                         MM_CAM_TAG_ALTITUDE,
941                         "tag-altitude",
942                         MM_ATTRS_TYPE_DOUBLE,
943                         MM_ATTRS_FLAG_RW,
944                         {.value_double = 0.0},
945                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
946                         {.double_min = -999999.0},
947                         {.double_max = 999999.0},
948                         _mmcamcorder_commit_tag,
949                 },
950                 {
951                         MM_CAM_STROBE_CONTROL,
952                         "strobe-control",
953                         MM_ATTRS_TYPE_INT,
954                         MM_ATTRS_FLAG_RW,
955                         {(void*)0},
956                         MM_ATTRS_VALID_TYPE_INT_RANGE,
957                         {.int_min = 0},
958                         {.int_max = -1},
959                         _mmcamcorder_commit_strobe,
960                 },
961                 {
962                         MM_CAM_STROBE_CAPABILITIES,
963                         "strobe-capabilities",
964                         MM_ATTRS_TYPE_INT,
965                         MM_ATTRS_FLAG_RW,
966                         {(void*)0},
967                         MM_ATTRS_VALID_TYPE_INT_RANGE,
968                         {.int_min = 0},
969                         {.int_max = -1},
970                         _mmcamcorder_commit_strobe,
971                 },
972                 {
973                         MM_CAM_STROBE_MODE,
974                         "strobe-mode",
975                         MM_ATTRS_TYPE_INT,
976                         MM_ATTRS_FLAG_RW,
977                         {(void*)0},
978                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
979                         {0},
980                         {0},
981                         _mmcamcorder_commit_strobe,
982                 },
983                 {
984                         MM_CAM_DETECT_MODE,
985                         "detect-mode",
986                         MM_ATTRS_TYPE_INT,
987                         MM_ATTRS_FLAG_RW,
988                         {(void*)0},
989                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
990                         {0},
991                         {0},
992                         _mmcamcorder_commit_detect,
993                 },
994                 {
995                         MM_CAM_DETECT_NUMBER,
996                         "detect-number",
997                         MM_ATTRS_TYPE_INT,
998                         MM_ATTRS_FLAG_RW,
999                         {(void*)0},
1000                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1001                         {.int_min = 0},
1002                         {.int_max = -1},
1003                         _mmcamcorder_commit_detect,
1004                 },
1005                 {
1006                         MM_CAM_DETECT_FOCUS_SELECT,
1007                         "detect-focus-select",
1008                         MM_ATTRS_TYPE_INT,
1009                         MM_ATTRS_FLAG_RW,
1010                         {(void*)0},
1011                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1012                         {.int_min = 0},
1013                         {.int_max = -1},
1014                         _mmcamcorder_commit_detect,
1015                 },
1016                 {
1017                         MM_CAM_DETECT_SELECT_NUMBER,
1018                         "detect-select-number",
1019                         MM_ATTRS_TYPE_INT,
1020                         MM_ATTRS_FLAG_RW,
1021                         {(void*)0},
1022                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1023                         {.int_min = 0},
1024                         {.int_max = -1},
1025                         _mmcamcorder_commit_detect,
1026                 },
1027                 /* 80 */
1028                 {
1029                         MM_CAM_DETECT_STATUS,
1030                         "detect-status",
1031                         MM_ATTRS_TYPE_INT,
1032                         MM_ATTRS_FLAG_RW,
1033                         {(void*)0},
1034                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1035                         {0},
1036                         {0},
1037                         _mmcamcorder_commit_detect,
1038                 },
1039                 {
1040                         MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
1041                         "capture-zero-systemlag",
1042                         MM_ATTRS_TYPE_INT,
1043                         MM_ATTRS_FLAG_RW,
1044                         {(void*)FALSE},
1045                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1046                         {.int_min = 0},
1047                         {.int_max = 1},
1048                         NULL,
1049                 },
1050                 {
1051                         MM_CAM_CAMERA_AF_TOUCH_X,
1052                         "camera-af-touch-x",
1053                         MM_ATTRS_TYPE_INT,
1054                         MM_ATTRS_FLAG_RW,
1055                         {(void*)0},
1056                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1057                         {.int_min = 0},
1058                         {.int_max = _MMCAMCORDER_MAX_INT},
1059                         _mmcamcorder_commit_camera_af_touch_area,
1060                 },
1061                 {
1062                         MM_CAM_CAMERA_AF_TOUCH_Y,
1063                         "camera-af-touch-y",
1064                         MM_ATTRS_TYPE_INT,
1065                         MM_ATTRS_FLAG_RW,
1066                         {(void*)0},
1067                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1068                         {.int_min = 0},
1069                         {.int_max = _MMCAMCORDER_MAX_INT},
1070                         _mmcamcorder_commit_camera_af_touch_area,
1071                 },
1072                 {
1073                         MM_CAM_CAMERA_AF_TOUCH_WIDTH,
1074                         "camera-af-touch-width",
1075                         MM_ATTRS_TYPE_INT,
1076                         MM_ATTRS_FLAG_RW,
1077                         {(void*)0},
1078                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1079                         {.int_min = 0},
1080                         {.int_max = _MMCAMCORDER_MAX_INT},
1081                         _mmcamcorder_commit_camera_af_touch_area,
1082                 },
1083                 {
1084                         MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
1085                         "camera-af-touch-height",
1086                         MM_ATTRS_TYPE_INT,
1087                         MM_ATTRS_FLAG_RW,
1088                         {(void*)0},
1089                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1090                         {.int_min = 0},
1091                         {.int_max = _MMCAMCORDER_MAX_INT},
1092                         _mmcamcorder_commit_camera_af_touch_area,
1093                 },
1094                 {
1095                         MM_CAM_CAMERA_FOCAL_LENGTH,
1096                         "camera-focal-length",
1097                         MM_ATTRS_TYPE_DOUBLE,
1098                         MM_ATTRS_FLAG_RW,
1099                         {.value_double = 0.0},
1100                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
1101                         {.double_min = 0.0},
1102                         {.double_max = 1000.0},
1103                         _mmcamcorder_commit_camera_capture_mode,
1104                 },
1105                 {
1106                         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
1107                         "recommend-preview-format-for-capture",
1108                         MM_ATTRS_TYPE_INT,
1109                         MM_ATTRS_FLAG_RW,
1110                         {(void*)MM_PIXEL_FORMAT_YUYV},
1111                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1112                         {.int_min = MM_PIXEL_FORMAT_NV12},
1113                         {.int_max = (MM_PIXEL_FORMAT_NUM-1)},
1114                         NULL,
1115                 },
1116                 {
1117                         MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
1118                         "recommend-preview-format-for-recording",
1119                         MM_ATTRS_TYPE_INT,
1120                         MM_ATTRS_FLAG_RW,
1121                         {(void*)MM_PIXEL_FORMAT_NV12},
1122                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1123                         {.int_min = MM_PIXEL_FORMAT_NV12},
1124                         {.int_max = (MM_PIXEL_FORMAT_NUM-1)},
1125                         NULL,
1126                 },
1127                 {
1128                         MM_CAM_TAG_GPS_ENABLE,
1129                         "tag-gps-enable",
1130                         MM_ATTRS_TYPE_INT,
1131                         MM_ATTRS_FLAG_RW,
1132                         {(void*)FALSE},
1133                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1134                         {.int_min = FALSE},
1135                         {.int_max = TRUE},
1136                         _mmcamcorder_commit_tag,
1137                 },
1138                 /* 90 */
1139                 {
1140                         MM_CAM_TAG_GPS_TIME_STAMP,
1141                         "tag-gps-time-stamp",
1142                         MM_ATTRS_TYPE_DOUBLE,
1143                         MM_ATTRS_FLAG_RW,
1144                         {.value_double = 0.0},
1145                         MM_ATTRS_VALID_TYPE_NONE,
1146                         {0},
1147                         {0},
1148                         _mmcamcorder_commit_tag,
1149                 },
1150                 {
1151                         MM_CAM_TAG_GPS_DATE_STAMP,
1152                         "tag-gps-date-stamp",
1153                         MM_ATTRS_TYPE_STRING,
1154                         MM_ATTRS_FLAG_RW,
1155                         {NULL},
1156                         MM_ATTRS_VALID_TYPE_NONE,
1157                         {0},
1158                         {0},
1159                         _mmcamcorder_commit_tag,
1160                 },
1161                 {
1162                         MM_CAM_TAG_GPS_PROCESSING_METHOD,
1163                         "tag-gps-processing-method",
1164                         MM_ATTRS_TYPE_STRING,
1165                         MM_ATTRS_FLAG_RW,
1166                         {NULL},
1167                         MM_ATTRS_VALID_TYPE_NONE,
1168                         {0},
1169                         {0},
1170                         _mmcamcorder_commit_tag,
1171                 },
1172                 {
1173                         MM_CAM_CAMERA_ROTATION,
1174                         "camera-rotation",
1175                         MM_ATTRS_TYPE_INT,
1176                         MM_ATTRS_FLAG_RW,
1177                         {(void*)MM_VIDEO_INPUT_ROTATION_NONE},
1178                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1179                         {rotation_list},
1180                         {ARRAY_SIZE(rotation_list)},
1181                         _mmcamcorder_commit_camera_rotate,
1182                 },
1183                 {
1184                         MM_CAM_CAPTURED_SCREENNAIL,
1185                         "captured-screennail",
1186                         MM_ATTRS_TYPE_DATA,
1187                         MM_ATTRS_FLAG_RW,
1188                         {NULL},
1189                         MM_ATTRS_VALID_TYPE_NONE,
1190                         {0},
1191                         {0},
1192                         NULL,
1193                 },
1194                 {
1195                         MM_CAM_CAPTURE_SOUND_ENABLE,
1196                         "capture-sound-enable",
1197                         MM_ATTRS_TYPE_INT,
1198                         MM_ATTRS_FLAG_RW,
1199                         {(void*)TRUE},
1200                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1201                         {.int_min = FALSE},
1202                         {.int_max = TRUE},
1203                         _mmcamcorder_commit_capture_sound_enable,
1204                 },
1205                 {
1206                         MM_CAM_RECOMMEND_DISPLAY_ROTATION,
1207                         "recommend-display-rotation",
1208                         MM_ATTRS_TYPE_INT,
1209                         MM_ATTRS_FLAG_RW,
1210                         {(void*)MM_DISPLAY_ROTATION_270},
1211                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1212                         {.int_min = MM_DISPLAY_ROTATION_NONE},
1213                         {.int_max = MM_DISPLAY_ROTATION_270},
1214                         NULL,
1215                 },
1216                 {
1217                         MM_CAM_CAMERA_FLIP,
1218                         "camera-flip",
1219                         MM_ATTRS_TYPE_INT,
1220                         MM_ATTRS_FLAG_RW,
1221                         {(void*)MM_FLIP_NONE},
1222                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1223                         {flip_list},
1224                         {ARRAY_SIZE(flip_list)},
1225                         _mmcamcorder_commit_camera_flip,
1226                 },
1227                 {
1228                         MM_CAM_CAMERA_HDR_CAPTURE,
1229                         "camera-hdr-capture",
1230                         MM_ATTRS_TYPE_INT,
1231                         MM_ATTRS_FLAG_RW,
1232                         {(void*)FALSE},
1233                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1234                         {0},
1235                         {0},
1236                         _mmcamcorder_commit_camera_hdr_capture,
1237                 },
1238                 {
1239                         MM_CAM_DISPLAY_MODE,
1240                         "display-mode",
1241                         MM_ATTRS_TYPE_INT,
1242                         MM_ATTRS_FLAG_RW,
1243                         {(void*)MM_DISPLAY_MODE_DEFAULT},
1244                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1245                         {0},
1246                         {0},
1247                         _mmcamcorder_commit_display_mode,
1248                 },
1249                 /* 100 */
1250                 {
1251                         MM_CAM_AUDIO_DISABLE,
1252                         "audio-disable",
1253                         MM_ATTRS_TYPE_INT,
1254                         MM_ATTRS_FLAG_RW,
1255                         {(void*)FALSE},
1256                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1257                         {.int_min = FALSE},
1258                         {.int_max = TRUE},
1259                         _mmcamcorder_commit_audio_disable,
1260                 },
1261                 {
1262                         MM_CAM_RECOMMEND_CAMERA_WIDTH,
1263                         "recommend-camera-width",
1264                         MM_ATTRS_TYPE_INT,
1265                         MM_ATTRS_FLAG_RW,
1266                         {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
1267                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1268                         {0},
1269                         {0},
1270                         NULL,
1271                 },
1272                 {
1273                         MM_CAM_RECOMMEND_CAMERA_HEIGHT,
1274                         "recommend-camera-height",
1275                         MM_ATTRS_TYPE_INT,
1276                         MM_ATTRS_FLAG_RW,
1277                         {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
1278                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1279                         {0},
1280                         {0},
1281                         NULL,
1282                 },
1283                 {
1284                         MM_CAM_CAPTURED_EXIF_RAW_DATA,
1285                         "captured-exif-raw-data",
1286                         MM_ATTRS_TYPE_DATA,
1287                         MM_ATTRS_FLAG_RW,
1288                         {NULL},
1289                         MM_ATTRS_VALID_TYPE_NONE,
1290                         {0},
1291                         {0},
1292                         NULL,
1293                 },
1294                 {
1295                         MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
1296                         "display-evas-surface-sink",
1297                         MM_ATTRS_TYPE_STRING,
1298                         MM_ATTRS_FLAG_RW,
1299                         {NULL},
1300                         MM_ATTRS_VALID_TYPE_NONE,
1301                         {0},
1302                         {0},
1303                         NULL,
1304                 },
1305                 {
1306                         MM_CAM_DISPLAY_EVAS_DO_SCALING,
1307                         "display-evas-do-scaling",
1308                         MM_ATTRS_TYPE_INT,
1309                         MM_ATTRS_FLAG_RW,
1310                         {(void*)TRUE},
1311                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1312                         {.int_min = FALSE},
1313                         {.int_max = TRUE},
1314                         _mmcamcorder_commit_display_evas_do_scaling,
1315                 },
1316                 {
1317                         MM_CAM_CAMERA_FACING_DIRECTION,
1318                         "camera-facing-direction",
1319                         MM_ATTRS_TYPE_INT,
1320                         MM_ATTRS_FLAG_RW,
1321                         {(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
1322                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1323                         {.int_min = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
1324                         {.int_max = MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT},
1325                         NULL,
1326                 },
1327                 {
1328                         MM_CAM_DISPLAY_FLIP,
1329                         "display-flip",
1330                         MM_ATTRS_TYPE_INT,
1331                         MM_ATTRS_FLAG_RW,
1332                         {(void*)MM_FLIP_NONE},
1333                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1334                         {.int_min = MM_FLIP_NONE},
1335                         {.int_max = MM_FLIP_BOTH},
1336                         _mmcamcorder_commit_display_flip,
1337                 },
1338                 {
1339                         MM_CAM_CAMERA_VIDEO_STABILIZATION,
1340                         "camera-video-stabilization",
1341                         MM_ATTRS_TYPE_INT,
1342                         MM_ATTRS_FLAG_RW,
1343                         {(void*)MM_CAMCORDER_VIDEO_STABILIZATION_OFF},
1344                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1345                         {0},
1346                         {0},
1347                         _mmcamcorder_commit_camera_video_stabilization,
1348                 },
1349                 {
1350                         MM_CAM_TAG_VIDEO_ORIENTATION,
1351                         "tag-video-orientation",
1352                         MM_ATTRS_TYPE_INT,
1353                         MM_ATTRS_FLAG_RW,
1354                         {(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
1355                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1356                         {.int_min = MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
1357                         {.int_max = MM_CAMCORDER_TAG_VIDEO_ORT_270},
1358                         NULL,
1359                 },
1360                 /* 110 */
1361                 {
1362                         MM_CAM_CAMERA_PAN_MECHA,
1363                         "camera-pan-mecha",
1364                         MM_ATTRS_TYPE_INT,
1365                         MM_ATTRS_FLAG_RW,
1366                         {(void*)0},
1367                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1368                         {.int_min = 0},
1369                         {.int_max = -1},
1370                         _mmcamcorder_commit_camera_pan,
1371                 },
1372                 {
1373                         MM_CAM_CAMERA_PAN_ELEC,
1374                         "camera-pan-elec",
1375                         MM_ATTRS_TYPE_INT,
1376                         MM_ATTRS_FLAG_RW,
1377                         {(void*)0},
1378                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1379                         {.int_min = 0},
1380                         {.int_max = -1},
1381                         _mmcamcorder_commit_camera_pan,
1382                 },
1383                 {
1384                         MM_CAM_CAMERA_TILT_MECHA,
1385                         "camera-tilt-mecha",
1386                         MM_ATTRS_TYPE_INT,
1387                         MM_ATTRS_FLAG_RW,
1388                         {(void*)0},
1389                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1390                         {.int_min = 0},
1391                         {.int_max = -1},
1392                         _mmcamcorder_commit_camera_tilt,
1393                 },
1394                 {
1395                         MM_CAM_CAMERA_TILT_ELEC,
1396                         "camera-tilt-elec",
1397                         MM_ATTRS_TYPE_INT,
1398                         MM_ATTRS_FLAG_RW,
1399                         {(void*)0},
1400                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1401                         {.int_min = 0},
1402                         {.int_max = -1},
1403                         _mmcamcorder_commit_camera_tilt,
1404                 },
1405                 {
1406                         MM_CAM_CAMERA_PTZ_TYPE,
1407                         "camera-ptz-type",
1408                         MM_ATTRS_TYPE_INT,
1409                         MM_ATTRS_FLAG_RW,
1410                         {(void*)0},
1411                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1412                         {0},
1413                         {0},
1414                         _mmcamcorder_commit_camera_ptz_type,
1415                 },
1416                 {
1417                         MM_CAM_VIDEO_WIDTH,
1418                         "video-width",
1419                         MM_ATTRS_TYPE_INT,
1420                         MM_ATTRS_FLAG_RW,
1421                         {(void*)0},
1422                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1423                         {0},
1424                         {0},
1425                         _mmcamcorder_commit_video_size,
1426                 },
1427                 {
1428                         MM_CAM_VIDEO_HEIGHT,
1429                         "video-height",
1430                         MM_ATTRS_TYPE_INT,
1431                         MM_ATTRS_FLAG_RW,
1432                         {(void*)0},
1433                         MM_ATTRS_VALID_TYPE_INT_ARRAY,
1434                         {0},
1435                         {0},
1436                         _mmcamcorder_commit_video_size,
1437                 },
1438                 {
1439                         MM_CAM_SUPPORT_ZSL_CAPTURE,
1440                         "support-zsl-capture",
1441                         MM_ATTRS_TYPE_INT,
1442                         MM_ATTRS_FLAG_RW,
1443                         {(void*)FALSE},
1444                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1445                         {.int_min = FALSE},
1446                         {.int_max = TRUE},
1447                         NULL,
1448                 },
1449                 {
1450                         MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
1451                         "support-zero-copy-format",
1452                         MM_ATTRS_TYPE_INT,
1453                         MM_ATTRS_FLAG_RW,
1454                         {(void*)FALSE},
1455                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1456                         {.int_min = FALSE},
1457                         {.int_max = TRUE},
1458                         NULL,
1459                 },
1460                 {
1461                         MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
1462                         "support-media-packet-preview-cb",
1463                         MM_ATTRS_TYPE_INT,
1464                         MM_ATTRS_FLAG_RW,
1465                         {(void*)FALSE},
1466                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1467                         {.int_min = FALSE},
1468                         {.int_max = TRUE},
1469                         NULL,
1470                 },
1471                 /* 120 */
1472                 {
1473                         MM_CAM_ENCODED_PREVIEW_BITRATE,
1474                         "encoded-preview-bitrate",
1475                         MM_ATTRS_TYPE_INT,
1476                         MM_ATTRS_FLAG_RW,
1477                         {(void*)0},
1478                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1479                         {.int_min = 0},
1480                         {.int_max = _MMCAMCORDER_MAX_INT},
1481                         _mmcamcorder_commit_encoded_preview_bitrate,
1482                 },
1483                 {
1484                         MM_CAM_ENCODED_PREVIEW_GOP_INTERVAL,
1485                         "encoded-preview-gop-interval",
1486                         MM_ATTRS_TYPE_INT,
1487                         MM_ATTRS_FLAG_RW,
1488                         {(void*)MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL},
1489                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1490                         {.int_min = 0},
1491                         {.int_max = _MMCAMCORDER_MAX_INT},
1492                         _mmcamcorder_commit_encoded_preview_gop_interval,
1493                 },
1494                 {
1495                         MM_CAM_RECORDER_TAG_ENABLE,
1496                         "recorder-tag-enable",
1497                         MM_ATTRS_TYPE_INT,
1498                         MM_ATTRS_FLAG_RW,
1499                         {(void*)FALSE},
1500                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1501                         {.int_min = FALSE},
1502                         {.int_max = TRUE},
1503                         NULL,
1504                 },
1505                 {
1506                         MM_CAM_DISPLAY_SOCKET_PATH,
1507                         "display-socket-path",
1508                         MM_ATTRS_TYPE_STRING,
1509                         MM_ATTRS_FLAG_RW,
1510                         {NULL},
1511                         MM_ATTRS_VALID_TYPE_NONE,
1512                         {0},
1513                         {0},
1514                         NULL,
1515                 },
1516                 {
1517                         MM_CAM_CLIENT_PID,
1518                         "client-pid",
1519                         MM_ATTRS_TYPE_INT,
1520                         MM_ATTRS_FLAG_RW,
1521                         {(void*)0},
1522                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1523                         {.int_min = 0},
1524                         {.int_max = _MMCAMCORDER_MAX_INT},
1525                         NULL,
1526                 },
1527                 {
1528                         MM_CAM_ROOT_DIRECTORY,
1529                         "root-directory",
1530                         MM_ATTRS_TYPE_STRING,
1531                         MM_ATTRS_FLAG_RW,
1532                         {NULL},
1533                         MM_ATTRS_VALID_TYPE_NONE,
1534                         {0},
1535                         {0},
1536                         NULL,
1537                 },
1538                 {
1539                         MM_CAM_SOUND_STREAM_INDEX,
1540                         "sound-stream-index",
1541                         MM_ATTRS_TYPE_INT,
1542                         MM_ATTRS_FLAG_RW,
1543                         {(void*)-1},
1544                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1545                         {.int_min = -1},
1546                         {.int_max = _MMCAMCORDER_MAX_INT},
1547                         NULL,
1548                 },
1549                 {
1550                         MM_CAM_SOUND_STREAM_TYPE,
1551                         "sound-stream-type",
1552                         MM_ATTRS_TYPE_STRING,
1553                         MM_ATTRS_FLAG_RW,
1554                         {NULL},
1555                         MM_ATTRS_VALID_TYPE_NONE,
1556                         {0},
1557                         {0},
1558                         _mmcamcorder_commit_sound_stream_info,
1559                 },
1560                 {
1561                         MM_CAM_DISPLAY_REUSE_HINT,
1562                         "display-reuse-hint",
1563                         MM_ATTRS_TYPE_INT,
1564                         MM_ATTRS_FLAG_RW,
1565                         {(void*)FALSE},
1566                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1567                         {.int_min = FALSE},
1568                         {.int_max = TRUE},
1569                         NULL,
1570                 },
1571                 {
1572                         MM_CAM_DISPLAY_REUSE_ELEMENT,
1573                         "display-reuse-element",
1574                         MM_ATTRS_TYPE_DATA,
1575                         MM_ATTRS_FLAG_RW,
1576                         {NULL},
1577                         MM_ATTRS_VALID_TYPE_NONE,
1578                         {0},
1579                         {0},
1580                         NULL,
1581                 },
1582                 {
1583                         MM_CAM_GDBUS_CONNECTION,
1584                         "gdbus-connection",
1585                         MM_ATTRS_TYPE_DATA,
1586                         MM_ATTRS_FLAG_RW,
1587                         {NULL},
1588                         MM_ATTRS_VALID_TYPE_NONE,
1589                         {0},
1590                         {0},
1591                         NULL,
1592                 },
1593                 {
1594                         MM_CAM_AUDIO_REPLAY_GAIN_ENABLE,
1595                         "audio-replay-gain-enable",
1596                         MM_ATTRS_TYPE_INT,
1597                         MM_ATTRS_FLAG_RW,
1598                         {(void*)FALSE},
1599                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1600                         {.int_min = FALSE},
1601                         {.int_max = TRUE},
1602                         _mmcamcorder_commit_audio_replay_gain,
1603                 },
1604                 {
1605                         MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL,
1606                         "audio-replay-gain-reference-level",
1607                         MM_ATTRS_TYPE_DOUBLE,
1608                         MM_ATTRS_FLAG_RW,
1609                         {.value_double = MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL},
1610                         MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
1611                         {.double_min = 0.0},
1612                         {.double_max = 150.0},
1613                         _mmcamcorder_commit_audio_replay_gain,
1614                 },
1615                 {
1616                         MM_CAM_SUPPORT_USER_BUFFER,
1617                         "support-user-buffer",
1618                         MM_ATTRS_TYPE_INT,
1619                         MM_ATTRS_FLAG_RW,
1620                         {(void*)FALSE},
1621                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1622                         {.int_min = FALSE},
1623                         {.int_max = TRUE},
1624                         NULL,
1625                 },
1626                 {
1627                         MM_CAM_USER_BUFFER_FD,
1628                         "user-buffer-fd",
1629                         MM_ATTRS_TYPE_DATA,
1630                         MM_ATTRS_FLAG_RW,
1631                         {NULL},
1632                         MM_ATTRS_VALID_TYPE_NONE,
1633                         {0},
1634                         {0},
1635                         NULL,
1636                 },
1637                 {
1638                         MM_CAM_PLATFORM_PRIVILEGE_CAMERA,
1639                         "platform-privilege-camera",
1640                         MM_ATTRS_TYPE_STRING,
1641                         MM_ATTRS_FLAG_RW,
1642                         {NULL},
1643                         MM_ATTRS_VALID_TYPE_NONE,
1644                         {0},
1645                         {0},
1646                         NULL,
1647                 },
1648                 {
1649                         MM_CAM_STROBE_BRIGHTNESS,
1650                         "strobe-brightness",
1651                         MM_ATTRS_TYPE_INT,
1652                         MM_ATTRS_FLAG_RW,
1653                         {(void*)1},
1654                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1655                         {.int_min = 0},
1656                         {.int_max = -1},
1657                         _mmcamcorder_commit_strobe,
1658                 },
1659                 {
1660                         MM_CAM_VIDEOSRC_ELEMENT_NAME,
1661                         "videosrc-element-name",
1662                         MM_ATTRS_TYPE_STRING,
1663                         MM_ATTRS_FLAG_RW,
1664                         {NULL},
1665                         MM_ATTRS_VALID_TYPE_NONE,
1666                         {0},
1667                         {0},
1668                         NULL,
1669                 },
1670                 {
1671                         MM_CAM_AUDIOSRC_ELEMENT_NAME,
1672                         "audiosrc-element-name",
1673                         MM_ATTRS_TYPE_STRING,
1674                         MM_ATTRS_FLAG_RW,
1675                         {NULL},
1676                         MM_ATTRS_VALID_TYPE_NONE,
1677                         {0},
1678                         {0},
1679                         NULL,
1680                 },
1681                 {
1682                         MM_CAM_EXTRA_PREVIEW_ENABLE,
1683                         "extra-preview-enable",
1684                         MM_ATTRS_TYPE_INT,
1685                         MM_ATTRS_FLAG_RW,
1686                         {(void*)FALSE},
1687                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1688                         {.int_min = FALSE},
1689                         {.int_max = TRUE},
1690                         _mmcamcorder_commit_extra_preview,
1691                 },
1692                 {
1693                         MM_CAM_CAMERA_FOCUS_LEVEL,
1694                         "camera-focus-level",
1695                         MM_ATTRS_TYPE_INT,
1696                         MM_ATTRS_FLAG_RW,
1697                         {(void*)0},
1698                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1699                         {.int_min = 0},
1700                         {.int_max = -1},
1701                         _mmcamcorder_commit_camera_focus_level,
1702                 },
1703                 {
1704                         MM_CAM_SUPPORT_EXTRA_PREVIEW,
1705                         "support-extra-preview",
1706                         MM_ATTRS_TYPE_INT,
1707                         MM_ATTRS_FLAG_RW,
1708                         {(void*)FALSE},
1709                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1710                         {.int_min = FALSE},
1711                         {.int_max = TRUE},
1712                         NULL,
1713                 },
1714                 {
1715                         MM_CAM_REQUEST_CODEC_CONFIG,
1716                         "request-codec-config",
1717                         MM_ATTRS_TYPE_INT,
1718                         MM_ATTRS_FLAG_RW,
1719                         {(void*)FALSE},
1720                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1721                         {.int_min = FALSE},
1722                         {.int_max = TRUE},
1723                         _mmcamcorder_commit_request_codec_config,
1724                 },
1725                 {
1726                         MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_INTERNAL_CB,
1727                         "support-media-packet-preview-internal-cb",
1728                         MM_ATTRS_TYPE_INT,
1729                         MM_ATTRS_FLAG_RW,
1730                         {(void*)FALSE},
1731                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1732                         {.int_min = FALSE},
1733                         {.int_max = TRUE},
1734                         NULL,
1735                 },
1736                 {
1737                         MM_CAM_VIDEO_STREAM_CALLBACK_FLAG,
1738                         "video-stream-callback-flag",
1739                         MM_ATTRS_TYPE_INT,
1740                         MM_ATTRS_FLAG_RW,
1741                         {(void*)MM_CAMCORDER_VIDEO_STREAM_CALLBACK_FLAG_NONE},
1742                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1743                         {.int_min = 0},
1744                         {.int_max = _MMCAMCORDER_MAX_INT},
1745                         NULL,
1746                 },
1747                 {
1748                         MM_CAM_FILTER_WB_TEMPERATURE,
1749                         "filter-wb-temperature",
1750                         MM_ATTRS_TYPE_INT,
1751                         MM_ATTRS_FLAG_RW,
1752                         {(void*)0},
1753                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1754                         {.int_min = 0},
1755                         {.int_max = -1},
1756                         _mmcamcorder_commit_filter,
1757                 },
1758                 {
1759                         MM_CAM_FILTER_WB_TEMPERATURE_STEP,
1760                         "filter-wb-temperature-step",
1761                         MM_ATTRS_TYPE_INT,
1762                         MM_ATTRS_FLAG_RW,
1763                         {(void*)1},
1764                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1765                         {.int_min = 1},
1766                         {.int_max = _MMCAMCORDER_MAX_INT},
1767                         NULL,
1768                 },
1769                 {
1770                         MM_CAM_CAMERA_GAIN,
1771                         "camera-gain",
1772                         MM_ATTRS_TYPE_INT,
1773                         MM_ATTRS_FLAG_RW,
1774                         {(void*)0},
1775                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1776                         {.int_min = 0},
1777                         {.int_max = -1},
1778                         _mmcamcorder_commit_camera_capture_mode,
1779                 },
1780                 {
1781                         MM_CAM_CAMERA_GAIN_STEP,
1782                         "camera-gain-step",
1783                         MM_ATTRS_TYPE_INT,
1784                         MM_ATTRS_FLAG_RW,
1785                         {(void*)1},
1786                         MM_ATTRS_VALID_TYPE_INT_RANGE,
1787                         {.int_min = 1},
1788                         {.int_max = _MMCAMCORDER_MAX_INT},
1789                         NULL,
1790                 }
1791         };
1792
1793         memcpy(hcamcorder->cam_attrs_const_info, temp_info, sizeof(mm_cam_attr_construct_info) * attr_count);
1794
1795         for (idx = 0 ; idx < attr_count ; idx++) {
1796                 /* attribute order check. This should be same. */
1797                 if (idx != hcamcorder->cam_attrs_const_info[idx].attrid) {
1798                         MMCAM_LOG_ERROR("Please check attributes order. Is the idx same with enum val?");
1799                         free(attrs_const_info);
1800                         attrs_const_info = NULL;
1801                         free(hcamcorder->cam_attrs_const_info);
1802                         hcamcorder->cam_attrs_const_info = NULL;
1803                         return 0;
1804                 }
1805
1806                 attrs_const_info[idx].name = hcamcorder->cam_attrs_const_info[idx].name;
1807                 attrs_const_info[idx].value_type = hcamcorder->cam_attrs_const_info[idx].value_type;
1808                 attrs_const_info[idx].flags = hcamcorder->cam_attrs_const_info[idx].flags;
1809                 attrs_const_info[idx].default_value = hcamcorder->cam_attrs_const_info[idx].default_value.value_void;
1810         }
1811
1812         /* Camcorder Attributes */
1813         MMCAM_LOG_INFO("Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count);
1814
1815         ret = mm_attrs_new(attrs_const_info,
1816                 attr_count,
1817                 "Camcorder_Attributes",
1818                 _mmcamcorder_commit_camcorder_attrs,
1819                 (void *)handle,
1820                 &attrs);
1821
1822         free(attrs_const_info);
1823         attrs_const_info = NULL;
1824
1825         if (ret != MM_ERROR_NONE) {
1826                 MMCAM_LOG_ERROR("Fail to alloc attribute handle");
1827                 free(hcamcorder->cam_attrs_const_info);
1828                 hcamcorder->cam_attrs_const_info = NULL;
1829                 return 0;
1830         }
1831
1832         __mmcamcorder_set_conf_to_valid_info(handle);
1833
1834         for (idx = 0; idx < attr_count; idx++) {
1835                 mm_cam_attr_construct_info *attr_info = &hcamcorder->cam_attrs_const_info[idx];
1836
1837                 mm_attrs_set_valid_type(attrs, idx, attr_info->validity_type);
1838
1839                 switch (attr_info->validity_type) {
1840                 case MM_ATTRS_VALID_TYPE_INT_ARRAY:
1841                         if (attr_info->validity_value_1.int_array &&
1842                             attr_info->validity_value_2.count > 0) {
1843                                 mm_attrs_set_valid_array(attrs, idx,
1844                                         (const int *)(attr_info->validity_value_1.int_array),
1845                                         attr_info->validity_value_2.count,
1846                                         attr_info->default_value.value_int);
1847                         }
1848                         break;
1849                 case MM_ATTRS_VALID_TYPE_INT_RANGE:
1850                         mm_attrs_set_valid_range(attrs, idx,
1851                                 attr_info->validity_value_1.int_min,
1852                                 attr_info->validity_value_2.int_max,
1853                                 attr_info->default_value.value_int);
1854                         break;
1855                 case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
1856                         if (attr_info->validity_value_1.double_array &&
1857                             attr_info->validity_value_2.count > 0) {
1858                                 mm_attrs_set_valid_double_array(attrs, idx,
1859                                         (const double *)(attr_info->validity_value_1.double_array),
1860                                         attr_info->validity_value_2.count,
1861                                         attr_info->default_value.value_double);
1862                         }
1863                         break;
1864                 case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
1865                         mm_attrs_set_valid_double_range(attrs, idx,
1866                                 attr_info->validity_value_1.double_min,
1867                                 attr_info->validity_value_2.double_max,
1868                                 attr_info->default_value.value_double);
1869                         break;
1870                 case MM_ATTRS_VALID_TYPE_NONE:
1871                         break;
1872                 case MM_ATTRS_VALID_TYPE_INVALID:
1873                 default:
1874                         MMCAM_LOG_ERROR("Valid type error.");
1875                         break;
1876                 }
1877         }
1878
1879         __mmcamcorder_release_conf_valid_info(handle);
1880
1881         return attrs;
1882 }
1883
1884
1885 void
1886 _mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs)
1887 {
1888         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1889
1890         if (hcamcorder == NULL) {
1891                 MMCAM_LOG_ERROR("handle is NULL");
1892                 return;
1893         }
1894
1895         MMCAM_LOG_INFO("");
1896
1897         if (attrs) {
1898                 mm_attrs_free(attrs);
1899                 MMCAM_LOG_INFO("released attribute");
1900         }
1901
1902         if (hcamcorder->cam_attrs_const_info) {
1903                 free(hcamcorder->cam_attrs_const_info);
1904                 hcamcorder->cam_attrs_const_info = NULL;
1905                 MMCAM_LOG_INFO("released attribute info");
1906         }
1907
1908         return;
1909 }
1910
1911
1912 int
1913 _mmcamcorder_get_attributes(MMHandleType handle,  char **err_attr_name, const char *attribute_name, va_list var_args)
1914 {
1915         MMHandleType attrs = 0;
1916         int ret = MM_ERROR_NONE;
1917
1918         mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
1919         /*mmf_return_val_if_fail(err_attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);*/
1920
1921         attrs = MMF_CAMCORDER_ATTRS(handle);
1922         mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
1923
1924         ret = mm_attrs_get_valist(attrs, err_attr_name, attribute_name, var_args);
1925
1926         return ret;
1927 }
1928
1929
1930 int
1931 _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
1932 {
1933         MMHandleType attrs = 0;
1934         int ret = MM_ERROR_NONE;
1935         int err_index = 0;
1936         char *tmp_err_attr_name = NULL;
1937         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
1938         va_list var_args_copy;
1939
1940         mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
1941
1942         if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
1943                 MMCAM_LOG_ERROR("Another command is running.");
1944                 return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
1945         }
1946
1947         hcamcorder->error_code = MM_ERROR_NONE;
1948
1949         /* copy var_args to keep original var_args */
1950         va_copy(var_args_copy, var_args);
1951
1952         attrs = MMF_CAMCORDER_ATTRS(handle);
1953         if (attrs) {
1954                 ret = __mmcamcorder_check_valid_pair(handle, &tmp_err_attr_name, attribute_name, var_args);
1955         } else {
1956                 MMCAM_LOG_ERROR("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name);
1957                 ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
1958         }
1959
1960         if (ret == MM_ERROR_NONE) {
1961                 /* In 64bit environment, unexpected result is returned if var_args is used again. */
1962                 ret = mm_attrs_set_valist(attrs, &tmp_err_attr_name, attribute_name, var_args_copy);
1963         }
1964
1965         va_end(var_args_copy);
1966
1967         _MMCAMCORDER_UNLOCK_CMD(handle);
1968
1969         if (ret != MM_ERROR_NONE) {
1970                 if (ret == MM_ERROR_COMMON_OUT_OF_RANGE) {
1971                         if (mm_attrs_get_index(attrs, tmp_err_attr_name, &err_index) == MM_ERROR_NONE &&
1972                                 _mmcamcorder_check_supported_attribute(handle, err_index)) {
1973                                 MMCAM_LOG_ERROR("[%s] is supported, but value is invalid",
1974                                         tmp_err_attr_name ? tmp_err_attr_name : "NULL");
1975                                 ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
1976                         }
1977                 }
1978
1979                 if (hcamcorder->error_code != MM_ERROR_NONE) {
1980                         MMCAM_LOG_ERROR("error_code is set. ret 0x%x -> modified 0x%x", ret, hcamcorder->error_code);
1981                         ret = hcamcorder->error_code;
1982                         hcamcorder->error_code = MM_ERROR_NONE;
1983                 }
1984
1985                 MMCAM_LOG_ERROR("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle);
1986         }
1987
1988         if (tmp_err_attr_name) {
1989                 if (!err_attr_name) {
1990                         MMCAM_LOG_ERROR("set attribute[%s] error, but err name is NULL", tmp_err_attr_name);
1991                         free(tmp_err_attr_name);
1992                         tmp_err_attr_name = NULL;
1993                 } else {
1994                         *err_attr_name = tmp_err_attr_name;
1995                 }
1996         }
1997
1998         return ret;
1999 }
2000
2001
2002 int
2003 _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCamAttrsInfo *info)
2004 {
2005         MMHandleType attrs = 0;
2006         MMAttrsInfo attrinfo;
2007         int ret = MM_ERROR_NONE;
2008
2009         mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
2010         mmf_return_val_if_fail(attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
2011         mmf_return_val_if_fail(info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
2012
2013         attrs = MMF_CAMCORDER_ATTRS(handle);
2014         mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
2015
2016         ret = mm_attrs_get_info_by_name(attrs, attr_name, (MMAttrsInfo*)&attrinfo);
2017
2018         if (ret == MM_ERROR_NONE) {
2019                 memset(info, 0x00, sizeof(MMCamAttrsInfo));
2020                 info->type = attrinfo.type;
2021                 info->flag = attrinfo.flag;
2022                 info->validity_type = attrinfo.validity_type;
2023
2024                 switch (attrinfo.validity_type) {
2025                 case MM_ATTRS_VALID_TYPE_INT_ARRAY:
2026                         info->int_array.array = attrinfo.int_array.array;
2027                         info->int_array.count = attrinfo.int_array.count;
2028                         info->int_array.def = attrinfo.int_array.dval;
2029                         break;
2030                 case MM_ATTRS_VALID_TYPE_INT_RANGE:
2031                         info->int_range.min = attrinfo.int_range.min;
2032                         info->int_range.max = attrinfo.int_range.max;
2033                         info->int_range.def = attrinfo.int_range.dval;
2034                         break;
2035                 case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
2036                         info->double_array.array = attrinfo.double_array.array;
2037                         info->double_array.count = attrinfo.double_array.count;
2038                         info->double_array.def = attrinfo.double_array.dval;
2039                         break;
2040                 case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
2041                         info->double_range.min = attrinfo.double_range.min;
2042                         info->double_range.max = attrinfo.double_range.max;
2043                         info->double_range.def = attrinfo.double_range.dval;
2044                         break;
2045                 case MM_ATTRS_VALID_TYPE_NONE:
2046                         break;
2047                 case MM_ATTRS_VALID_TYPE_INVALID:
2048                 default:
2049                         break;
2050                 }
2051         }
2052
2053         return ret;
2054 }
2055
2056
2057 bool
2058 _mmcamcorder_commit_camcorder_attrs(int attr_idx, const char *attr_name, const MMAttrsValue *value, void *commit_param)
2059 {
2060         bool bret = FALSE;
2061         mmf_camcorder_t *hcamcorder = NULL;
2062
2063         mmf_return_val_if_fail(commit_param, FALSE);
2064         mmf_return_val_if_fail(attr_idx >= 0, FALSE);
2065         mmf_return_val_if_fail(attr_name, FALSE);
2066         mmf_return_val_if_fail(value, FALSE);
2067
2068         hcamcorder = MMF_CAMCORDER(commit_param);
2069
2070         if (hcamcorder->cam_attrs_const_info[attr_idx].attr_commit)
2071                 bret = hcamcorder->cam_attrs_const_info[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
2072         else
2073                 bret = TRUE;
2074
2075         return bret;
2076 }
2077
2078
2079 int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle)
2080 {
2081         int *format = NULL;
2082         int total_count = 0;
2083
2084         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2085
2086         if (hcamcorder == NULL) {
2087                 MMCAM_LOG_ERROR("handle is NULL");
2088                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
2089         }
2090
2091         /* Audio encoder */
2092         total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER, &format);
2093         hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = format;
2094         hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = total_count;
2095
2096         /* Video encoder */
2097         total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER, &format);
2098         hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = format;
2099         hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = total_count;
2100
2101         /* Image encoder */
2102         total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER, &format);
2103         hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = format;
2104         hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = total_count;
2105
2106         /* File format */
2107         total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_MUX, &format);
2108         hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = format;
2109         hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = total_count;
2110
2111         return MM_ERROR_NONE;
2112 }
2113
2114
2115 int __mmcamcorder_release_conf_valid_info(MMHandleType handle)
2116 {
2117         int *allocated_memory = NULL;
2118
2119         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2120
2121         if (hcamcorder == NULL) {
2122                 MMCAM_LOG_ERROR("handle is NULL");
2123                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
2124         }
2125
2126         MMCAM_LOG_INFO("START");
2127
2128         /* Audio encoder info */
2129         allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array);
2130         if (allocated_memory) {
2131                 g_free(allocated_memory);
2132                 hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = NULL;
2133                 hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = 0;
2134         }
2135
2136         /* Video encoder info */
2137         allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array);
2138         if (allocated_memory) {
2139                 g_free(allocated_memory);
2140                 hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = NULL;
2141                 hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = 0;
2142         }
2143
2144         /* Image encoder info */
2145         allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array);
2146         if (allocated_memory) {
2147                 g_free(allocated_memory);
2148                 hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = NULL;
2149                 hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = 0;
2150         }
2151
2152         /* File format info */
2153         allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array);
2154         if (allocated_memory) {
2155                 g_free(allocated_memory);
2156                 hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = NULL;
2157                 hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = 0;
2158         }
2159
2160         MMCAM_LOG_INFO("DONE");
2161
2162         return MM_ERROR_NONE;
2163 }
2164
2165
2166 bool _mmcamcorder_commit_capture_width(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2167 {
2168         MMHandleType attr = 0;
2169         int current_state = MM_CAMCORDER_STATE_NONE;
2170
2171         mmf_return_val_if_fail(handle && value, FALSE);
2172
2173         attr = MMF_CAMCORDER_ATTRS(handle);
2174         mmf_return_val_if_fail(attr, FALSE);
2175
2176         /*MMCAM_LOG_INFO("(%d)", attr_idx);*/
2177
2178         current_state = _mmcamcorder_get_state(handle);
2179         if (current_state <= MM_CAMCORDER_STATE_PREPARE) {
2180                 int flags = MM_ATTRS_FLAG_NONE;
2181                 int capture_width, capture_height;
2182                 MMCamAttrsInfo info;
2183
2184                 mm_camcorder_get_attribute_info(handle, MMCAM_CAPTURE_HEIGHT, &info);
2185                 flags = info.flag;
2186
2187                 if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
2188                         mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_HEIGHT, &capture_height, NULL);
2189                         capture_width = value->value.i_val;
2190
2191                         /* Check whether they are valid pair */
2192                         return __mmcamcorder_set_capture_resolution(handle, capture_width, capture_height);
2193                 }
2194
2195                 return TRUE;
2196         } else {
2197                 MMCAM_LOG_INFO("Capture resolution can't be set.(state=%d)", current_state);
2198                 return FALSE;
2199         }
2200 }
2201
2202
2203 bool _mmcamcorder_commit_capture_height(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2204 {
2205         int current_state = MM_CAMCORDER_STATE_NONE;
2206
2207         current_state = _mmcamcorder_get_state(handle);
2208
2209         if (current_state <= MM_CAMCORDER_STATE_PREPARE) {
2210                 int capture_width, capture_height;
2211
2212                 mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_WIDTH, &capture_width, NULL);
2213                 capture_height = value->value.i_val;
2214
2215                 return __mmcamcorder_set_capture_resolution(handle, capture_width, capture_height);
2216         } else {
2217                 MMCAM_LOG_INFO("Capture resolution can't be set.(state=%d)", current_state);
2218
2219                 return FALSE;
2220         }
2221 }
2222
2223
2224 bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2225 {
2226         int current_state = 0;
2227         int ivalue = 0;
2228         _MMCamcorderSubContext *sc = NULL;
2229         _MMCamcorderImageInfo *info = NULL;
2230         GstCameraControl *control = NULL;
2231
2232         mmf_return_val_if_fail(handle && value, FALSE);
2233
2234         current_state = _mmcamcorder_get_state(handle);
2235         ivalue = value->value.i_val;
2236
2237         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2238         if (!sc)
2239                 return TRUE;
2240
2241         info = sc->info_image;
2242         if (!info) {
2243                 MMCAM_LOG_ERROR("info image is NULL");
2244                 return FALSE;
2245         }
2246
2247         if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) {
2248                 if (info->capture_send_count > 0) {
2249                         info->capturing = FALSE;
2250                         MMCAM_LOG_WARNING("capturing -> FALSE and skip capture callback since now");
2251                 }
2252
2253                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
2254                         MMCAM_LOG_WARNING("Can't cast Video source into camera control.");
2255                         return TRUE;
2256                 }
2257
2258                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
2259                 if (control) {
2260                         gst_camera_control_set_capture_command(control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT);
2261                         MMCAM_LOG_WARNING("Commit Break continuous shot : Set command OK. current state[%d]", current_state);
2262                 } else {
2263                         MMCAM_LOG_WARNING("cast CAMERA_CONTROL failed");
2264                 }
2265         } else {
2266                 MMCAM_LOG_WARNING("Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state);
2267         }
2268
2269         return TRUE;
2270 }
2271
2272
2273 bool _mmcamcorder_commit_capture_count(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2274 {
2275         int mode = MM_CAMCORDER_MODE_VIDEO_CAPTURE;
2276         int current_state = MM_CAMCORDER_STATE_NONE;
2277         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2278
2279         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2280
2281         current_state = _mmcamcorder_get_state(handle);
2282         mm_camcorder_get_attributes(handle, NULL, MMCAM_MODE, &mode, NULL);
2283
2284         MMCAM_LOG_INFO("current state %d, mode %d, set count %d",
2285                 current_state, mode, value->value.i_val);
2286
2287         if (mode != MM_CAMCORDER_MODE_AUDIO &&
2288             current_state != MM_CAMCORDER_STATE_CAPTURING) {
2289                 return TRUE;
2290         } else {
2291                 MMCAM_LOG_ERROR("Invalid mode[%d] or state[%d]", mode, current_state);
2292                 return FALSE;
2293         }
2294 }
2295
2296
2297 bool _mmcamcorder_commit_capture_sound_enable(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2298 {
2299         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2300
2301         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2302
2303         MMCAM_LOG_INFO("shutter sound policy: %d", hcamcorder->shutter_sound_policy);
2304
2305         /* return error when disable shutter sound if policy is TRUE */
2306         if (!value->value.i_val &&
2307             hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
2308                 MMCAM_LOG_ERROR("not permitted DISABLE SHUTTER SOUND");
2309                 return FALSE;
2310         } else {
2311                 MMCAM_LOG_INFO("set value [%d] success", value->value.i_val);
2312                 return TRUE;
2313         }
2314 }
2315
2316
2317 bool _mmcamcorder_commit_audio_volume(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2318 {
2319         int current_state = MM_CAMCORDER_STATE_NONE;
2320         _MMCamcorderSubContext *sc = NULL;
2321         bool bret = FALSE;
2322
2323         mmf_return_val_if_fail(handle && value, FALSE);
2324
2325         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2326         if (!sc)
2327                 return TRUE;
2328
2329         current_state = _mmcamcorder_get_state(handle);
2330
2331         if ((current_state == MM_CAMCORDER_STATE_RECORDING) || (current_state == MM_CAMCORDER_STATE_PAUSED)) {
2332                 double mslNewVal = 0;
2333                 mslNewVal = value->value.d_val;
2334
2335                 if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst) {
2336                         if (mslNewVal == 0.0) {
2337                                 /* Because data probe of audio src do the same job, it doesn't need to set mute here. Already null raw data. */
2338                                 MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
2339                         } else {
2340                                 MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
2341                                 MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal);
2342                         }
2343                 }
2344
2345                 MMCAM_LOG_INFO("Commit : volume(%f)", mslNewVal);
2346                 bret = TRUE;
2347         } else {
2348                 MMCAM_LOG_INFO("Commit : nothing to commit. status(%d)", current_state);
2349                 bret = TRUE;
2350         }
2351
2352         return bret;
2353 }
2354
2355
2356 bool _mmcamcorder_commit_camera_format(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2357 {
2358         int ret = MM_ERROR_NONE;
2359         int current_state = MM_CAMCORDER_STATE_NONE;
2360         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2361
2362         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2363
2364         current_state = _mmcamcorder_get_state(handle);
2365         if (current_state > MM_CAMCORDER_STATE_READY) {
2366                 MMCAM_LOG_ERROR("invalid state %d", current_state);
2367                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2368                 return FALSE;
2369         }
2370
2371         if (hcamcorder->is_configured && hcamcorder->mmcam_capability) {
2372                 ret = _mmcamcorder_capability_update_capability_format(handle, value->value.i_val);
2373                 if (ret != MM_ERROR_NONE) {
2374                         MMCAM_LOG_ERROR("update capability format failed[0x%x]", ret);
2375                         return FALSE;
2376                 }
2377
2378                 ret = _mmcamcorder_capability_update_preview_resolution_list(handle);
2379                 if (ret != MM_ERROR_NONE) {
2380                         MMCAM_LOG_ERROR("update resolution list failed[0x%x]", ret);
2381                         return FALSE;
2382                 }
2383         }
2384
2385         MMCAM_LOG_INFO("done");
2386
2387         return TRUE;
2388 }
2389
2390
2391 bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2392 {
2393         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2394         MMCamAttrsInfo fps_info;
2395         int resolution_width = 0;
2396         int resolution_height = 0;
2397         int i = 0;
2398         int ret = 0;
2399         int current_state = MM_CAMCORDER_STATE_NONE;
2400
2401         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2402
2403         current_state = _mmcamcorder_get_state(handle);
2404         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
2405                 MMCAM_LOG_ERROR("invalid state %d", current_state);
2406                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2407                 return FALSE;
2408         }
2409
2410         if (attr_idx == MM_CAM_CAMERA_FPS_AUTO)
2411                 return TRUE;
2412
2413         MMCAM_LOG_INFO("FPS(%d)", value->value.i_val);
2414
2415         if (hcamcorder->on_preview_resolution_update) {
2416                 MMCAM_LOG_INFO("no need to check FPS list");
2417                 return TRUE;
2418         }
2419
2420         ret = mm_camcorder_get_attributes(handle, NULL,
2421                 MMCAM_CAMERA_WIDTH, &resolution_width,
2422                 MMCAM_CAMERA_HEIGHT, &resolution_height,
2423                 NULL);
2424
2425         if (ret != MM_ERROR_NONE) {
2426                 MMCAM_LOG_ERROR("FAILED : coult not get resolution values.");
2427                 return FALSE;
2428         }
2429
2430         ret = mm_camcorder_get_fps_list_by_resolution(handle, resolution_width, resolution_height, &fps_info);
2431         if (ret != MM_ERROR_NONE) {
2432                 MMCAM_LOG_ERROR("FAILED : coult not get FPS values by resolution.");
2433                 return FALSE;
2434         }
2435
2436         for (i = 0 ; i < fps_info.int_array.count ; i++) {
2437                 if (value->value.i_val == fps_info.int_array.array[i])
2438                         return TRUE;
2439         }
2440
2441         MMCAM_LOG_ERROR("FAILED : %d is not supported FPS", value->value.i_val);
2442
2443         return FALSE;
2444 }
2445
2446
2447 bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2448 {
2449         int current_state = MM_CAMCORDER_STATE_NONE;
2450         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2451         _MMCamcorderSubContext *sc = NULL;
2452
2453         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2454
2455         current_state = _mmcamcorder_get_state(handle);
2456         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
2457                 MMCAM_LOG_WARNING("invalid state %d", current_state);
2458                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2459                 return FALSE;
2460         }
2461
2462         /* Verify recording motion rate */
2463         if (value->value.d_val > 0.0) {
2464                 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2465                 if (!sc)
2466                         return TRUE;
2467
2468                 /* set is_slow flag */
2469                 if (value->value.d_val != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE)
2470                         sc->is_modified_rate = TRUE;
2471                 else
2472                         sc->is_modified_rate = FALSE;
2473
2474                 MMCAM_LOG_INFO("Set slow motion rate %lf", value->value.d_val);
2475                 return TRUE;
2476         } else {
2477                 MMCAM_LOG_WARNING("Failed to set recording motion rate %lf", value->value.d_val);
2478                 return FALSE;
2479         }
2480 }
2481
2482
2483 bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2484 {
2485         MMHandleType attr = 0;
2486         int current_state = MM_CAMCORDER_STATE_NONE;
2487         int ret = 0;
2488         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2489         _MMCamcorderSubContext *sc = NULL;
2490
2491         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2492
2493         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2494         if (!sc)
2495                 return TRUE;
2496
2497         attr = MMF_CAMCORDER_ATTRS(handle);
2498         mmf_return_val_if_fail(attr, FALSE);
2499
2500         MMCAM_LOG_INFO("Width(%d)", value->value.i_val);
2501
2502         current_state = _mmcamcorder_get_state(handle);
2503
2504         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
2505                 MMCAM_LOG_INFO("Resolution can't be changed.(state=%d)", current_state);
2506                 return FALSE;
2507         } else {
2508                 int flags = MM_ATTRS_FLAG_NONE;
2509                 MMCamAttrsInfo info;
2510                 mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_HEIGHT, &info);
2511                 flags = info.flag;
2512
2513                 if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
2514                         int width = value->value.i_val;
2515                         int height = 0;
2516                         int preview_format = MM_PIXEL_FORMAT_NV12;
2517                         int codec_type = MM_IMAGE_CODEC_JPEG;
2518
2519                         mm_camcorder_get_attributes(handle, NULL,
2520                                 MMCAM_CAMERA_HEIGHT, &height,
2521                                 MMCAM_CAMERA_FORMAT, &preview_format,
2522                                 MMCAM_IMAGE_ENCODER, &codec_type,
2523                                 NULL);
2524
2525                         if (current_state == MM_CAMCORDER_STATE_PREPARE) {
2526                                 if (hcamcorder->resolution_changed == FALSE) {
2527                                         MMCAM_LOG_INFO("no need to restart preview");
2528                                         return TRUE;
2529                                 }
2530
2531                                 hcamcorder->resolution_changed = FALSE;
2532
2533                                 if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) {
2534                                         MMCAM_LOG_INFO("restart preview");
2535
2536                                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
2537                                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
2538
2539                                         if (!_mmcamcorder_is_encoded_preview_pixel_format(preview_format))
2540                                                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
2541
2542                                         /* check decoder recreation */
2543                                         if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
2544                                                 MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
2545                                                 g_mutex_unlock(&hcamcorder->restart_preview_lock);
2546                                                 return FALSE;
2547                                         }
2548
2549                                         /* get preview format */
2550                                         sc->info_image->preview_format = preview_format;
2551                                         sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
2552                                         ret = _mmcamcorder_set_camera_resolution(handle, width, height);
2553
2554                                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
2555                                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
2556
2557                                         if (!_mmcamcorder_is_encoded_preview_pixel_format(preview_format))
2558                                                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
2559
2560                                         /* unlock */
2561                                         g_mutex_unlock(&hcamcorder->restart_preview_lock);
2562                                 } else {
2563                                         MMCAM_LOG_ERROR("currently locked for preview restart");
2564                                         return FALSE;
2565                                 }
2566                         } else {
2567                                 /* get preview format */
2568                                 sc->info_image->preview_format = preview_format;
2569                                 sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
2570                                 ret = _mmcamcorder_set_camera_resolution(handle, width, height);
2571                         }
2572
2573                         return ret;
2574                 }
2575
2576                 return TRUE;
2577         }
2578 }
2579
2580
2581 bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2582 {
2583         bool ret = false;
2584         int mm_ret = MM_ERROR_NONE;
2585         int current_state = MM_CAMCORDER_STATE_NONE;
2586         int width = 0;
2587         int height = 0;
2588         int preview_format = MM_PIXEL_FORMAT_NV12;
2589         int codec_type = MM_IMAGE_CODEC_JPEG;
2590         MMHandleType attr = 0;
2591         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2592         _MMCamcorderSubContext *sc = NULL;
2593
2594         mmf_return_val_if_fail(hcamcorder && value, false);
2595
2596         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2597         if (!sc)
2598                 return true;
2599
2600         attr = MMF_CAMCORDER_ATTRS(hcamcorder);
2601         mmf_return_val_if_fail(attr, false);
2602
2603         MMCAM_LOG_INFO("Height(%d)", value->value.i_val);
2604         current_state = _mmcamcorder_get_state(handle);
2605
2606         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
2607                 MMCAM_LOG_INFO("Resolution can't be changed.(state=%d)", current_state);
2608                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2609                 return false;
2610         }
2611
2612         height = value->value.i_val;
2613
2614         mm_ret = mm_camcorder_get_attributes(handle, NULL,
2615                 MMCAM_CAMERA_WIDTH, &width,
2616                 MMCAM_CAMERA_FORMAT, &preview_format,
2617                 MMCAM_IMAGE_ENCODER, &codec_type,
2618                 NULL);
2619         if (mm_ret != MM_ERROR_NONE) {
2620                 MMCAM_LOG_ERROR("attributes get failed[0x%x]", ret);
2621                 return false;
2622         }
2623
2624         sc->info_video->preview_width = width;
2625         sc->info_video->preview_height = height;
2626
2627         /* update FPS from capability */
2628         if (hcamcorder->is_configured && hcamcorder->mmcam_capability) {
2629                 mm_ret = _mmcamcorder_capability_update_capability_resolution(handle, width, height);
2630                 if (mm_ret != MM_ERROR_NONE) {
2631                         MMCAM_LOG_ERROR("update capability resolution failed[0x%x]", mm_ret);
2632                         return false;
2633                 }
2634
2635                 hcamcorder->on_preview_resolution_update = TRUE;
2636                 mm_ret = _mmcamcorder_capability_update_preview_fps(hcamcorder);
2637                 hcamcorder->on_preview_resolution_update = FALSE;
2638
2639                 if (mm_ret != MM_ERROR_NONE) {
2640                         MMCAM_LOG_ERROR("update resolution list failed[0x%x]", mm_ret);
2641                         return false;
2642                 }
2643         }
2644
2645         if (current_state != MM_CAMCORDER_STATE_PREPARE) {
2646                 sc->info_image->preview_format = preview_format;
2647                 sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
2648                 return _mmcamcorder_set_camera_resolution(handle, width, height);
2649         }
2650
2651         if (hcamcorder->resolution_changed == FALSE) {
2652                 MMCAM_LOG_INFO("no need to restart preview");
2653                 return true;
2654         }
2655
2656         hcamcorder->resolution_changed = FALSE;
2657
2658         if (!g_mutex_trylock(&hcamcorder->restart_preview_lock)) {
2659                 MMCAM_LOG_ERROR("currently locked for preview restart");
2660                 return false;
2661         }
2662
2663         MMCAM_LOG_INFO("restart preview");
2664
2665         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
2666         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
2667
2668         if (!_mmcamcorder_is_encoded_preview_pixel_format(preview_format))
2669                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
2670
2671         if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
2672                 MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
2673                 g_mutex_unlock(&hcamcorder->restart_preview_lock);
2674                 return false;
2675         }
2676
2677         sc->info_image->preview_format = preview_format;
2678         sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
2679
2680         ret = _mmcamcorder_set_camera_resolution(handle, width, height);
2681
2682         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
2683         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
2684
2685         if (!_mmcamcorder_is_encoded_preview_pixel_format(preview_format))
2686                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
2687
2688         g_mutex_unlock(&hcamcorder->restart_preview_lock);
2689
2690         return ret;
2691 }
2692
2693
2694 bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2695 {
2696         int current_state = MM_CAMCORDER_STATE_NONE;
2697         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2698
2699         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2700
2701         current_state = _mmcamcorder_get_state(handle);
2702         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
2703                 MMCAM_LOG_ERROR("Video Resolution can't be changed.(state=%d)", current_state);
2704                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2705                 return FALSE;
2706         } else {
2707                 MMCAM_LOG_WARNING("Video Resolution %d [attr_idx %d] ",
2708                         value->value.i_val, attr_idx);
2709                 return TRUE;
2710         }
2711 }
2712
2713
2714 bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2715 {
2716         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2717         _MMCamcorderSubContext *sc = NULL;
2718         int current_state = MM_CAMCORDER_STATE_NONE;
2719         GstCameraControl *control = NULL;
2720         int zoom_level = 0;
2721         int zoom_type = 0;
2722
2723         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2724
2725         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2726         if (!sc)
2727                 return TRUE;
2728
2729         zoom_level = value->value.i_val;
2730
2731         MMCAM_LOG_INFO("(%d)", attr_idx);
2732
2733         current_state = _mmcamcorder_get_state(handle);
2734         if (current_state < MM_CAMCORDER_STATE_READY) {
2735                 MMCAM_LOG_INFO("will be applied when preview starts");
2736                 return TRUE;
2737         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
2738                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
2739                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2740                 return FALSE;
2741         }
2742
2743         if (attr_idx == MM_CAM_CAMERA_OPTICAL_ZOOM)
2744                 zoom_type = GST_CAMERA_CONTROL_OPTICAL_ZOOM;
2745         else
2746                 zoom_type = GST_CAMERA_CONTROL_DIGITAL_ZOOM;
2747
2748         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
2749                 int ret = FALSE;
2750
2751                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
2752                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
2753                         return TRUE;
2754                 }
2755
2756                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
2757                 if (control == NULL) {
2758                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
2759                         return FALSE;
2760                 }
2761
2762                 ret = gst_camera_control_set_zoom(control, zoom_type, zoom_level);
2763                 if (ret) {
2764                         MMCAM_LOG_INFO("Succeed in operating Zoom[%d].", zoom_level);
2765                         return TRUE;
2766                 } else {
2767                         MMCAM_LOG_WARNING("Failed to operate Zoom. Type[%d],Level[%d]", zoom_type, zoom_level);
2768                 }
2769         } else {
2770                 MMCAM_LOG_INFO("pointer of video src is null");
2771         }
2772
2773         return FALSE;
2774 }
2775
2776
2777 bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2778 {
2779         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2780         _MMCamcorderSubContext *sc = NULL;
2781         int current_state = MM_CAMCORDER_STATE_NONE;
2782
2783         GstCameraControl *CameraControl = NULL;
2784         GstCameraControlChannel *CameraControlChannel = NULL;
2785         const GList *controls = NULL;
2786         const GList *item = NULL;
2787
2788         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2789
2790         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2791         mmf_return_val_if_fail(sc, TRUE);
2792
2793         MMCAM_LOG_INFO("ptz type : %d", value->value.i_val);
2794
2795         current_state = _mmcamcorder_get_state(handle);
2796         if (current_state < MM_CAMCORDER_STATE_PREPARE ||
2797             current_state == MM_CAMCORDER_STATE_CAPTURING) {
2798                 MMCAM_LOG_ERROR("invalid state[%d]", current_state);
2799                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2800                 return FALSE;
2801         }
2802
2803         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
2804                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
2805                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
2806                         return FALSE;
2807                 }
2808
2809                 CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
2810                 if (CameraControl == NULL) {
2811                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
2812                         return FALSE;
2813                 }
2814
2815                 controls = gst_camera_control_list_channels(CameraControl);
2816                 if (controls == NULL) {
2817                         MMCAM_LOG_ERROR("gst_camera_control_list_channels failed");
2818                         return FALSE;
2819                 }
2820
2821                 for (item = controls ; item && item->data ; item = item->next) {
2822                         CameraControlChannel = item->data;
2823                         MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label);
2824                         if (!strcmp(CameraControlChannel->label, "ptz_type")) {
2825                                 if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
2826                                         MMCAM_LOG_WARNING("set ptz type %d done", value->value.i_val);
2827                                         return TRUE;
2828                                 } else {
2829                                         MMCAM_LOG_ERROR("failed to set ptz type %d", value->value.i_val);
2830                                         return FALSE;
2831                                 }
2832                         }
2833                 }
2834
2835                 MMCAM_LOG_WARNING("failed to find ptz type control channel");
2836         }
2837
2838         return FALSE;
2839 }
2840
2841
2842 bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2843 {
2844         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2845         _MMCamcorderSubContext *sc = NULL;
2846         int current_state = MM_CAMCORDER_STATE_NONE;
2847
2848         GstCameraControl *CameraControl = NULL;
2849         GstCameraControlChannel *CameraControlChannel = NULL;
2850         const GList *controls = NULL;
2851         const GList *item = NULL;
2852
2853         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2854
2855         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2856         mmf_return_val_if_fail(sc, TRUE);
2857
2858         MMCAM_LOG_INFO("pan : %d", value->value.i_val);
2859
2860         current_state = _mmcamcorder_get_state(handle);
2861         if (current_state < MM_CAMCORDER_STATE_PREPARE ||
2862             current_state == MM_CAMCORDER_STATE_CAPTURING) {
2863                 MMCAM_LOG_ERROR("invalid state[%d]", current_state);
2864                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2865                 return FALSE;
2866         }
2867
2868         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
2869                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
2870                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
2871                         return FALSE;
2872                 }
2873
2874                 CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
2875                 if (CameraControl == NULL) {
2876                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
2877                         return FALSE;
2878                 }
2879
2880                 controls = gst_camera_control_list_channels(CameraControl);
2881                 if (controls == NULL) {
2882                         MMCAM_LOG_ERROR("gst_camera_control_list_channels failed");
2883                         return FALSE;
2884                 }
2885
2886                 for (item = controls ; item && item->data ; item = item->next) {
2887                         CameraControlChannel = item->data;
2888                         MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label);
2889                         if (!strcmp(CameraControlChannel->label, "pan")) {
2890                                 if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
2891                                         MMCAM_LOG_WARNING("set pan %d done", value->value.i_val);
2892                                         return TRUE;
2893                                 } else {
2894                                         MMCAM_LOG_ERROR("failed to set pan %d", value->value.i_val);
2895                                         return FALSE;
2896                                 }
2897                         }
2898                 }
2899
2900                 MMCAM_LOG_WARNING("failed to find pan control channel");
2901         }
2902
2903         return FALSE;
2904 }
2905
2906
2907 bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2908 {
2909         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2910         _MMCamcorderSubContext *sc = NULL;
2911         int current_state = MM_CAMCORDER_STATE_NONE;
2912
2913         GstCameraControl *CameraControl = NULL;
2914         GstCameraControlChannel *CameraControlChannel = NULL;
2915         const GList *controls = NULL;
2916         const GList *item = NULL;
2917
2918         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2919
2920         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2921         mmf_return_val_if_fail(sc, TRUE);
2922
2923         MMCAM_LOG_INFO("tilt : %d", value->value.i_val);
2924
2925         current_state = _mmcamcorder_get_state(handle);
2926         if (current_state < MM_CAMCORDER_STATE_PREPARE ||
2927             current_state == MM_CAMCORDER_STATE_CAPTURING) {
2928                 MMCAM_LOG_ERROR("invalid state[%d]", current_state);
2929                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
2930                 return FALSE;
2931         }
2932
2933         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
2934                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
2935                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
2936                         return FALSE;
2937                 }
2938
2939                 CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
2940                 if (CameraControl == NULL) {
2941                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
2942                         return FALSE;
2943                 }
2944
2945                 controls = gst_camera_control_list_channels(CameraControl);
2946                 if (controls == NULL) {
2947                         MMCAM_LOG_ERROR("gst_camera_control_list_channels failed");
2948                         return FALSE;
2949                 }
2950
2951                 for (item = controls ; item && item->data ; item = item->next) {
2952                         CameraControlChannel = item->data;
2953                         MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label);
2954                         if (!strcmp(CameraControlChannel->label, "tilt")) {
2955                                 if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
2956                                         MMCAM_LOG_WARNING("set tilt %d done", value->value.i_val);
2957                                         return TRUE;
2958                                 } else {
2959                                         MMCAM_LOG_ERROR("failed to set tilt %d", value->value.i_val);
2960                                         return FALSE;
2961                                 }
2962                         }
2963                 }
2964
2965                 MMCAM_LOG_WARNING("failed to find tilt control channel");
2966         }
2967
2968         return FALSE;
2969 }
2970
2971
2972 bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
2973 {
2974         MMHandleType attr = 0;
2975         int current_state = MM_CAMCORDER_STATE_NONE;
2976         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
2977         _MMCamcorderSubContext *sc = NULL;
2978         GstCameraControl *control = NULL;
2979         int mslVal;
2980         int set_focus_mode = 0;
2981         int cur_focus_mode = 0;
2982         int cur_focus_range = 0;
2983
2984         mmf_return_val_if_fail(hcamcorder && value, FALSE);
2985
2986         attr = MMF_CAMCORDER_ATTRS(handle);
2987         mmf_return_val_if_fail(attr, FALSE);
2988
2989         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
2990         if (!sc)
2991                 return TRUE;
2992
2993         MMCAM_LOG_INFO("Focus mode(%d)", value->value.i_val);
2994
2995         /* check whether set or not */
2996         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
2997                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
2998                 return TRUE;
2999         }
3000
3001         current_state = _mmcamcorder_get_state(handle);
3002         if (current_state < MM_CAMCORDER_STATE_NULL) {
3003                 MMCAM_LOG_INFO("Focus mode will be changed later.(state=%d)", current_state);
3004                 return TRUE;
3005         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3006                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3007                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3008                 return FALSE;
3009         }
3010
3011         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3012                 int flags = MM_ATTRS_FLAG_NONE;
3013                 MMCamAttrsInfo info;
3014
3015                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3016                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3017                         return TRUE;
3018                 }
3019
3020                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3021                 if (control == NULL) {
3022                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3023                         return FALSE;
3024                 }
3025
3026                 mslVal = value->value.i_val;
3027                 set_focus_mode = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
3028
3029                 mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_SCAN_RANGE, &info);
3030                 flags = info.flag;
3031
3032                 if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
3033                         if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
3034                                 if (set_focus_mode != cur_focus_mode) {
3035                                         if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) {
3036                                                 MMCAM_LOG_INFO("Succeed in setting AF mode[%d]", mslVal);
3037                                                 return TRUE;
3038                                         } else {
3039                                                 MMCAM_LOG_WARNING("Failed to set AF mode[%d]", mslVal);
3040                                         }
3041                                 } else {
3042                                         MMCAM_LOG_INFO("No need to set AF mode. Current[%d]", mslVal);
3043                                         return TRUE;
3044                                 }
3045                         } else {
3046                                 MMCAM_LOG_WARNING("Failed to get AF mode, so do not set new AF mode[%d]", mslVal);
3047                         }
3048                 }
3049         } else {
3050                 MMCAM_LOG_INFO("pointer of video src is null");
3051         }
3052
3053         return TRUE;
3054 }
3055
3056
3057 bool _mmcamcorder_commit_camera_focus_level(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3058 {
3059         int current_state = MM_CAMCORDER_STATE_NONE;
3060         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3061         _MMCamcorderSubContext *sc = NULL;
3062         GstCameraControl *control = NULL;
3063
3064         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3065
3066         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3067         if (!sc)
3068                 return TRUE;
3069
3070         MMCAM_LOG_INFO("Focus level[%d]", value->value.i_val);
3071
3072         current_state = _mmcamcorder_get_state(handle);
3073         if (current_state < MM_CAMCORDER_STATE_READY) {
3074                 MMCAM_LOG_INFO("Focus level will be set later.(state=%d)", current_state);
3075                 return TRUE;
3076         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3077                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3078                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3079                 return FALSE;
3080         }
3081
3082         if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3083                 MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
3084                 return FALSE;
3085         }
3086
3087         control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3088         if (control == NULL) {
3089                 MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3090                 return FALSE;
3091         }
3092
3093         if (!gst_camera_control_set_focus_level(control, value->value.i_val)) {
3094                 MMCAM_LOG_ERROR("set focus level[%d[ failed", value->value.i_val);
3095                 return FALSE;
3096         }
3097
3098         return TRUE;
3099 }
3100
3101
3102 bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3103 {
3104         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3105         _MMCamcorderSubContext *sc = NULL;
3106         GstCameraControl *control = NULL;
3107         int current_state = MM_CAMCORDER_STATE_NONE;
3108         int mslVal = 0;
3109         int newVal = 0;
3110         int cur_focus_mode = 0;
3111         int cur_focus_range = 0;
3112         int msl_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
3113         int converted_mode = 0;
3114
3115         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3116
3117         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3118         if (!sc)
3119                 return TRUE;
3120
3121         MMCAM_LOG_INFO("(%d)", attr_idx);
3122
3123         /* check whether set or not */
3124         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3125                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3126                 return TRUE;
3127         }
3128
3129         mslVal = value->value.i_val;
3130         newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
3131
3132         current_state = _mmcamcorder_get_state(handle);
3133         if (current_state < MM_CAMCORDER_STATE_PREPARE) {
3134                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
3135                 return TRUE;
3136         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3137                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3138                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3139                 return FALSE;
3140         }
3141
3142         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3143                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3144                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3145                         return TRUE;
3146                 }
3147
3148                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3149                 if (control == NULL) {
3150                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3151                         return FALSE;
3152                 }
3153
3154                 mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &msl_mode, NULL);
3155                 converted_mode = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_FOCUS_MODE, msl_mode);
3156
3157                 if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
3158                         if ((newVal != cur_focus_range) || (converted_mode != cur_focus_mode)) {
3159                                 if (gst_camera_control_set_focus(control, converted_mode, newVal)) {
3160                                         /*MMCAM_LOG_INFO("Succeed in setting AF mode[%d]", mslVal);*/
3161                                         return TRUE;
3162                                 } else {
3163                                         MMCAM_LOG_WARNING("Failed to set AF mode[%d]", mslVal);
3164                                 }
3165                         } else {
3166                                 /*MMCAM_LOG_INFO("No need to set AF mode. Current[%d]", mslVal);*/
3167                                 return TRUE;
3168                         }
3169                 } else {
3170                         MMCAM_LOG_WARNING("Failed to get AF mode, so do not set new AF mode[%d]", mslVal);
3171                 }
3172         } else {
3173                 MMCAM_LOG_INFO("pointer of video src is null");
3174         }
3175
3176         return FALSE;
3177 }
3178
3179
3180 bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3181 {
3182         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3183         _MMCamcorderSubContext *sc = NULL;
3184         GstCameraControl *control = NULL;
3185         GstCameraControlRectType set_area = { 0, 0, 0, 0 };
3186         GstCameraControlRectType get_area = { 0, 0, 0, 0 };
3187
3188         int current_state = MM_CAMCORDER_STATE_NONE;
3189         int ret = FALSE;
3190         int focus_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
3191
3192         gboolean do_set = FALSE;
3193
3194         MMCamAttrsInfo info_y;
3195         MMCamAttrsInfo info_w;
3196         MMCamAttrsInfo info_h;
3197
3198         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3199
3200         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3201         if (!sc)
3202                 return TRUE;
3203
3204         MMCAM_LOG_INFO("(%d)", attr_idx);
3205
3206         current_state = _mmcamcorder_get_state(handle);
3207         if (current_state < MM_CAMCORDER_STATE_PREPARE) {
3208                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
3209                 return TRUE;
3210         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3211                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3212                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3213                 return FALSE;
3214         }
3215
3216         ret = mm_camcorder_get_attributes(handle, NULL,
3217                 MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
3218                 NULL);
3219         if (ret != MM_ERROR_NONE) {
3220                 MMCAM_LOG_WARNING("Failed to get FOCUS MODE.[%x]", ret);
3221                 return FALSE;
3222         }
3223
3224         if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS)) {
3225                 MMCAM_LOG_WARNING("Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode);
3226                 return FALSE;
3227         }
3228
3229         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3230                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3231                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3232                         return TRUE;
3233                 }
3234
3235                 memset(&info_y, 0x0, sizeof(MMCamAttrsInfo));
3236                 memset(&info_w, 0x0, sizeof(MMCamAttrsInfo));
3237                 memset(&info_h, 0x0, sizeof(MMCamAttrsInfo));
3238
3239                 switch (attr_idx) {
3240                 case MM_CAM_CAMERA_AF_TOUCH_X:
3241                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_Y, &info_y);
3242                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
3243                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
3244                         if (!((info_y.flag|info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED)) {
3245                                 set_area.x = value->value.i_val;
3246                                 mm_camcorder_get_attributes(handle, NULL,
3247                                         MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
3248                                         MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
3249                                         MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
3250                                         NULL);
3251                                 do_set = TRUE;
3252                         } else {
3253                                 MMCAM_LOG_INFO("Just store AF area[x:%d]", value->value.i_val);
3254                                 return TRUE;
3255                         }
3256                         break;
3257                 case MM_CAM_CAMERA_AF_TOUCH_Y:
3258                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
3259                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
3260                         if (!((info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED)) {
3261                                 set_area.y = value->value.i_val;
3262                                 mm_camcorder_get_attributes(handle, NULL,
3263                                         MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
3264                                         MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
3265                                         MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
3266                                         NULL);
3267                                 do_set = TRUE;
3268                         } else {
3269                                 MMCAM_LOG_INFO("Just store AF area[y:%d]", value->value.i_val);
3270                                 return TRUE;
3271                         }
3272                         break;
3273                 case MM_CAM_CAMERA_AF_TOUCH_WIDTH:
3274                         mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
3275                         if (!(info_h.flag & MM_ATTRS_FLAG_MODIFIED)) {
3276                                 set_area.width = value->value.i_val;
3277                                 mm_camcorder_get_attributes(handle, NULL,
3278                                         MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
3279                                         MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
3280                                         MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
3281                                         NULL);
3282                                 do_set = TRUE;
3283                         } else {
3284                                 MMCAM_LOG_INFO("Just store AF area[width:%d]", value->value.i_val);
3285                                 return TRUE;
3286                         }
3287                         break;
3288                 case MM_CAM_CAMERA_AF_TOUCH_HEIGHT:
3289                         set_area.height = value->value.i_val;
3290                         mm_camcorder_get_attributes(handle, NULL,
3291                                 MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
3292                                 MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
3293                                 MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
3294                                 NULL);
3295                         do_set = TRUE;
3296                         break;
3297                 default:
3298                         break;
3299                 }
3300
3301                 if (do_set) {
3302                         _MMCamcorderVideoInfo *info = sc->info_video;
3303
3304                         if (info == NULL) {
3305                                 MMCAM_LOG_ERROR("video info is NULL");
3306                                 return FALSE;
3307                         }
3308
3309                         control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3310                         if (control == NULL) {
3311                                 MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3312                                 return FALSE;
3313                         }
3314
3315                         /* convert area */
3316                         if (current_state >= MM_CAMCORDER_STATE_RECORDING && info->support_dual_stream == FALSE &&
3317                             (info->preview_width != info->video_width || info->preview_height != info->video_height)) {
3318                                 float ratio_width = 0.0;
3319                                 float ratio_height = 0.0;
3320
3321                                 if (info->preview_width != 0 && info->preview_height != 0) {
3322                                         ratio_width = (float)info->video_width / (float)info->preview_width;
3323                                         ratio_height = (float)info->video_height / (float)info->preview_height;
3324
3325                                         MMCAM_LOG_INFO("original area %d,%d,%dx%d, resolution ratio : width %f, height %f",
3326                                                 set_area.x, set_area.y, set_area.width, set_area.height, ratio_width, ratio_height);
3327
3328                                         set_area.x = (int)((float)set_area.x * ratio_width);
3329                                         set_area.y = (int)((float)set_area.y * ratio_height);
3330                                         set_area.width = (int)((float)set_area.width * ratio_width);
3331                                         set_area.height = (int)((float)set_area.height * ratio_height);
3332
3333                                         if (set_area.width <= 0)
3334                                                 set_area.width = 1;
3335
3336                                         if (set_area.height <= 0)
3337                                                 set_area.height = 1;
3338
3339                                         MMCAM_LOG_INFO("converted area %d,%d,%dx%d",
3340                                                 set_area.x, set_area.y, set_area.width, set_area.height);
3341                                 } else {
3342                                         MMCAM_LOG_WARNING("invalid preview size %dx%d, skip AF area converting",
3343                                                 info->preview_width, info->preview_height);
3344                                 }
3345                         }
3346
3347                         ret = gst_camera_control_get_auto_focus_area(control, &get_area);
3348                         if (!ret) {
3349                                 MMCAM_LOG_WARNING("Failed to get AF area");
3350                                 return FALSE;
3351                         }
3352
3353                         /* width and height are not supported now */
3354                         if (get_area.x == set_area.x && get_area.y == set_area.y) {
3355                                 MMCAM_LOG_INFO("No need to set AF area[x,y:%d,%d]",
3356                                         get_area.x, get_area.y);
3357                                 return TRUE;
3358                         }
3359
3360                         ret = gst_camera_control_set_auto_focus_area(control, set_area);
3361                         if (ret) {
3362                                 MMCAM_LOG_INFO("Succeed to set AF area[%d,%d,%dx%d]",
3363                                         set_area.x, set_area.y, set_area.width, set_area.height);
3364                                 return TRUE;
3365                         } else {
3366                                 MMCAM_LOG_WARNING("Failed to set AF area[%d,%d,%dx%d]",
3367                                         set_area.x, set_area.y, set_area.width, set_area.height);
3368                         }
3369                 }
3370         } else {
3371                 MMCAM_LOG_INFO("pointer of video src is null");
3372         }
3373
3374         return FALSE;
3375 }
3376
3377
3378 bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3379 {
3380         GstCameraControl *control = NULL;
3381         int ivalue = 0;
3382         int mslVal1 = 0;
3383         int mslVal2 = 0;
3384         int newVal1 = 0;
3385         int newVal2 = 0;
3386         int exposure_type = 0;
3387         int current_state = MM_CAMCORDER_STATE_NONE;
3388         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3389         _MMCamcorderSubContext *sc = NULL;
3390
3391         int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
3392         gboolean check_scene_mode = FALSE;
3393
3394         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3395
3396         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3397         if (!sc)
3398                 return TRUE;
3399
3400         /* check whether set or not */
3401         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3402                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3403                 return TRUE;
3404         }
3405
3406         current_state = _mmcamcorder_get_state(handle);
3407         if (current_state < MM_CAMCORDER_STATE_READY) {
3408                 MMCAM_LOG_INFO("will be applied when preview starts");
3409                 return TRUE;
3410         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3411                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3412                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3413                 return FALSE;
3414         }
3415
3416         ivalue = value->value.i_val;
3417
3418         switch (attr_idx) {
3419         case MM_CAM_CAMERA_F_NUMBER:
3420                 exposure_type = GST_CAMERA_CONTROL_F_NUMBER;
3421                 mslVal1 = newVal1 = MM_CAMCORDER_GET_NUMERATOR(ivalue);
3422                 mslVal2 = newVal2 = MM_CAMCORDER_GET_DENOMINATOR(ivalue);
3423                 break;
3424         case MM_CAM_CAMERA_SHUTTER_SPEED:
3425                 exposure_type = GST_CAMERA_CONTROL_SHUTTER_SPEED;
3426                 mslVal1 = newVal1 = MM_CAMCORDER_GET_NUMERATOR(ivalue);
3427                 mslVal2 = newVal2 = MM_CAMCORDER_GET_DENOMINATOR(ivalue);
3428                 break;
3429         case MM_CAM_CAMERA_ISO:
3430                 exposure_type = GST_CAMERA_CONTROL_ISO;
3431                 mslVal1 = ivalue;
3432                 newVal1 = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal1);
3433                 check_scene_mode = TRUE;
3434                 break;
3435         case MM_CAM_CAMERA_EXPOSURE_MODE:
3436                 exposure_type = GST_CAMERA_CONTROL_EXPOSURE_MODE;
3437                 mslVal1 = ivalue;
3438                 newVal1 =  _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal1);
3439                 check_scene_mode = TRUE;
3440                 break;
3441         case MM_CAM_CAMERA_EXPOSURE_VALUE:
3442                 exposure_type = GST_CAMERA_CONTROL_EXPOSURE_VALUE;
3443                 mslVal1 = newVal1 = ivalue;
3444                 break;
3445         case MM_CAM_CAMERA_GAIN:
3446                 exposure_type = GST_CAMERA_CONTROL_GAIN;
3447                 mslVal1 = newVal1 = ivalue;
3448                 break;
3449         default:
3450                 MMCAM_LOG_ERROR("unknown attr idx[%d]", attr_idx);
3451                 return FALSE;
3452         }
3453
3454         if (check_scene_mode) {
3455                 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &scene_mode, NULL);
3456                 if (scene_mode != MM_CAMCORDER_SCENE_MODE_NORMAL) {
3457                         MMCAM_LOG_WARNING("can not set [%d] when scene mode is NOT normal.", attr_idx);
3458                         return FALSE;
3459                 }
3460         }
3461
3462         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3463                 int ret = 0;
3464
3465                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3466                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3467                         return TRUE;
3468                 }
3469
3470                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3471                 if (control == NULL) {
3472                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3473                         return FALSE;
3474                 }
3475
3476                 ret = gst_camera_control_set_exposure(control, exposure_type, newVal1, newVal2);
3477                 if (ret) {
3478                         MMCAM_LOG_INFO("Succeed in setting exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2);
3479                         return TRUE;
3480                 } else {
3481                         MMCAM_LOG_WARNING("Failed to set exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2);
3482                 }
3483         } else {
3484                 MMCAM_LOG_INFO("pointer of video src is null");
3485         }
3486
3487         return FALSE;
3488 }
3489
3490
3491 bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3492 {
3493         GstCameraControl *control = NULL;
3494         int mslVal = 0;
3495         int newVal = 0;
3496         int cur_value = 0;
3497         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3498         _MMCamcorderSubContext *sc = NULL;
3499         int current_state = MM_CAMCORDER_STATE_NONE;
3500
3501         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3502
3503         /* check whether set or not */
3504         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3505                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3506                 return TRUE;
3507         }
3508
3509         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3510         if (!sc)
3511                 return TRUE;
3512
3513         /* check current state */
3514         current_state = _mmcamcorder_get_state(handle);
3515         if (current_state < MM_CAMCORDER_STATE_READY) {
3516                 MMCAM_LOG_INFO("will be applied when preview starts");
3517                 return TRUE;
3518         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3519                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3520                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3521                 return FALSE;
3522         }
3523
3524         mslVal = value->value.i_val;
3525         newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_WDR, mslVal);
3526
3527         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3528                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3529                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3530                         return TRUE;
3531                 }
3532
3533                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3534                 if (control == NULL) {
3535                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3536                         return FALSE;
3537                 }
3538
3539                 if (gst_camera_control_get_wdr(control, &cur_value)) {
3540                         if (newVal != cur_value) {
3541                                 if (gst_camera_control_set_wdr(control, newVal)) {
3542                                         MMCAM_LOG_INFO("Success - set wdr[%d]", mslVal);
3543                                         return TRUE;
3544                                 } else {
3545                                         MMCAM_LOG_WARNING("Failed to set WDR. NewVal[%d],CurVal[%d]", newVal, cur_value);
3546                                 }
3547                         } else {
3548                                 MMCAM_LOG_INFO("No need to set new WDR. Current[%d]", mslVal);
3549                                 return TRUE;
3550                         }
3551                 } else {
3552                         MMCAM_LOG_WARNING("Failed to get WDR.");
3553                 }
3554         } else {
3555                 MMCAM_LOG_INFO("pointer of video src is null");
3556         }
3557
3558         return FALSE;
3559 }
3560
3561
3562 bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3563 {
3564         int current_state = MM_CAMCORDER_STATE_NONE;
3565         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3566
3567         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3568
3569         /* check whether set or not */
3570         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3571                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3572                 return TRUE;
3573         }
3574
3575         current_state = _mmcamcorder_get_state(handle);
3576         if (current_state < MM_CAMCORDER_STATE_READY) {
3577                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
3578                 return TRUE;
3579         } else if (current_state > MM_CAMCORDER_STATE_PREPARE) {
3580                 MMCAM_LOG_ERROR("Invalid state (state %d)", current_state);
3581                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3582                 return FALSE;
3583         }
3584
3585         return _mmcamcorder_set_videosrc_anti_shake(handle, value->value.i_val);
3586 }
3587
3588
3589 bool _mmcamcorder_commit_encoder_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3590 {
3591         int audio_enc = 0;
3592         int bitrate = 0;
3593         int current_state = MM_CAMCORDER_STATE_NONE;
3594         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3595         _MMCamcorderSubContext *sc = NULL;
3596
3597         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3598
3599         bitrate = value->value.i_val;
3600
3601         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3602         if (!sc || !sc->encode_element) {
3603                 MMCAM_LOG_INFO("will be applied later - idx %d, bitrate %d", attr_idx, bitrate);
3604                 return TRUE;
3605         }
3606
3607         current_state = _mmcamcorder_get_state(handle);
3608         if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
3609                 MMCAM_LOG_ERROR("Can not set while RECORDING - attr idx %d", attr_idx);
3610                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3611                 return FALSE;
3612         }
3613
3614         if (attr_idx == MM_CAM_AUDIO_ENCODER_BITRATE) {
3615                 mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &audio_enc, NULL);
3616
3617                 _mmcamcorder_set_encoder_bitrate(MM_CAMCORDER_ENCODER_TYPE_AUDIO, audio_enc,
3618                         bitrate, sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst);
3619         } else {
3620                 _mmcamcorder_set_encoder_bitrate(MM_CAMCORDER_ENCODER_TYPE_VIDEO, 0,
3621                         bitrate, sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
3622         }
3623
3624         return TRUE;
3625 }
3626
3627
3628 bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3629 {
3630         int current_state = MM_CAMCORDER_STATE_NONE;
3631         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3632
3633         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3634
3635         current_state = _mmcamcorder_get_state(handle);
3636         if (current_state < MM_CAMCORDER_STATE_READY) {
3637                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
3638                 return TRUE;
3639         } else if (current_state > MM_CAMCORDER_STATE_PREPARE) {
3640                 MMCAM_LOG_ERROR("Invalid state (state %d)", current_state);
3641                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3642                 return FALSE;
3643         }
3644
3645         return _mmcamcorder_set_videosrc_stabilization(handle, value->value.i_val);
3646 }
3647
3648
3649 bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3650 {
3651         int current_state = MM_CAMCORDER_STATE_NONE;
3652         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3653
3654         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3655
3656         MMCAM_LOG_INFO("rotate(%d)", value->value.i_val);
3657
3658         current_state = _mmcamcorder_get_state(handle);
3659
3660         if (current_state > MM_CAMCORDER_STATE_READY) {
3661                 MMCAM_LOG_ERROR("camera rotation setting failed.(state=%d)", current_state);
3662                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3663                 return FALSE;
3664         } else {
3665                 return _mmcamcorder_set_videosrc_rotation(handle, value->value.i_val);
3666         }
3667 }
3668
3669
3670 bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3671 {
3672         int current_state = MM_CAMCORDER_STATE_NONE;
3673
3674         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3675         _MMCamcorderSubContext *sc = NULL;
3676
3677         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3678
3679         /* check type */
3680         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
3681                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
3682                 return FALSE;
3683         }
3684
3685         /* check current state */
3686         current_state = _mmcamcorder_get_state(handle);
3687         if (current_state < MM_CAMCORDER_STATE_READY) {
3688                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
3689                 return TRUE;
3690         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3691                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3692                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3693                 return FALSE;
3694         }
3695
3696         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3697
3698         MMCAM_LOG_INFO("Image encoder quality(%d)", value->value.i_val);
3699
3700         if (current_state == MM_CAMCORDER_STATE_PREPARE) {
3701                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", value->value.i_val);
3702                 return TRUE;
3703         } else {
3704                 MMCAM_LOG_ERROR("invalid state %d", current_state);
3705                 return FALSE;
3706         }
3707 }
3708
3709
3710 bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3711 {
3712         mmf_return_val_if_fail(handle && value, FALSE);
3713
3714         /* get string */
3715         if (!value->value.s_val) {
3716                 MMCAM_LOG_ERROR("NULL filename");
3717                 return FALSE;
3718         }
3719
3720         MMCAM_LOG_INFO("set filename [%s]", value->value.s_val);
3721
3722         return TRUE;
3723 }
3724
3725
3726 bool _mmcamcorder_commit_recording_max_limit(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3727 {
3728         int current_state = MM_CAMCORDER_STATE_NONE;
3729         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3730
3731         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3732
3733         current_state = _mmcamcorder_get_state(handle);
3734         if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
3735                 MMCAM_LOG_ERROR("Can not set while RECORDING");
3736                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3737                 return FALSE;
3738         }
3739
3740         return TRUE;
3741 }
3742
3743
3744 static int __color_channel_item_compare_func(gconstpointer data, gconstpointer user_data)
3745 {
3746         GstColorBalanceChannel *Colorchannel = (GstColorBalanceChannel *)data;
3747         MMCAM_LOG_VERBOSE("check[%s], input[%s]", Colorchannel->label, (char *)user_data);
3748         return strcmp(Colorchannel->label, user_data);
3749 }
3750
3751 bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3752 {
3753         GstColorBalance *balance = NULL;
3754         GstColorBalanceChannel *Colorchannel = NULL;
3755         GList *controls = NULL;
3756         GList *item = NULL;
3757         int newVal = 0;
3758         int mslVal = 0;
3759         int current_state = MM_CAMCORDER_STATE_NONE;
3760         const char *control_label = NULL;
3761         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3762         _MMCamcorderSubContext *sc = NULL;
3763
3764         int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
3765         gboolean check_scene_mode = FALSE;
3766
3767         int wb_temp_table[] = {
3768                 [MM_CAMCORDER_WHITE_BALANCE_DAYLIGHT] = 5200,
3769                 [MM_CAMCORDER_WHITE_BALANCE_CLOUDY] = 6000,
3770                 [MM_CAMCORDER_WHITE_BALANCE_FLUORESCENT] = 4000,
3771                 [MM_CAMCORDER_WHITE_BALANCE_INCANDESCENT] = 3200,
3772                 [MM_CAMCORDER_WHITE_BALANCE_SHADE] = 7000,
3773                 [MM_CAMCORDER_WHITE_BALANCE_FLASH] = 6000
3774         };
3775
3776         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3777
3778         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3779         if (!sc)
3780                 return TRUE;
3781
3782         /* check whether set or not */
3783         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3784                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3785                 return TRUE;
3786         }
3787
3788         current_state = _mmcamcorder_get_state(handle);
3789         if (current_state < MM_CAMCORDER_STATE_READY) {
3790                 MMCAM_LOG_INFO("will be applied when preview starts");
3791                 return TRUE;
3792         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3793                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3794                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3795                 return FALSE;
3796         }
3797
3798         if (value->type != MM_ATTRS_TYPE_INT) {
3799                 MMCAM_LOG_WARNING("Mismatched value type (%d)", value->type);
3800                 return FALSE;
3801         }
3802
3803         mslVal = value->value.i_val;
3804
3805         switch (attr_idx) {
3806         case MM_CAM_FILTER_BRIGHTNESS:
3807                 control_label = "brightness";
3808                 check_scene_mode = TRUE;
3809                 break;
3810         case MM_CAM_FILTER_CONTRAST:
3811                 control_label = "contrast";
3812                 break;
3813         case MM_CAM_FILTER_WB:
3814                 control_label = "white balance";
3815                 check_scene_mode = TRUE;
3816                 break;
3817         case MM_CAM_FILTER_WB_TEMPERATURE:
3818                 control_label = "white balance temperature";
3819                 check_scene_mode = TRUE;
3820                 break;
3821         case MM_CAM_FILTER_COLOR_TONE:
3822                 control_label = "color tone";
3823                 break;
3824         case MM_CAM_FILTER_SATURATION:
3825                 control_label = "saturation";
3826                 check_scene_mode = TRUE;
3827                 break;
3828         case MM_CAM_FILTER_HUE:
3829                 control_label = "hue";
3830                 break;
3831         case MM_CAM_FILTER_SHARPNESS:
3832                 control_label = "sharpness";
3833                 check_scene_mode = TRUE;
3834                 break;
3835         default:
3836                 MMCAM_LOG_ERROR("unknown attribute index %d", attr_idx);
3837                 return FALSE;
3838         }
3839
3840         if (check_scene_mode) {
3841                 mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &scene_mode, NULL);
3842                 if (scene_mode != MM_CAMCORDER_SCENE_MODE_NORMAL) {
3843                         MMCAM_LOG_WARNING("can not set %s when scene mode is NOT normal.", control_label);
3844                         return FALSE;
3845                 }
3846         }
3847
3848         newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
3849         if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE)
3850                 return FALSE;
3851
3852         if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3853                 MMCAM_LOG_INFO("Can't cast Video source into color balance.");
3854                 return TRUE;
3855         }
3856
3857         balance = GST_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3858         if (balance == NULL) {
3859                 MMCAM_LOG_ERROR("cast COLOR_BALANCE failed");
3860                 return FALSE;
3861         }
3862
3863         controls = (GList *)gst_color_balance_list_channels(balance);
3864         if (controls == NULL) {
3865                 MMCAM_LOG_INFO("There is no list of colorbalance controls");
3866                 return FALSE;
3867         }
3868
3869 _CHECK_AGAIN:
3870         MMCAM_LOG_DEBUG("attr[%d] label[%s]: MSL[%d] -> Sensor[%d]",
3871                 attr_idx, control_label, mslVal, newVal);
3872
3873         item = g_list_find_custom(controls, control_label, __color_channel_item_compare_func);
3874         if (item) {
3875                 Colorchannel = item->data;
3876                 gst_color_balance_set_value(balance, Colorchannel, newVal);
3877                 MMCAM_LOG_INFO("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslVal, newVal);
3878                 return TRUE;
3879         }
3880
3881         if (attr_idx == MM_CAM_FILTER_WB && !strcmp(control_label, "white balance")) {
3882                 if (mslVal == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC) {
3883                         newVal = 1;
3884                         control_label = "white_balance_temperature_auto";
3885                         goto _CHECK_AGAIN;
3886                 } else {
3887                         newVal = wb_temp_table[mslVal];
3888                         control_label = "white_balance_temperature";
3889                         goto _CHECK_AGAIN;
3890                 }
3891         }
3892
3893         MMCAM_LOG_ERROR("failed to find color channel item");
3894
3895         return FALSE;
3896 }
3897
3898
3899 bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3900 {
3901         int mslVal = 0;
3902         int newVal = 0;
3903         int current_state = MM_CAMCORDER_STATE_NONE;
3904         GstCameraControl *control = NULL;
3905         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
3906         _MMCamcorderSubContext *sc = NULL;
3907
3908         mmf_return_val_if_fail(hcamcorder && value, FALSE);
3909
3910         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
3911         if (!sc)
3912                 return TRUE;
3913
3914         mslVal = value->value.i_val;
3915         newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_FILTER_SCENE_MODE, mslVal);
3916
3917         /* check whether set or not */
3918         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
3919                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
3920                 return TRUE;
3921         }
3922
3923         current_state = _mmcamcorder_get_state(handle);
3924         if (current_state < MM_CAMCORDER_STATE_READY) {
3925                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
3926                 return TRUE;
3927         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
3928                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
3929                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
3930                 return FALSE;
3931         }
3932
3933         if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
3934                 int ret = 0;
3935
3936                 if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
3937                         MMCAM_LOG_INFO("Can't cast Video source into camera control.");
3938                         return TRUE;
3939                 }
3940
3941                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
3942                 if (control == NULL) {
3943                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
3944                         return FALSE;
3945                 }
3946
3947                 ret = gst_camera_control_set_exposure(control, GST_CAMERA_CONTROL_PROGRAM_MODE, newVal, 0);
3948                 if (ret) {
3949                         MMCAM_LOG_INFO("Succeed in setting program mode[%d].", mslVal);
3950
3951                         if (mslVal == MM_CAMCORDER_SCENE_MODE_NORMAL) {
3952                                 unsigned int i = 0;
3953                                 int attr_idxs[] = {
3954                                         MM_CAM_CAMERA_ISO,
3955                                         MM_CAM_FILTER_BRIGHTNESS,
3956                                         MM_CAM_FILTER_WB,
3957                                         MM_CAM_FILTER_SATURATION,
3958                                         MM_CAM_FILTER_SHARPNESS,
3959                                         MM_CAM_FILTER_COLOR_TONE,
3960                                         MM_CAM_CAMERA_EXPOSURE_MODE
3961                                 };
3962                                 MMHandleType attrs = MMF_CAMCORDER_ATTRS(handle);
3963
3964                                 for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
3965                                         if (_mmcamcorder_check_supported_attribute(handle, attr_idxs[i]))
3966                                                 mm_attrs_set_modified(attrs, attr_idxs[i]);
3967                                 }
3968                         }
3969
3970                         return TRUE;
3971                 } else {
3972                         MMCAM_LOG_INFO("Failed to set program mode[%d].", mslVal);
3973                 }
3974         } else {
3975                 MMCAM_LOG_WARNING("pointer of video src is null");
3976         }
3977
3978         return FALSE;
3979 }
3980
3981
3982 bool _mmcamcorder_commit_filter_flip(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3983 {
3984         mmf_return_val_if_fail(handle && value, FALSE);
3985
3986         MMCAM_LOG_WARNING("Filter Flip(%d)", value->value.i_val);
3987
3988         return TRUE;
3989 }
3990
3991
3992 bool _mmcamcorder_commit_audio_input_route(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
3993 {
3994         mmf_return_val_if_fail(handle && value, FALSE);
3995
3996         MMCAM_LOG_INFO("Commit : Do nothing. this attr will be removed soon.");
3997
3998         return TRUE;
3999 }
4000
4001
4002 bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4003 {
4004         int current_state = MM_CAMCORDER_STATE_NONE;
4005         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4006
4007         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4008
4009         current_state = _mmcamcorder_get_state(handle);
4010         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
4011                 MMCAM_LOG_WARNING("Can NOT set disable[%d] AUDIO. invalid state %d",
4012                         value->value.i_val, current_state);
4013                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4014                 return FALSE;
4015         } else {
4016                 MMCAM_LOG_INFO("Set disable[%d] AUDIO when Recording", value->value.i_val);
4017                 return TRUE;
4018         }
4019 }
4020
4021
4022 bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4023 {
4024         int current_state = MM_CAMCORDER_STATE_NONE;
4025         const char *videosink_name = NULL;
4026         void *dp_handle = NULL;
4027         MMCamWindowInfo *window_info = NULL;
4028
4029         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4030         _MMCamcorderSubContext *sc = NULL;
4031
4032         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4033
4034         /* check type */
4035         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4036                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4037                 return FALSE;
4038         }
4039
4040         /* check current state */
4041         current_state = _mmcamcorder_get_state(handle);
4042         if (current_state < MM_CAMCORDER_STATE_READY) {
4043                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4044                 return TRUE;
4045         }
4046
4047         dp_handle = value->value.p_val;
4048         if (!dp_handle) {
4049                 MMCAM_LOG_WARNING("Display handle is NULL");
4050                 return FALSE;
4051         }
4052
4053         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4054
4055         /* get videosink name */
4056         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4057         if (!videosink_name) {
4058                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4059                 return FALSE;
4060         }
4061
4062         MMCAM_LOG_INFO("Commit : videosinkname[%s]", videosink_name);
4063
4064         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) {
4065                 MMCAM_LOG_INFO("Commit : Set XID[%x]", *(int *)(dp_handle));
4066                 gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int *)(dp_handle));
4067         } else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) {
4068                 MMCAM_LOG_INFO("Commit : Set evas object [%p]", dp_handle);
4069                 MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", dp_handle);
4070         } else if (!strcmp(videosink_name, "tizenwlsink")) {
4071                 window_info = (MMCamWindowInfo *)dp_handle;
4072                 MMCAM_LOG_INFO("wayland global surface id : %d", window_info->surface_id);
4073                 gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)window_info->surface_id);
4074         } else if (!strcmp(videosink_name, "directvideosink")) {
4075                 window_info = (MMCamWindowInfo *)dp_handle;
4076                 MMCAM_LOG_INFO("wayland global surface id : %d, x,y,w,h (%d,%d,%d,%d)",
4077                         window_info->surface_id,
4078                         window_info->rect.x,
4079                         window_info->rect.y,
4080                         window_info->rect.width,
4081                         window_info->rect.height);
4082                 gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)window_info->surface_id);
4083                 gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
4084                         window_info->rect.x,
4085                         window_info->rect.y,
4086                         window_info->rect.width,
4087                         window_info->rect.height);
4088         } else {
4089                 MMCAM_LOG_WARNING("Commit : Nothing to commit with this element[%s]", videosink_name);
4090                 return FALSE;
4091         }
4092
4093         return TRUE;
4094 }
4095
4096
4097 bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4098 {
4099         int current_state = MM_CAMCORDER_STATE_NONE;
4100         const char *videosink_name = NULL;
4101
4102         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4103         _MMCamcorderSubContext *sc = NULL;
4104
4105         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4106
4107         /* check type */
4108         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4109                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4110                 return FALSE;
4111         }
4112
4113         /* check current state */
4114         current_state = _mmcamcorder_get_state(handle);
4115         if (current_state < MM_CAMCORDER_STATE_READY) {
4116                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4117                 return TRUE;
4118         }
4119
4120         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4121
4122         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4123         if (videosink_name == NULL) {
4124                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4125                 return FALSE;
4126         }
4127
4128         MMCAM_LOG_INFO("Commit : videosinkname[%s]", videosink_name);
4129
4130         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
4131                 MMCAM_LOG_INFO("Commit : display mode [%d]", value->value.i_val);
4132                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val);
4133         } else {
4134                 MMCAM_LOG_WARNING("[%s] does not support display mode, but no error", videosink_name);
4135         }
4136
4137         return TRUE;
4138 }
4139
4140
4141 bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4142 {
4143         int current_state = MM_CAMCORDER_STATE_NONE;
4144
4145         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4146
4147         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4148
4149         /* check type */
4150         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4151                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4152                 return FALSE;
4153         }
4154
4155         /* check current state */
4156         current_state = _mmcamcorder_get_state(handle);
4157         if (current_state < MM_CAMCORDER_STATE_READY) {
4158                 MMCAM_LOG_INFO("NOT initialized. this will be applied later [rotate:%d]", value->value.i_val);
4159                 return TRUE;
4160         }
4161
4162         return _mmcamcorder_set_display_rotation(handle, value->value.i_val, _MMCAMCORDER_VIDEOSINK_SINK);
4163 }
4164
4165
4166 bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4167 {
4168         int current_state = MM_CAMCORDER_STATE_NONE;
4169
4170         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4171
4172         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4173
4174         /* check type */
4175         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4176                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4177                 return FALSE;
4178         }
4179
4180         /* check current state */
4181         current_state = _mmcamcorder_get_state(handle);
4182         if (current_state < MM_CAMCORDER_STATE_READY) {
4183                 MMCAM_LOG_INFO("NOT initialized. this will be applied later [flip:%d]", value->value.i_val);
4184                 return TRUE;
4185         }
4186
4187         return _mmcamcorder_set_display_flip(handle, value->value.i_val, _MMCAMCORDER_VIDEOSINK_SINK);
4188 }
4189
4190
4191 bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4192 {
4193         int current_state = MM_CAMCORDER_STATE_NONE;
4194         const char *videosink_name = NULL;
4195
4196         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4197         _MMCamcorderSubContext *sc = NULL;
4198
4199         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4200
4201         /* check type */
4202         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4203                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4204                 return FALSE;
4205         }
4206
4207         /* check current state */
4208         current_state = _mmcamcorder_get_state(handle);
4209         if (current_state < MM_CAMCORDER_STATE_READY) {
4210                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4211                 return TRUE;
4212         }
4213
4214         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4215
4216         /* Get videosink name */
4217         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4218         if (videosink_name == NULL) {
4219                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4220                 return FALSE;
4221         }
4222
4223         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
4224                 !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink") ||
4225                 !strcmp(videosink_name, "directvideosink")) {
4226                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "visible", value->value.i_val);
4227                 MMCAM_LOG_INFO("Set visible [%d] done.", value->value.i_val);
4228         } else {
4229                 MMCAM_LOG_WARNING("[%s] does not support VISIBLE, but no error", videosink_name);
4230         }
4231
4232         return TRUE;
4233 }
4234
4235
4236 bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4237 {
4238         int method = 0;
4239         int current_state = MM_CAMCORDER_STATE_NONE;
4240         const char *videosink_name = NULL;
4241
4242         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4243         _MMCamcorderSubContext *sc = NULL;
4244
4245         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4246
4247         /* check type */
4248         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4249                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4250                 return FALSE;
4251         }
4252
4253         /* check current state */
4254         current_state = _mmcamcorder_get_state(handle);
4255         if (current_state < MM_CAMCORDER_STATE_READY) {
4256                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4257                 return TRUE;
4258         }
4259
4260         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4261
4262         /* Get videosink name */
4263         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4264         if (videosink_name == NULL) {
4265                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4266                 return FALSE;
4267         }
4268
4269         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
4270             !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink") ||
4271             !strcmp(videosink_name, "directvideosink")) {
4272                 method = value->value.i_val;
4273                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
4274         } else {
4275                 MMCAM_LOG_WARNING("[%s] does not support geometry method, but no error", videosink_name);
4276         }
4277
4278         return TRUE;
4279 }
4280
4281
4282 bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4283 {
4284         int current_state = MM_CAMCORDER_STATE_NONE;
4285         int ret = MM_ERROR_NONE;
4286         const char *videosink_name = NULL;
4287
4288         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4289         _MMCamcorderSubContext *sc = NULL;
4290
4291         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4292
4293         /* check type */
4294         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4295                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4296                 return FALSE;
4297         }
4298
4299         /* check current state */
4300         current_state = _mmcamcorder_get_state(handle);
4301         if (current_state < MM_CAMCORDER_STATE_READY) {
4302                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4303                 return TRUE;
4304         }
4305
4306         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4307
4308         /* Get videosink name */
4309         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4310         if (videosink_name == NULL) {
4311                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4312                 return FALSE;
4313         }
4314
4315         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
4316             !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "directvideosink")) {
4317                 int rect_x = 0;
4318                 int rect_y = 0;
4319                 int rect_width = 0;
4320                 int rect_height = 0;
4321                 int flags = MM_ATTRS_FLAG_NONE;
4322                 MMCamAttrsInfo info;
4323
4324                 mm_camcorder_get_attributes(handle, NULL,
4325                         MMCAM_DISPLAY_RECT_X, &rect_x,
4326                         MMCAM_DISPLAY_RECT_Y, &rect_y,
4327                         MMCAM_DISPLAY_RECT_WIDTH, &rect_width,
4328                         MMCAM_DISPLAY_RECT_HEIGHT, &rect_height,
4329                         NULL);
4330                 switch (attr_idx) {
4331                 case MM_CAM_DISPLAY_RECT_X:
4332                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_Y, &info);
4333                         flags |= info.flag;
4334                         memset(&info, 0x00, sizeof(info));
4335                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_WIDTH, &info);
4336                         flags |= info.flag;
4337                         memset(&info, 0x00, sizeof(info));
4338                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_HEIGHT, &info);
4339                         flags |= info.flag;
4340
4341                         rect_x = value->value.i_val;
4342                         break;
4343                 case MM_CAM_DISPLAY_RECT_Y:
4344                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_WIDTH, &info);
4345                         flags |= info.flag;
4346                         memset(&info, 0x00, sizeof(info));
4347                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_HEIGHT, &info);
4348                         flags |= info.flag;
4349
4350                         rect_y = value->value.i_val;
4351                         break;
4352                 case MM_CAM_DISPLAY_RECT_WIDTH:
4353                         mm_camcorder_get_attribute_info(handle, MMCAM_DISPLAY_RECT_HEIGHT, &info);
4354                         flags |= info.flag;
4355
4356                         rect_width = value->value.i_val;
4357                         break;
4358                 case MM_CAM_DISPLAY_RECT_HEIGHT:
4359                         rect_height = value->value.i_val;
4360                         break;
4361                 default:
4362                         MMCAM_LOG_ERROR("Wrong attr_idx!");
4363                         return FALSE;
4364                 }
4365
4366                 if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
4367                         MMCAM_LOG_INFO("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height);
4368
4369                         if (!strcmp(videosink_name, "tizenwlsink")) {
4370                             ret = gst_video_overlay_set_display_roi_area(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
4371                                         rect_x, rect_y, rect_width, rect_height);
4372                                 if (!ret) {
4373                                         MMCAM_LOG_ERROR("FAILED : could not set display roi area.");
4374                                         return FALSE;
4375                                 }
4376                         } else {
4377                             g_object_set(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
4378                                         "dst-roi-x", rect_x,
4379                                         "dst-roi-y", rect_y,
4380                                         "dst-roi-w", rect_width,
4381                                         "dst-roi-h", rect_height,
4382                                         NULL);
4383                         }
4384                 }
4385         } else {
4386                 MMCAM_LOG_WARNING("[%s] does not support display rect, but no error", videosink_name);
4387         }
4388
4389         return TRUE;
4390 }
4391
4392
4393 bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4394 {
4395         int zoom = 0;
4396         int current_state = MM_CAMCORDER_STATE_NONE;
4397         const char *videosink_name = NULL;
4398         GstElement *vs_element = NULL;
4399
4400         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4401         _MMCamcorderSubContext *sc = NULL;
4402
4403         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4404
4405         /* check type */
4406         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4407                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4408                 return FALSE;
4409         }
4410
4411         /* check current state */
4412         current_state = _mmcamcorder_get_state(handle);
4413         if (current_state < MM_CAMCORDER_STATE_READY) {
4414                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4415                 return TRUE;
4416         }
4417
4418         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4419
4420         /* Get videosink name */
4421         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4422         if (videosink_name == NULL) {
4423                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4424                 return FALSE;
4425         }
4426
4427         zoom = value->value.i_val;
4428         if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
4429                 vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
4430
4431                 MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
4432                 MMCAM_LOG_INFO("Set display zoom to %d", zoom + 1);
4433
4434                 return TRUE;
4435         } else {
4436                 MMCAM_LOG_WARNING("videosink[%s] does not support scale", videosink_name);
4437                 return FALSE;
4438         }
4439 }
4440
4441
4442 bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4443 {
4444         int current_state = MM_CAMCORDER_STATE_NONE;
4445         int do_scaling = 0;
4446         const char *videosink_name = NULL;
4447
4448         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4449         _MMCamcorderSubContext *sc = NULL;
4450
4451         mmf_return_val_if_fail(handle && value, FALSE);
4452
4453         /* check type */
4454         if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) {
4455                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4456                 return FALSE;
4457         }
4458
4459         /* check current state */
4460         current_state = _mmcamcorder_get_state(handle);
4461         if (current_state < MM_CAMCORDER_STATE_READY) {
4462                 MMCAM_LOG_INFO("NOT initialized. this will be applied later");
4463                 return TRUE;
4464         }
4465
4466         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4467
4468         do_scaling = value->value.i_val;
4469
4470         /* Get videosink name */
4471         _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
4472         if (videosink_name == NULL) {
4473                 MMCAM_LOG_ERROR("Please check videosink element in configuration file");
4474                 return FALSE;
4475         }
4476
4477         if (!strcmp(videosink_name, "evaspixmapsink")) {
4478                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "origin-size", !do_scaling);
4479                 MMCAM_LOG_INFO("Set origin-size to %d", !(value->value.i_val));
4480                 return TRUE;
4481         } else {
4482                 MMCAM_LOG_WARNING("videosink[%s] does not support scale", videosink_name);
4483                 return FALSE;
4484         }
4485 }
4486
4487
4488 bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4489 {
4490         _MMCamcorderSubContext *sc = NULL;
4491         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4492         int strobe_type, mslVal, newVal, cur_value;
4493         int current_state = MM_CAMCORDER_STATE_NONE;
4494
4495         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4496
4497         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4498         if (!sc)
4499                 return TRUE;
4500
4501         /*MMCAM_LOG_INFO( "Commit : strobe attribute(%d)", attr_idx );*/
4502
4503         mslVal = value->value.i_val;
4504
4505         /* check flash state */
4506         if (attr_idx == MM_CAM_STROBE_MODE) {
4507                 int led_brightness = 0;
4508
4509                 if (_mmcamcorder_get_device_led_brightness(hcamcorder->gdbus_conn, &led_brightness) != MM_ERROR_NONE) {
4510                         MMCAM_LOG_ERROR("_mmcamcorder_get_device_led_brightness failed");
4511                         hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION;
4512                         return FALSE;
4513                 }
4514
4515                 MMCAM_LOG_INFO("LED brightness[%d] from deviced", led_brightness);
4516
4517                 if (led_brightness > 0 &&
4518                     mslVal != MM_CAMCORDER_STROBE_MODE_OFF) {
4519                         /* other module already turned on LED */
4520                         hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY;
4521                         MMCAM_LOG_ERROR("other module already turned on LED. avoid to set strobe mode here.");
4522                         return FALSE;
4523                 }
4524
4525                 MMCAM_LOG_INFO("keep going");
4526         }
4527
4528         /* check state */
4529         current_state = _mmcamcorder_get_state(handle);
4530         if (current_state < MM_CAMCORDER_STATE_READY) {
4531                 MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state);
4532                 return TRUE;
4533         } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
4534                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
4535                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4536                 return FALSE;
4537         }
4538
4539         switch (attr_idx) {
4540         case MM_CAM_STROBE_CONTROL:
4541                 strobe_type = GST_CAMERA_CONTROL_STROBE_CONTROL;
4542                 newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_CONTROL, mslVal);
4543                 break;
4544         case MM_CAM_STROBE_CAPABILITIES:
4545                 strobe_type = GST_CAMERA_CONTROL_STROBE_CAPABILITIES;
4546                 newVal = mslVal;
4547                 break;
4548         case MM_CAM_STROBE_MODE:
4549                 /* check whether set or not */
4550                 if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
4551                         MMCAM_LOG_INFO("skip set value %d", mslVal);
4552                         return TRUE;
4553                 }
4554
4555                 strobe_type = GST_CAMERA_CONTROL_STROBE_MODE;
4556                 newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, mslVal);
4557                 break;
4558         case MM_CAM_STROBE_BRIGHTNESS:
4559                 strobe_type = GST_CAMERA_CONTROL_STROBE_BRIGHTNESS;
4560                 newVal = mslVal;
4561                 break;
4562         default:
4563                 MMCAM_LOG_ERROR("invalid attribute[%d]", attr_idx);
4564                 return FALSE;
4565         }
4566
4567         GstCameraControl *control = NULL;
4568         if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
4569                 MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
4570                 return FALSE;
4571         }
4572
4573         control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
4574         if (control == NULL) {
4575                 MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
4576                 return FALSE;
4577         }
4578
4579         if (!gst_camera_control_get_strobe(control, strobe_type, &cur_value)) {
4580                 MMCAM_LOG_WARNING("Failed to get strobe. Type[%d]", strobe_type);
4581                 return FALSE;
4582         }
4583
4584         if (newVal == cur_value) {
4585                 MMCAM_LOG_INFO("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal);
4586                 return TRUE;
4587         }
4588
4589         if (!gst_camera_control_set_strobe(control, strobe_type, newVal)) {
4590                 MMCAM_LOG_WARNING("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal);
4591                 return FALSE;
4592         }
4593
4594         MMCAM_LOG_INFO("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal);
4595
4596         return TRUE;
4597 }
4598
4599
4600 bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4601 {
4602         int ret = 0;
4603         int current_state = MM_CAMCORDER_STATE_NONE;
4604         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4605
4606         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4607
4608         MMCAM_LOG_INFO("Commit : flip %d", value->value.i_val);
4609
4610         /* state check */
4611         current_state = _mmcamcorder_get_state(handle);
4612         if (current_state > MM_CAMCORDER_STATE_READY) {
4613                 MMCAM_LOG_ERROR("Can not set camera FLIP horizontal at state %d", current_state);
4614                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4615                 return FALSE;
4616         } else if (current_state < MM_CAMCORDER_STATE_READY) {
4617                 MMCAM_LOG_INFO("Pipeline is not created yet. This will be set when create pipeline.");
4618                 return TRUE;
4619         }
4620
4621         ret = _mmcamcorder_set_videosrc_flip(handle, value->value.i_val);
4622
4623         MMCAM_LOG_INFO("ret %d", ret);
4624
4625         return ret;
4626 }
4627
4628
4629 bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4630 {
4631         int set_hdr_mode = MM_CAMCORDER_HDR_OFF;
4632         int current_state = MM_CAMCORDER_STATE_NONE;
4633         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4634         _MMCamcorderSubContext *sc = NULL;
4635
4636         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4637
4638         /*MMCAM_LOG_INFO("Commit : HDR Capture %d", value->value.i_val);*/
4639
4640         /* check whether set or not */
4641         if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
4642                 MMCAM_LOG_INFO("skip set value %d", value->value.i_val);
4643                 return TRUE;
4644         }
4645
4646         /* state check */
4647         current_state = _mmcamcorder_get_state(handle);
4648         if (current_state > MM_CAMCORDER_STATE_PREPARE) {
4649                 MMCAM_LOG_ERROR("can NOT set HDR capture at state %d", current_state);
4650                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4651                 return FALSE;
4652         }
4653
4654         if (current_state >= MM_CAMCORDER_STATE_READY) {
4655                 int current_value = 0;
4656
4657                 set_hdr_mode = value->value.i_val;
4658                 mm_camcorder_get_attributes(handle, NULL,
4659                         MMCAM_CAMERA_HDR_CAPTURE, &current_value,
4660                         NULL);
4661
4662                 if (set_hdr_mode == current_value) {
4663                         MMCAM_LOG_INFO("same HDR value : %d, do nothing", set_hdr_mode);
4664                         return TRUE;
4665                 }
4666
4667                 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4668                 if (sc) {
4669                         if (current_state == MM_CAMCORDER_STATE_PREPARE) {
4670                                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
4671                                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
4672
4673                                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
4674
4675                                 /* check decoder recreation */
4676                                 if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
4677                                         MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
4678                                         return FALSE;
4679                                 }
4680
4681                                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
4682                                 MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
4683                         }
4684
4685                         set_hdr_mode = value->value.i_val;
4686                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", set_hdr_mode);
4687                         sc->info_image->hdr_capture_mode = set_hdr_mode;
4688                         MMCAM_LOG_INFO("set HDR mode : %d", set_hdr_mode);
4689
4690                         if (current_state == MM_CAMCORDER_STATE_PREPARE)
4691                                 _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
4692                 } else {
4693                         MMCAM_LOG_ERROR("sc is NULL. can not set HDR capture");
4694                         return FALSE;
4695                 }
4696         }
4697
4698         return TRUE;
4699 }
4700
4701
4702 bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4703 {
4704         bool bret = FALSE;
4705         _MMCamcorderSubContext *sc = NULL;
4706         int detect_type = GST_CAMERA_CONTROL_FACE_DETECT_MODE;
4707         int set_value = 0;
4708         int current_value = 0;
4709         int current_state = MM_CAMCORDER_STATE_NONE;
4710         GstCameraControl *control = NULL;
4711
4712         mmf_return_val_if_fail(handle && value, FALSE);
4713
4714         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4715         if (!sc)
4716                 return TRUE;
4717
4718         /*MMCAM_LOG_INFO("Commit : detect attribute(%d)", attr_idx);*/
4719
4720         /* state check */
4721         current_state = _mmcamcorder_get_state(handle);
4722         if (current_state < MM_CAMCORDER_STATE_READY) {
4723                 MMCAM_LOG_INFO("will be applied when preview starts");
4724                 return TRUE;
4725         }
4726
4727         set_value = value->value.i_val;
4728
4729         switch (attr_idx) {
4730         case MM_CAM_DETECT_MODE:
4731                 /* check whether set or not */
4732                 if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
4733                         MMCAM_LOG_INFO("skip set value %d", set_value);
4734                         return TRUE;
4735                 }
4736
4737                 detect_type = GST_CAMERA_CONTROL_FACE_DETECT_MODE;
4738                 break;
4739         case MM_CAM_DETECT_NUMBER:
4740                 detect_type = GST_CAMERA_CONTROL_FACE_DETECT_NUMBER;
4741                 break;
4742         case MM_CAM_DETECT_FOCUS_SELECT:
4743                 detect_type = GST_CAMERA_CONTROL_FACE_FOCUS_SELECT;
4744                 break;
4745         case MM_CAM_DETECT_SELECT_NUMBER:
4746                 detect_type = GST_CAMERA_CONTROL_FACE_SELECT_NUMBER;
4747                 break;
4748         case MM_CAM_DETECT_STATUS:
4749                 detect_type = GST_CAMERA_CONTROL_FACE_DETECT_STATUS;
4750                 break;
4751         default:
4752                 MMCAM_LOG_ERROR("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx);
4753                 return FALSE;
4754         }
4755
4756         if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
4757                 MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
4758                 bret = FALSE;
4759         } else {
4760                 control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
4761                 if (control == NULL) {
4762                         MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
4763                         return FALSE;
4764                 }
4765
4766                 if (gst_camera_control_get_detect(control, detect_type, &current_value)) {
4767                         if (current_value == set_value) {
4768                                 MMCAM_LOG_INFO("No need to set detect(same). Type[%d],value[%d]", detect_type, set_value);
4769                                 bret = TRUE;
4770                         } else {
4771                                 if (!gst_camera_control_set_detect(control, detect_type, set_value)) {
4772                                         MMCAM_LOG_WARNING("Set detect failed. Type[%d],value[%d]",
4773                                                 detect_type, set_value);
4774                                         bret = FALSE;
4775                                 } else {
4776                                         MMCAM_LOG_INFO("Set detect success. Type[%d],value[%d]",
4777                                                 detect_type, set_value);
4778                                         bret = TRUE;
4779                                 }
4780                         }
4781                 } else {
4782                         MMCAM_LOG_WARNING("Get detect failed. Type[%d]", detect_type);
4783                         bret = FALSE;
4784                 }
4785         }
4786
4787         return bret;
4788 }
4789
4790
4791 bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4792 {
4793         int current_state = MM_CAMCORDER_STATE_NONE;
4794
4795         mmf_return_val_if_fail(handle && value, FALSE);
4796
4797         MMCAM_LOG_INFO("Commit : encoded preview bitrate - %d", value->value.i_val);
4798
4799         /* check state */
4800         current_state = _mmcamcorder_get_state(handle);
4801         if (current_state < MM_CAMCORDER_STATE_READY) {
4802                 MMCAM_LOG_INFO("will be applied when preview starts");
4803                 return TRUE;
4804         }
4805
4806         return _mmcamcorder_set_encoded_preview_bitrate(handle, value->value.i_val);
4807 }
4808
4809
4810 bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4811 {
4812         int current_state = MM_CAMCORDER_STATE_NONE;
4813         int preview_format = MM_PIXEL_FORMAT_NV12;
4814
4815         mmf_return_val_if_fail(handle && value, FALSE);
4816
4817         MMCAM_LOG_INFO("Commit : encoded preview I-frame interval - %d", value->value.i_val);
4818
4819         /* check preview format */
4820         mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL);
4821         if (!_mmcamcorder_is_encoded_preview_pixel_format(preview_format)) {
4822                 MMCAM_LOG_ERROR("current preview format[%d] is not encoded format", preview_format);
4823                 return FALSE;
4824         }
4825
4826         /* check state */
4827         current_state = _mmcamcorder_get_state(handle);
4828         if (current_state < MM_CAMCORDER_STATE_READY) {
4829                 MMCAM_LOG_INFO("will be applied when preview starts");
4830                 return TRUE;
4831         }
4832
4833         return _mmcamcorder_set_encoded_preview_gop_interval(handle, value->value.i_val);
4834 }
4835
4836
4837 bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4838 {
4839         int stream_index = 0;
4840         char *stream_type = NULL;
4841         _MMCamcorderSubContext *sc = NULL;
4842
4843         mmf_return_val_if_fail(handle && value, FALSE);
4844
4845         stream_type = value->value.s_val;
4846         if (!stream_type) {
4847                 MMCAM_LOG_ERROR("NULL string");
4848                 return FALSE;
4849         }
4850
4851         mm_camcorder_get_attributes(handle, NULL,
4852                 MMCAM_SOUND_STREAM_INDEX, &stream_index,
4853                 NULL);
4854         if (stream_index < 0) {
4855                 MMCAM_LOG_ERROR("invalid stream index %d", stream_index);
4856                 return FALSE;
4857         }
4858
4859         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4860         if (!sc || !sc->encode_element ||
4861             !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
4862                 MMCAM_LOG_WARNING("audiosrc element is not initialized, it will be set later");
4863                 return TRUE;
4864         }
4865
4866         MMCAM_LOG_WARNING("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
4867
4868         return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
4869 }
4870
4871
4872 bool _mmcamcorder_commit_tag(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4873 {
4874         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4875         int current_state = MM_CAMCORDER_STATE_NONE;
4876
4877         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4878
4879         current_state = _mmcamcorder_get_state(handle);
4880         if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
4881                 MMCAM_LOG_ERROR("Can not set while CAPTURING");
4882                 hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4883                 return FALSE;
4884         }
4885
4886         return TRUE;
4887 }
4888
4889 bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4890 {
4891         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4892
4893         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4894
4895         if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_ENABLE) {
4896                 /* Replay gain enable */
4897                 int current_state = MM_CAMCORDER_STATE_NONE;
4898                 int audio_disable = FALSE;
4899
4900                 current_state = _mmcamcorder_get_state(handle);
4901                 if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
4902                         MMCAM_LOG_ERROR("Can not set replay gain enable [state : %d]", current_state);
4903                         hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
4904                         return FALSE;
4905                 }
4906
4907                 mm_camcorder_get_attributes(handle, NULL,
4908                         MMCAM_AUDIO_DISABLE, &audio_disable,
4909                         NULL);
4910
4911                 if (audio_disable) {
4912                         MMCAM_LOG_ERROR("audio is disabled");
4913                         hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
4914                         return FALSE;
4915                 }
4916
4917                 MMCAM_LOG_INFO("set replay gain enable : %d", value->value.i_val);
4918         } else if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL) {
4919                 /* Replay gain reference level */
4920                 int replay_gain_enable = FALSE;
4921
4922                 mm_camcorder_get_attributes(handle, NULL,
4923                         MMCAM_AUDIO_REPLAY_GAIN_ENABLE, &replay_gain_enable,
4924                         NULL);
4925
4926                 if (replay_gain_enable == FALSE) {
4927                         MMCAM_LOG_ERROR("replay gain is disabled");
4928                         hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
4929                         return FALSE;
4930                 }
4931
4932                 MMCAM_LOG_INFO("set reference level for replay gain : %lf dB", value->value.d_val);
4933         } else {
4934                 MMCAM_LOG_ERROR("unknown attribute id %d", attr_idx);
4935                 return FALSE;
4936         }
4937
4938         return TRUE;
4939 }
4940
4941
4942 bool _mmcamcorder_commit_extra_preview(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4943 {
4944         int ret = MM_ERROR_NONE;
4945         int current_state = MM_CAMCORDER_STATE_NONE;
4946         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4947         _MMCamcorderSubContext *sc = NULL;
4948
4949         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4950
4951         if (hcamcorder->type != MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
4952                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4953                 return FALSE;
4954         }
4955
4956         MMCAM_LOG_INFO("Enable extra preview(%d)", value->value.i_val);
4957
4958         current_state = _mmcamcorder_get_state(handle);
4959         if (current_state < MM_CAMCORDER_STATE_READY) {
4960                 MMCAM_LOG_INFO("will be set when preview is started");
4961                 return TRUE;
4962         }
4963
4964         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
4965         mmf_return_val_if_fail(sc, FALSE);
4966
4967         if (value->value.i_val)
4968                 ret = _mmcamcorder_initialize_extra_preview_mode(handle);
4969         else
4970                 ret = _mmcamcorder_deinitialize_extra_preview_mode(handle);
4971
4972         if (ret != MM_ERROR_NONE) {
4973                 MMCAM_LOG_ERROR("set[%d] failed[0x%x]", value->value.i_val, ret);
4974                 return FALSE;
4975         }
4976
4977         MMCAM_LOG_INFO("done");
4978
4979         return TRUE;
4980 }
4981
4982
4983 bool _mmcamcorder_commit_request_codec_config(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
4984 {
4985         int ret = MM_ERROR_NONE;
4986         int current_state = MM_CAMCORDER_STATE_NONE;
4987         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
4988         _MMCamcorderSubContext *sc = NULL;
4989
4990         mmf_return_val_if_fail(hcamcorder && value, FALSE);
4991
4992         if (hcamcorder->type != MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
4993                 MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type);
4994                 return FALSE;
4995         }
4996
4997         MMCAM_LOG_INFO("Request codec config");
4998
4999         current_state = _mmcamcorder_get_state(handle);
5000         if (current_state < MM_CAMCORDER_STATE_READY) {
5001                 MMCAM_LOG_INFO("invalid state[%d]", current_state);
5002                 return FALSE;
5003         }
5004
5005         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
5006         mmf_return_val_if_fail(sc, FALSE);
5007
5008         ret = _mmcamcorder_request_codec_config(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
5009         if (ret != MM_ERROR_NONE) {
5010                 hcamcorder->error_code = ret;
5011                 return FALSE;
5012         }
5013
5014         return TRUE;
5015 }
5016
5017
5018 bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
5019 {
5020         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
5021         MMHandleType attrs;
5022
5023         int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
5024
5025         unsigned int i = 0;
5026         int ret = TRUE;
5027         int attr_idxs_default[] = {
5028                 MM_CAM_CAMERA_DIGITAL_ZOOM,
5029                 MM_CAM_CAMERA_OPTICAL_ZOOM,
5030                 MM_CAM_CAMERA_WDR,
5031                 MM_CAM_FILTER_CONTRAST,
5032                 MM_CAM_FILTER_HUE,
5033                 MM_CAM_DETECT_MODE,
5034                 MM_CAM_STROBE_BRIGHTNESS
5035         };
5036
5037         int attr_idxs_extra[] = {
5038                 MM_CAM_CAMERA_ISO,
5039                 MM_CAM_FILTER_BRIGHTNESS,
5040                 MM_CAM_FILTER_WB,
5041                 MM_CAM_FILTER_SATURATION,
5042                 MM_CAM_FILTER_SHARPNESS,
5043                 MM_CAM_FILTER_COLOR_TONE,
5044                 MM_CAM_CAMERA_EXPOSURE_MODE,
5045                 MM_CAM_CAMERA_EXPOSURE_VALUE
5046         };
5047
5048         mmf_return_val_if_fail(hcamcorder, FALSE);
5049
5050         MMCAM_LOG_INFO("commit some attributes again");
5051
5052         attrs = MMF_CAMCORDER_ATTRS(handle);
5053         if (attrs == NULL) {
5054                 MMCAM_LOG_ERROR("Get attribute handle failed.");
5055                 return FALSE;
5056         }
5057
5058         /* Get Scene mode */
5059         mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &scene_mode, NULL);
5060
5061         for (i = 0 ; i < ARRAY_SIZE(attr_idxs_default) ; i++) {
5062                 if (_mmcamcorder_check_supported_attribute(handle, attr_idxs_default[i]))
5063                         mm_attrs_set_modified(attrs, attr_idxs_default[i]);
5064         }
5065
5066         /* Set extra if scene mode is NORMAL */
5067         if (scene_mode == MM_CAMCORDER_SCENE_MODE_NORMAL) {
5068                 for (i = 0 ; i < ARRAY_SIZE(attr_idxs_extra) ; i++) {
5069                         if (_mmcamcorder_check_supported_attribute(handle, attr_idxs_extra[i]))
5070                                 mm_attrs_set_modified(attrs, attr_idxs_extra[i]);
5071                 }
5072         } else {
5073                 /* Set scene mode if scene mode is NOT NORMAL */
5074                 if (_mmcamcorder_check_supported_attribute(handle, MM_CAM_FILTER_SCENE_MODE))
5075                         mm_attrs_set_modified(attrs, MM_CAM_FILTER_SCENE_MODE);
5076         }
5077
5078         if (mm_attrs_commit_all(attrs) == -1)
5079                 ret = FALSE;
5080
5081         MMCAM_LOG_INFO("Done.");
5082
5083         return ret;
5084 }
5085
5086
5087 bool _mmcamcorder_set_attribute_to_camsensor2(MMHandleType handle)
5088 {
5089         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
5090         MMHandleType attrs;
5091         unsigned int i = 0;
5092         int ret = TRUE;
5093         int attr_idxs[] = {
5094                 MM_CAM_STROBE_MODE,
5095                 MM_CAM_CAMERA_PTZ_TYPE,
5096                 MM_CAM_CAMERA_PAN_MECHA,
5097                 MM_CAM_CAMERA_PAN_ELEC,
5098                 MM_CAM_CAMERA_TILT_MECHA,
5099                 MM_CAM_CAMERA_TILT_ELEC
5100         };
5101
5102         mmf_return_val_if_fail(hcamcorder, FALSE);
5103
5104         MMCAM_LOG_INFO("commit some attribute again[2]");
5105
5106         attrs = MMF_CAMCORDER_ATTRS(handle);
5107         if (attrs == NULL) {
5108                 MMCAM_LOG_ERROR("Get attribute handle failed.");
5109                 return FALSE;
5110         }
5111
5112         for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
5113                 if (_mmcamcorder_check_supported_attribute(handle, attr_idxs[i]))
5114                         mm_attrs_set_modified(attrs, attr_idxs[i]);
5115         }
5116
5117         if (mm_attrs_commit_all(attrs) == -1)
5118                 ret = FALSE;
5119
5120         MMCAM_LOG_INFO("Done.");
5121
5122         return ret;
5123 }
5124
5125
5126 int _mmcamcorder_lock_readonly_attributes(MMHandleType handle)
5127 {
5128         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
5129         MMHandleType attrs;
5130         int table_size = 0;
5131         int i = 0;
5132         int nerror = MM_ERROR_NONE;
5133
5134         mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
5135
5136         attrs = MMF_CAMCORDER_ATTRS(handle);
5137         mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
5138
5139         MMCAM_LOG_INFO("");
5140
5141         table_size = ARRAY_SIZE(readonly_attributes);
5142         MMCAM_LOG_INFO("%d", table_size);
5143         for (i = 0; i < table_size; i++) {
5144                 int sCategory = readonly_attributes[i];
5145
5146                 mm_attrs_set_readonly(attrs, sCategory);
5147         }
5148
5149         return nerror;
5150 }
5151
5152
5153 /*---------------------------------------------------------------------------------------
5154 |    INTERNAL FUNCTION DEFINITIONS:                                                     |
5155 ---------------------------------------------------------------------------------------*/
5156 static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height)
5157 {
5158         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
5159         _MMCamcorderSubContext *sc = NULL;
5160         int current_state = MM_CAMCORDER_STATE_NULL;
5161
5162         mmf_return_val_if_fail(hcamcorder, FALSE);
5163
5164         sc = MMF_CAMCORDER_SUBCONTEXT(handle);
5165         if (!sc)
5166                 return TRUE;
5167
5168         current_state = _mmcamcorder_get_state(handle);
5169
5170         if (sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
5171                 if (current_state <= MM_CAMCORDER_STATE_PREPARE) {
5172                         MMCAM_LOG_INFO("set capture width and height [%dx%d] to camera plugin", width, height);
5173                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", width);
5174                         MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", height);
5175                 } else {
5176                         MMCAM_LOG_WARNING("invalid state[%d]", current_state);
5177                         return FALSE;
5178                 }
5179         } else {
5180                 MMCAM_LOG_INFO("element is not created yet");
5181         }
5182
5183         return TRUE;
5184 }
5185
5186
5187 static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
5188 {
5189         #define INIT_VALUE            -1
5190         #define CHECK_COUNT           3
5191
5192         mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
5193         MMHandleType attrs = 0;
5194
5195         int ret = MM_ERROR_NONE;
5196         int i = 0;
5197         int j = 0;
5198         const char *name = NULL;
5199         const char *check_pair_name[CHECK_COUNT][3] = {
5200                 {MMCAM_CAMERA_WIDTH,  MMCAM_CAMERA_HEIGHT,  "MMCAM_CAMERA_WIDTH and HEIGHT"},
5201                 {MMCAM_CAPTURE_WIDTH, MMCAM_CAPTURE_HEIGHT, "MMCAM_CAPTURE_WIDTH and HEIGHT"},
5202                 {MMCAM_VIDEO_WIDTH, MMCAM_VIDEO_HEIGHT, "MMCAM_VIDEO_WIDTH and HEIGHT"},
5203         };
5204
5205         int check_pair_value[CHECK_COUNT][2] = {
5206                 {INIT_VALUE, INIT_VALUE},
5207                 {INIT_VALUE, INIT_VALUE},
5208                 {INIT_VALUE, INIT_VALUE},
5209         };
5210
5211         if (hcamcorder == NULL || attribute_name == NULL) {
5212                 MMCAM_LOG_WARNING("handle[%p] or attribute_name[%p] is NULL.",
5213                         hcamcorder, attribute_name);
5214                 return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
5215         }
5216
5217         if (err_attr_name)
5218                 *err_attr_name = NULL;
5219
5220         /*MMCAM_LOG_INFO( "ENTER" );*/
5221
5222         attrs = MMF_CAMCORDER_ATTRS(handle);
5223
5224         name = attribute_name;
5225
5226         while (name) {
5227                 int idx = -1;
5228                 MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID;
5229
5230                 /*MMCAM_LOG_INFO("NAME : %s", name);*/
5231
5232                 /* attribute name check */
5233                 if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) {
5234                         if (err_attr_name)
5235                                 *err_attr_name = strdup(name);
5236
5237                         if (ret == (int)MM_ERROR_COMMON_OUT_OF_ARRAY)
5238                                 return MM_ERROR_COMMON_ATTR_NOT_EXIST;
5239                         else
5240                                 return ret;
5241                 }
5242
5243                 /* type check */
5244                 if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE)
5245                         return ret;
5246
5247                 switch (attr_type) {
5248                 case MM_ATTRS_TYPE_INT:
5249                 {
5250                         gboolean matched = FALSE;
5251                         for (i = 0 ; i < CHECK_COUNT ; i++) {
5252                                 for (j = 0 ; j < 2 ; j++) {
5253                                         if (!strcmp(name, check_pair_name[i][j])) {
5254                                                 check_pair_value[i][j] = va_arg((var_args), int);
5255                                                 MMCAM_LOG_INFO("%s : %d", check_pair_name[i][j], check_pair_value[i][j]);
5256                                                 matched = TRUE;
5257                                                 break;
5258                                         }
5259                                 }
5260                                 if (matched)
5261                                         break;
5262                         }
5263                         if (matched == FALSE)
5264                                 va_arg((var_args), int);
5265                         break;
5266                 }
5267                 case MM_ATTRS_TYPE_DOUBLE:
5268                         va_arg((var_args), double);
5269                         break;
5270                 case MM_ATTRS_TYPE_STRING:
5271                         va_arg((var_args), char*); /* string */
5272                         va_arg((var_args), int);   /* size */
5273                         break;
5274                 case MM_ATTRS_TYPE_DATA:
5275                         va_arg((var_args), void*); /* data */
5276                         va_arg((var_args), int);   /* size */
5277                         break;
5278                 case MM_ATTRS_TYPE_INVALID:
5279                 default:
5280                         MMCAM_LOG_ERROR("Not supported attribute type(%d, name:%s)", attr_type, name);
5281                         if (err_attr_name)
5282                                 *err_attr_name = strdup(name);
5283
5284                         return  MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
5285                 }
5286
5287                 /* next name */
5288                 name = va_arg(var_args, const char*);
5289         }
5290
5291         for (i = 0 ; i < CHECK_COUNT ; i++) {
5292                 if (check_pair_value[i][0] != INIT_VALUE || check_pair_value[i][1] != INIT_VALUE) {
5293                         gboolean check_result = FALSE;
5294                         char *err_name = NULL;
5295                         MMCamAttrsInfo attr_info_0, attr_info_1;
5296
5297                         if (check_pair_value[i][0] == INIT_VALUE) {
5298                                 mm_attrs_get_int_by_name(attrs, check_pair_name[i][0], &check_pair_value[i][0]);
5299                                 err_name = strdup(check_pair_name[i][1]);
5300                         } else if (check_pair_value[i][1] == INIT_VALUE) {
5301                                 mm_attrs_get_int_by_name(attrs, check_pair_name[i][1], &check_pair_value[i][1]);
5302                                 err_name = strdup(check_pair_name[i][0]);
5303                         } else {
5304                                 err_name = strdup(check_pair_name[i][2]);
5305                         }
5306
5307                         mm_camcorder_get_attribute_info(handle, check_pair_name[i][0], &attr_info_0);
5308                         mm_camcorder_get_attribute_info(handle, check_pair_name[i][1], &attr_info_1);
5309
5310                         check_result = FALSE;
5311
5312                         for (j = 0 ; j < attr_info_0.int_array.count ; j++) {
5313                                 if (attr_info_0.int_array.array[j] == check_pair_value[i][0] &&
5314                                     attr_info_1.int_array.array[j] == check_pair_value[i][1]) {
5315                                         /*
5316                                         MMCAM_LOG_INFO("Valid Pair[%s,%s] existed %dx%d[index:%d]",
5317                                                 check_pair_name[i][0], check_pair_name[i][1],
5318                                                 check_pair_value[i][0], check_pair_value[i][1], i);
5319                                         */
5320                                         check_result = TRUE;
5321                                         break;
5322                                 }
5323                         }
5324
5325                         if (check_result == FALSE) {
5326                                 MMCAM_LOG_ERROR("INVALID pair[%s,%s] %dx%d",
5327                                         check_pair_name[i][0], check_pair_name[i][1],
5328                                         check_pair_value[i][0], check_pair_value[i][1]);
5329                                 if (err_attr_name) {
5330                                         *err_attr_name = err_name;
5331                                 } else {
5332                                         if (err_name) {
5333                                                 free(err_name);
5334                                                 err_name = NULL;
5335                                         }
5336                                 }
5337
5338                                 if (check_pair_value[i][0] <= 0 || check_pair_value[i][1] <= 0)
5339                                         return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
5340
5341                                 return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
5342                         }
5343
5344                         if (!strcmp(check_pair_name[i][0], MMCAM_CAMERA_WIDTH)) {
5345                                 int current_width = 0;
5346                                 int current_height = 0;
5347
5348                                 mm_camcorder_get_attributes(handle, NULL,
5349                                         MMCAM_CAMERA_WIDTH, &current_width,
5350                                         MMCAM_CAMERA_HEIGHT, &current_height,
5351                                         NULL);
5352
5353                                 if (current_width != check_pair_value[i][0] ||
5354                                     current_height != check_pair_value[i][1]) {
5355                                         hcamcorder->resolution_changed = TRUE;
5356                                 } else {
5357                                         hcamcorder->resolution_changed = FALSE;
5358                                 }
5359
5360                                 MMCAM_LOG_INFO("resolution changed : %d", hcamcorder->resolution_changed);
5361                         }
5362
5363                         if (err_name) {
5364                                 free(err_name);
5365                                 err_name = NULL;
5366                         }
5367                 }
5368         }
5369
5370         /*MMCAM_LOG_INFO("DONE");*/
5371
5372         return MM_ERROR_NONE;
5373 }
5374
5375
5376 bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index)
5377 {
5378         MMAttrsInfo info;
5379
5380         if ((void *)handle == NULL) {
5381                 MMCAM_LOG_WARNING("handle %p is NULL", handle);
5382                 return FALSE;
5383         }
5384
5385         memset(&info, 0x0, sizeof(MMAttrsInfo));
5386
5387         mm_attrs_get_info(MMF_CAMCORDER_ATTRS(handle), attr_index, &info);
5388
5389         switch (info.validity_type) {
5390         case MM_ATTRS_VALID_TYPE_INT_ARRAY:
5391                 /*
5392                 MMCAM_LOG_INFO("int array count %d", info.int_array.count);
5393                 */
5394                 if (info.int_array.count < 1)
5395                         return FALSE;
5396                 break;
5397         case MM_ATTRS_VALID_TYPE_INT_RANGE:
5398                 /*
5399                 MMCAM_LOG_INFO("int range min %d, max %d",info.int_range.min, info.int_range.max);
5400                 */
5401                 if (info.int_range.min > info.int_range.max)
5402                         return FALSE;
5403                 break;
5404         case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
5405                 /*
5406                 MMCAM_LOG_INFO("double array count %d", info.double_array.count);
5407                 */
5408                 if (info.double_array.count < 1)
5409                         return FALSE;
5410                 break;
5411         case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
5412                 /*
5413                 MMCAM_LOG_INFO("double range min %lf, max %lf",info.int_range.min, info.int_range.max);
5414                 */
5415                 if (info.double_range.min >= info.double_range.max)
5416                         return FALSE;
5417                 break;
5418         default:
5419                 MMCAM_LOG_WARNING("invalid type %d", info.validity_type);
5420                 return FALSE;
5421         }
5422
5423         return TRUE;
5424 }