Add new INI fields to use multiple camera plugin 76/281676/7
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 20 Sep 2022 11:46:32 +0000 (20:46 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 12 Oct 2022 10:42:58 +0000 (19:42 +0900)
- "AltVideosrcElement"
: The alternative videosrc element will be used instead of "VideosrcElement"
  in main configuration file, if exists.
- "AltUseZeroCopyFormat"
: The alternative value of "UseZeroCopyFormat",
  it will be used if it's not default value(-1).

[Version] 0.10.272
[Issue Type] New feature

Change-Id: I6c27b4d2155c692e666e9913f0d2ef7daf999d8d
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/include/mm_camcorder_configure.h
src/mm_camcorder_configure.c
src/mm_camcorder_gstcommon.c
src/mm_camcorder_internal.c
src/mm_camcorder_stillshot.c

index f1c210c..5b969cf 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.271
+Version:    0.10.272
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index a5fc93a..26c9df6 100644 (file)
@@ -397,7 +397,8 @@ int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int c
 int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
 int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
 int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
-void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, int category, const char *name, type_element **element, const char **element_name);
+void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, camera_conf *configure_info, int category,
+       const char *name, type_element **element, const char **element_name);
 
 #ifdef __cplusplus
 }
index 3737d04..bf2e84d 100644 (file)
@@ -823,7 +823,9 @@ int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure
                { "FacingDirection",      CONFIGURE_VALUE_INT,            {.value_int = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
                { "FrameStabilityCount",  CONFIGURE_VALUE_INT,            {.value_int = 0} },
                { "SupportExtraPreview",  CONFIGURE_VALUE_INT,            {.value_int = 0} },
-               { "ExtraPreviewMode",     CONFIGURE_VALUE_INT,            {.value_int = MM_CAMCORDER_EXTRA_PREVIEW_MODE_CAMERA_CONTROL} }
+               { "ExtraPreviewMode",     CONFIGURE_VALUE_INT,            {.value_int = MM_CAMCORDER_EXTRA_PREVIEW_MODE_CAMERA_CONTROL} },
+               { "AltVideosrcElement",   CONFIGURE_VALUE_ELEMENT,        {NULL} }, /* The alternative of videosrc element, it will be used instead of "VideosrcElement" if exists. */
+               { "AltUseZeroCopyFormat", CONFIGURE_VALUE_INT,            {.value_int = -1} } /* The alternative of "UseZeroCopyFormat", it will be used if it's not default(-1) value. */
        };
 
        /* [Strobe] matching table */
@@ -2090,7 +2092,8 @@ int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int categ
        return TRUE;
 }
 
-void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, int category, const char *name, type_element **element, const char **element_name)
+void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, camera_conf *conf, int category,
+       const char *name, type_element **element, const char **element_name)
 {
        type_element *_element = NULL;
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
@@ -2100,8 +2103,11 @@ void _mmcamcorder_conf_get_element_and_name(MMHandleType handle, int category, c
                return;
        }
 
-       _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
-               category, name, &_element);
+       if (!_mmcamcorder_conf_get_element(handle, conf,
+               category, name, &_element)) {
+               MMCAM_LOG_WARNING("get [%s] failed", name);
+               return;
+       }
 
        if (element)
                *element = _element;
index 362421c..4933e86 100644 (file)
@@ -618,9 +618,16 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle)
        sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
 
        _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
-               CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
+               hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAMERA, "AltVideosrcElement",
                &videosrc_element, &videosrc_name);
 
+       /* Skip getting "VideosrcElement" if alternative element exists. */
+       if (videosrc_name == NULL) {
+               _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
+                       hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
+                       &videosrc_element, &videosrc_name);
+       }
+
        /**
         * Create child element
         */
@@ -939,7 +946,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle)
        }
 
        _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
-               CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT, cat_name,
+               hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT, cat_name,
                &audiosrc_element, &audiosrc_name);
 
        free(cat_name);
index b473eb7..0069000 100644 (file)
@@ -451,10 +451,17 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord
        MMCAM_LOG_INFO("Brightness step denominator[%d]", hcamcorder->brightness_step_denominator);
        MMCAM_LOG_INFO("Support ZSL capture[%d]", hcamcorder->support_zsl_capture);
 
-       _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
-               CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
-               "UseZeroCopyFormat",
+       _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_ctrl,
+               CONFIGURE_CATEGORY_CTRL_CAMERA,
+               "AltUseZeroCopyFormat",
                &hcamcorder->use_zero_copy_format);
+       if (hcamcorder->use_zero_copy_format == -1) {
+               MMCAM_LOG_WARNING("AltUseZeroCopyFormat is not set, so use \"UseZeroCopyFormat\".");
+               _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+                       "UseZeroCopyFormat",
+                       &hcamcorder->use_zero_copy_format);
+       }
 
        _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
                CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
@@ -618,11 +625,11 @@ static gint __mmcamcorder_init_configure_common(mmf_camcorder_t *hcamcorder)
                &device_count);
 
        _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
-               CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
+               hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
                NULL, &videosrc_name);
 
        _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
-               CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT, "AudiosrcElement",
+               hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT, "AudiosrcElement",
                NULL, &audiosrc_name);
 
        MMCAM_LOG_INFO("Device count[%d], Videosrc[%s], Audiosrc[%s]",
index 85a5202..e1ab043 100644 (file)
@@ -387,7 +387,7 @@ static int __mmcamcorder_extra_preview_mode_init_pipeline(MMHandleType handle, M
 
        if (mode == MM_CAMCORDER_EXTRA_PREVIEW_MODE_PIPELINE_ELEMENT) {
                _mmcamcorder_conf_get_element_and_name(handle,
-                       CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
+                       hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
                        &videosrc_element, &videosrc_name);
 
                _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_EXT_SRC, videosrc_name, "videosrc_ext_src", element_list, err);