Improve continuous capture logic 87/296687/1 accepted/tizen/unified/20230807.014644
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 3 Aug 2023 02:35:28 +0000 (11:35 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 3 Aug 2023 05:41:35 +0000 (14:41 +0900)
- Previously, in capture mode ENCODEBIN or IMAGE_PAD,
 1. The continuous capture is not supported.
 2. The capture interval is ignored.
- This patch adds the logic for continuous capture and capture interval.

[Version] 0.10.295
[Issue Type] Improvement

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

index f0deab5b159fd0b0dd7ceb3f2a27da05a3b84e61..c2e9124a02efe029b3b77b68b465b7365a14b00d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.294
+Version:    0.10.295
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 62bd86f992f232f899717323dfb176a9ec317bba..7a1d25dc50b0242009de9c06b7a7804170d78ad1 100644 (file)
@@ -61,7 +61,7 @@ typedef struct {
        int count;                                      /**< Multi-shot capture count */
        int capture_cur_count;                          /**< Multi-shot capture current count */
        int capture_send_count;                         /**< Multi-shot capture send count */
-       unsigned long long next_shot_time;              /**< next still capture time */
+       GstClockTime next_shot_time;            /**< next still capture time */
        gboolean multi_shot_stop;                       /**< Multi-shot stop flag */
        gboolean capturing;                             /**< whether MSL is on capturing */
        gboolean resolution_change;                     /**< whether on resolution changing for capturing. After changing to capture resolution, it sets to FALSE again. */
index 37a3c3620222099a1f91b82ff740522a5b6e338f..033531048418240c7e3ccd1cf1ff4ad3d490d016 100644 (file)
@@ -1998,6 +1998,7 @@ _CAPTURE_CB_EXIF_DONE:
 
        /* Set capture count */
        count = ++(info->capture_send_count);
+       info->next_shot_time = GST_BUFFER_PTS(gst_sample_get_buffer(sample1)) + (GST_MSECOND * info->interval);
        send_captured_message = TRUE;
 
 err_release_exif:
@@ -2155,18 +2156,29 @@ static gboolean __mmcamcorder_handoff_callback_capture(GstElement *fakesink, Gst
 {
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
        _MMCamcorderSubContext *sc = NULL;
+       _MMCamcorderImageInfo *info = NULL;
 
        mmf_return_val_if_fail(hcamcorder, FALSE);
+       mmf_return_val_if_fail(buffer, FALSE);
 
        sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
        mmf_return_val_if_fail(sc && sc->element, FALSE);
 
        MMCAM_LOG_INFO("");
 
+       info = sc->info_image;
+
+       if (info->capture_send_count > 0 && info->next_shot_time > GST_BUFFER_PTS(buffer)) {
+               MMCAM_LOG_INFO("next capture time[%"GST_TIME_FORMAT"], but buffer[%"GST_TIME_FORMAT"]",
+                       GST_TIME_ARGS(info->next_shot_time), GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));
+               return TRUE;
+       }
+
        /* FIXME. How could you get a thumbnail? */
        __mmcamcorder_image_capture_cb(fakesink, gst_sample_new(buffer, gst_pad_get_current_caps(pad), NULL, NULL), NULL, NULL, u_data);
 
-       if (sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
+       if ((info->capture_send_count == info->count || info->capturing == FALSE) &&
+               sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
                MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "signal-handoffs", FALSE);
                MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
                sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;