mjpeg resource allcation routine changes according to resource information 36/230136/2 accepted/tizen/unified/20200417.152759 submit/tizen/20200414.033349
authorHyuntae Kim <ht1211.kim@samsung.com>
Wed, 8 Apr 2020 06:38:39 +0000 (15:38 +0900)
committerHyuntae Kim <ht1211.kim@samsung.com>
Thu, 9 Apr 2020 01:43:00 +0000 (10:43 +0900)
Change-Id: I8e16bb03cd78cbdf890b28dd15ec95bc0a413782

configure.ac
packaging/libmm-camcorder.spec
src/Makefile.am
src/mm_camcorder_rm.c

index 52a670dcfd33c7f0c2a46758ab236ce0d1a427ac..3cfec97f3401d88c63ee23a3f6acc398134cdebd 100644 (file)
@@ -112,6 +112,10 @@ AC_SUBST(RM_LIBS)
 PKG_CHECK_MODULES(AUL, aul)
 AC_SUBST(AUL_CFLAGS)
 AC_SUBST(AUL_LIBS)
+
+PKG_CHECK_MODULES(RI, tv-resource-information)
+AC_SUBST(RI_CFLAGS)
+AC_SUBST(RI_LIBS)
 fi
 AM_CONDITIONAL([RM_SUPPORT], [test "x$RM_SUPPORT" = "xyes"])
 
index 0b6ddbe9f336ff8d268d8f949825fac417d373e7..3cff0c9f2f54a6d1fcdc2cbfa76f8217da34c9f6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.195
+Version:    0.10.196
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -24,6 +24,7 @@ BuildRequires:  pkgconfig(libtbm)
 BuildRequires:  pkgconfig(storage)
 %if "%{tizen_profile_name}" == "tv"
 BuildRequires:  pkgconfig(tv-resource-manager)
+BuildRequires:  pkgconfig(tv-resource-information)
 BuildRequires:  pkgconfig(aul)
 %else
 BuildRequires:  pkgconfig(mm-resource-manager)
index 0fdc6db71671b7fa42ac988ba580ca79e6f4d416..3808f77dd331d8d807901797f63f027480e68268 100644 (file)
@@ -86,8 +86,8 @@ libmmfcamcorder_la_LIBADD += $(MM_RESOURCE_MANAGER_LIBS)
 endif
 
 if RM_SUPPORT
-libmmfcamcorder_la_CFLAGS += $(RM_CFLAGS) $(AUL_CFLAGS) -D_MMCAMCORDER_RM_SUPPORT
-libmmfcamcorder_la_LIBADD += $(RM_LIBS) $(AUL_LIBS)
+libmmfcamcorder_la_CFLAGS += $(RM_CFLAGS) $(RI_CFLAGS) $(AUL_CFLAGS) -D_MMCAMCORDER_RM_SUPPORT
+libmmfcamcorder_la_LIBADD += $(RM_LIBS) $(RI_LIBS) $(AUL_LIBS)
 endif
 
 if PRODUCT_TV
index fecd42e4daf3767349df1c4a80f1f6b8165947ad..0d8ccb56278d88aa6724605306fdbbc856ee872b 100644 (file)
@@ -25,6 +25,8 @@
 #ifdef _MMCAMCORDER_RM_SUPPORT
 #include <aul.h>
 #include <rm_api.h>
+#include <ri-api.h>
+#include <ri-module-api.h>
 #include "mm_camcorder_rm.h"
 #include "mm_camcorder_internal.h"
 
@@ -75,6 +77,8 @@ int _mmcamcorder_rm_create(MMHandleType handle)
                return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
        }
 
+       memset(&rci, 0x00, sizeof(rm_consumer_info));
+
        mm_camcorder_get_attributes(handle, NULL,
                MMCAM_CLIENT_PID, &app_pid,
                NULL);
@@ -83,7 +87,10 @@ int _mmcamcorder_rm_create(MMHandleType handle)
 
        /* RM register */
        if (hcamcorder->rm_handle == 0) {
-               ret = rm_register((rm_resource_cb)__mmcamcorder_rm_callback, (void*)hcamcorder, &(hcamcorder->rm_handle), &rci);
+               ret = rm_register((rm_resource_cb)__mmcamcorder_rm_callback,
+                       (void*)hcamcorder,
+                       &(hcamcorder->rm_handle),
+                       (rci.app_id[0] != '\0') ? &rci : NULL);
                if (ret != RM_OK) {
                        _mmcam_dbg_err("rm_register fail ret = %d",ret);
                        return MM_ERROR_RESOURCE_INTERNAL;
@@ -100,6 +107,7 @@ int _mmcamcorder_rm_allocate(MMHandleType handle)
        int qret_avail = 0; /* 0: not available, 1: available */
        int resource_count = 0;
        int display_surface_type = MM_DISPLAY_SURFACE_OVERLAY;
+       int camera_width = 0;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
        if (!hcamcorder) {
@@ -128,20 +136,20 @@ int _mmcamcorder_rm_allocate(MMHandleType handle)
 
                        resource_count++;
                } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) {
-                       hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
-                       hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB;
-
-                       _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB);
+                       mm_camcorder_get_attributes(handle, NULL,
+                               MMCAM_CAMERA_WIDTH, &camera_width,
+                               NULL);
 
+                       hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+                       hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_MJPEG_DECODER;
+                       hcamcorder->request_resources.category_option[resource_count] = ri_get_jpeg_category_id("MJPEG", camera_width);
+                       _mmcam_dbg_log("request dec rsc - category 0x%x, option width [%d]", RM_CATEGORY_MJPEG_DECODER, camera_width);
                        resource_count++;
                }
                if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
                        hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
-                       if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264)
-                               hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
-                       else
-                               hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
-                       _mmcam_dbg_log("request scaler rsc - category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
+                       hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
+                       _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER);
                        resource_count++;
                }
 
@@ -163,18 +171,23 @@ int _mmcamcorder_rm_allocate(MMHandleType handle)
                                        resource_count++;
                                } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) {
                                        hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
-                                       hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER;
-                                       _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER);
+                                       hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_MJPEG_DECODER;
+                                       hcamcorder->request_resources.category_option[resource_count] = ri_get_jpeg_category_id("MJPEG", camera_width);
+                                       _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_MJPEG_DECODER);
                                        resource_count++;
                                }
                                if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
-                                       hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
-                                       if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264)
+                                       if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+                                               hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
                                                hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
-                                       else
+                                               _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB);
+                                               resource_count++;
+                                       } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) {
+                                               hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
                                                hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
-                                       _mmcam_dbg_log("request scaler rsc - category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
-                                       resource_count++;
+                                               _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER);
+                                               resource_count++;
+                                       }
                                }
                        }
                }