From 2f502a2a8f8f228a0880635d419c9f4045292479 Mon Sep 17 00:00:00 2001 From: Hyuntae Kim Date: Wed, 8 Apr 2020 15:38:39 +0900 Subject: [PATCH] mjpeg resource allcation routine changes according to resource information Change-Id: I8e16bb03cd78cbdf890b28dd15ec95bc0a413782 --- configure.ac | 4 +++ packaging/libmm-camcorder.spec | 3 ++- src/Makefile.am | 4 +-- src/mm_camcorder_rm.c | 47 ++++++++++++++++++++++------------ 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 52a670d..3cfec97 100644 --- a/configure.ac +++ b/configure.ac @@ -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"]) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 0b6ddbe..3cff0c9 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -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) diff --git a/src/Makefile.am b/src/Makefile.am index 0fdc6db..3808f77 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/mm_camcorder_rm.c b/src/mm_camcorder_rm.c index fecd42e..0d8ccb5 100644 --- a/src/mm_camcorder_rm.c +++ b/src/mm_camcorder_rm.c @@ -25,6 +25,8 @@ #ifdef _MMCAMCORDER_RM_SUPPORT #include #include +#include +#include #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++; + } } } } -- 2.34.1