Add new internal API to request codec cofig 57/283057/1
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 17 Oct 2022 10:20:20 +0000 (19:20 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 17 Oct 2022 10:20:20 +0000 (19:20 +0900)
[Version] 0.4.93
[Issue Type] New feature

Change-Id: I9d925b90633ef05954b6bc2c524e75194bed0d2f
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/camera_internal.h
packaging/capi-media-camera.spec
src/camera.c
src/camera_internal.c
test/camera_test.c

index 672a64b..9775db8 100644 (file)
@@ -237,6 +237,22 @@ int camera_attr_get_focus_level_range(camera_h camera, int *min, int *max);
 int camera_set_extra_preview_device(camera_h camera, int stream_id, camera_device_e device);
 
 /**
+ * @internal
+ * @brief Requests codec config data for encoded format.
+ * @since_tizen 7.0
+ * @param[in] camera       The handle to the camera
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
+ * @pre The camera state must be set to #CAMERA_STATE_PREVIEW.
+ * @see camera_start_preview()
+ */
+int camera_request_codec_config(camera_h camera);
+
+/**
  * @}
  */
 #ifdef __cplusplus
index bb25635..c63cf24 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.92
+Version:    0.4.93
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 0f60caf..75f5ddd 100644 (file)
@@ -1286,7 +1286,7 @@ static int __camera_update_media_packet_format(camera_cb_info_s *cb_info, MMCamc
                media_format_get_video_info(cb_info->pkt_fmt,
                        &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
 
-               CAM_LOG_INFO("pkt_fmt %dx%d - stream %dx%d",
+               CAM_LOG_DEBUG("pkt_fmt %dx%d - stream %dx%d",
                        pkt_fmt_width, pkt_fmt_height, stream->width, stream->height);
 
                if (pkt_fmt_mimetype != mimetype ||
@@ -1349,6 +1349,16 @@ static int __camera_create_media_packet(camera_cb_info_s *cb_info, MMCamcorderVi
                        stream->data.encoded.data, stream->data.encoded.length_data,
                        (media_packet_dispose_cb)_camera_media_packet_dispose, (void *)cb_info,
                        &pkt);
+
+               if (pkt) {
+                       if (!stream->data.encoded.is_delta_frame)
+                               media_packet_set_flags(pkt, MEDIA_PACKET_SYNC_FRAME);
+
+                       if (stream->data.encoded.is_header_included) {
+                               media_packet_set_flags(pkt, MEDIA_PACKET_CODEC_CONFIG);
+                               CAM_LOG_INFO("Codec config in buffer");
+                       }
+               }
        } else {
                tsurf = __camera_get_tbm_surface(stream, mp_data);
                if (!tsurf) {
index 7fc9b72..9f28f7e 100644 (file)
@@ -357,4 +357,25 @@ int camera_set_extra_preview_device(camera_h camera, int stream_id, camera_devic
 
        return ret;
 }
+
+
+int camera_request_codec_config(camera_h camera)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_REQUEST_CODEC_CONFIG;
+
+       if (!pc || !pc->cb_info) {
+               CAM_LOG_ERROR("NULL pointer %p", pc);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       CAM_LOG_INFO("Enter");
+
+       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       CAM_LOG_INFO("ret : 0x%x", ret);
+
+       return ret;
+}
 //LCOV_EXCL_STOP
index e471e37..dbad1b3 100644 (file)
@@ -825,6 +825,7 @@ void print_menu()
                g_print("\t     's' Extra preview stream format\n");
                g_print("\t     'B' Extra preview bitrate\n");
                g_print("\t     'V' Extra preview GOP interval\n");
+               g_print("\t     'D' Request codec config\n");
                g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n");
                g_print("\t     'v' Visible \n");
                g_print("\t     'o' Output mode \n");
@@ -1306,6 +1307,15 @@ static void setting_menu(gchar buf)
 
                g_print("\tResult GOP interval[%d]bps for stream_id[%d]\n", interval, stream_id);
                break;
+       case 'D': /* Setting > Request codec config */
+               g_print("* Request codec config\n");
+
+               err = camera_request_codec_config(hcamcorder->camera);
+               if (err != CAMERA_ERROR_NONE) {
+                       g_print("\tFailed to request codec config\n");
+                       break;
+               }
+               break;
                /* Display / Filter setting */
        case 'v': /* Display visible */
                g_print("* Display visible setting !\n");