Add new configuration to update capsfilter by stream rotation 28/316228/1
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 16 Aug 2024 05:05:58 +0000 (14:05 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 16 Aug 2024 05:05:58 +0000 (14:05 +0900)
[Version] 1.2.1
[Issue Type] Update

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

index 0d07056..4dd4746 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    1.2.0
+Version:    1.2.1
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index cddea03..b2ce52c 100644 (file)
@@ -826,6 +826,7 @@ typedef struct mmf_camcorder {
        gboolean is_network;                                    /**< Flag for network camera */
        const char *network_hal_name;                           /**< Name of network camera HAL library */
        int default_encoded_preview_bitrate;                    /**< Default bitrate for encoded preview */
+       int update_caps_by_stream_rotation;                     /**< Update resolution in capsfilter by stream rotation setting */
 
        _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM];        /**< converting structure of camera info */
        _MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM];                    /**< enum converting list that is modified by ini info */
index 9a43875..fbe1a66 100644 (file)
@@ -674,6 +674,7 @@ int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure
                { "SupportUserBuffer",            CONFIGURE_VALUE_INT,          {.value_int = 0} },
                { "MeasurePreviewFPS",            CONFIGURE_VALUE_INT,          {.value_int = 0} },
                { "DefaultEncodedPreviewBitrate", CONFIGURE_VALUE_INT,          {.value_int = DEFAULT_ENCODED_PREVIEW_BITRATE} },
+               { "UpdateCapsByStreamRotation",   CONFIGURE_VALUE_INT,          {.value_int = 0} },
        };
 
        /* [AudioInput] matching table */
index 2469dfb..842a96c 100644 (file)
@@ -2860,38 +2860,24 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in
                sc->info_video->fps = fps;
        }
 
-       /* Interleaved format does not support rotation */
-       if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
-               /* store videosrc rotation */
-               sc->videosrc_rotate = rotate;
-
-               /* Define width, height and rotate in caps */
-
-               /* This will be applied when rotate is 0, 90, 180, 270 if rear camera.
-               This will be applied when rotate is 0, 180 if front camera. */
-               set_rotate = rotate * 90;
-
-               if (rotate == MM_VIDEO_INPUT_ROTATION_90 ||
-                   rotate == MM_VIDEO_INPUT_ROTATION_270) {
-                       set_width = height;
-                       set_height = width;
-                       if (hcamcorder->device_type == MM_VIDEO_DEVICE_CAMERA1) {
-                               if (rotate == MM_VIDEO_INPUT_ROTATION_90)
-                                       set_rotate = 270;
-                               else
-                                       set_rotate = 90;
-                       }
-               } else {
-                       set_width = width;
-                       set_height = height;
-               }
-       } else {
-               sc->videosrc_rotate = MM_VIDEO_INPUT_ROTATION_NONE;
-               set_rotate = 0;
-               set_width = width;
-               set_height = height;
+       sc->videosrc_rotate = rotate;
+       set_rotate = rotate * 90;
+       set_width = width;
+       set_height = height;
 
-               MMCAM_LOG_WARNING("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]", rotate);
+       if (hcamcorder->update_caps_by_stream_rotation &&
+               (rotate == MM_VIDEO_INPUT_ROTATION_90 || rotate == MM_VIDEO_INPUT_ROTATION_270)) {
+               MMCAM_LOG_WARNING("update caps by stream rotation[%d]", set_rotate);
+
+               set_width = height;
+               set_height = width;
+
+               if (hcamcorder->device_type == MM_VIDEO_DEVICE_CAMERA1) {
+                       if (rotate == MM_VIDEO_INPUT_ROTATION_90)
+                               set_rotate = 270;
+                       else
+                               set_rotate = 90;
+               }
        }
 
        MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_CAPS].gst, "caps", &caps);
index dbf4b13..a887e23 100644 (file)
@@ -497,6 +497,11 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord
                &hcamcorder->default_encoded_preview_bitrate);
 
        _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+               CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+               "UpdateCapsByRotation",
+               &hcamcorder->update_caps_by_stream_rotation);
+
+       _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
                CONFIGURE_CATEGORY_MAIN_CAPTURE,
                "CaptureMode",
                &hcamcorder->capture_mode);
@@ -522,6 +527,7 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord
        MMCAM_LOG_INFO("Use video convert[%d]", hcamcorder->use_videoconvert);
        MMCAM_LOG_INFO("Measure preview FPS[%d]", hcamcorder->measure_preview_fps);
        MMCAM_LOG_INFO("Default encoded preview bitrate[%d]", hcamcorder->default_encoded_preview_bitrate);
+       MMCAM_LOG_INFO("Update capsfilter by stream rotation[%d]", hcamcorder->update_caps_by_stream_rotation);
        MMCAM_LOG_INFO("Play capture sound[%d]", play_capture_sound);
 
        ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,