From: Jeongmo Yang Date: Thu, 17 Sep 2020 10:51:05 +0000 (+0900) Subject: Revise log related code X-Git-Tag: submit/tizen/20200922.071245^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45f4d26ceabda8ac102cf64460a5c2293e895cf0;p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git Revise log related code - Rearrange log level. enum MMCamcorderLogLevel { MM_CAMCORDER_LOG_LEVEL_CRITICAL = 0, MM_CAMCORDER_LOG_LEVEL_ERROR, MM_CAMCORDER_LOG_LEVEL_WARNING, MM_CAMCORDER_LOG_LEVEL_INFO, MM_CAMCORDER_LOG_LEVEL_DEBUG, MM_CAMCORDER_LOG_LEVEL_VERBOSE }; - The default value is MM_CAMCORDER_LOG_LEVEL_INFO(3). - Add new field to mmfw_camcorder.ini to control log level. [General] ... LogLevel = 3 [Version] 0.10.215 [Issue Type] Log feature Change-Id: I055534ab7d8274e4df1f5d64ba8090c4adad2d63 Signed-off-by: Jeongmo Yang --- diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 40f6d7d..5568f89 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.214 +Version: 0.10.215 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_camcorder.h b/src/include/mm_camcorder.h index 6fdcac9..a458ddb 100644 --- a/src/include/mm_camcorder.h +++ b/src/include/mm_camcorder.h @@ -1324,6 +1324,12 @@ extern "C" { */ #define MMCAM_PLATFORM_PRIVILEGE_CAMERA "platform-privilege-camera" +/** + * Log level + */ +#define MMCAM_LOG_LEVEL "log-level" + + /*======================================================================================= | ENUM DEFINITIONS | ========================================================================================*/ @@ -1644,6 +1650,19 @@ enum MMCamcorderPreviewType { }; +/** + * An enumeration for log level. + */ +enum MMCamcorderLogLevel { + MM_CAMCORDER_LOG_LEVEL_CRITICAL = 0, + MM_CAMCORDER_LOG_LEVEL_ERROR, + MM_CAMCORDER_LOG_LEVEL_WARNING, + MM_CAMCORDER_LOG_LEVEL_INFO, + MM_CAMCORDER_LOG_LEVEL_DEBUG, + MM_CAMCORDER_LOG_LEVEL_VERBOSE +}; + + /********************************** * Attribute info * **********************************/ diff --git a/src/include/mm_camcorder_attribute.h b/src/include/mm_camcorder_attribute.h index db22af1..7ea258d 100644 --- a/src/include/mm_camcorder_attribute.h +++ b/src/include/mm_camcorder_attribute.h @@ -191,6 +191,7 @@ typedef enum { MM_CAM_SUPPORT_USER_BUFFER, MM_CAM_USER_BUFFER_FD, MM_CAM_PLATFORM_PRIVILEGE_CAMERA, + MM_CAM_LOG_LEVEL, MM_CAM_ATTRIBUTE_NUM } MMCamcorderAttrsID; diff --git a/src/include/mm_camcorder_internal.h b/src/include/mm_camcorder_internal.h index 8ac7edb..ecd7d51 100644 --- a/src/include/mm_camcorder_internal.h +++ b/src/include/mm_camcorder_internal.h @@ -79,18 +79,12 @@ extern "C" { /*======================================================================================= | MACRO DEFINITIONS | ========================================================================================*/ -#define _mmcam_dbg_verb(fmt, args...) SLOGI(fmt, ##args); -#define _mmcam_dbg_log(fmt, args...) SLOGD(fmt, ##args); -#define _mmcam_dbg_warn(fmt, args...) SLOGW(fmt, ##args); -#define _mmcam_dbg_err(fmt, args...) SLOGE(fmt, ##args); -#define _mmcam_dbg_crit(fmt, args...) SLOGF(fmt, ##args); - /** * Macro for checking validity and debugging */ #define mmf_return_if_fail(expr) \ if (!(expr)) { \ - _mmcam_dbg_err("failed [%s]", #expr); \ + MMCAM_LOG_ERROR("failed [%s]", #expr); \ return; \ } @@ -99,7 +93,7 @@ extern "C" { */ #define mmf_return_val_if_fail(expr, val) \ if (!(expr)) { \ - _mmcam_dbg_err("failed [%s]", #expr); \ + MMCAM_LOG_ERROR("failed [%s]", #expr); \ return (val); \ } @@ -115,13 +109,13 @@ extern "C" { #define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(element[eid].gst); \ } \ element[eid].id = eid; \ element[eid].gst = gst_pipeline_new(name); \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ goto pipeline_creation_error; \ } else { \ @@ -132,13 +126,13 @@ do { \ #define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(element[eid].gst); \ } \ element[eid].id = eid; \ element[eid].gst = gst_bin_new(name); \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \ + MMCAM_LOG_ERROR("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ goto pipeline_creation_error; \ } else { \ @@ -149,18 +143,18 @@ do { \ #define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(element[eid].gst); \ } \ traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:ELEMENT_MAKE:%s", name); \ element[eid].gst = gst_element_factory_make(name, nickname); \ traceEnd(TTRACE_TAG_CAMERA); \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("Element creation fail. element_id=[%d], name=[%s]", eid, name); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ goto pipeline_creation_error; \ } else { \ - _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \ element[eid].id = eid; \ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \ err = MM_ERROR_NONE; \ @@ -171,15 +165,15 @@ do { \ #define _MMCAMCORDER_ELEMENT_MAKE2(sub_context, element, eid, name /*char* */, nickname /*char* */, err) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(element[eid].gst); \ } \ element[eid].gst = gst_element_factory_make(name, nickname); \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("Element creation fail. element_id=[%d], name=[%s]", eid, name); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ } else { \ - _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \ element[eid].id = eid; \ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \ err = MM_ERROR_NONE; \ @@ -189,14 +183,14 @@ do { \ #define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(element[eid].gst); \ } \ element[eid].gst = gst_element_factory_make(name, nickname); \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \ + MMCAM_LOG_ERROR("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \ } else { \ - _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_INFO("Element creation done. element_id=[%d], name=[%s]", eid, name); \ element[eid].id = eid; \ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \ elist = g_list_append(elist, &(element[eid])); \ @@ -206,16 +200,16 @@ do { \ #define _MMCAMCORDER_ELEMENT_ADD(sub_context, element, eid, gst_element, elist, err) \ do { \ if (element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element is existed. element_id=[%d]", eid); \ + MMCAM_LOG_ERROR("The element is existed. element_id=[%d]", eid); \ gst_object_unref(element[eid].gst); \ } \ element[eid].gst = gst_element; \ if (element[eid].gst == NULL) { \ - _mmcam_dbg_err("Element is NULL. element_id=[%d]", eid); \ + MMCAM_LOG_ERROR("Element is NULL. element_id=[%d]", eid); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ goto pipeline_creation_error; \ } else { \ - _mmcam_dbg_log("Adding Element is done. element_id=[%d] %p", eid, gst_element); \ + MMCAM_LOG_INFO("Adding Element is done. element_id=[%d] %p", eid, gst_element); \ element[eid].id = eid; \ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \ err = MM_ERROR_NONE; \ @@ -226,13 +220,13 @@ do { \ #define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \ do { \ if (sub_context->encode_element[eid].gst != NULL) { \ - _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("The element is existed. element_id=[%d], name=[%s]", eid, name); \ gst_object_unref(sub_context->encode_element[eid].gst); \ } \ sub_context->encode_element[eid].id = eid; \ g_object_get(G_OBJECT(sub_context->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sub_context->encode_element[eid].gst), NULL); \ if (sub_context->encode_element[eid].gst == NULL) { \ - _mmcam_dbg_err("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \ + MMCAM_LOG_ERROR("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \ goto pipeline_creation_error; \ } else{ \ @@ -258,13 +252,13 @@ do { \ GstPadLinkReturn ret = GST_PAD_LINK_OK; \ if (srcpad == NULL || sinkpad == NULL) { \ if (srcpad == NULL) { \ - _mmcam_dbg_err("srcpad is NULL"); \ + MMCAM_LOG_ERROR("srcpad is NULL"); \ } else { \ gst_object_unref(srcpad);\ srcpad = NULL; \ } \ if (sinkpad == NULL) { \ - _mmcam_dbg_err("sinkpad is NULL"); \ + MMCAM_LOG_ERROR("sinkpad is NULL"); \ } else { \ gst_object_unref(sinkpad); \ sinkpad = NULL;\ @@ -280,7 +274,7 @@ do { \ char *sink_name = NULL; \ g_object_get((GObject *)src_parent, "name", &src_name, NULL); \ g_object_get((GObject *)sink_parent, "name", &sink_name, NULL); \ - _mmcam_dbg_err("src[%s] - sink[%s] link failed", src_name, sink_name); \ + MMCAM_LOG_ERROR("src[%s] - sink[%s] link failed", src_name, sink_name); \ gst_object_unref(src_parent); src_parent = NULL; \ gst_object_unref(sink_parent); sink_parent = NULL; \ if (src_name) { \ @@ -303,7 +297,7 @@ do { \ if (srcpad && sinkpad) { \ gst_pad_unlink(srcpad, sinkpad); \ } else { \ - _mmcam_dbg_warn("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \ + MMCAM_LOG_WARNING("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \ } \ if (srcpad) { \ gst_object_unref(srcpad); srcpad = NULL; \ diff --git a/src/include/mm_camcorder_util.h b/src/include/mm_camcorder_util.h index 409215e..f2c641e 100644 --- a/src/include/mm_camcorder_util.h +++ b/src/include/mm_camcorder_util.h @@ -37,6 +37,7 @@ extern "C" { /*======================================================================================= | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER | ========================================================================================*/ +extern int mmcam_log_level; /*======================================================================================= | MACRO DEFINITIONS | @@ -45,20 +46,55 @@ extern "C" { #define CLEAR(x) memset(&(x), 0, sizeof(x)) #endif +/* log */ +#define MMCAM_LOG_CRITICAL(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_CRITICAL) \ + SLOGF(format, ##args); \ + } while (0) + +#define MMCAM_LOG_ERROR(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_ERROR) \ + SLOGE(format, ##args); \ + } while (0) + +#define MMCAM_LOG_WARNING(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_WARNING) \ + SLOGW(format, ##args); \ + } while (0) + +#define MMCAM_LOG_INFO(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_INFO) \ + SLOGI(format, ##args); \ + } while (0) + +#define MMCAM_LOG_DEBUG(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_DEBUG) \ + SLOGD(format, ##args); \ + } while (0) + +#define MMCAM_LOG_VERBOSE(format, args...) \ + do { \ + if (mmcam_log_level >= MM_CAMCORDER_LOG_LEVEL_VERBOSE) \ + SLOGD("[V] "format, ##args); \ + } while (0) + #define MMCAMCORDER_ADD_BUFFER_PROBE(x_pad, x_category, x_callback, x_hcamcorder) \ do { \ MMCamcorderHandlerItem *item = NULL; \ item = (MMCamcorderHandlerItem *)g_malloc(sizeof(MMCamcorderHandlerItem)); \ - if (!item) {\ - _mmcam_dbg_err("Cannot connect buffer probe [malloc fail] \n"); \ - } else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ - _mmcam_dbg_err("Invalid handler category : %x \n", x_category); \ + if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ + MMCAM_LOG_ERROR("Invalid handler category : %x", x_category); \ } else { \ item->object = G_OBJECT(x_pad); \ item->category = x_category; \ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \ x_hcamcorder->buffer_probes = g_list_append(x_hcamcorder->buffer_probes, item); \ - _mmcam_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", \ + MMCAM_LOG_INFO("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", \ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \ } \ } while (0) @@ -66,18 +102,15 @@ do { \ #define MMCAMCORDER_ADD_EVENT_PROBE(x_pad, x_category, x_callback, x_hcamcorder) \ do { \ MMCamcorderHandlerItem *item = NULL; \ - item = (MMCamcorderHandlerItem *) g_malloc(sizeof(MMCamcorderHandlerItem)); \ - if (!item) { \ - _mmcam_dbg_err("Cannot connect buffer probe [malloc fail] \n"); \ - } \ - else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ - _mmcam_dbg_err("Invalid handler category : %x \n", x_category); \ + item = (MMCamcorderHandlerItem *)g_malloc(sizeof(MMCamcorderHandlerItem)); \ + if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ + MMCAM_LOG_ERROR("Invalid handler category : %x", x_category); \ } else { \ item->object = G_OBJECT(x_pad); \ item->category = x_category; \ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \ x_hcamcorder->event_probes = g_list_append(x_hcamcorder->event_probes, item); \ - _mmcam_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", \ + MMCAM_LOG_INFO("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", \ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \ } \ } while (0) @@ -85,18 +118,16 @@ do { \ #define MMCAMCORDER_SIGNAL_CONNECT(x_object, x_category, x_signal, x_callback, x_hcamcorder) \ do { \ MMCamcorderHandlerItem* item = NULL; \ - item = (MMCamcorderHandlerItem *) g_malloc(sizeof(MMCamcorderHandlerItem)); \ - if (!item) { \ - _mmcam_dbg_err("Cannot connect signal [%s]\n", x_signal); \ - } else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ - _mmcam_dbg_err("Invalid handler category : %x \n", x_category); \ + item = (MMCamcorderHandlerItem *)g_malloc(sizeof(MMCamcorderHandlerItem)); \ + if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \ + MMCAM_LOG_ERROR("Invalid handler category : %x", x_category); \ } else { \ item->object = G_OBJECT(x_object); \ item->category = x_category; \ item->handler_id = g_signal_connect(G_OBJECT(x_object), x_signal, \ G_CALLBACK(x_callback), x_hcamcorder); \ x_hcamcorder->signals = g_list_append(x_hcamcorder->signals, item); \ - _mmcam_dbg_log("Connecting signal on [%s][%p] - [ID : %lu], [Category : %x] ", \ + MMCAM_LOG_INFO("Connecting signal on [%s][%p] - [ID : %lu], [Category : %x] ", \ GST_OBJECT_NAME(item->object), item->object, item->handler_id, item->category); \ } \ } while (0) @@ -107,10 +138,10 @@ do { \ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \ g_object_get(G_OBJECT(obj), name, value, NULL); \ } else { \ - _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \ + MMCAM_LOG_WARNING("The object doesn't have a property named(%s)", name); \ } \ } else { \ - _mmcam_dbg_err("Null object"); \ + MMCAM_LOG_ERROR("Null object"); \ } \ } while (0) @@ -131,10 +162,10 @@ do { \ g_object_set(G_OBJECT(obj), name, value, NULL); \ } \ } else { \ - _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \ + MMCAM_LOG_WARNING("The object doesn't have a property named(%s)", name); \ } \ } else { \ - _mmcam_dbg_err("Null object"); \ + MMCAM_LOG_ERROR("Null object"); \ } \ } while (0) @@ -145,10 +176,10 @@ do { \ if (spec) { \ g_object_set(G_OBJECT(obj), name, value, NULL); \ } else { \ - _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \ + MMCAM_LOG_WARNING("The object doesn't have a property named(%s)", name); \ } \ } else { \ - _mmcam_dbg_err("Null object"); \ + MMCAM_LOG_ERROR("Null object"); \ } \ } while (0) @@ -164,7 +195,7 @@ do {\ _MMCamcorderMsgItem msg;\ msg.id = msg_id;\ msg.param.code = msg_code;\ - _mmcam_dbg_log("msg id : %x, code : %x", msg_id, msg_code);\ + MMCAM_LOG_INFO("msg id : %x, code : %x", msg_id, msg_code);\ _mmcamcorder_send_message((MMHandleType)handle, &msg);\ } while (0) diff --git a/src/mm_camcorder.c b/src/mm_camcorder.c index 2a68051..0108b45 100644 --- a/src/mm_camcorder.c +++ b/src/mm_camcorder.c @@ -44,7 +44,7 @@ int mm_camcorder_create(MMHandleType *camcorder, MMCamPreset *info) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); mmf_return_val_if_fail((void *)info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:CREATE"); @@ -52,7 +52,7 @@ int mm_camcorder_create(MMHandleType *camcorder, MMCamPreset *info) traceEnd(TTRACE_TAG_CAMERA); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -64,7 +64,7 @@ int mm_camcorder_destroy(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:DESTROY"); @@ -72,7 +72,7 @@ int mm_camcorder_destroy(MMHandleType camcorder) traceEnd(TTRACE_TAG_CAMERA); - _mmcam_dbg_err("END!!!"); + MMCAM_LOG_ERROR("END!!!"); return error; } @@ -84,7 +84,7 @@ int mm_camcorder_realize(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -96,7 +96,7 @@ int mm_camcorder_realize(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -108,7 +108,7 @@ int mm_camcorder_unrealize(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -120,7 +120,7 @@ int mm_camcorder_unrealize(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -132,7 +132,7 @@ int mm_camcorder_start(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -144,7 +144,7 @@ int mm_camcorder_start(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -156,7 +156,7 @@ int mm_camcorder_stop(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -168,7 +168,7 @@ int mm_camcorder_stop(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -180,7 +180,7 @@ int mm_camcorder_capture_start(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -188,7 +188,7 @@ int mm_camcorder_capture_start(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -200,7 +200,7 @@ int mm_camcorder_capture_stop(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -208,7 +208,7 @@ int mm_camcorder_capture_stop(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -220,7 +220,7 @@ int mm_camcorder_record(MMHandleType camcorder) mmf_return_val_if_fail((void*)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -228,7 +228,7 @@ int mm_camcorder_record(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -240,7 +240,7 @@ int mm_camcorder_pause(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -248,7 +248,7 @@ int mm_camcorder_pause(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -260,7 +260,7 @@ int mm_camcorder_commit(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -268,7 +268,7 @@ int mm_camcorder_commit(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -280,7 +280,7 @@ int mm_camcorder_cancel(MMHandleType camcorder) mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); _MMCAMCORDER_LOCK_INTERRUPT(camcorder); @@ -288,7 +288,7 @@ int mm_camcorder_cancel(MMHandleType camcorder) _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return error; } @@ -347,7 +347,7 @@ int mm_camcorder_get_state(MMHandleType camcorder, MMCamcorderStateType *state) int ret = MM_ERROR_NONE; if (!camcorder) { - _mmcam_dbg_warn("Empty handle."); + MMCAM_LOG_WARNING("Empty handle."); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -360,7 +360,7 @@ int mm_camcorder_get_state(MMHandleType camcorder, MMCamcorderStateType *state) int mm_camcorder_get_state2(MMHandleType camcorder, MMCamcorderStateType *state, MMCamcorderStateType *old_state) { if (!camcorder) { - _mmcam_dbg_warn("Empty handle."); + MMCAM_LOG_WARNING("Empty handle."); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } diff --git a/src/mm_camcorder_attribute.c b/src/mm_camcorder_attribute.c index e4fdbd9..c466d2b 100644 --- a/src/mm_camcorder_attribute.c +++ b/src/mm_camcorder_attribute.c @@ -63,7 +63,8 @@ static int readonly_attributes[] = { MM_CAM_SUPPORT_ZSL_CAPTURE, MM_CAM_SUPPORT_ZERO_COPY_FORMAT, MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, - MM_CAM_PLATFORM_PRIVILEGE_CAMERA + MM_CAM_PLATFORM_PRIVILEGE_CAMERA, + MM_CAM_LOG_LEVEL }; /*----------------------------------------------------------------------- @@ -84,7 +85,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_ MMHandleType _mmcamcorder_alloc_attribute(MMHandleType handle) { - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); MMHandleType attrs = NULL; @@ -109,25 +110,25 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) }; if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return 0; } /* Create attribute constructor */ - _mmcam_dbg_log("start"); + MMCAM_LOG_INFO("start"); /* alloc 'MMAttrsConstructInfo' */ attr_count = MM_CAM_ATTRIBUTE_NUM; attrs_const_info = malloc(attr_count * sizeof(MMAttrsConstructInfo)); if (!attrs_const_info) { - _mmcam_dbg_err("Fail to alloc constructor."); + MMCAM_LOG_ERROR("Fail to alloc constructor."); return 0; } /* alloc default attribute info */ hcamcorder->cam_attrs_const_info = (mm_cam_attr_construct_info *)malloc(sizeof(mm_cam_attr_construct_info) * attr_count); if (hcamcorder->cam_attrs_const_info == NULL) { - _mmcam_dbg_err("failed to alloc default attribute info"); + MMCAM_LOG_ERROR("failed to alloc default attribute info"); free(attrs_const_info); attrs_const_info = NULL; return 0; @@ -1643,6 +1644,17 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) {0}, {0}, NULL, + }, + { + MM_CAM_LOG_LEVEL, + "log-level", + MM_ATTRS_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)MM_CAMCORDER_LOG_LEVEL_INFO}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = MM_CAMCORDER_LOG_LEVEL_CRITICAL}, + {.int_max = MM_CAMCORDER_LOG_LEVEL_VERBOSE}, + NULL, } }; @@ -1651,7 +1663,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) for (idx = 0 ; idx < attr_count ; idx++) { /* attribute order check. This should be same. */ if (idx != hcamcorder->cam_attrs_const_info[idx].attrid) { - _mmcam_dbg_err("Please check attributes order. Is the idx same with enum val?"); + MMCAM_LOG_ERROR("Please check attributes order. Is the idx same with enum val?"); free(attrs_const_info); attrs_const_info = NULL; free(hcamcorder->cam_attrs_const_info); @@ -1666,7 +1678,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) } /* Camcorder Attributes */ - _mmcam_dbg_log("Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count); + MMCAM_LOG_INFO("Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count); ret = mm_attrs_new(attrs_const_info, attr_count, @@ -1679,7 +1691,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) attrs_const_info = NULL; if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Fail to alloc attribute handle"); + MMCAM_LOG_ERROR("Fail to alloc attribute handle"); free(hcamcorder->cam_attrs_const_info); hcamcorder->cam_attrs_const_info = NULL; return 0; @@ -1690,11 +1702,6 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) for (idx = 0; idx < attr_count; idx++) { mm_cam_attr_construct_info *attr_info = &hcamcorder->cam_attrs_const_info[idx]; -/* - _mmcam_dbg_log("Valid type [%s:%d, %d, %d]", - attr_info->name, attr_info->validity_type, - attr_info->validity_value1, attr_info->validity_value2); -*/ mm_attrs_set_valid_type(attrs, idx, attr_info->validity_type); switch (attr_info->validity_type) { @@ -1732,7 +1739,7 @@ _mmcamcorder_alloc_attribute(MMHandleType handle) break; case MM_ATTRS_VALID_TYPE_INVALID: default: - _mmcam_dbg_err("Valid type error."); + MMCAM_LOG_ERROR("Valid type error."); break; } } @@ -1749,21 +1756,21 @@ _mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return; } - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (attrs) { mm_attrs_free(attrs); - _mmcam_dbg_log("released attribute"); + MMCAM_LOG_INFO("released attribute"); } if (hcamcorder->cam_attrs_const_info) { free(hcamcorder->cam_attrs_const_info); hcamcorder->cam_attrs_const_info = NULL; - _mmcam_dbg_log("released attribute info"); + MMCAM_LOG_INFO("released attribute info"); } return; @@ -1801,7 +1808,7 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -1812,7 +1819,7 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha if (attrs) { ret = __mmcamcorder_check_valid_pair(handle, &tmp_err_attr_name, attribute_name, var_args); } else { - _mmcam_dbg_err("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name); + MMCAM_LOG_ERROR("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; } @@ -1830,24 +1837,24 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha if (ret == MM_ERROR_COMMON_OUT_OF_RANGE) { if (mm_attrs_get_index(attrs, tmp_err_attr_name, &err_index) == MM_ERROR_NONE && _mmcamcorder_check_supported_attribute(handle, err_index)) { - _mmcam_dbg_err("[%s] is supported, but value is invalid", + MMCAM_LOG_ERROR("[%s] is supported, but value is invalid", tmp_err_attr_name ? tmp_err_attr_name : "NULL"); ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } } if (hcamcorder->error_code != MM_ERROR_NONE) { - _mmcam_dbg_err("error_code is set. ret 0x%x -> modified 0x%x", ret, hcamcorder->error_code); + MMCAM_LOG_ERROR("error_code is set. ret 0x%x -> modified 0x%x", ret, hcamcorder->error_code); ret = hcamcorder->error_code; hcamcorder->error_code = MM_ERROR_NONE; } - _mmcam_dbg_err("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle); + MMCAM_LOG_ERROR("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle); } if (tmp_err_attr_name) { if (!err_attr_name) { - _mmcam_dbg_err("set attribute[%s] error, but err name is NULL", tmp_err_attr_name); + MMCAM_LOG_ERROR("set attribute[%s] error, but err name is NULL", tmp_err_attr_name); free(tmp_err_attr_name); tmp_err_attr_name = NULL; } else { @@ -1944,7 +1951,7 @@ int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -1979,11 +1986,11 @@ int __mmcamcorder_release_conf_valid_info(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } - _mmcam_dbg_log("START"); + MMCAM_LOG_INFO("START"); /* Audio encoder info */ allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array); @@ -2017,7 +2024,7 @@ int __mmcamcorder_release_conf_valid_info(MMHandleType handle) hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = 0; } - _mmcam_dbg_log("DONE"); + MMCAM_LOG_INFO("DONE"); return MM_ERROR_NONE; } @@ -2033,7 +2040,7 @@ bool _mmcamcorder_commit_capture_width(MMHandleType handle, int attr_idx, const attr = MMF_CAMCORDER_ATTRS(handle); mmf_return_val_if_fail(attr, FALSE); - /*_mmcam_dbg_log("(%d)", attr_idx);*/ + /*MMCAM_LOG_INFO("(%d)", attr_idx);*/ current_state = _mmcamcorder_get_state(handle); if (current_state <= MM_CAMCORDER_STATE_PREPARE) { @@ -2054,7 +2061,7 @@ bool _mmcamcorder_commit_capture_width(MMHandleType handle, int attr_idx, const return TRUE; } else { - _mmcam_dbg_log("Capture resolution can't be set.(state=%d)", current_state); + MMCAM_LOG_INFO("Capture resolution can't be set.(state=%d)", current_state); return FALSE; } } @@ -2074,7 +2081,7 @@ bool _mmcamcorder_commit_capture_height(MMHandleType handle, int attr_idx, const return __mmcamcorder_set_capture_resolution(handle, capture_width, capture_height); } else { - _mmcam_dbg_log("Capture resolution can't be set.(state=%d)", current_state); + MMCAM_LOG_INFO("Capture resolution can't be set.(state=%d)", current_state); return FALSE; } @@ -2109,30 +2116,30 @@ bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_i info = sc->info_image; if (!info) { - _mmcam_dbg_err("info image is NULL"); + MMCAM_LOG_ERROR("info image is NULL"); return FALSE; } if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) { if (info->capture_send_count > 0) { info->capturing = FALSE; - _mmcam_dbg_warn("capturing -> FALSE and skip capture callback since now"); + MMCAM_LOG_WARNING("capturing -> FALSE and skip capture callback since now"); } if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_warn("Can't cast Video source into camera control."); + MMCAM_LOG_WARNING("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control) { gst_camera_control_set_capture_command(control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT); - _mmcam_dbg_warn("Commit Break continuous shot : Set command OK. current state[%d]", current_state); + MMCAM_LOG_WARNING("Commit Break continuous shot : Set command OK. current state[%d]", current_state); } else { - _mmcam_dbg_warn("cast CAMERA_CONTROL failed"); + MMCAM_LOG_WARNING("cast CAMERA_CONTROL failed"); } } else { - _mmcam_dbg_warn("Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state); + MMCAM_LOG_WARNING("Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state); } return TRUE; @@ -2150,14 +2157,14 @@ bool _mmcamcorder_commit_capture_count(MMHandleType handle, int attr_idx, const current_state = _mmcamcorder_get_state(handle); mm_camcorder_get_attributes(handle, NULL, MMCAM_MODE, &mode, NULL); - _mmcam_dbg_log("current state %d, mode %d, set count %d", + MMCAM_LOG_INFO("current state %d, mode %d, set count %d", current_state, mode, value->value.i_val); if (mode != MM_CAMCORDER_MODE_AUDIO && current_state != MM_CAMCORDER_STATE_CAPTURING) { return TRUE; } else { - _mmcam_dbg_err("Invalid mode[%d] or state[%d]", mode, current_state); + MMCAM_LOG_ERROR("Invalid mode[%d] or state[%d]", mode, current_state); return FALSE; } } @@ -2169,15 +2176,15 @@ bool _mmcamcorder_commit_capture_sound_enable(MMHandleType handle, int attr_idx, mmf_return_val_if_fail(hcamcorder && value, FALSE); - _mmcam_dbg_log("shutter sound policy: %d", hcamcorder->shutter_sound_policy); + MMCAM_LOG_INFO("shutter sound policy: %d", hcamcorder->shutter_sound_policy); /* return error when disable shutter sound if policy is TRUE */ if (!value->value.i_val && hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) { - _mmcam_dbg_err("not permitted DISABLE SHUTTER SOUND"); + MMCAM_LOG_ERROR("not permitted DISABLE SHUTTER SOUND"); return FALSE; } else { - _mmcam_dbg_log("set value [%d] success", value->value.i_val); + MMCAM_LOG_INFO("set value [%d] success", value->value.i_val); return TRUE; } } @@ -2211,10 +2218,10 @@ bool _mmcamcorder_commit_audio_volume(MMHandleType handle, int attr_idx, const M } } - _mmcam_dbg_log("Commit : volume(%f)", mslNewVal); + MMCAM_LOG_INFO("Commit : volume(%f)", mslNewVal); bret = TRUE; } else { - _mmcam_dbg_log("Commit : nothing to commit. status(%d)", current_state); + MMCAM_LOG_INFO("Commit : nothing to commit. status(%d)", current_state); bret = TRUE; } @@ -2231,7 +2238,7 @@ bool _mmcamcorder_commit_camera_format(MMHandleType handle, int attr_idx, const current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_err("invalid state %d", current_state); + MMCAM_LOG_ERROR("invalid state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -2254,7 +2261,7 @@ bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const MMA current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("invalid state %d", current_state); + MMCAM_LOG_ERROR("invalid state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -2262,7 +2269,7 @@ bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const MMA if (attr_idx == MM_CAM_CAMERA_FPS_AUTO) return TRUE; - _mmcam_dbg_log("FPS(%d)", value->value.i_val); + MMCAM_LOG_INFO("FPS(%d)", value->value.i_val); ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_WIDTH, &resolution_width, @@ -2270,13 +2277,13 @@ bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const MMA NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("FAILED : coult not get resolution values."); + MMCAM_LOG_ERROR("FAILED : coult not get resolution values."); return FALSE; } ret = mm_camcorder_get_fps_list_by_resolution(handle, resolution_width, resolution_height, &fps_info); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("FAILED : coult not get FPS values by resolution."); + MMCAM_LOG_ERROR("FAILED : coult not get FPS values by resolution."); return FALSE; } @@ -2285,7 +2292,7 @@ bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const MMA return TRUE; } - _mmcam_dbg_err("FAILED : %d is not supported FPS", value->value.i_val); + MMCAM_LOG_ERROR("FAILED : %d is not supported FPS", value->value.i_val); return FALSE; } @@ -2301,7 +2308,7 @@ bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int a current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_warn("invalid state %d", current_state); + MMCAM_LOG_WARNING("invalid state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -2318,10 +2325,10 @@ bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int a else sc->is_modified_rate = FALSE; - _mmcam_dbg_log("Set slow motion rate %lf", value->value.d_val); + MMCAM_LOG_INFO("Set slow motion rate %lf", value->value.d_val); return TRUE; } else { - _mmcam_dbg_warn("Failed to set recording motion rate %lf", value->value.d_val); + MMCAM_LOG_WARNING("Failed to set recording motion rate %lf", value->value.d_val); return FALSE; } } @@ -2344,12 +2351,12 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const M attr = MMF_CAMCORDER_ATTRS(handle); mmf_return_val_if_fail(attr, FALSE); - _mmcam_dbg_log("Width(%d)", value->value.i_val); + MMCAM_LOG_INFO("Width(%d)", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state); + MMCAM_LOG_INFO("Resolution can't be changed.(state=%d)", current_state); return FALSE; } else { int flags = MM_ATTRS_FLAG_NONE; @@ -2371,14 +2378,14 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const M if (current_state == MM_CAMCORDER_STATE_PREPARE) { if (hcamcorder->resolution_changed == FALSE) { - _mmcam_dbg_log("no need to restart preview"); + MMCAM_LOG_INFO("no need to restart preview"); return TRUE; } hcamcorder->resolution_changed = FALSE; if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) { - _mmcam_dbg_log("restart preview"); + MMCAM_LOG_INFO("restart preview"); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); @@ -2388,7 +2395,7 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const M /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); g_mutex_unlock(&hcamcorder->restart_preview_lock); return FALSE; } @@ -2407,7 +2414,7 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const M /* unlock */ g_mutex_unlock(&hcamcorder->restart_preview_lock); } else { - _mmcam_dbg_err("currently locked for preview restart"); + MMCAM_LOG_ERROR("currently locked for preview restart"); return FALSE; } } else { @@ -2442,11 +2449,11 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const attr = MMF_CAMCORDER_ATTRS(hcamcorder); mmf_return_val_if_fail(attr, FALSE); - _mmcam_dbg_log("Height(%d)", value->value.i_val); + MMCAM_LOG_INFO("Height(%d)", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state); + MMCAM_LOG_INFO("Resolution can't be changed.(state=%d)", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } else { @@ -2468,16 +2475,16 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const if (current_state == MM_CAMCORDER_STATE_PREPARE) { if (hcamcorder->resolution_changed == FALSE) { - _mmcam_dbg_log("no need to restart preview"); + MMCAM_LOG_INFO("no need to restart preview"); return TRUE; } hcamcorder->resolution_changed = FALSE; if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) { - _mmcam_dbg_log("restart preview"); + MMCAM_LOG_INFO("restart preview"); - _mmcam_dbg_log("set empty buffers"); + MMCAM_LOG_INFO("set empty buffers"); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); @@ -2487,7 +2494,7 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); g_mutex_unlock(&hcamcorder->restart_preview_lock); return FALSE; } @@ -2507,7 +2514,7 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const /* unlock */ g_mutex_unlock(&hcamcorder->restart_preview_lock); } else { - _mmcam_dbg_err("currently locked for preview restart"); + MMCAM_LOG_ERROR("currently locked for preview restart"); return FALSE; } } else { @@ -2531,11 +2538,11 @@ bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const MMA current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Video Resolution can't be changed.(state=%d)", current_state); + MMCAM_LOG_ERROR("Video Resolution can't be changed.(state=%d)", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } else { - _mmcam_dbg_warn("Video Resolution %d [attr_idx %d] ", + MMCAM_LOG_WARNING("Video Resolution %d [attr_idx %d] ", value->value.i_val, attr_idx); return TRUE; } @@ -2559,14 +2566,14 @@ bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const MM zoom_level = value->value.i_val; - _mmcam_dbg_log("(%d)", attr_idx); + MMCAM_LOG_INFO("(%d)", attr_idx); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -2580,25 +2587,25 @@ bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const MM int ret = FALSE; if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } ret = gst_camera_control_set_zoom(control, zoom_type, zoom_level); if (ret) { - _mmcam_dbg_log("Succeed in operating Zoom[%d].", zoom_level); + MMCAM_LOG_INFO("Succeed in operating Zoom[%d].", zoom_level); return TRUE; } else { - _mmcam_dbg_warn("Failed to operate Zoom. Type[%d],Level[%d]", zoom_type, zoom_level); + MMCAM_LOG_WARNING("Failed to operate Zoom. Type[%d],Level[%d]", zoom_type, zoom_level); } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return FALSE; @@ -2621,49 +2628,49 @@ bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, cons sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, TRUE); - _mmcam_dbg_log("ptz type : %d", value->value.i_val); + MMCAM_LOG_INFO("ptz type : %d", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE || current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("invalid state[%d]", current_state); + MMCAM_LOG_ERROR("invalid state[%d]", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return FALSE; } CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (CameraControl == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } controls = gst_camera_control_list_channels(CameraControl); if (controls == NULL) { - _mmcam_dbg_err("gst_camera_control_list_channels failed"); + MMCAM_LOG_ERROR("gst_camera_control_list_channels failed"); return FALSE; } for (item = controls ; item && item->data ; item = item->next) { CameraControlChannel = item->data; - _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label); if (!strcmp(CameraControlChannel->label, "ptz_type")) { if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { - _mmcam_dbg_warn("set ptz type %d done", value->value.i_val); + MMCAM_LOG_WARNING("set ptz type %d done", value->value.i_val); return TRUE; } else { - _mmcam_dbg_err("failed to set ptz type %d", value->value.i_val); + MMCAM_LOG_ERROR("failed to set ptz type %d", value->value.i_val); return FALSE; } } } - _mmcam_dbg_warn("failed to find ptz type control channel"); + MMCAM_LOG_WARNING("failed to find ptz type control channel"); } return FALSE; @@ -2686,49 +2693,49 @@ bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const MMA sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, TRUE); - _mmcam_dbg_log("pan : %d", value->value.i_val); + MMCAM_LOG_INFO("pan : %d", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE || current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("invalid state[%d]", current_state); + MMCAM_LOG_ERROR("invalid state[%d]", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return FALSE; } CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (CameraControl == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } controls = gst_camera_control_list_channels(CameraControl); if (controls == NULL) { - _mmcam_dbg_err("gst_camera_control_list_channels failed"); + MMCAM_LOG_ERROR("gst_camera_control_list_channels failed"); return FALSE; } for (item = controls ; item && item->data ; item = item->next) { CameraControlChannel = item->data; - _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label); if (!strcmp(CameraControlChannel->label, "pan")) { if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { - _mmcam_dbg_warn("set pan %d done", value->value.i_val); + MMCAM_LOG_WARNING("set pan %d done", value->value.i_val); return TRUE; } else { - _mmcam_dbg_err("failed to set pan %d", value->value.i_val); + MMCAM_LOG_ERROR("failed to set pan %d", value->value.i_val); return FALSE; } } } - _mmcam_dbg_warn("failed to find pan control channel"); + MMCAM_LOG_WARNING("failed to find pan control channel"); } return FALSE; @@ -2751,49 +2758,49 @@ bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const MM sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, TRUE); - _mmcam_dbg_log("tilt : %d", value->value.i_val); + MMCAM_LOG_INFO("tilt : %d", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE || current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("invalid state[%d]", current_state); + MMCAM_LOG_ERROR("invalid state[%d]", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return FALSE; } CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (CameraControl == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } controls = gst_camera_control_list_channels(CameraControl); if (controls == NULL) { - _mmcam_dbg_err("gst_camera_control_list_channels failed"); + MMCAM_LOG_ERROR("gst_camera_control_list_channels failed"); return FALSE; } for (item = controls ; item && item->data ; item = item->next) { CameraControlChannel = item->data; - _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + MMCAM_LOG_INFO("CameraControlChannel->label %s", CameraControlChannel->label); if (!strcmp(CameraControlChannel->label, "tilt")) { if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { - _mmcam_dbg_warn("set tilt %d done", value->value.i_val); + MMCAM_LOG_WARNING("set tilt %d done", value->value.i_val); return TRUE; } else { - _mmcam_dbg_err("failed to set tilt %d", value->value.i_val); + MMCAM_LOG_ERROR("failed to set tilt %d", value->value.i_val); return FALSE; } } } - _mmcam_dbg_warn("failed to find tilt control channel"); + MMCAM_LOG_WARNING("failed to find tilt control channel"); } return FALSE; @@ -2821,20 +2828,20 @@ bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, co if (!sc) return TRUE; - _mmcam_dbg_log("Focus mode(%d)", value->value.i_val); + MMCAM_LOG_INFO("Focus mode(%d)", value->value.i_val); /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_NULL) { - _mmcam_dbg_log("Focus mode will be changed later.(state=%d)", current_state); + MMCAM_LOG_INFO("Focus mode will be changed later.(state=%d)", current_state); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -2844,13 +2851,13 @@ bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, co MMCamAttrsInfo info; if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } @@ -2864,21 +2871,21 @@ bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, co if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) { if (set_focus_mode != cur_focus_mode) { if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) { - _mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal); + MMCAM_LOG_INFO("Succeed in setting AF mode[%d]", mslVal); return TRUE; } else { - _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal); + MMCAM_LOG_WARNING("Failed to set AF mode[%d]", mslVal); } } else { - _mmcam_dbg_log("No need to set AF mode. Current[%d]", mslVal); + MMCAM_LOG_INFO("No need to set AF mode. Current[%d]", mslVal); return TRUE; } } else { - _mmcam_dbg_warn("Failed to get AF mode, so do not set new AF mode[%d]", mslVal); + MMCAM_LOG_WARNING("Failed to get AF mode, so do not set new AF mode[%d]", mslVal); } } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return TRUE; @@ -2904,11 +2911,11 @@ bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, if (!sc) return TRUE; - _mmcam_dbg_log("(%d)", attr_idx); + MMCAM_LOG_INFO("(%d)", attr_idx); /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } @@ -2917,23 +2924,23 @@ bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } @@ -2943,20 +2950,20 @@ bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) { if ((newVal != cur_focus_range) || (converted_mode != cur_focus_mode)) { if (gst_camera_control_set_focus(control, converted_mode, newVal)) { - /*_mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);*/ + /*MMCAM_LOG_INFO("Succeed in setting AF mode[%d]", mslVal);*/ return TRUE; } else { - _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal); + MMCAM_LOG_WARNING("Failed to set AF mode[%d]", mslVal); } } else { - /*_mmcam_dbg_log("No need to set AF mode. Current[%d]", mslVal);*/ + /*MMCAM_LOG_INFO("No need to set AF mode. Current[%d]", mslVal);*/ return TRUE; } } else { - _mmcam_dbg_warn("Failed to get AF mode, so do not set new AF mode[%d]", mslVal); + MMCAM_LOG_WARNING("Failed to get AF mode, so do not set new AF mode[%d]", mslVal); } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return FALSE; @@ -2987,14 +2994,14 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, if (!sc) return TRUE; - _mmcam_dbg_log("(%d)", attr_idx); + MMCAM_LOG_INFO("(%d)", attr_idx); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3003,18 +3010,18 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, MMCAM_CAMERA_FOCUS_MODE, &focus_mode, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Failed to get FOCUS MODE.[%x]", ret); + MMCAM_LOG_WARNING("Failed to get FOCUS MODE.[%x]", ret); return FALSE; } if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS)) { - _mmcam_dbg_warn("Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode); + MMCAM_LOG_WARNING("Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode); return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } @@ -3036,7 +3043,7 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, NULL); do_set = TRUE; } else { - _mmcam_dbg_log("Just store AF area[x:%d]", value->value.i_val); + MMCAM_LOG_INFO("Just store AF area[x:%d]", value->value.i_val); return TRUE; } break; @@ -3052,7 +3059,7 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, NULL); do_set = TRUE; } else { - _mmcam_dbg_log("Just store AF area[y:%d]", value->value.i_val); + MMCAM_LOG_INFO("Just store AF area[y:%d]", value->value.i_val); return TRUE; } break; @@ -3067,7 +3074,7 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, NULL); do_set = TRUE; } else { - _mmcam_dbg_log("Just store AF area[width:%d]", value->value.i_val); + MMCAM_LOG_INFO("Just store AF area[width:%d]", value->value.i_val); return TRUE; } break; @@ -3088,13 +3095,13 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, _MMCamcorderVideoInfo *info = sc->info_video; if (info == NULL) { - _mmcam_dbg_err("video info is NULL"); + MMCAM_LOG_ERROR("video info is NULL"); return FALSE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } @@ -3108,7 +3115,7 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, ratio_width = (float)info->video_width / (float)info->preview_width; ratio_height = (float)info->video_height / (float)info->preview_height; - _mmcam_dbg_log("original area %d,%d,%dx%d, resolution ratio : width %f, height %f", + MMCAM_LOG_INFO("original area %d,%d,%dx%d, resolution ratio : width %f, height %f", set_area.x, set_area.y, set_area.width, set_area.height, ratio_width, ratio_height); set_area.x = (int)((float)set_area.x * ratio_width); @@ -3122,39 +3129,39 @@ bool _mmcamcorder_commit_camera_af_touch_area(MMHandleType handle, int attr_idx, if (set_area.height <= 0) set_area.height = 1; - _mmcam_dbg_log("converted area %d,%d,%dx%d", + MMCAM_LOG_INFO("converted area %d,%d,%dx%d", set_area.x, set_area.y, set_area.width, set_area.height); } else { - _mmcam_dbg_warn("invalid preview size %dx%d, skip AF area converting", + MMCAM_LOG_WARNING("invalid preview size %dx%d, skip AF area converting", info->preview_width, info->preview_height); } } ret = gst_camera_control_get_auto_focus_area(control, &get_area); if (!ret) { - _mmcam_dbg_warn("Failed to get AF area"); + MMCAM_LOG_WARNING("Failed to get AF area"); return FALSE; } /* width and height are not supported now */ if (get_area.x == set_area.x && get_area.y == set_area.y) { - _mmcam_dbg_log("No need to set AF area[x,y:%d,%d]", + MMCAM_LOG_INFO("No need to set AF area[x,y:%d,%d]", get_area.x, get_area.y); return TRUE; } ret = gst_camera_control_set_auto_focus_area(control, set_area); if (ret) { - _mmcam_dbg_log("Succeed to set AF area[%d,%d,%dx%d]", + MMCAM_LOG_INFO("Succeed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height); return TRUE; } else { - _mmcam_dbg_warn("Failed to set AF area[%d,%d,%dx%d]", + MMCAM_LOG_WARNING("Failed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height); } } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return FALSE; @@ -3185,16 +3192,16 @@ bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3228,7 +3235,7 @@ bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, if (check_scene_mode) { mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &scene_mode, NULL); if (scene_mode != MM_CAMCORDER_SCENE_MODE_NORMAL) { - _mmcam_dbg_warn("can not set [%d] when scene mode is NOT normal.", attr_idx); + MMCAM_LOG_WARNING("can not set [%d] when scene mode is NOT normal.", attr_idx); return FALSE; } } @@ -3237,25 +3244,25 @@ bool _mmcamcorder_commit_camera_capture_mode(MMHandleType handle, int attr_idx, int ret = 0; if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } ret = gst_camera_control_set_exposure(control, exposure_type, newVal1, newVal2); if (ret) { - _mmcam_dbg_log("Succeed in setting exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2); + MMCAM_LOG_INFO("Succeed in setting exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2); return TRUE; } else { - _mmcam_dbg_warn("Failed to set exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2); + MMCAM_LOG_WARNING("Failed to set exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2); } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return FALSE; @@ -3276,7 +3283,7 @@ bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const MMA /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } @@ -3287,10 +3294,10 @@ bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const MMA /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3300,33 +3307,33 @@ bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const MMA if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } if (gst_camera_control_get_wdr(control, &cur_value)) { if (newVal != cur_value) { if (gst_camera_control_set_wdr(control, newVal)) { - _mmcam_dbg_log("Success - set wdr[%d]", mslVal); + MMCAM_LOG_INFO("Success - set wdr[%d]", mslVal); return TRUE; } else { - _mmcam_dbg_warn("Failed to set WDR. NewVal[%d],CurVal[%d]", newVal, cur_value); + MMCAM_LOG_WARNING("Failed to set WDR. NewVal[%d],CurVal[%d]", newVal, cur_value); } } else { - _mmcam_dbg_log("No need to set new WDR. Current[%d]", mslVal); + MMCAM_LOG_INFO("No need to set new WDR. Current[%d]", mslVal); return TRUE; } } else { - _mmcam_dbg_warn("Failed to get WDR."); + MMCAM_LOG_WARNING("Failed to get WDR."); } } else { - _mmcam_dbg_log("pointer of video src is null"); + MMCAM_LOG_INFO("pointer of video src is null"); } return FALSE; @@ -3342,16 +3349,16 @@ bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Invaild state (state %d)", current_state); + MMCAM_LOG_ERROR("Invalid state (state %d)", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3374,13 +3381,13 @@ bool _mmcamcorder_commit_encoder_bitrate(MMHandleType handle, int attr_idx, cons sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc || !sc->encode_element) { - _mmcam_dbg_log("will be applied later - idx %d, bitrate %d", attr_idx, bitrate); + MMCAM_LOG_INFO("will be applied later - idx %d, bitrate %d", attr_idx, bitrate); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state >= MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_err("Can not set while RECORDING - attr idx %d", attr_idx); + MMCAM_LOG_ERROR("Can not set while RECORDING - attr idx %d", attr_idx); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3408,10 +3415,10 @@ bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int att current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Invaild state (state %d)", current_state); + MMCAM_LOG_ERROR("Invalid state (state %d)", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3427,12 +3434,12 @@ bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_return_val_if_fail(hcamcorder && value, FALSE); - _mmcam_dbg_log("rotate(%d)", value->value.i_val); + MMCAM_LOG_INFO("rotate(%d)", value->value.i_val); current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_err("camera rotation setting failed.(state=%d)", current_state); + MMCAM_LOG_ERROR("camera rotation setting failed.(state=%d)", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } else { @@ -3452,30 +3459,30 @@ bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } sc = MMF_CAMCORDER_SUBCONTEXT(handle); - _mmcam_dbg_log("Image encoder quality(%d)", value->value.i_val); + MMCAM_LOG_INFO("Image encoder quality(%d)", value->value.i_val); if (current_state == MM_CAMCORDER_STATE_PREPARE) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", value->value.i_val); return TRUE; } else { - _mmcam_dbg_err("invalid state %d", current_state); + MMCAM_LOG_ERROR("invalid state %d", current_state); return FALSE; } } @@ -3487,11 +3494,11 @@ bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, cons /* get string */ if (!value->value.s_val) { - _mmcam_dbg_err("NULL filename"); + MMCAM_LOG_ERROR("NULL filename"); return FALSE; } - _mmcam_dbg_log("set filename [%s]", value->value.s_val); + MMCAM_LOG_INFO("set filename [%s]", value->value.s_val); return TRUE; } @@ -3506,7 +3513,7 @@ bool _mmcamcorder_commit_recording_max_limit(MMHandleType handle, int attr_idx, current_state = _mmcamcorder_get_state(handle); if (current_state >= MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_err("Can not set while RECORDING"); + MMCAM_LOG_ERROR("Can not set while RECORDING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3539,22 +3546,22 @@ bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const MMAttrs /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } if (value->type != MM_ATTRS_TYPE_INT) { - _mmcam_dbg_warn("Mismatched value type (%d)", value->type); + MMCAM_LOG_WARNING("Mismatched value type (%d)", value->type); return FALSE; } else { mslNewVal = value->value.i_val; @@ -3593,14 +3600,14 @@ bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const MMAttrs check_scene_mode = TRUE; break; default: - _mmcam_dbg_err("unknown attribute index %d", attr_idx); + MMCAM_LOG_ERROR("unknown attribute index %d", attr_idx); return FALSE; } if (check_scene_mode) { mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &scene_mode, NULL); if (scene_mode != MM_CAMCORDER_SCENE_MODE_NORMAL) { - _mmcam_dbg_warn("can not set %s when scene mode is NOT normal.", control_label); + MMCAM_LOG_WARNING("can not set %s when scene mode is NOT normal.", control_label); return FALSE; } } @@ -3609,38 +3616,38 @@ bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const MMAttrs if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE) return FALSE; - /*_mmcam_dbg_log("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);*/ + /*MMCAM_LOG_INFO("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);*/ if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into color balance."); + MMCAM_LOG_INFO("Can't cast Video source into color balance."); return TRUE; } balance = GST_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (balance == NULL) { - _mmcam_dbg_err("cast COLOR_BALANCE failed"); + MMCAM_LOG_ERROR("cast COLOR_BALANCE failed"); return FALSE; } controls = gst_color_balance_list_channels(balance); if (controls == NULL) { - _mmcam_dbg_log("There is no list of colorbalance controls"); + MMCAM_LOG_INFO("There is no list of colorbalance controls"); return FALSE; } for (item = controls ; item && item->data ; item = item->next) { Colorchannel = item->data; - /*_mmcam_dbg_log("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);*/ + /*MMCAM_LOG_INFO("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);*/ if (!strcmp(Colorchannel->label, control_label)) { gst_color_balance_set_value(balance, Colorchannel, newVal); - _mmcam_dbg_log("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal); + MMCAM_LOG_INFO("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal); break; } } if (item == NULL) { - _mmcam_dbg_err("failed to find color channel item"); + MMCAM_LOG_ERROR("failed to find color channel item"); return FALSE; } @@ -3668,16 +3675,16 @@ bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, co /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -3686,19 +3693,19 @@ bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, co int ret = 0; if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return TRUE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } ret = gst_camera_control_set_exposure(control, GST_CAMERA_CONTROL_PROGRAM_MODE, newVal, 0); if (ret) { - _mmcam_dbg_log("Succeed in setting program mode[%d].", mslVal); + MMCAM_LOG_INFO("Succeed in setting program mode[%d].", mslVal); if (mslVal == MM_CAMCORDER_SCENE_MODE_NORMAL) { unsigned int i = 0; @@ -3721,10 +3728,10 @@ bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, co return TRUE; } else { - _mmcam_dbg_log("Failed to set program mode[%d].", mslVal); + MMCAM_LOG_INFO("Failed to set program mode[%d].", mslVal); } } else { - _mmcam_dbg_warn("pointer of video src is null"); + MMCAM_LOG_WARNING("pointer of video src is null"); } return FALSE; @@ -3735,7 +3742,7 @@ bool _mmcamcorder_commit_filter_flip(MMHandleType handle, int attr_idx, const MM { mmf_return_val_if_fail(handle && value, FALSE); - _mmcam_dbg_warn("Filter Flip(%d)", value->value.i_val); + MMCAM_LOG_WARNING("Filter Flip(%d)", value->value.i_val); return TRUE; } @@ -3745,7 +3752,7 @@ bool _mmcamcorder_commit_audio_input_route(MMHandleType handle, int attr_idx, co { mmf_return_val_if_fail(handle && value, FALSE); - _mmcam_dbg_log("Commit : Do nothing. this attr will be removed soon."); + MMCAM_LOG_INFO("Commit : Do nothing. this attr will be removed soon."); return TRUE; } @@ -3760,11 +3767,11 @@ bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_warn("Can NOT Disable AUDIO. invalid state %d", current_state); + MMCAM_LOG_WARNING("Can NOT Disable AUDIO. invalid state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } else { - _mmcam_dbg_log("Disable AUDIO when Recording"); + MMCAM_LOG_INFO("Disable AUDIO when Recording"); return TRUE; } } @@ -3784,20 +3791,20 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } dp_handle = value->value.p_val; if (!dp_handle) { - _mmcam_dbg_warn("Display handle is NULL"); + MMCAM_LOG_WARNING("Display handle is NULL"); return FALSE; } @@ -3806,25 +3813,25 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const /* get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (!videosink_name) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } - _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name); + MMCAM_LOG_INFO("Commit : videosinkname[%s]", videosink_name); if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) { - _mmcam_dbg_log("Commit : Set XID[%x]", *(int *)(dp_handle)); + MMCAM_LOG_INFO("Commit : Set XID[%x]", *(int *)(dp_handle)); gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int *)(dp_handle)); } else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) { - _mmcam_dbg_log("Commit : Set evas object [%p]", dp_handle); + MMCAM_LOG_INFO("Commit : Set evas object [%p]", dp_handle); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", dp_handle); } else if (!strcmp(videosink_name, "tizenwlsink")) { window_info = (MMCamWindowInfo *)dp_handle; - _mmcam_dbg_log("wayland global surface id : %d", window_info->surface_id); + MMCAM_LOG_INFO("wayland global surface id : %d", window_info->surface_id); gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)window_info->surface_id); } else if (!strcmp(videosink_name, "directvideosink")) { window_info = (MMCamWindowInfo *)dp_handle; - _mmcam_dbg_log("wayland global surface id : %d, x,y,w,h (%d,%d,%d,%d)", + MMCAM_LOG_INFO("wayland global surface id : %d, x,y,w,h (%d,%d,%d,%d)", window_info->surface_id, window_info->rect.x, window_info->rect.y, @@ -3837,7 +3844,7 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const window_info->rect.width, window_info->rect.height); } else { - _mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name); + MMCAM_LOG_WARNING("Commit : Nothing to commit with this element[%s]", videosink_name); return FALSE; } @@ -3857,14 +3864,14 @@ bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const M /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -3872,17 +3879,17 @@ bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const M _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } - _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name); + MMCAM_LOG_INFO("Commit : videosinkname[%s]", videosink_name); if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) { - _mmcam_dbg_log("Commit : display mode [%d]", value->value.i_val); + MMCAM_LOG_INFO("Commit : display mode [%d]", value->value.i_val); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val); } else { - _mmcam_dbg_warn("[%s] does not support display mode, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support display mode, but no error", videosink_name); } return TRUE; @@ -3899,14 +3906,14 @@ bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, con /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later [rotate:%d]", value->value.i_val); + MMCAM_LOG_INFO("NOT initialized. this will be applied later [rotate:%d]", value->value.i_val); return TRUE; } @@ -3924,14 +3931,14 @@ bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const M /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later [flip:%d]", value->value.i_val); + MMCAM_LOG_INFO("NOT initialized. this will be applied later [flip:%d]", value->value.i_val); return TRUE; } @@ -3951,14 +3958,14 @@ bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, cons /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -3967,7 +3974,7 @@ bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, cons /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -3975,9 +3982,9 @@ bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, cons !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "directvideosink")) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "visible", value->value.i_val); - _mmcam_dbg_log("Set visible [%d] done.", value->value.i_val); + MMCAM_LOG_INFO("Set visible [%d] done.", value->value.i_val); } else { - _mmcam_dbg_warn("[%s] does not support VISIBLE, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support VISIBLE, but no error", videosink_name); } return TRUE; @@ -3997,14 +4004,14 @@ bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_i /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -4013,7 +4020,7 @@ bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_i /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -4023,7 +4030,7 @@ bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_i method = value->value.i_val; MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method); } else { - _mmcam_dbg_warn("[%s] does not support geometry method, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support geometry method, but no error", videosink_name); } return TRUE; @@ -4043,14 +4050,14 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const M /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -4059,7 +4066,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const M /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -4110,18 +4117,18 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const M rect_height = value->value.i_val; break; default: - _mmcam_dbg_err("Wrong attr_idx!"); + MMCAM_LOG_ERROR("Wrong attr_idx!"); return FALSE; } if (!(flags & MM_ATTRS_FLAG_MODIFIED)) { - _mmcam_dbg_log("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height); + MMCAM_LOG_INFO("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height); if (!strcmp(videosink_name, "tizenwlsink")) { ret = gst_video_overlay_set_display_roi_area(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), rect_x, rect_y, rect_width, rect_height); if (!ret) { - _mmcam_dbg_err("FAILED : could not set display roi area."); + MMCAM_LOG_ERROR("FAILED : could not set display roi area."); return FALSE; } } else { @@ -4134,7 +4141,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const M } } } else { - _mmcam_dbg_warn("[%s] does not support display rect, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support display rect, but no error", videosink_name); } return TRUE; @@ -4155,14 +4162,14 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -4171,7 +4178,7 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -4180,11 +4187,11 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst; MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1)); - _mmcam_dbg_log("Set display zoom to %d", zoom + 1); + MMCAM_LOG_INFO("Set display zoom to %d", zoom + 1); return TRUE; } else { - _mmcam_dbg_warn("videosink[%s] does not support scale", videosink_name); + MMCAM_LOG_WARNING("videosink[%s] does not support scale", videosink_name); return FALSE; } } @@ -4203,14 +4210,14 @@ bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_i /* check type */ if (hcamcorder->type == MM_CAMCORDER_MODE_AUDIO) { - _mmcam_dbg_err("invalid mode %d", hcamcorder->type); + MMCAM_LOG_ERROR("invalid mode %d", hcamcorder->type); return FALSE; } /* check current state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("NOT initialized. this will be applied later"); + MMCAM_LOG_INFO("NOT initialized. this will be applied later"); return TRUE; } @@ -4221,16 +4228,16 @@ bool _mmcamcorder_commit_display_evas_do_scaling(MMHandleType handle, int attr_i /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } if (!strcmp(videosink_name, "evaspixmapsink")) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "origin-size", !do_scaling); - _mmcam_dbg_log("Set origin-size to %d", !(value->value.i_val)); + MMCAM_LOG_INFO("Set origin-size to %d", !(value->value.i_val)); return TRUE; } else { - _mmcam_dbg_warn("videosink[%s] does not support scale", videosink_name); + MMCAM_LOG_WARNING("videosink[%s] does not support scale", videosink_name); return FALSE; } } @@ -4250,7 +4257,7 @@ bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrs if (!sc) return TRUE; - /*_mmcam_dbg_log( "Commit : strobe attribute(%d)", attr_idx );*/ + /*MMCAM_LOG_INFO( "Commit : strobe attribute(%d)", attr_idx );*/ mslVal = value->value.i_val; @@ -4260,31 +4267,31 @@ bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrs /* get current flash brightness */ if (_mmcamcorder_get_device_flash_brightness(hcamcorder->gdbus_conn, &flash_brightness) != MM_ERROR_NONE) { - _mmcam_dbg_err("_mmcamcorder_get_device_flash_brightness failed"); + MMCAM_LOG_ERROR("_mmcamcorder_get_device_flash_brightness failed"); hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION; return FALSE; } - _mmcam_dbg_log("flash brightness %d", flash_brightness); + MMCAM_LOG_INFO("flash brightness %d", flash_brightness); if (flash_brightness > 0 && mslVal != MM_CAMCORDER_STROBE_MODE_OFF) { /* other module already turned on flash */ hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY; - _mmcam_dbg_err("other module already turned on flash. avoid to set flash mode here."); + MMCAM_LOG_ERROR("other module already turned on flash. avoid to set flash mode here."); return FALSE; } else { - _mmcam_dbg_log("keep going"); + MMCAM_LOG_INFO("keep going"); } } /* check state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + MMCAM_LOG_INFO("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -4301,7 +4308,7 @@ bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrs case MM_CAM_STROBE_MODE: /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", mslVal); + MMCAM_LOG_INFO("skip set value %d", mslVal); return TRUE; } @@ -4309,36 +4316,36 @@ bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const MMAttrs newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, mslVal); break; default: - _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); + MMCAM_LOG_ERROR("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); return FALSE; } GstCameraControl *control = NULL; if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control."); + MMCAM_LOG_ERROR("Can't cast Video source into camera control."); bret = FALSE; } else { control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } if (gst_camera_control_get_strobe(control, strobe_type, &cur_value)) { if (newVal != cur_value) { if (gst_camera_control_set_strobe(control, strobe_type, newVal)) { - _mmcam_dbg_log("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal); + MMCAM_LOG_INFO("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal); bret = TRUE; } else { - _mmcam_dbg_warn("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal); + MMCAM_LOG_WARNING("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal); bret = FALSE; } } else { - _mmcam_dbg_log("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal); + MMCAM_LOG_INFO("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal); bret = TRUE; } } else { - _mmcam_dbg_warn("Failed to get strobe. Type[%d]", strobe_type); + MMCAM_LOG_WARNING("Failed to get strobe. Type[%d]", strobe_type); bret = FALSE; } } @@ -4355,22 +4362,22 @@ bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const MM mmf_return_val_if_fail(hcamcorder && value, FALSE); - _mmcam_dbg_log("Commit : flip %d", value->value.i_val); + MMCAM_LOG_INFO("Commit : flip %d", value->value.i_val); /* state check */ current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_err("Can not set camera FLIP horizontal at state %d", current_state); + MMCAM_LOG_ERROR("Can not set camera FLIP horizontal at state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } else if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("Pipeline is not created yet. This will be set when create pipeline."); + MMCAM_LOG_INFO("Pipeline is not created yet. This will be set when create pipeline."); return TRUE; } ret = _mmcamcorder_set_videosrc_flip(handle, value->value.i_val); - _mmcam_dbg_log("ret %d", ret); + MMCAM_LOG_INFO("ret %d", ret); return ret; } @@ -4385,18 +4392,18 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c mmf_return_val_if_fail(hcamcorder && value, FALSE); - /*_mmcam_dbg_log("Commit : HDR Capture %d", value->value.i_val);*/ + /*MMCAM_LOG_INFO("Commit : HDR Capture %d", value->value.i_val);*/ /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", value->value.i_val); + MMCAM_LOG_INFO("skip set value %d", value->value.i_val); return TRUE; } /* state check */ current_state = _mmcamcorder_get_state(handle); if (current_state > MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("can NOT set HDR capture at state %d", current_state); + MMCAM_LOG_ERROR("can NOT set HDR capture at state %d", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -4410,7 +4417,7 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c NULL); if (set_hdr_mode == current_value) { - _mmcam_dbg_log("same HDR value : %d, do nothing", set_hdr_mode); + MMCAM_LOG_INFO("same HDR value : %d, do nothing", set_hdr_mode); return TRUE; } @@ -4424,7 +4431,7 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); return FALSE; } @@ -4435,12 +4442,12 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c set_hdr_mode = value->value.i_val; MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", set_hdr_mode); sc->info_image->hdr_capture_mode = set_hdr_mode; - _mmcam_dbg_log("set HDR mode : %d", set_hdr_mode); + MMCAM_LOG_INFO("set HDR mode : %d", set_hdr_mode); if (current_state == MM_CAMCORDER_STATE_PREPARE) _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING); } else { - _mmcam_dbg_err("sc is NULL. can not set HDR capture"); + MMCAM_LOG_ERROR("sc is NULL. can not set HDR capture"); return FALSE; } } @@ -4465,12 +4472,12 @@ bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const MMAttrs if (!sc) return TRUE; - /*_mmcam_dbg_log("Commit : detect attribute(%d)", attr_idx);*/ + /*MMCAM_LOG_INFO("Commit : detect attribute(%d)", attr_idx);*/ /* state check */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } @@ -4480,7 +4487,7 @@ bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const MMAttrs case MM_CAM_DETECT_MODE: /* check whether set or not */ if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { - _mmcam_dbg_log("skip set value %d", set_value); + MMCAM_LOG_INFO("skip set value %d", set_value); return TRUE; } @@ -4499,37 +4506,37 @@ bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const MMAttrs detect_type = GST_CAMERA_CONTROL_FACE_DETECT_STATUS; break; default: - _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); + MMCAM_LOG_ERROR("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); return FALSE; } if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control."); + MMCAM_LOG_ERROR("Can't cast Video source into camera control."); bret = FALSE; } else { control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return FALSE; } if (gst_camera_control_get_detect(control, detect_type, ¤t_value)) { if (current_value == set_value) { - _mmcam_dbg_log("No need to set detect(same). Type[%d],value[%d]", detect_type, set_value); + MMCAM_LOG_INFO("No need to set detect(same). Type[%d],value[%d]", detect_type, set_value); bret = TRUE; } else { if (!gst_camera_control_set_detect(control, detect_type, set_value)) { - _mmcam_dbg_warn("Set detect failed. Type[%d],value[%d]", + MMCAM_LOG_WARNING("Set detect failed. Type[%d],value[%d]", detect_type, set_value); bret = FALSE; } else { - _mmcam_dbg_log("Set detect success. Type[%d],value[%d]", + MMCAM_LOG_INFO("Set detect success. Type[%d],value[%d]", detect_type, set_value); bret = TRUE; } } } else { - _mmcam_dbg_warn("Get detect failed. Type[%d]", detect_type); + MMCAM_LOG_WARNING("Get detect failed. Type[%d]", detect_type); bret = FALSE; } } @@ -4545,19 +4552,19 @@ bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_i mmf_return_val_if_fail(handle && value, FALSE); - _mmcam_dbg_log("Commit : encoded preview bitrate - %d", value->value.i_val); + MMCAM_LOG_INFO("Commit : encoded preview bitrate - %d", value->value.i_val); /* check preview format */ mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL); if (preview_format != MM_PIXEL_FORMAT_ENCODED_H264) { - _mmcam_dbg_err("current preview format[%d] is not encoded format", preview_format); + MMCAM_LOG_ERROR("current preview format[%d] is not encoded format", preview_format); return FALSE; } /* check state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } @@ -4572,19 +4579,19 @@ bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int a mmf_return_val_if_fail(handle && value, FALSE); - _mmcam_dbg_log("Commit : encoded preview I-frame interval - %d", value->value.i_val); + MMCAM_LOG_INFO("Commit : encoded preview I-frame interval - %d", value->value.i_val); /* check preview format */ mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL); if (preview_format != MM_PIXEL_FORMAT_ENCODED_H264) { - _mmcam_dbg_err("current preview format[%d] is not encoded format", preview_format); + MMCAM_LOG_ERROR("current preview format[%d] is not encoded format", preview_format); return FALSE; } /* check state */ current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_log("will be applied when preview starts"); + MMCAM_LOG_INFO("will be applied when preview starts"); return TRUE; } @@ -4602,7 +4609,7 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co stream_type = value->value.s_val; if (!stream_type) { - _mmcam_dbg_err("NULL string"); + MMCAM_LOG_ERROR("NULL string"); return FALSE; } @@ -4610,18 +4617,18 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co MMCAM_SOUND_STREAM_INDEX, &stream_index, NULL); if (stream_index < 0) { - _mmcam_dbg_err("invalid stream index %d", stream_index); + MMCAM_LOG_ERROR("invalid stream index %d", stream_index); return FALSE; } sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc || !sc->encode_element || !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) { - _mmcam_dbg_warn("audiosrc element is not initialized, it will be set later"); + MMCAM_LOG_WARNING("audiosrc element is not initialized, it will be set later"); return TRUE; } - _mmcam_dbg_warn("Commit : sound stream info - type %s, index %d", stream_type, stream_index); + MMCAM_LOG_WARNING("Commit : sound stream info - type %s, index %d", stream_type, stream_index); return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index); } @@ -4636,7 +4643,7 @@ bool _mmcamcorder_commit_tag(MMHandleType handle, int attr_idx, const MMAttrsVal current_state = _mmcamcorder_get_state(handle); if (current_state == MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Can not set while CAPTURING"); + MMCAM_LOG_ERROR("Can not set while CAPTURING"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -4657,7 +4664,7 @@ bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, co current_state = _mmcamcorder_get_state(handle); if (current_state >= MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_err("Can not set replay gain enable [state : %d]", current_state); + MMCAM_LOG_ERROR("Can not set replay gain enable [state : %d]", current_state); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; return FALSE; } @@ -4667,12 +4674,12 @@ bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, co NULL); if (audio_disable) { - _mmcam_dbg_err("audio is disabled"); + MMCAM_LOG_ERROR("audio is disabled"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION; return FALSE; } - _mmcam_dbg_log("set replay gain enable : %d", value->value.i_val); + MMCAM_LOG_INFO("set replay gain enable : %d", value->value.i_val); } else if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL) { /* Replay gain reference level */ int replay_gain_enable = FALSE; @@ -4682,14 +4689,14 @@ bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, co NULL); if (replay_gain_enable == FALSE) { - _mmcam_dbg_err("replay gain is disabled"); + MMCAM_LOG_ERROR("replay gain is disabled"); hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION; return FALSE; } - _mmcam_dbg_log("set reference level for replay gain : %lf dB", value->value.d_val); + MMCAM_LOG_INFO("set reference level for replay gain : %lf dB", value->value.d_val); } else { - _mmcam_dbg_err("unknown attribute id %d", attr_idx); + MMCAM_LOG_ERROR("unknown attribute id %d", attr_idx); return FALSE; } @@ -4727,11 +4734,11 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle) mmf_return_val_if_fail(hcamcorder, FALSE); - _mmcam_dbg_log("commit some attributes again"); + MMCAM_LOG_INFO("commit some attributes again"); attrs = MMF_CAMCORDER_ATTRS(handle); if (attrs == NULL) { - _mmcam_dbg_err("Get attribute handle failed."); + MMCAM_LOG_ERROR("Get attribute handle failed."); return FALSE; } @@ -4760,7 +4767,7 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle) else ret = TRUE; - _mmcam_dbg_log("Done."); + MMCAM_LOG_INFO("Done."); return ret; } @@ -4783,11 +4790,11 @@ bool _mmcamcorder_set_attribute_to_camsensor2(MMHandleType handle) mmf_return_val_if_fail(hcamcorder, FALSE); - _mmcam_dbg_log("commit some attribute again[2]"); + MMCAM_LOG_INFO("commit some attribute again[2]"); attrs = MMF_CAMCORDER_ATTRS(handle); if (attrs == NULL) { - _mmcam_dbg_err("Get attribute handle failed."); + MMCAM_LOG_ERROR("Get attribute handle failed."); return FALSE; } @@ -4801,7 +4808,7 @@ bool _mmcamcorder_set_attribute_to_camsensor2(MMHandleType handle) else ret = TRUE; - _mmcam_dbg_log("Done."); + MMCAM_LOG_INFO("Done."); return ret; } @@ -4820,10 +4827,10 @@ int _mmcamcorder_lock_readonly_attributes(MMHandleType handle) attrs = MMF_CAMCORDER_ATTRS(handle); mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); table_size = ARRAY_SIZE(readonly_attributes); - _mmcam_dbg_log("%d", table_size); + MMCAM_LOG_INFO("%d", table_size); for (i = 0; i < table_size; i++) { int sCategory = readonly_attributes[i]; @@ -4848,7 +4855,7 @@ int _mmcamcorder_set_disabled_attributes(MMHandleType handle) attrs = MMF_CAMCORDER_ATTRS(handle); mmf_return_val_if_fail(attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* add gst_param */ _mmcamcorder_conf_get_value_string_array(hcamcorder->conf_main, @@ -4859,13 +4866,13 @@ int _mmcamcorder_set_disabled_attributes(MMHandleType handle) cnt_str = disabled_attr->count; for (i = 0; i < cnt_str; i++) { int idx = 0; - _mmcam_dbg_log("[%d]%s", i, disabled_attr->value[i]); + MMCAM_LOG_INFO("[%d]%s", i, disabled_attr->value[i]); nerror = mm_attrs_get_index(attrs, disabled_attr->value[i], &idx); if (nerror == MM_ERROR_NONE) mm_attrs_set_disabled(attrs, idx); else - _mmcam_dbg_warn("No ATTR named %s[%d]", disabled_attr->value[i], i); + MMCAM_LOG_WARNING("No ATTR named %s[%d]", disabled_attr->value[i], i); } } @@ -4892,15 +4899,15 @@ static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, if (sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { if (current_state <= MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_log("set capture width and height [%dx%d] to camera plugin", width, height); + MMCAM_LOG_INFO("set capture width and height [%dx%d] to camera plugin", width, height); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", width); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", height); } else { - _mmcam_dbg_warn("invalid state[%d]", current_state); + MMCAM_LOG_WARNING("invalid state[%d]", current_state); return FALSE; } } else { - _mmcam_dbg_log("element is not created yet"); + MMCAM_LOG_INFO("element is not created yet"); } return TRUE; @@ -4932,7 +4939,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n }; if (hcamcorder == NULL || attribute_name == NULL) { - _mmcam_dbg_warn("handle[%p] or attribute_name[%p] is NULL.", + MMCAM_LOG_WARNING("handle[%p] or attribute_name[%p] is NULL.", hcamcorder, attribute_name); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -4940,7 +4947,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n if (err_attr_name) *err_attr_name = NULL; - /*_mmcam_dbg_log( "ENTER" );*/ + /*MMCAM_LOG_INFO( "ENTER" );*/ attrs = MMF_CAMCORDER_ATTRS(handle); @@ -4950,7 +4957,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n int idx = -1; MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID; - /*_mmcam_dbg_log("NAME : %s", name);*/ + /*MMCAM_LOG_INFO("NAME : %s", name);*/ /* attribute name check */ if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) { @@ -4975,7 +4982,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n for (j = 0 ; j < 2 ; j++) { if (!strcmp(name, check_pair_name[i][j])) { check_pair_value[i][j] = va_arg((var_args), int); - _mmcam_dbg_log("%s : %d", check_pair_name[i][j], check_pair_value[i][j]); + MMCAM_LOG_INFO("%s : %d", check_pair_name[i][j], check_pair_value[i][j]); matched = TRUE; break; } @@ -5000,7 +5007,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n break; case MM_ATTRS_TYPE_INVALID: default: - _mmcam_dbg_err("Not supported attribute type(%d, name:%s)", attr_type, name); + MMCAM_LOG_ERROR("Not supported attribute type(%d, name:%s)", attr_type, name); if (err_attr_name) *err_attr_name = strdup(name); @@ -5036,7 +5043,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n if (attr_info_0.int_array.array[j] == check_pair_value[i][0] && attr_info_1.int_array.array[j] == check_pair_value[i][1]) { /* - _mmcam_dbg_log("Valid Pair[%s,%s] existed %dx%d[index:%d]", + MMCAM_LOG_INFO("Valid Pair[%s,%s] existed %dx%d[index:%d]", check_pair_name[i][0], check_pair_name[i][1], check_pair_value[i][0], check_pair_value[i][1], i); */ @@ -5046,7 +5053,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n } if (check_result == FALSE) { - _mmcam_dbg_err("INVALID pair[%s,%s] %dx%d", + MMCAM_LOG_ERROR("INVALID pair[%s,%s] %dx%d", check_pair_name[i][0], check_pair_name[i][1], check_pair_value[i][0], check_pair_value[i][1]); if (err_attr_name) { @@ -5077,7 +5084,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n hcamcorder->resolution_changed = FALSE; } - _mmcam_dbg_log("resolution changed : %d", hcamcorder->resolution_changed); + MMCAM_LOG_INFO("resolution changed : %d", hcamcorder->resolution_changed); } if (err_name) { @@ -5087,7 +5094,7 @@ static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_n } } - /*_mmcam_dbg_log("DONE");*/ + /*MMCAM_LOG_INFO("DONE");*/ return MM_ERROR_NONE; } @@ -5098,7 +5105,7 @@ bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index) MMAttrsInfo info; if ((void *)handle == NULL) { - _mmcam_dbg_warn("handle %p is NULL", handle); + MMCAM_LOG_WARNING("handle %p is NULL", handle); return FALSE; } @@ -5109,34 +5116,34 @@ bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index) switch (info.validity_type) { case MM_ATTRS_VALID_TYPE_INT_ARRAY: /* - _mmcam_dbg_log("int array count %d", info.int_array.count); + MMCAM_LOG_INFO("int array count %d", info.int_array.count); */ if (info.int_array.count < 1) return FALSE; break; case MM_ATTRS_VALID_TYPE_INT_RANGE: /* - _mmcam_dbg_log("int range min %d, max %d",info.int_range.min, info.int_range.max); + MMCAM_LOG_INFO("int range min %d, max %d",info.int_range.min, info.int_range.max); */ if (info.int_range.min > info.int_range.max) return FALSE; break; case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: /* - _mmcam_dbg_log("double array count %d", info.double_array.count); + MMCAM_LOG_INFO("double array count %d", info.double_array.count); */ if (info.double_array.count < 1) return FALSE; break; case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: /* - _mmcam_dbg_log("double range min %lf, max %lf",info.int_range.min, info.int_range.max); + MMCAM_LOG_INFO("double range min %lf, max %lf",info.int_range.min, info.int_range.max); */ if (info.double_range.min >= info.double_range.max) return FALSE; break; default: - _mmcam_dbg_warn("invalid type %d", info.validity_type); + MMCAM_LOG_WARNING("invalid type %d", info.validity_type); return FALSE; } diff --git a/src/mm_camcorder_audiorec.c b/src/mm_camcorder_audiorec.c index 5856eab..2023a31 100644 --- a/src/mm_camcorder_audiorec.c +++ b/src/mm_camcorder_audiorec.c @@ -88,17 +88,17 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) info = (_MMCamcorderAudioInfo *)sc->info_audio; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mux_elem = _mmcamcorder_get_type_element(handle, MM_CAM_FILE_FORMAT); err = _mmcamcorder_conf_get_value_element_name(mux_elem, &mux_name); if (!mux_name || !strcmp(mux_name, "wavenc")) { /* IF MUX in not chosen then record in raw file */ - _mmcam_dbg_log("Record without muxing."); + MMCAM_LOG_INFO("Record without muxing."); info->bMuxing = FALSE; } else { - _mmcam_dbg_log("Record with mux."); + MMCAM_LOG_INFO("Record with mux."); info->bMuxing = TRUE; } @@ -129,7 +129,7 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) MMCAM_TARGET_FILENAME, &file_name, &file_name_len, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to get filename [0x%x]", err); + MMCAM_LOG_ERROR("failed to get filename [0x%x]", err); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -137,14 +137,14 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) /* without muxing. can't use encodebin. */ aenc_elem = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER); if (!aenc_elem) { - _mmcam_dbg_err("Fail to get type element"); + MMCAM_LOG_ERROR("Fail to get type element"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } err = _mmcamcorder_conf_get_value_element_name(aenc_elem, &aenc_name); if ((!err) || (!aenc_name)) { - _mmcam_dbg_err("Fail to get element name"); + MMCAM_LOG_ERROR("Fail to get element name"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -164,7 +164,7 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) &sink_elem); _mmcamcorder_conf_get_value_element_name(sink_elem, &sink_name); - _mmcam_dbg_log("encode sink : %s", sink_name); + MMCAM_LOG_INFO("encode sink : %s", sink_name); _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, sink_name, NULL, element_list, err); @@ -172,14 +172,14 @@ static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) /* add elements to encode pipeline */ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst), element_list)) { - _mmcam_dbg_err("add encode elements error."); + MMCAM_LOG_ERROR("add encode elements error."); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } /* link elements */ if (!_mmcamcorder_link_elements(element_list)) { - _mmcam_dbg_err("encode element link error."); + MMCAM_LOG_ERROR("encode element link error."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -285,10 +285,10 @@ _mmcamcorder_destroy_audio_pipeline(MMHandleType handle) info = sc->info_audio; - _mmcam_dbg_log("start"); + MMCAM_LOG_INFO("start"); if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) { - _mmcam_dbg_warn("release audio pipeline"); + MMCAM_LOG_WARNING("release audio pipeline"); _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL); @@ -313,7 +313,7 @@ _mmcamcorder_destroy_audio_pipeline(MMHandleType handle) gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst); } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return; } @@ -342,7 +342,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; info = sc->info_audio; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst; audioSrc = sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst; @@ -370,13 +370,13 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) MMCAM_ROOT_DIRECTORY, &hcamcorder->root_directory, &root_directory_length, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret); + MMCAM_LOG_WARNING("failed to get attribute. (%s:%x)", err_attr_name, ret); SAFE_FREE(err_attr_name); goto _ERR_CAMCORDER_AUDIO_COMMAND; } if (!target_filename && !hcamcorder->mstream_cb) { - _mmcam_dbg_err("filename is not set and muxed stream cb is NULL"); + MMCAM_LOG_ERROR("filename is not set and muxed stream cb is NULL"); ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; goto _ERR_CAMCORDER_AUDIO_COMMAND; } @@ -386,15 +386,15 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) if (target_filename) { info->filename = g_strdup(target_filename); if (!info->filename) { - _mmcam_dbg_err("STRDUP was failed for [%s]", target_filename); + MMCAM_LOG_ERROR("STRDUP was failed for [%s]", target_filename); goto _ERR_CAMCORDER_AUDIO_COMMAND; } - _mmcam_dbg_log("Record start : file name [%s]", info->filename); + MMCAM_LOG_INFO("Record start : file name [%s]", info->filename); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename); } else { - _mmcam_dbg_log("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL); + MMCAM_LOG_INFO("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", _MMCamcorder_FILENAME_NULL); } @@ -419,7 +419,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) ret = _mmcamcorder_get_storage_validity(handle, info->filename, _MMCAMCORDER_AUDIO_MINIMUM_SPACE, &storage_validity); if (ret != MM_ERROR_NONE || !storage_validity) { - _mmcam_dbg_err("storage validation failed[0x%x]:%d", ret, storage_validity); + MMCAM_LOG_ERROR("storage validation failed[0x%x]:%d", ret, storage_validity); return ret; } @@ -438,7 +438,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) int count = 0; if (info->b_committing) { - _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd); + MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -446,11 +446,11 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) if (info->filesize > 0) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Pause fail, wait 200 ms, but file size is %"G_GUINT64_FORMAT, + MMCAM_LOG_ERROR("Pause fail, wait 200 ms, but file size is %"G_GUINT64_FORMAT, info->filesize); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } else { - _mmcam_dbg_warn("Wait for enough audio frame, retry count[%d], file size is %"G_GUINT64_FORMAT, + MMCAM_LOG_WARNING("Wait for enough audio frame, retry count[%d], file size is %"G_GUINT64_FORMAT, count, info->filesize); } usleep(_MMCAMCORDER_FRAME_WAIT_TIME); @@ -468,7 +468,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) case _MMCamcorder_CMD_CANCEL: if (info->b_committing) { - _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd); + MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -495,7 +495,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) sc->isMaxtimePausing = FALSE; if (info->filename) { - _mmcam_dbg_log("file delete(%s)", info->filename); + MMCAM_LOG_INFO("file delete(%s)", info->filename); unlink(info->filename); SAFE_G_FREE(info->filename); } @@ -505,13 +505,13 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) { int count = 0; guint64 free_space = 0; - _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT"); + MMCAM_LOG_INFO("_MMCamcorder_CMD_COMMIT"); if (info->b_committing) { - _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd); + MMCAM_LOG_WARNING("now on commiting previous file!!(cmd : %d)", cmd); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } else { - _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start"); + MMCAM_LOG_INFO("_MMCamcorder_CMD_COMMIT : start"); info->b_committing = TRUE; } @@ -519,11 +519,11 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) if (info->filesize > 0) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Commit fail, waited 200 ms, but file size is %"G_GUINT64_FORMAT, info->filesize); + MMCAM_LOG_ERROR("Commit fail, waited 200 ms, but file size is %"G_GUINT64_FORMAT, info->filesize); info->b_committing = FALSE; return MM_ERROR_CAMCORDER_INVALID_CONDITION; } else { - _mmcam_dbg_warn("Waiting for enough audio frame, re-count[%d], file size is %"G_GUINT64_FORMAT, + MMCAM_LOG_WARNING("Waiting for enough audio frame, re-count[%d], file size is %"G_GUINT64_FORMAT, count, info->filesize); } usleep(_MMCAMCORDER_FRAME_WAIT_TIME); @@ -531,20 +531,20 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space); if (free_space < _MMCAMCORDER_AUDIO_MINIMUM_SPACE) { - _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space); + MMCAM_LOG_WARNING("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space); ret = MM_ERROR_OUT_OF_STORAGE; goto _ERR_CAMCORDER_AUDIO_COMMAND; } if (audioSrc) { if (gst_element_send_event(audioSrc, gst_event_new_eos()) == FALSE) { - _mmcam_dbg_err("send EOS failed"); + MMCAM_LOG_ERROR("send EOS failed"); info->b_committing = FALSE; ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_AUDIO_COMMAND; } - _mmcam_dbg_log("send EOS done"); + MMCAM_LOG_INFO("send EOS done"); /* for pause -> commit case */ if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) { @@ -555,14 +555,14 @@ _mmcamcorder_audio_command(MMHandleType handle, int command) } } } else { - _mmcam_dbg_err("No audio stream source"); + MMCAM_LOG_ERROR("No audio stream source"); info->b_committing = FALSE; ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_AUDIO_COMMAND; } /* wait until finishing EOS */ - _mmcam_dbg_log("Start to wait EOS"); + MMCAM_LOG_INFO("Start to wait EOS"); if ((ret = _mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE) { info->b_committing = FALSE; goto _ERR_CAMCORDER_AUDIO_COMMAND; @@ -604,7 +604,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle) mmf_return_val_if_fail(sc, FALSE); mmf_return_val_if_fail(sc->info_audio, FALSE); - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); info = sc->info_audio; @@ -612,15 +612,11 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle) err = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY); if (err != MM_ERROR_NONE) - _mmcam_dbg_warn("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err); + MMCAM_LOG_WARNING("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err); /* Send recording report message to application */ msg.id = MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED; - report = (MMCamRecordingReport*) g_malloc(sizeof(MMCamRecordingReport)); - if (!report) { - _mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename); - return FALSE; - } + report = (MMCamRecordingReport *)g_malloc(sizeof(MMCamRecordingReport)); /* START TAG HERE */ /* MM_AUDIO_CODEC_AAC + MM_FILE_FORMAT_MP4 */ @@ -647,7 +643,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle) SAFE_G_FREE(info->filename); - _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end"); + MMCAM_LOG_ERROR("_MMCamcorder_CMD_COMMIT : end"); info->b_committing = FALSE; @@ -700,7 +696,7 @@ __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat f } /* - _mmcam_dbg_log("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]", + MMCAM_LOG_INFO("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]", size, depthByte, count, rms, db); */ @@ -726,7 +722,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); if (current_state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_warn("Not ready for stream callback"); + MMCAM_LOG_WARNING("Not ready for stream callback"); return GST_PAD_PROBE_OK; } @@ -740,7 +736,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad NULL); if (err < 0) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -759,20 +755,18 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_voicerecorder(GstPad *pad _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(hcamcorder); + MMCAM_LOG_DEBUG("audio stream cb[%p][%"GST_TIME_FORMAT"] - fmt[%d], ch[%d], size[%"G_GSIZE_FORMAT"], dB[%f]", + hcamcorder->astream_cb, GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), format, channel, mapinfo.size, curdcb); + /* CALL audio stream callback */ if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) { MMCamcorderAudioStreamDataType stream; - /* - _mmcam_dbg_log("Call audio steramCb, data[%p], format[%d], channel[%d], length[%d], volume_dB[%f]", - GST_BUFFER_DATA(buffer), format, channel, GST_BUFFER_SIZE(buffer), curdcb); - */ - stream.data = (void *)mapinfo.data; stream.format = format; stream.channel = channel; stream.length = mapinfo.size; - stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano -> msecond */ + stream.timestamp = (unsigned int)(GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer))); stream.volume_dB = curdcb; hcamcorder->astream_cb(&stream, hcamcorder->astream_cb_param); @@ -810,7 +804,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa audioinfo = sc->info_audio; if (sc->isMaxtimePausing || sc->isMaxsizePausing) { - _mmcam_dbg_warn("isMaxtimePausing[%d],isMaxsizePausing[%d]", + MMCAM_LOG_WARNING("isMaxtimePausing[%d],isMaxsizePausing[%d]", sc->isMaxtimePausing, sc->isMaxsizePausing); return GST_PAD_PROBE_DROP; } @@ -828,7 +822,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa } if (sc->ferror_send) { - _mmcam_dbg_warn("file write error, drop frames"); + MMCAM_LOG_WARNING("file write error, drop frames"); return GST_PAD_PROBE_DROP; } @@ -839,7 +833,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa audioinfo->fileformat == MM_FILE_FORMAT_AAC) ? TRUE : FALSE; if (get_trailer_size) { MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size); - /*_mmcam_dbg_log("trailer_size %d", trailer_size);*/ + MMCAM_LOG_VERBOSE("trailer_size %"G_GUINT64_FORMAT, trailer_size); } else { trailer_size = 0; /* no trailer */ } @@ -853,7 +847,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa /* check free space */ free_space_ret = _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space); if (free_space_ret != 0) { - _mmcam_dbg_err("Error occured. [%d]", free_space_ret); + MMCAM_LOG_ERROR("Error occurred. [%d]", free_space_ret); if (sc->ferror_count == 2 && sc->ferror_send == FALSE) { sc->ferror_send = TRUE; @@ -872,16 +866,16 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa /* check storage state */ storage_get_state(hcamcorder->storage_info.id, &storage_state); - _mmcam_dbg_warn("storage state %d", storage_state); + MMCAM_LOG_WARNING("storage state %d", storage_state); if (storage_state == STORAGE_STATE_REMOVED || storage_state == STORAGE_STATE_UNMOUNTABLE) { - _mmcam_dbg_err("storage was removed!"); + MMCAM_LOG_ERROR("storage was removed!"); _MMCAMCORDER_LOCK(hcamcorder); if (sc->ferror_send == FALSE) { - _mmcam_dbg_err("OUT_OF_STORAGE error"); + MMCAM_LOG_ERROR("OUT_OF_STORAGE error"); sc->ferror_send = TRUE; @@ -893,7 +887,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); } else { _MMCAMCORDER_UNLOCK(hcamcorder); - _mmcam_dbg_warn("error was already sent"); + MMCAM_LOG_WARNING("error was already sent"); } return GST_PAD_PROBE_DROP; @@ -901,8 +895,8 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa } if (free_space < (guint64)(_MMCAMCORDER_AUDIO_MINIMUM_SPACE + buffer_size + trailer_size)) { - _mmcam_dbg_warn("No more space for recording!!!"); - _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]", + MMCAM_LOG_WARNING("No more space for recording!!!"); + MMCAM_LOG_WARNING("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]", free_space, audioinfo->filesize); if (audioinfo->bMuxing) @@ -919,7 +913,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa } if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) { - _mmcam_dbg_err("Buffer timestamp is invalid, check it"); + MMCAM_LOG_ERROR("Buffer timestamp is invalid, check it"); return GST_PAD_PROBE_DROP; } @@ -935,13 +929,11 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time; } - /*_mmcam_dbg_log("remained time : %u", remained_time);*/ - /* check max size of recorded file */ if (audioinfo->max_size > 0 && audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) { - _mmcam_dbg_warn("Max size!!! Recording is paused."); - _mmcam_dbg_warn("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \ + MMCAM_LOG_WARNING("Max size!!! Recording is paused."); + MMCAM_LOG_WARNING("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \ audioinfo->max_size, audioinfo->filesize, trailer_size); /* just same as pause status. After blocking two queue, this function will not call again. */ @@ -956,7 +948,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa msg.param.recording_status.remained_time = 0; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - _mmcam_dbg_warn("Last filesize sent by message : %"G_GUINT64_FORMAT, audioinfo->filesize + trailer_size); + MMCAM_LOG_WARNING("Last filesize sent by message : %"G_GUINT64_FORMAT, audioinfo->filesize + trailer_size); sc->isMaxsizePausing = TRUE; msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE; @@ -968,8 +960,8 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa /* check recording time limit and send recording status message */ if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) { - _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \ - rec_pipe_time, audioinfo->max_time); + MMCAM_LOG_WARNING("Current time : [%"GST_TIME_FORMAT"], Maximum time : [%"GST_TIME_FORMAT"]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), GST_TIME_ARGS(audioinfo->max_time * GST_MSECOND)); if (audioinfo->bMuxing) MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE); @@ -992,6 +984,10 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstPa msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time; msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10); msg.param.recording_status.remained_time = remained_time; + + MMCAM_LOG_DEBUG("audio rec[%"GST_TIME_FORMAT"], size[%"G_GUINT64_FORMAT"(trailer:%"G_GUINT64_FORMAT")]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), audioinfo->filesize + trailer_size, trailer_size); + _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); return GST_PAD_PROBE_OK; @@ -1052,7 +1048,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) f = fopen64(info->filename, "rb+"); if (f == NULL) { strerror_r(errno, err_msg, 128); - _mmcam_dbg_err("file open failed [%s]", err_msg); + MMCAM_LOG_ERROR("file open failed [%s]", err_msg); return FALSE; } @@ -1062,7 +1058,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) if (_mmcamcorder_find_fourcc(f, MMCAM_FOURCC('u', 'd', 't', 'a'), TRUE)) { size_t nread = 0; - _mmcam_dbg_log("find udta container"); + MMCAM_LOG_INFO("find udta container"); /* read size */ if (fseek(f, -8L, SEEK_CUR) != 0) @@ -1074,7 +1070,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) nread = fread(&buf, sizeof(char), sizeof(buf), f); - _mmcam_dbg_log("recorded file fread %zu", nread); + MMCAM_LOG_INFO("recorded file fread %zu", nread); udta_size = _mmcamcorder_get_container_size(buf); @@ -1097,7 +1093,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) if (!_mmcamcorder_update_size(f, udta_pos, current_pos)) goto fail; } else { - _mmcam_dbg_log("No udta container"); + MMCAM_LOG_INFO("No udta container"); if (fseek(f, 0, SEEK_END) != 0) goto fail; @@ -1112,7 +1108,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) if (_mmcamcorder_find_fourcc(f, MMCAM_FOURCC('m', 'o', 'o', 'v'), TRUE)) { - _mmcam_dbg_log("found moov container"); + MMCAM_LOG_INFO("found moov container"); if (fseek(f, -8L, SEEK_CUR) != 0) goto fail; @@ -1124,7 +1120,7 @@ static gboolean __mmcamcorder_audio_add_metadata_info_m4a(MMHandleType handle) goto fail; } else { - _mmcam_dbg_err("No 'moov' container"); + MMCAM_LOG_ERROR("No 'moov' container"); goto fail; } @@ -1137,7 +1133,7 @@ fail: return FALSE; ftell_fail: - _mmcam_dbg_err("ftell() returns negative value."); + MMCAM_LOG_ERROR("ftell() returns negative value."); fclose(f); return FALSE; } diff --git a/src/mm_camcorder_configure.c b/src/mm_camcorder_configure.c index 0a17758..661e5a2 100644 --- a/src/mm_camcorder_configure.c +++ b/src/mm_camcorder_configure.c @@ -43,7 +43,8 @@ -----------------------------------------------------------------------*/ #define DEFAULT_AUDIO_BUFFER_INTERVAL 50 -#define __MMCAMCORDER_CONF_FILEPATH_LENGTH 128 +#define MMCAMCORDER_CONF_FILEPATH_LENGTH 128 +#define MMCAMCORDER_BUFFER_LINE_MAX 256 char *get_new_string(char* src_string) { @@ -627,6 +628,7 @@ int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure { "ModelName", CONFIGURE_VALUE_STRING, {NULL} }, { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} }, { "PlatformPrivilegeCamera", CONFIGURE_VALUE_STRING, {NULL} }, + { "LogLevel", CONFIGURE_VALUE_INT, {.value_int = MM_CAMCORDER_LOG_LEVEL_INFO} }, }; /* [VideoInput] matching table */ @@ -856,7 +858,7 @@ int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} }, }; - _mmcam_dbg_log("Entered..."); + MMCAM_LOG_INFO("Entered..."); if (type == CONFIGURE_TYPE_MAIN) { hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table; @@ -901,12 +903,8 @@ int _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf *configure } configure_info->info = (conf_detail **)g_malloc0(sizeof(conf_detail *) * category_num); - if (configure_info->info == NULL) { - _mmcam_dbg_err("category info alloc failed : type %d", type); - return MM_ERROR_CAMCORDER_LOW_MEMORY; - } - _mmcam_dbg_log("Done."); + MMCAM_LOG_INFO("Done."); return MM_ERROR_NONE; } @@ -916,24 +914,24 @@ int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFi { int ret = MM_ERROR_NONE; FILE *fp = NULL; - char conf_path[__MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',}; + char conf_path[MMCAMCORDER_CONF_FILEPATH_LENGTH] = {'\0',}; - _mmcam_dbg_log("Opening...[%s]", ConfFile); + MMCAM_LOG_INFO("Opening...[%s]", ConfFile); mmf_return_val_if_fail(ConfFile, FALSE); snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", SYSCONFDIR, ConfFile); - _mmcam_dbg_log("Try open Configure File[%s]", conf_path); + MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path); fp = fopen(conf_path, "r"); if (!fp) { - _mmcam_dbg_warn("File open failed.[%s] retry...", conf_path); + MMCAM_LOG_WARNING("File open failed.[%s] retry...", conf_path); snprintf(conf_path, sizeof(conf_path), "%s/multimedia/%s", TZ_SYS_ETC, ConfFile); - _mmcam_dbg_log("Try open Configure File[%s]", conf_path); + MMCAM_LOG_INFO("Try open Configure File[%s]", conf_path); fp = fopen(conf_path, "r"); if (!fp) { - _mmcam_dbg_warn("open failed.[%s] errno [%d]", conf_path, errno); + MMCAM_LOG_WARNING("open failed.[%s] errno [%d]", conf_path, errno); ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED; } } @@ -943,7 +941,7 @@ int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFi fclose(fp); } - _mmcam_dbg_log("Leave [0x%x]", ret); + MMCAM_LOG_INFO("Leave [0x%x]", ret); return ret; } @@ -953,7 +951,7 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera { const unsigned int BUFFER_NUM_DETAILS = 256; const unsigned int BUFFER_NUM_TOKEN = 20; - size_t BUFFER_LENGTH_STRING = 256; + size_t buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX; const char* delimiters = " |=,\t\n"; int i = 0; @@ -975,30 +973,20 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera camera_conf *new_conf = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(handle && fp && configure_info, MM_ERROR_INVALID_ARGUMENT); *configure_info = NULL; new_conf = (camera_conf *)g_malloc0(sizeof(camera_conf)); - if (new_conf == NULL) { - _mmcam_dbg_err("new_conf alloc failed : %zu", sizeof(camera_conf)); - return MM_ERROR_CAMCORDER_LOW_MEMORY; - } - - buffer_string = (char*)g_malloc0(sizeof(char) * BUFFER_LENGTH_STRING); - if (buffer_string == NULL) { - _mmcam_dbg_err("buffer_string alloc failed : %zu", sizeof(char) * BUFFER_LENGTH_STRING); - g_free(new_conf); - return MM_ERROR_CAMCORDER_LOW_MEMORY; - } + buffer_string = (char *)g_malloc0(sizeof(char) * buffer_line_size); new_conf->type = type; ret = _mmcamcorder_conf_init(handle, type, new_conf); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("conf init failed 0x%x", ret); + MMCAM_LOG_ERROR("conf init failed 0x%x", ret); g_free(new_conf); g_free(buffer_string); return ret; @@ -1011,19 +999,27 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera while (!feof(fp)) { if (read_main == 0) { - length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp); - /*_mmcam_dbg_log( "Read Line : [%s]", buffer_string );*/ + buffer_line_size = MMCAMCORDER_BUFFER_LINE_MAX; + length_read = getline(&buffer_string, &buffer_line_size, fp); + if (length_read < 1) { + MMCAM_LOG_WARNING("skip this case - length read[%d]", length_read); + continue; + } + + buffer_string[--length_read] = '\0'; /* remove new line character */ + + MMCAM_LOG_DEBUG("Read Line : \"%s\"", buffer_string); count_token = 0; token = strtok_r(buffer_string, delimiters, &user_ptr); if ((token) && (token[0] == ';') && (length_read > -1)) { - /*_mmcam_dbg_log( "Comment - Nothing to do" );*/ + MMCAM_LOG_VERBOSE( "Comment - Nothing to do" ); continue; } while (token) { - /*_mmcam_dbg_log("token : [%s]", token);*/ + MMCAM_LOG_VERBOSE("token : \"%s\"", token); buffer_token[count_token] = token; count_token++; token = strtok_r(NULL, delimiters, &user_ptr); @@ -1037,12 +1033,12 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera if (*buffer_token[0] == ';') { /* Comment */ - /*_mmcam_dbg_log( "Comment - Nothing to do" );*/ + MMCAM_LOG_VERBOSE( "Comment - Nothing to do" ); } else if (*buffer_token[0] == '[') { /* Main Category */ category_name = get_new_string(buffer_token[0]); if (category_name == NULL) { - _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]); + MMCAM_LOG_ERROR("strdup failed for \"%s\"", buffer_token[0]); continue; } @@ -1050,15 +1046,22 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera count_details = 0; while (!feof(fp)) { - length_read = getline(&buffer_string, &BUFFER_LENGTH_STRING, fp); - /*_mmcam_dbg_log("Read Detail Line : [%s], read length : [%d]", buffer_string, length_read);*/ + length_read = getline(&buffer_string, &buffer_line_size, fp); + if (length_read < 1) { + MMCAM_LOG_WARNING("skip this case - length read[%d]", length_read); + continue; + } + + buffer_string[--length_read] = '\0'; /* remove new line character */ + + MMCAM_LOG_DEBUG("Read Detail Line : \"%s\", length[%d]", buffer_string, length_read); detail_string = get_new_string(buffer_string); token = strtok_r(buffer_string, delimiters, &user_ptr); if (token && token[0] != ';' && length_read > -1) { - /*_mmcam_dbg_log("token : [%s]", token);*/ + MMCAM_LOG_VERBOSE("token : [%s]", token); if (token[0] == '[') { read_main = 1; buffer_token[0] = token; @@ -1072,10 +1075,10 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera } } - /*_mmcam_dbg_log("type : %d, category_name : %s, count : [%d]", type, category_name, count_details);*/ + MMCAM_LOG_DEBUG("type : %d, category_name : %s, count : [%d]", type, category_name, count_details); if (count_details == 0) { - _mmcam_dbg_warn("category %s has no detail value... skip this category...", category_name); + MMCAM_LOG_WARNING("category %s has no detail value... skip this category...", category_name); SAFE_G_FREE(category_name); continue; } @@ -1121,9 +1124,9 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera if (category != -1) { _mmcamcorder_conf_add_info(handle, type, &(new_conf->info[category]), - buffer_details, category, count_details); + buffer_details, category, count_details); } else { - _mmcam_dbg_warn("No matched category[%s],type[%d]... check it.", category_name, type); + MMCAM_LOG_WARNING("No matched category[%s],type[%d]... check it.", category_name, type); } /* Free memory */ @@ -1138,7 +1141,7 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fp, camera SAFE_G_FREE(buffer_string); - /*_mmcam_dbg_log("Done.");*/ + /*MMCAM_LOG_INFO("Done.");*/ return MM_ERROR_NONE; } @@ -1162,7 +1165,7 @@ void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure type_string_array *temp_string_array = NULL; type_element2 *temp_element = NULL; - _mmcam_dbg_log("Entered..."); + MMCAM_LOG_INFO("Entered..."); mmf_return_if_fail(temp_conf); @@ -1241,7 +1244,7 @@ void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure } break; default: - _mmcam_dbg_warn("unknown type %d", type); + MMCAM_LOG_WARNING("unknown type %d", type); break; } } @@ -1259,7 +1262,7 @@ void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure SAFE_G_FREE((*configure_info)->info); SAFE_G_FREE((*configure_info)); - _mmcam_dbg_log("Done."); + MMCAM_LOG_INFO("Done."); } int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type) @@ -1270,26 +1273,26 @@ int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return FALSE; } - /*_mmcam_dbg_log("Entered...");*/ + /*MMCAM_LOG_INFO("Entered...");*/ mmf_return_val_if_fail(name, FALSE); if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) { - _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category); + MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category); return FALSE; } - /*_mmcam_dbg_log("Number of value : [%d]", count_value);*/ + /*MMCAM_LOG_INFO("Number of value : [%d]", count_value);*/ if (type == CONFIGURE_TYPE_MAIN) { for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) { *value_type = hcamcorder->conf_main_info_table[category][i].value_type; - /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/ + /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/ return TRUE; } } @@ -1297,7 +1300,7 @@ int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) { *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type; - /*_mmcam_dbg_log("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/ + /*MMCAM_LOG_INFO("Category[%d],Name[%s],Type[%d]", category, name, *value_type);*/ return TRUE; } } @@ -1325,23 +1328,12 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info mmf_return_val_if_fail(info && buffer_details, FALSE); - (*info) = (conf_detail*)g_malloc0(sizeof(conf_detail)); - if (*info == NULL) { - _mmcam_dbg_err("info allo failed"); - return FALSE; - } + (*info) = (conf_detail *)g_malloc0(sizeof(conf_detail)); (*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details); (*info)->count = count_details; - if ((*info)->detail_info == NULL) { - _mmcam_dbg_err("detail_info alloc failed"); - g_free(*info); - *info = NULL; - return FALSE; - } - for (i = 0 ; i < count_details ; i++) { - /*_mmcam_dbg_log("Read line\"%s\"", buffer_details[i]);*/ + MMCAM_LOG_VERBOSE("Read line\"%s\"", buffer_details[i]); count_token = 0; token = strtok_r(buffer_details[i], delimiters, &user_ptr); @@ -1350,13 +1342,13 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info count_token++; } else { (*info)->detail_info[i] = NULL; - _mmcam_dbg_warn("No token... check it.[%s]", buffer_details[i]); + MMCAM_LOG_WARNING("No token... check it.[%s]", buffer_details[i]); continue; } if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) { (*info)->detail_info[i] = NULL; - _mmcam_dbg_warn("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]); + MMCAM_LOG_WARNING("Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0]); continue; } @@ -1364,14 +1356,14 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info token = strtok_r(NULL, delimiters, &user_ptr); while (token) { buffer_token[count_token] = token; - /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/ + MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]); count_token++; token = strtok_r(NULL, delimiters, &user_ptr); } if (count_token < 2) { (*info)->detail_info[i] = NULL; - _mmcam_dbg_warn("Number of token is too small... check it.[%s]", buffer_details[i]); + MMCAM_LOG_WARNING("Number of token is too small... check it.[%s]", buffer_details[i]); continue; } } else { /* CONFIGURE_VALUE_STRING or CONFIGURE_VALUE_STRING_ARRAY */ @@ -1382,7 +1374,7 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info token = strtok_r(NULL, delimiters_sub, &user_ptr); while (token) { buffer_token[count_token] = token; - /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/ + MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]); count_token++; token = strtok_r(NULL, delimiters_sub, &user_ptr); } @@ -1391,14 +1383,14 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info if (token) { g_strchug(token); buffer_token[count_token] = token; - /*_mmcam_dbg_log("token : [%s]", buffer_token[count_token]);*/ + MMCAM_LOG_VERBOSE("token : [%s]", buffer_token[count_token]); count_token++; } } if (count_token < 2) { (*info)->detail_info[i] = NULL; - _mmcam_dbg_warn("No string value... check it.[%s]", buffer_details[i]); + MMCAM_LOG_WARNING("No string value... check it.[%s]", buffer_details[i]); continue; } } @@ -1409,14 +1401,10 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_int2* new_int; new_int = (type_int2*)g_malloc0(sizeof(type_int2)); - if (new_int == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_int->name = get_new_string(buffer_token[0]); new_int->value = atoi(buffer_token[1]); (*info)->detail_info[i] = (void*)new_int; - /*_mmcam_dbg_log("INT - name[%s],value[%d]", new_int->name, new_int->value);*/ + MMCAM_LOG_VERBOSE("INT - name[%s],value[%d]", new_int->name, new_int->value); break; } case CONFIGURE_VALUE_INT_RANGE: @@ -1424,22 +1412,17 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_int_range* new_int_range; new_int_range = (type_int_range*)g_malloc0(sizeof(type_int_range)); - if (new_int_range == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_int_range->name = get_new_string(buffer_token[0]); new_int_range->min = atoi(buffer_token[1]); new_int_range->max = atoi(buffer_token[2]); new_int_range->default_value = atoi(buffer_token[3]); (*info)->detail_info[i] = (void*)new_int_range; - /* - _mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]", + + MMCAM_LOG_VERBOSE("INT RANGE - name[%s],min[%d],max[%d],default[%d]", new_int_range->name, new_int_range->min, new_int_range->max, new_int_range->default_value); - */ break; } case CONFIGURE_VALUE_INT_ARRAY: @@ -1448,28 +1431,18 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_int_array* new_int_array; new_int_array = (type_int_array*)g_malloc0(sizeof(type_int_array)); - if (new_int_array == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_int_array->name = get_new_string(buffer_token[0]); new_int_array->value = (int*)g_malloc0(sizeof(int)*count_value); - if (new_int_array->value == NULL) { - SAFE_G_FREE(new_int_array->name); - SAFE_G_FREE(new_int_array); - _mmcam_dbg_err("allocation failed"); - break; - } new_int_array->count = count_value; - /*_mmcam_dbg_log("INT ARRAY - name[%s]", new_int_array->name);*/ + MMCAM_LOG_VERBOSE("INT ARRAY - name[%s]", new_int_array->name); for (j = 0 ; j < count_value ; j++) { new_int_array->value[j] = atoi(buffer_token[j+1]); - /*_mmcam_dbg_log(" index[%d] - value[%d]", j, new_int_array->value[j]);*/ + MMCAM_LOG_VERBOSE(" index[%d] - value[%d]", j, new_int_array->value[j]); } new_int_array->default_value = atoi(buffer_token[count_token-1]); - /*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/ + MMCAM_LOG_VERBOSE(" default value[%d]", new_int_array->default_value); (*info)->detail_info[i] = (void*)new_int_array; break; @@ -1480,46 +1453,28 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_int_pair_array* new_int_pair_array; new_int_pair_array = (type_int_pair_array*)g_malloc0(sizeof(type_int_pair_array)); - if (new_int_pair_array == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_int_pair_array->name = get_new_string(buffer_token[0]); new_int_pair_array->value[0] = (int*)g_malloc0(sizeof(int)*(count_value)); - if (new_int_pair_array->value[0] == NULL) { - SAFE_G_FREE(new_int_pair_array->name); - SAFE_G_FREE(new_int_pair_array); - _mmcam_dbg_err("allocation failed"); - break; - } new_int_pair_array->value[1] = (int*)g_malloc0(sizeof(int)*(count_value)); - if (new_int_pair_array->value[1] == NULL) { - SAFE_G_FREE(new_int_pair_array->value[0]); - SAFE_G_FREE(new_int_pair_array->name); - SAFE_G_FREE(new_int_pair_array); - _mmcam_dbg_err("allocation failed"); - break; - } new_int_pair_array->count = count_value; - /*_mmcam_dbg_log("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value);*/ + MMCAM_LOG_VERBOSE("INT PAIR ARRAY - name[%s],count[%d]", new_int_pair_array->name, count_value); for (j = 0 ; j < count_value ; j++) { new_int_pair_array->value[0][j] = atoi(buffer_token[(j<<1)+1]); new_int_pair_array->value[1][j] = atoi(buffer_token[(j<<1)+2]); - /* - _mmcam_dbg_log(" index[%d] - value[%d,%d]", j, + + MMCAM_LOG_VERBOSE(" index[%d] - value[%d,%d]", j, new_int_pair_array->value[0][j], new_int_pair_array->value[1][j]); - */ } new_int_pair_array->default_value[0] = atoi(buffer_token[count_token-2]); new_int_pair_array->default_value[1] = atoi(buffer_token[count_token-1]); - /* - _mmcam_dbg_log(" default value[%d,%d]", + + MMCAM_LOG_VERBOSE(" default value[%d,%d]", new_int_pair_array->default_value[0], new_int_pair_array->default_value[1]); - */ + (*info)->detail_info[i] = (void*)new_int_pair_array; break; } @@ -1528,15 +1483,11 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_string2* new_string; new_string = (type_string2*)g_malloc0(sizeof(type_string2)); - if (new_string == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_string->name = get_new_string(buffer_token[0]); new_string->value = get_new_string(buffer_token[1]); (*info)->detail_info[i] = (void*)new_string; - /*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/ + MMCAM_LOG_VERBOSE("STRING - name[%s],value[%s]", new_string->name, new_string->value); break; } case CONFIGURE_VALUE_STRING_ARRAY: @@ -1545,26 +1496,21 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_string_array* new_string_array; new_string_array = (type_string_array*)g_malloc0(sizeof(type_string_array)); - if (new_string_array == NULL) - break; - new_string_array->name = get_new_string(buffer_token[0]); new_string_array->count = count_value; new_string_array->value = (char**)g_malloc0(sizeof(char*)*count_value); - if (new_string_array->value == NULL) { - SAFE_G_FREE(new_string_array->name); - SAFE_G_FREE(new_string_array); - _mmcam_dbg_err("allocation failed"); - break; - } - /*_mmcam_dbg_log("STRING ARRAY - name[%s]", new_string_array->name);*/ + + MMCAM_LOG_VERBOSE("STRING ARRAY - name[%s]", new_string_array->name); + for (j = 0 ; j < count_value ; j++) { new_string_array->value[j] = get_new_string(buffer_token[j+1]); - /*_mmcam_dbg_log(" index[%d] - value[%s]", j, new_string_array->value[j]);*/ + MMCAM_LOG_VERBOSE(" index[%d] - value[%s]", j, new_string_array->value[j]); } new_string_array->default_value = get_new_string(buffer_token[count_token-1]); - /*_mmcam_dbg_log(" default value[%s]", new_string_array->default_value);*/ + + MMCAM_LOG_VERBOSE(" default value[%s]", new_string_array->default_value); + (*info)->detail_info[i] = (void*)new_string_array; break; } @@ -1573,70 +1519,41 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info type_element2* new_element; new_element = (type_element2*)g_malloc0(sizeof(type_element2)); - if (new_element == NULL) { - _mmcam_dbg_err("allocation failed"); - break; - } new_element->name = get_new_string(buffer_token[0]); new_element->element_name = get_new_string(buffer_token[1]); new_element->count_int = atoi(buffer_token[2]); new_element->value_int = NULL; new_element->count_string = atoi(buffer_token[3]); new_element->value_string = NULL; - /* - _mmcam_dbg_log("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]", + + MMCAM_LOG_VERBOSE("Element - name[%s],element_name[%s],count_int[%d],count_string[%d]", new_element->name, new_element->element_name, new_element->count_int, new_element->count_string); - */ /* add int values */ if (new_element->count_int > 0 && new_element->count_int <= 30) { new_element->value_int = (type_int2**)g_malloc0(sizeof(type_int2*)*(new_element->count_int)); - if (new_element->value_int) { - for (j = 0 ; j < new_element->count_int ; j++) { - new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2)); - if (new_element->value_int[j]) { - new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]); - new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]); - } else { - _mmcam_dbg_err("allocation failed"); - } - /* - _mmcam_dbg_log(" Element INT[%d] - name[%s],value[%d]", - j, new_element->value_int[j]->name, new_element->value_int[j]->value); - */ - } - } else { - _mmcam_dbg_err("allocation failed"); + for (j = 0 ; j < new_element->count_int ; j++) { + new_element->value_int[j] = (type_int2*)g_malloc0(sizeof(type_int2)); + new_element->value_int[j]->name = get_new_string(buffer_token[4+(j<<1)]); + new_element->value_int[j]->value = atoi(buffer_token[5+(j<<1)]); + + MMCAM_LOG_VERBOSE(" Element INT[%d] - name[%s],value[%d]", + j, new_element->value_int[j]->name, new_element->value_int[j]->value); } - } else { - /*_mmcam_dbg_err("invalid count - %d", new_element->count_int);*/ - new_element->value_int = NULL; } /* add string values */ if (new_element->count_string > 0 && new_element->count_string <= 30 && new_element->count_int >= 0 && new_element->count_int <= 30) { new_element->value_string = (type_string2**)g_malloc0(sizeof(type_string2*)*(new_element->count_string)); - if (new_element->value_string) { - for ( ; j < new_element->count_string + new_element->count_int ; j++) { - new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2)); - if (new_element->value_string[j-new_element->count_int]) { - new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]); - new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]); - /* - _mmcam_dbg_log(" Element STRING[%d] - name[%s],value[%s]", - j-new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value); - */ - } else { - _mmcam_dbg_err("allocation failed"); - } - } - } else { - _mmcam_dbg_err("malloc failed : %zu", sizeof(type_string2*)*(new_element->count_string)); + for ( ; j < new_element->count_string + new_element->count_int ; j++) { + new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0(sizeof(type_string2)); + new_element->value_string[j-new_element->count_int]->name = get_new_string(buffer_token[4+(j<<1)]); + new_element->value_string[j-new_element->count_int]->value = get_new_string(buffer_token[5+(j<<1)]); + + MMCAM_LOG_VERBOSE(" Element STRING[%d] - name[%s],value[%s]", + j - new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value); } - } else { - /*_mmcam_dbg_err("invalid count - %d", new_element->count_string);*/ - new_element->value_string = NULL; } (*info)->detail_info[i] = (void*)new_element; @@ -1656,7 +1573,7 @@ int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_ int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1671,18 +1588,18 @@ int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_ if (!strcmp(((type_int*)(info->detail_info[i]))->name , name)) { *value = ((type_int*)(info->detail_info[i]))->value; - /* _mmcam_dbg_log("Get[%s] int[%d]", name, *value); */ + MMCAM_LOG_DEBUG("Get[%s] int[%d]", name, *value); return TRUE; } } } if (_mmcamcorder_conf_get_default_value_int(handle, configure_info->type, category, name, value)) { - /*_mmcam_dbg_log("Get[%s] int[%d]", name, *value);*/ + MMCAM_LOG_DEBUG("Get default [%s] int[%d]", name, *value); return TRUE; } - _mmcam_dbg_err("Faild to get int... check it...Category[%d],Name[%s]", category, name); + MMCAM_LOG_ERROR("Failed to get int. Category[%d],Name[%s]", category, name); return FALSE; } @@ -1693,7 +1610,7 @@ _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1708,10 +1625,8 @@ _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, if (!strcmp(((type_int_range*)(info->detail_info[i]))->name , name)) { *value = (type_int_range*)(info->detail_info[i]); - /* - _mmcam_dbg_log("Get[%s] int range - min[%d],max[%d],default[%d]", + MMCAM_LOG_DEBUG("Get[%s] int range - min[%d],max[%d],default[%d]", name, (*value)->min, (*value)->max, (*value)->default_value); - */ return TRUE; } } @@ -1719,18 +1634,17 @@ _mmcamcorder_conf_get_value_int_range(camera_conf* configure_info, int category, *value = NULL; - /*_mmcam_dbg_warn( "Faild to get int range... check it...Category[%d],Name[%s]", category, name );*/ + MMCAM_LOG_ERROR("Failed to get int range. Category[%d],Name[%s]", category, name); return FALSE; } -int -_mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value) +int _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, const char* name, type_int_array** value) { int i, count; conf_detail* info; - /*_mmcam_dbg_log("Entered... category[%d],name[%s]", category, name);*/ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1745,10 +1659,8 @@ _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, if (!strcmp(((type_int_array*)(info->detail_info[i]))->name , name)) { *value = (type_int_array*)(info->detail_info[i]); - /* - _mmcam_dbg_log("Get[%s] int array - [%x],count[%d],default[%d]", + MMCAM_LOG_DEBUG("Get[%s] int array - [%p],count[%d],default[%d]", name, (*value)->value, (*value)->count, (*value)->default_value); - */ return TRUE; } } @@ -1756,7 +1668,7 @@ _mmcamcorder_conf_get_value_int_array(camera_conf* configure_info, int category, *value = NULL; - /*_mmcam_dbg_warn( "Faild to get int array... check it...Category[%d],Name[%s]", category, name );*/ + MMCAM_LOG_ERROR("Failed to get int array. Category[%d],Name[%s]", category, name); return FALSE; } @@ -1767,7 +1679,7 @@ _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int cate int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1782,11 +1694,9 @@ _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int cate if (!strcmp(((type_int_pair_array*)(info->detail_info[i]))->name , name)) { *value = (type_int_pair_array*)(info->detail_info[i]); - /* - _mmcam_dbg_log("Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]", + MMCAM_LOG_DEBUG("Get[%s] int pair array - [%p][%p],count[%d],default[%d][%d]", name, (*value)->value[0], (*value)->value[1], (*value)->count, (*value)->default_value[0], (*value)->default_value[1]); - */ return TRUE; } } @@ -1794,7 +1704,7 @@ _mmcamcorder_conf_get_value_int_pair_array(camera_conf* configure_info, int cate *value = NULL; - /*_mmcam_dbg_warn("Faild to get int pair array... check it...Category[%d],Name[%s]", category, name);*/ + MMCAM_LOG_ERROR("Failed to get int pair array. Category[%d],Name[%s]", category, name); return FALSE; } @@ -1804,7 +1714,7 @@ int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configu int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1819,29 +1729,28 @@ int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configu if (!strcmp(((type_string*)(info->detail_info[i]))->name , name)) { *value = ((type_string*)(info->detail_info[i]))->value; - /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/ + MMCAM_LOG_DEBUG("Get[%s] string[%s]", name, *value ? *value : "NULL"); return TRUE; } } } if (_mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value)) { - /*_mmcam_dbg_log( "Get[%s] string[%s]", name, *value ? *value : "NULL" );*/ + MMCAM_LOG_DEBUG("Get default [%s] string[%s]", name, *value ? *value : "NULL"); return TRUE; } - _mmcam_dbg_err("Faild to get string... check it...Category[%d],Name[%s]", category, name); + MMCAM_LOG_ERROR("Failed to get string. Category[%d],Name[%s]", category, name); return FALSE; } -int -_mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value) +int _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int category, const char* name, type_string_array** value) { int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d],name[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d],name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1856,10 +1765,8 @@ _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int catego if (!strcmp(((type_string_array*)(info->detail_info[i]))->name , name)) { *value = (type_string_array*)(info->detail_info[i]); - /* - _mmcam_dbg_log("Get[%s] string array - [%x],count[%d],default[%s]", + MMCAM_LOG_DEBUG("Get[%s] string array - [%p],count[%d],default[%s]", name, (*value)->value, (*value)->count, (*value)->default_value); - */ return TRUE; } } @@ -1867,7 +1774,7 @@ _mmcamcorder_conf_get_value_string_array(camera_conf* configure_info, int catego *value = NULL; - /*_mmcam_dbg_warn("Faild to get string array... check it...Category[%d],Name[%s]", category, name);*/ + MMCAM_LOG_ERROR("Failed to get string array. Category[%d],Name[%s]", category, name); return FALSE; } @@ -1877,7 +1784,7 @@ int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_in int i, count; conf_detail* info; - /* _mmcam_dbg_log("Entered... category[%d], ame[%s]", category, name); */ + MMCAM_LOG_DEBUG("category[%d], name[%s]", category, name); mmf_return_val_if_fail(configure_info, FALSE); mmf_return_val_if_fail(name, FALSE); @@ -1892,139 +1799,122 @@ int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_in if (!strcmp(((type_element*)(info->detail_info[i]))->name , name)) { *element = (type_element*)(info->detail_info[i]); - /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */ + MMCAM_LOG_DEBUG("Get[%s] element[%p]", name, *element); return TRUE; } } } if (_mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element)) { - /* _mmcam_dbg_log("Get[%s] element[%x]", name, *element); */ + MMCAM_LOG_DEBUG("Get default [%s] element[%p]", name, *element); return TRUE; } - _mmcam_dbg_warn("Faild to get element name... check it...Category[%d],Name[%s]", category, name); + MMCAM_LOG_ERROR("Failed to get element name. Category[%d],Name[%s]", category, name); return FALSE; } -int -_mmcamcorder_conf_get_value_element_name(type_element* element, const char** value) +int _mmcamcorder_conf_get_value_element_name(type_element* element, const char** value) { - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(element, FALSE); *value = element->element_name; - /* _mmcam_dbg_log("Get element name : [%s]", *value); */ + MMCAM_LOG_DEBUG("Get element name : [%s]", *value); return TRUE; } -int -_mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value) +int _mmcamcorder_conf_get_value_element_int(type_element* element, const char* name, int* value) { int i; - /* _mmcam_dbg_log( "Entered..." ); */ - mmf_return_val_if_fail(element, FALSE); mmf_return_val_if_fail(name, FALSE); for (i = 0 ; i < element->count_int ; i++) { if (!strcmp(element->value_int[i]->name, name)) { *value = element->value_int[i]->value; - /* _mmcam_dbg_log("Get[%s] element int[%d]", name, *value); */ + MMCAM_LOG_DEBUG("Get[%s] element int[%d]", name, *value); return TRUE; } } - _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]", + MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]", element->name, name, element->count_int); return FALSE; } -int -_mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value) +int _mmcamcorder_conf_get_value_element_string(type_element* element, const char* name, const char** value) { int i; - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(element, FALSE); mmf_return_val_if_fail(name, FALSE); for (i = 0 ; i < element->count_string ; i++) { if (!strcmp(element->value_string[i]->name, name)) { *value = element->value_string[i]->value; - /*_mmcam_dbg_log("Get[%s] element string[%s]", name, *value);*/ + MMCAM_LOG_DEBUG("Get[%s] element string[%s]", name, *value); return TRUE; } } - _mmcam_dbg_warn("Faild to get int in element... ElementName[%p],Name[%s],Count[%d]", + MMCAM_LOG_ERROR("Failed to get int in element. Element[%s],Name[%s],Count[%d]", element->name, name, element->count_string); return FALSE; } -int -_mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element) +int _mmcamcorder_conf_set_value_element_property(GstElement* gst, type_element* element) { int i; - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(gst, FALSE); mmf_return_val_if_fail(element, FALSE); if (element->count_int == 0) { - /*_mmcam_dbg_log( "There is no integer property to set in INI file[%s].", element->name );*/ + MMCAM_LOG_DEBUG("There is no integer property to set in INI file[%s].", element->name ); } else { if (element->value_int == NULL) { - _mmcam_dbg_warn("count_int[%d] is NOT zero, but value_int is NULL", element->count_int); + MMCAM_LOG_WARNING("count_int[%d] is NOT zero, but value_int is NULL", element->count_int); return FALSE; } for (i = 0 ; i < element->count_int ; i++) { MMCAMCORDER_G_OBJECT_SET(gst, element->value_int[i]->name, element->value_int[i]->value); - /* - _mmcam_dbg_log("Element[%s] Set[%s] -> integer[%d]", + MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> integer[%d]", element->element_name, element->value_int[i]->name, element->value_int[i]->value); - */ } } if (element->count_string == 0) { - _mmcam_dbg_log("There is no string property to set in INI file[%s].", element->name); + MMCAM_LOG_DEBUG("There is no string property to set in INI file[%s].", element->name); } else { if (element->value_string == NULL) { - _mmcam_dbg_warn("count_string[%d] is NOT zero, but value_string is NULL", element->count_string); + MMCAM_LOG_WARNING("count_string[%d] is NOT zero, but value_string is NULL", element->count_string); return FALSE; } for (i = 0 ; i < element->count_string ; i++) { MMCAMCORDER_G_OBJECT_SET_POINTER(gst, element->value_string[i]->name, element->value_string[i]->value); - _mmcam_dbg_log("Element[%s] Set[%s] -> string[%s]", + MMCAM_LOG_DEBUG("Element[%s] Set[%s] -> string[%s]", element->element_name, element->value_string[i]->name, element->value_string[i]->value); } } - /* _mmcam_dbg_log( "Done." ); */ - return TRUE; } -int -_mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value) +int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value) { int i = 0; int count_value = 0; @@ -2032,16 +1922,14 @@ _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int categ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return FALSE; } - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(name, FALSE); if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) { - _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category); + MMCAM_LOG_WARNING("No matched category. categoty[%d]", category); return FALSE; } @@ -2061,7 +1949,7 @@ _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int categ } } - _mmcam_dbg_err("Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name); + MMCAM_LOG_ERROR("Failed to get default int. Type[%d],Category[%d],Name[%s]", type, category, name); return FALSE; } @@ -2074,16 +1962,14 @@ int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, in mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return FALSE; } - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(name, FALSE); if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) { - _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category); + MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category); return FALSE; } @@ -2091,7 +1977,6 @@ int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, in for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) { *value = hcamcorder->conf_main_info_table[category][i].value_string; - /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/ return TRUE; } } @@ -2099,13 +1984,12 @@ int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, in for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) { *value = hcamcorder->conf_ctrl_info_table[category][i].value_string; - /*_mmcam_dbg_log("Get[%s] default string[%s]", name, *value ? *value : "NULL");*/ return TRUE; } } } - _mmcam_dbg_warn("Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name); + MMCAM_LOG_ERROR("Failed to get default string. Type[%d],Category[%d],Name[%s]", type, category, name); return FALSE; } @@ -2118,16 +2002,14 @@ int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int cat mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return FALSE; } - /* _mmcam_dbg_log("Entered..."); */ - mmf_return_val_if_fail(name, FALSE); if (!_mmcamcorder_conf_get_category_size(handle, type, category, &count_value)) { - _mmcam_dbg_warn("No matched category... check it... categoty[%d]", category); + MMCAM_LOG_WARNING("No matched category... check it... categoty[%d]", category); return FALSE; } @@ -2135,7 +2017,6 @@ int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int cat for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_main_info_table[category][i].name, name)) { *element = hcamcorder->conf_main_info_table[category][i].value_element; - _mmcam_dbg_log("Get[%s] element[%p]", name, *element); return TRUE; } } @@ -2143,13 +2024,12 @@ int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int cat for (i = 0 ; i < count_value ; i++) { if (!strcmp(hcamcorder->conf_ctrl_info_table[category][i].name, name)) { *element = hcamcorder->conf_ctrl_info_table[category][i].value_element; - _mmcam_dbg_log("Get[%s] element[%p]", name, *element); return TRUE; } } } - _mmcam_dbg_warn("Failed to get default element... check it... Type[%d],Category[%d],Name[%s]", type, category, name); + MMCAM_LOG_ERROR("Failed to get default element. Type[%d],Category[%d],Name[%s]", type, category, name); return FALSE; } @@ -2159,30 +2039,22 @@ int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int categ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (hcamcorder == NULL) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return FALSE; } - /* - mmf_return_val_if_fail(conf_main_category_size, FALSE); - mmf_return_val_if_fail(conf_ctrl_category_size, FALSE); - */ - if (type == CONFIGURE_TYPE_MAIN) { mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE); - *size = (int)hcamcorder->conf_main_category_size[category]; } else { mmf_return_val_if_fail(category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE); - *size = (int)hcamcorder->conf_ctrl_category_size[category]; } return TRUE; } -void -_mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info) +void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info) { int i, j, k, type, category_type; @@ -2270,8 +2142,7 @@ _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info) } -static type_element * -__mmcamcorder_get_audio_codec_element(MMHandleType handle) +static type_element *__mmcamcorder_get_audio_codec_element(MMHandleType handle) { type_element *telement = NULL; const char *codec_type_str = NULL; @@ -2284,7 +2155,7 @@ __mmcamcorder_get_audio_codec_element(MMHandleType handle) mmf_return_val_if_fail(sc, NULL); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Check element availability */ mm_camcorder_get_attributes(handle, NULL, MMCAM_AUDIO_ENCODER, &codec_type, NULL); @@ -2321,7 +2192,7 @@ __mmcamcorder_get_audio_codec_element(MMHandleType handle) codec_type_str = "VORBIS"; break; default: - _mmcam_dbg_err("Not supported audio codec[%d]", codec_type); + MMCAM_LOG_ERROR("Not supported audio codec[%d]", codec_type); return NULL; } @@ -2334,8 +2205,7 @@ __mmcamcorder_get_audio_codec_element(MMHandleType handle) } -static type_element * -__mmcamcorder_get_video_codec_element(MMHandleType handle) +static type_element *__mmcamcorder_get_video_codec_element(MMHandleType handle) { type_element *telement = NULL; const char *codec_type_str = NULL; @@ -2348,8 +2218,6 @@ __mmcamcorder_get_video_codec_element(MMHandleType handle) mmf_return_val_if_fail(sc, NULL); - _mmcam_dbg_log(""); - /* Check element availability */ mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &codec_type, NULL); @@ -2373,7 +2241,7 @@ __mmcamcorder_get_video_codec_element(MMHandleType handle) codec_type_str = "THEORA"; break; default: - _mmcam_dbg_err("Not supported video codec[%d]", codec_type); + MMCAM_LOG_ERROR("Not supported video codec[%d]", codec_type); return NULL; } @@ -2386,8 +2254,7 @@ __mmcamcorder_get_video_codec_element(MMHandleType handle) } -static type_element * -__mmcamcorder_get_image_codec_element(MMHandleType handle) +static type_element *__mmcamcorder_get_image_codec_element(MMHandleType handle) { type_element *telement = NULL; const char *codec_type_str = NULL; @@ -2400,8 +2267,6 @@ __mmcamcorder_get_image_codec_element(MMHandleType handle) mmf_return_val_if_fail(sc, NULL); - _mmcam_dbg_log(""); - /* Check element availability */ mm_camcorder_get_attributes(handle, NULL, MMCAM_IMAGE_ENCODER, &codec_type, NULL); @@ -2449,7 +2314,7 @@ __mmcamcorder_get_image_codec_element(MMHandleType handle) codec_type_str = "XPM"; break; default: - _mmcam_dbg_err("Not supported image codec[%d]", codec_type); + MMCAM_LOG_ERROR("Not supported image codec[%d]", codec_type); return NULL; } @@ -2462,8 +2327,7 @@ __mmcamcorder_get_image_codec_element(MMHandleType handle) } -static type_element * -__mmcamcorder_get_file_format_element(MMHandleType handle) +static type_element *__mmcamcorder_get_file_format_element(MMHandleType handle) { type_element *telement = NULL; const char *mux_type_str = NULL; @@ -2476,8 +2340,6 @@ __mmcamcorder_get_file_format_element(MMHandleType handle) mmf_return_val_if_fail(sc, NULL); - _mmcam_dbg_log(""); - /* Check element availability */ mm_camcorder_get_attributes(handle, NULL, MMCAM_FILE_FORMAT, &file_type, NULL); @@ -2525,7 +2387,7 @@ __mmcamcorder_get_file_format_element(MMHandleType handle) mux_type_str = "M2TS"; break; default: - _mmcam_dbg_err("Not supported file format[%d]", file_type); + MMCAM_LOG_ERROR("Not supported file format[%d]", file_type); return NULL; } @@ -2538,13 +2400,10 @@ __mmcamcorder_get_file_format_element(MMHandleType handle) } -type_element * -_mmcamcorder_get_type_element(MMHandleType handle, int type) +type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type) { type_element *telement = NULL; - _mmcam_dbg_log("type:%d", type); - switch (type) { case MM_CAM_AUDIO_ENCODER: telement = __mmcamcorder_get_audio_codec_element(handle); @@ -2559,7 +2418,7 @@ _mmcamcorder_get_type_element(MMHandleType handle, int type) telement = __mmcamcorder_get_file_format_element(handle); break; default: - _mmcam_dbg_log("Can't get element type form this profile.(%d)", type); + MMCAM_LOG_INFO("Can't get element type form this profile.(%d)", type); } return telement; @@ -2571,7 +2430,7 @@ int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name) int codec_index = MM_AUDIO_CODEC_INVALID; if (!name) { - _mmcam_dbg_err("name is NULL"); + MMCAM_LOG_ERROR("name is NULL"); return MM_AUDIO_CODEC_INVALID; } @@ -2596,7 +2455,7 @@ int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name) else if (!strcmp(name, "VORBIS")) codec_index = MM_AUDIO_CODEC_VORBIS; - /*_mmcam_dbg_log("audio codec index %d", codec_index);*/ + MMCAM_LOG_DEBUG("audio codec index %d", codec_index); return codec_index; } @@ -2608,7 +2467,7 @@ int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name) int codec_index = MM_VIDEO_CODEC_INVALID; if (!name) { - _mmcam_dbg_err("name is NULL"); + MMCAM_LOG_ERROR("name is NULL"); return MM_VIDEO_CODEC_INVALID; } @@ -2625,7 +2484,7 @@ int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name) else if (!strcmp(name, "THEORA")) codec_index = MM_VIDEO_CODEC_THEORA; - /*_mmcam_dbg_log("video codec index %d", codec_index);*/ + MMCAM_LOG_DEBUG("video codec index %d", codec_index); return codec_index; } @@ -2637,7 +2496,7 @@ int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name) int codec_index = MM_IMAGE_CODEC_INVALID; if (!name) { - _mmcam_dbg_err("name is NULL"); + MMCAM_LOG_ERROR("name is NULL"); return MM_IMAGE_CODEC_INVALID; } @@ -2666,7 +2525,7 @@ int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name) else if (!strcmp(name, "XPM")) codec_index = MM_IMAGE_CODEC_XPM; - _mmcam_dbg_log("image codec index %d", codec_index); + MMCAM_LOG_DEBUG("image codec index %d", codec_index); return codec_index; } @@ -2677,7 +2536,7 @@ int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name) int mux_index = MM_FILE_FORMAT_INVALID; if (!name) { - _mmcam_dbg_err("name is NULL"); + MMCAM_LOG_ERROR("name is NULL"); return MM_FILE_FORMAT_INVALID; } @@ -2710,14 +2569,13 @@ int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name) else if (!strcmp(name, "M2TS")) mux_index = MM_FILE_FORMAT_M2TS; - /*_mmcam_dbg_log("mux index %d", mux_index);*/ + MMCAM_LOG_DEBUG("mux index %d", mux_index); return mux_index; } -int -_mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name) +int _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name) { int fmt = -1; @@ -2737,14 +2595,13 @@ _mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name fmt = _mmcamcorder_get_mux_format(handle, name); break; default: - _mmcam_dbg_log("Can't get format from this category.(%d)", conf_category); + MMCAM_LOG_ERROR("Can't get format from this category.(%d)", conf_category); } return fmt; } -int -_mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** format) +int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); camera_conf* configure_info = NULL; @@ -2753,8 +2610,6 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** mmf_return_val_if_fail(hcamcorder, 0); - /*_mmcam_dbg_log("conf_category:%d", conf_category);*/ - configure_info = hcamcorder->conf_main; if (configure_info->info[conf_category]) { @@ -2764,16 +2619,13 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** int count = configure_info->info[conf_category]->count; conf_detail *info = configure_info->info[conf_category]; - /*_mmcam_dbg_log("count[%d], info[%p]", count, info);*/ + MMCAM_LOG_DEBUG("conf_category[%d] : count[%d], info[%p]", + conf_category, count, info); if (count <= 0 || !info) return total_count; - arr = (int*) g_malloc0(count * sizeof(int)); - if (arr == NULL) { - _mmcam_dbg_err("malloc failed : %zu", count * sizeof(int)); - return 0; - } + arr = (int*)g_malloc0(count * sizeof(int)); for (i = 0 ; i < count ; i++) { if (info->detail_info[i] == NULL) @@ -2784,7 +2636,7 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** if (fmt >= 0) arr[total_count++] = fmt; - /*_mmcam_dbg_log("name:%s, fmt:%d", name, fmt);*/ + MMCAM_LOG_VERBOSE(" name:%s, fmt:%d", name, fmt); } } diff --git a/src/mm_camcorder_exifinfo.c b/src/mm_camcorder_exifinfo.c index 0865139..c907b5d 100644 --- a/src/mm_camcorder_exifinfo.c +++ b/src/mm_camcorder_exifinfo.c @@ -105,12 +105,12 @@ _exif_get_jpeg_marker_offset(void *jpeg, int jpeg_size, unsigned short marker) m[0] = marker >> 8; m[1] = marker & 0x00FF; - _mmcam_dbg_log("marker: 0x%02X 0x%02X", m[0], m[1]); + MMCAM_LOG_INFO("marker: 0x%02X 0x%02X", m[0], m[1]); if (*src == 0xff && *(src + 1) == 0xd8) { p = src + 2; /* SOI(start of image) */ } else { - _mmcam_dbg_log("invalid JPEG file."); + MMCAM_LOG_INFO("invalid JPEG file."); return 0UL; } @@ -119,12 +119,12 @@ _exif_get_jpeg_marker_offset(void *jpeg, int jpeg_size, unsigned short marker) /*marker is 0xFFxx*/ if (*(p + 1) == m[1]) { ret = p - src; - _mmcam_dbg_log("marker offset: %lu %p %p.", ret, (p+1), src); + MMCAM_LOG_INFO("marker offset: %lu %p %p.", ret, (p+1), src); return ret; } } } - _mmcam_dbg_log("Marker not found."); + MMCAM_LOG_INFO("Marker not found."); return 0UL; } #endif /* _MMCAMCORDER_EXIF_GET_JPEG_MARKER_OFFSET */ @@ -137,7 +137,7 @@ mm_exif_get_exif_data_from_data(mm_exif_info_t *info) ed = exif_data_new_from_data(info->data, info->size); if (ed == NULL) - _mmcam_dbg_log("Null exif data. (ed:%p)", ed); + MMCAM_LOG_INFO("Null exif data. (ed:%p)", ed); return ed; } @@ -153,7 +153,7 @@ mm_exif_get_exif_from_info(mm_exif_info_t *info) unsigned int i; if (!info) { - _mmcam_dbg_err("NULL exif info"); + MMCAM_LOG_ERROR("NULL exif info"); return NULL; } @@ -179,11 +179,11 @@ mm_exif_set_exif_to_info(mm_exif_info_t *info, ExifData *exif) unsigned int ebs; if (!exif) { - _mmcam_dbg_log("exif Null"); + MMCAM_LOG_INFO("exif Null"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } - _mmcam_dbg_log("exif(ifd :%p)", exif->ifd); + MMCAM_LOG_INFO("exif(ifd :%p)", exif->ifd); if (info->data) { free(info->data); @@ -193,7 +193,7 @@ mm_exif_set_exif_to_info(mm_exif_info_t *info, ExifData *exif) exif_data_save_data(exif, &eb, &ebs); if (eb == NULL) { - _mmcam_dbg_log("MM_ERROR_CAMCORDER_LOW_MEMORY"); + MMCAM_LOG_INFO("MM_ERROR_CAMCORDER_LOW_MEMORY"); return MM_ERROR_CAMCORDER_LOW_MEMORY; } info->data = eb; @@ -209,7 +209,7 @@ mm_exif_set_add_entry(ExifData *exif, ExifIfd ifd, ExifTag tag, ExifFormat forma ExifEntry *e = NULL; if (exif == NULL || format <= 0 || components <= 0 || data == NULL) { - _mmcam_dbg_err("invalid argument exif=%p format=%d, components=%lu data=%p!", + MMCAM_LOG_ERROR("invalid argument exif=%p format=%d, components=%lu data=%p!", exif, format, components, data); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -220,7 +220,7 @@ mm_exif_set_add_entry(ExifData *exif, ExifIfd ifd, ExifTag tag, ExifFormat forma /*create new tag*/ e = exif_entry_new(); if (e == NULL) { - _mmcam_dbg_err("entry create error!"); + MMCAM_LOG_ERROR("entry create error!"); return MM_ERROR_CAMCORDER_LOW_MEMORY; } @@ -267,23 +267,23 @@ mm_exif_create_exif_info(mm_exif_info_t **info) unsigned char *eb = NULL; unsigned int ebs; #endif - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!info) { - _mmcam_dbg_err("NULL pointer"); + MMCAM_LOG_ERROR("NULL pointer"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } x = malloc(sizeof(mm_exif_info_t)); if (!x) { - _mmcam_dbg_err("malloc error"); + MMCAM_LOG_ERROR("malloc error"); return MM_ERROR_CAMCORDER_LOW_MEMORY; } #if MM_EXIFINFO_USE_BINARY_EXIFDATA x->data = NULL; x->data = malloc(_EXIF_BIN_SIZE_); if (!x->data) { - _mmcam_dbg_err("malloc error"); + MMCAM_LOG_ERROR("malloc error"); free(x); return MM_ERROR_CAMCORDER_LOW_MEMORY; } @@ -292,7 +292,7 @@ mm_exif_create_exif_info(mm_exif_info_t **info) #else ed = exif_data_new(); if (!ed) { - _mmcam_dbg_err("exif data new error"); + MMCAM_LOG_ERROR("exif data new error"); free(x); return MM_ERROR_CAMCORDER_LOW_MEMORY; } @@ -305,7 +305,7 @@ mm_exif_create_exif_info(mm_exif_info_t **info) exif_data_save_data(ed, &eb, &ebs); if (eb == NULL) { - _mmcam_dbg_err("exif_data_save_data error"); + MMCAM_LOG_ERROR("exif_data_save_data error"); free(x); exif_data_unref(ed); return MM_ERROR_CAMCORDER_INTERNAL; @@ -317,7 +317,7 @@ mm_exif_create_exif_info(mm_exif_info_t **info) #endif *info = x; - _mmcam_dbg_log("Data:%p Size:%d", x->data, x->size); + MMCAM_LOG_INFO("Data:%p Size:%d", x->data, x->size); return MM_ERROR_NONE; } @@ -325,7 +325,7 @@ mm_exif_create_exif_info(mm_exif_info_t **info) void mm_exif_destory_exif_info(mm_exif_info_t *info) { - /* _mmcam_dbg_log( ""); */ + /* MMCAM_LOG_INFO( ""); */ if (info) { if (info->data) free(info->data); @@ -344,17 +344,17 @@ mm_exif_add_thumbnail_info(mm_exif_info_t *info, void *thumbnail, int width, int int ret = MM_ERROR_NONE; int cntl = 0; - _mmcam_dbg_log("Thumbnail size:%d, width:%d, height:%d", len, width, height); + MMCAM_LOG_INFO("Thumbnail size:%d, width:%d, height:%d", len, width, height); if (len > JPEG_THUMBNAIL_MAX_SIZE) { - _mmcam_dbg_err("Thumbnail size[%d] over!!! Skip inserting thumbnail...", len); + MMCAM_LOG_ERROR("Thumbnail size[%d] over!!! Skip inserting thumbnail...", len); return MM_ERROR_NONE; } /* get ExifData from info*/ ed = mm_exif_get_exif_from_info(info); if (ed == NULL) { - _mmcam_dbg_err("mm_exif_get_exif_from_info failed"); + MMCAM_LOG_ERROR("mm_exif_get_exif_from_info failed"); return MM_ERROR_CAMCORDER_INTERNAL; } @@ -414,15 +414,15 @@ mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length, mm_exif_info unsigned char *m = NULL; int m_len = 0; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (info == NULL || jpeg == NULL) { - _mmcam_dbg_err("MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p", info, jpeg); + MMCAM_LOG_ERROR("MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p", info, jpeg); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } if (jpeg_len > JPEG_MAX_SIZE) { - _mmcam_dbg_err("jpeg_len is worng jpeg_len=%d", jpeg_len); + MMCAM_LOG_ERROR("jpeg_len is wrong jpeg_len=%d", jpeg_len); return MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG; } @@ -440,10 +440,10 @@ mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length, mm_exif_info free(test_exif_info); test_exif_info = NULL; } else { - _mmcam_dbg_err("test_exif_info is NULL"); + MMCAM_LOG_ERROR("test_exif_info is NULL"); } } else { - _mmcam_dbg_warn("no EXIF in JPEG"); + MMCAM_LOG_WARNING("no EXIF in JPEG"); } /*length of output image*/ @@ -452,7 +452,7 @@ mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length, mm_exif_info /*alloc output image*/ m = malloc(m_len); if (!m) { - _mmcam_dbg_err("malloc() failed."); + MMCAM_LOG_ERROR("malloc() failed."); return MM_ERROR_CAMCORDER_LOW_MEMORY; } @@ -462,7 +462,7 @@ mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length, mm_exif_info /*set header length*/ _exif_set_uint16(0, &head_len, (unsigned short)(ebs + 2)); if (head[0] == 0 || head[1] == 0 || head_len == 0) { - _mmcam_dbg_err("setting error"); + MMCAM_LOG_ERROR("setting error"); free(m); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -484,7 +484,7 @@ mm_exif_write_exif_jpeg_to_memory(void **mem, unsigned int *length, mm_exif_info memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs, jpeg + jpeg_offset, jpeg_len - jpeg_offset); - _mmcam_dbg_log("JPEG+EXIF Copy DONE(original:%d, offset:%d, copied:%d)", + MMCAM_LOG_INFO("JPEG+EXIF Copy DONE(original:%d, offset:%d, copied:%d)", jpeg_len, jpeg_offset, jpeg_len - jpeg_offset); /*set ouput param*/ @@ -516,26 +516,26 @@ int mm_exif_load_exif_info(mm_exif_info_t **info, void *jpeg_data, int jpeg_leng memcpy((char*)x->data, b, s); x->size = s; *info = x; - _mmcam_dbg_warn("load EXIF : data %p, size %d", x->data, x->size); + MMCAM_LOG_WARNING("load EXIF : data %p, size %d", x->data, x->size); } else { - _mmcam_dbg_err("mm_exif_info_t malloc failed"); + MMCAM_LOG_ERROR("mm_exif_info_t malloc failed"); free(x); exif_loader_unref(loader); return MM_ERROR_CAMCORDER_LOW_MEMORY; } } else { - _mmcam_dbg_err("mm_exif_info_t malloc failed"); + MMCAM_LOG_ERROR("mm_exif_info_t malloc failed"); } } else { - _mmcam_dbg_err("exif_loader_get_buf failed"); + MMCAM_LOG_ERROR("exif_loader_get_buf failed"); } /* The loader is no longer needed--free it */ exif_loader_unref(loader); loader = NULL; } else { - _mmcam_dbg_err("exif_loader_new failed"); + MMCAM_LOG_ERROR("exif_loader_new failed"); } if (x) diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index 8e1af22..39c5285 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -254,7 +254,7 @@ static gboolean __mmcamcorder_set_stream_data_normal(MMCamcorderVideoStreamDataT break; default: - _mmcam_dbg_err("unsupported format[%d]", stream->format); + MMCAM_LOG_ERROR("unsupported format[%d]", stream->format); return FALSE; } @@ -290,7 +290,7 @@ static gboolean __mmcamcorder_set_stream_data_tbm(MMCamcorderVideoStreamDataType break; default: - _mmcam_dbg_err("unsupported format[%d]", stream->format); + MMCAM_LOG_ERROR("unsupported format[%d]", stream->format); return FALSE; } @@ -335,14 +335,14 @@ gboolean _mmcamcorder_invoke_video_stream_cb(MMHandleType handle, GstBuffer *buf caps = gst_pad_get_allowed_caps(pad); if (!caps) { - _mmcam_dbg_err("failed to get caps from pad %p", pad); + MMCAM_LOG_ERROR("failed to get caps from pad %p", pad); gst_object_unref(pad); return FALSE; } structure = gst_caps_get_structure(caps, 0); if (!structure) { - _mmcam_dbg_err("failed to get structure from caps %p", caps); + MMCAM_LOG_ERROR("failed to get structure from caps %p", caps); gst_caps_unref(caps); gst_object_unref(pad); return FALSE; @@ -361,18 +361,13 @@ gboolean _mmcamcorder_invoke_video_stream_cb(MMHandleType handle, GstBuffer *buf stream.height = sc->info_video->video_height; } - /* - _mmcam_dbg_log("VideoStreamData : resolution[%dx%d], format[%d]", - stream.width, stream.height, stream.format); - */ - /* set size and timestamp */ if (_mmcamcorder_is_encoded_preview_pixel_format(stream.format)) memory = gst_buffer_get_all_memory(buffer); else memory = gst_buffer_peek_memory(buffer, 0); if (!memory) { - _mmcam_dbg_err("GstMemory get failed from buffer %p", buffer); + MMCAM_LOG_ERROR("GstMemory get failed from buffer %p", buffer); return FALSE; } @@ -381,7 +376,7 @@ gboolean _mmcamcorder_invoke_video_stream_cb(MMHandleType handle, GstBuffer *buf t_surface = (tbm_surface_h)gst_tizen_memory_get_surface(memory); if (tbm_surface_get_info(t_surface, &ts_info) != TBM_SURFACE_ERROR_NONE) { - _mmcam_dbg_err("failed to get tbm surface[%p] info", t_surface); + MMCAM_LOG_ERROR("failed to get tbm surface[%p] info", t_surface); goto _INVOKE_VIDEO_STREAM_CB_DONE; } @@ -393,7 +388,7 @@ gboolean _mmcamcorder_invoke_video_stream_cb(MMHandleType handle, GstBuffer *buf for (i = 0 ; i < ts_info.num_planes ; i++) { stream.stride[i] = ts_info.planes[i].stride; stream.elevation[i] = ts_info.planes[i].size / ts_info.planes[i].stride; - /*_mmcam_dbg_log("[%d] %dx%d", i, stream.stride[i], stream.elevation[i]);*/ + MMCAM_LOG_VERBOSE(" plane[%d] %dx%d", i, stream.stride[i], stream.elevation[i]); } stream.length_total = ts_info.size; @@ -409,6 +404,9 @@ gboolean _mmcamcorder_invoke_video_stream_cb(MMHandleType handle, GstBuffer *buf goto _INVOKE_VIDEO_STREAM_CB_DONE; } + MMCAM_LOG_DEBUG("VideoStreamData : resolution[%dx%d], format[%d]", + stream.width, stream.height, stream.format); + stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer) / 1000000); /* nano sec -> milli sec */ /* invoke application callback */ @@ -483,7 +481,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Check existence */ for (i = _MMCAMCORDER_VIDEOSRC_SRC ; i <= _MMCAMCORDER_VIDEOSINK_SINK ; i++) { @@ -491,7 +489,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) if (((GObject *)sc->element[i].gst)->ref_count > 0) gst_object_unref(sc->element[i].gst); - _mmcam_dbg_log("element[index:%d] is Already existed.", i); + MMCAM_LOG_INFO("element[index:%d] is Already existed.", i); } } @@ -501,7 +499,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) "InputIndex", &input_index); if (input_index == NULL) { - _mmcam_dbg_err("Failed to get input_index"); + MMCAM_LOG_ERROR("Failed to get input_index"); return MM_ERROR_CAMCORDER_CREATE_CONFIGURE; } @@ -521,7 +519,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) MMCAM_DISPLAY_SURFACE, &display_surface_type, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -531,13 +529,13 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) MMCAM_USER_BUFFER_FD, &fds, &fd_number, NULL); if (err != MM_ERROR_NONE || fd_number < 1) { - _mmcam_dbg_err("get user buffer fd failed 0x%x, number %d", err, fd_number); + MMCAM_LOG_ERROR("get user buffer fd failed 0x%x, number %d", err, fd_number); return err; } /* for (i = 0 ; i < fd_number ; i++) - _mmcam_dbg_log("fds[%d] %d", i, fds[i]); + MMCAM_LOG_INFO("fds[%d] %d", i, fds[i]); */ } @@ -595,7 +593,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) if (hcamcorder->support_user_buffer) { control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (!gst_camera_control_set_user_buffer_fd(control, fds, fd_number)) { - _mmcam_dbg_err("set user buffer fd failed"); + MMCAM_LOG_ERROR("set user buffer fd failed"); goto pipeline_creation_error; } } @@ -618,11 +616,11 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) /* set encoded preview bitrate */ if (!_mmcamcorder_set_encoded_preview_bitrate(handle, preview_bitrate)) - _mmcam_dbg_warn("_mmcamcorder_set_encoded_preview_bitrate failed"); + MMCAM_LOG_WARNING("_mmcamcorder_set_encoded_preview_bitrate failed"); /* set encoded preview iframe interval */ if (!_mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval)) - _mmcam_dbg_warn("_mmcamcorder_set_encoded_preview_gop_interval failed"); + MMCAM_LOG_WARNING("_mmcamcorder_set_encoded_preview_gop_interval failed"); } if (display_surface_type != MM_DISPLAY_SURFACE_NULL) { @@ -642,18 +640,18 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) decoder_index = 1; snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); - _mmcam_dbg_log("encoded preview decoder_name [%s], video decoder element [%s]", + MMCAM_LOG_INFO("encoded preview decoder_name [%s], video decoder element [%s]", decoder_name, videodecoder_name); /* create decoder element */ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, decoder_name, "videosrc_decode", element_list, err); #else /* _MMCAMCORDER_RM_SUPPORT */ - _mmcam_dbg_log("video decoder element [%s]", videodecoder_name); + MMCAM_LOG_INFO("video decoder element [%s]", videodecoder_name); /* create decoder element */ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, videodecoder_name, "videosrc_decode", element_list, err); #endif /* _MMCAMCORDER_RM_SUPPORT */ _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, sc->VideodecoderElementH264); } else { - _mmcam_dbg_err("failed to get video decoder element name from %p", sc->VideodecoderElementH264); + MMCAM_LOG_ERROR("failed to get video decoder element name from %p", sc->VideodecoderElementH264); goto pipeline_creation_error; } } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { @@ -670,36 +668,36 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_uhd_mjpegdec"); else snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_mjpegdec"); - _mmcam_dbg_log("encoded preview decoder_name [%s], video decoder element [%s]", + MMCAM_LOG_INFO("encoded preview decoder_name [%s], video decoder element [%s]", decoder_name, videodecoder_name); /* create decoder element */ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, decoder_name, "videosrc_decode", element_list, err); _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, sc->VideodecoderElementH264); } else { - _mmcam_dbg_err("failed to get video decoder element name from %p", sc->VideodecoderElementH264); + MMCAM_LOG_ERROR("failed to get video decoder element name from %p", sc->VideodecoderElementH264); goto pipeline_creation_error; } #else /* _MMCAMCORDER_RM_SUPPORT */ - _mmcam_dbg_log("video decoder element [jpegdec]"); + MMCAM_LOG_INFO("video decoder element [jpegdec]"); /* create decoder element */ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, "jpegdec", "videosrc_decode", element_list, err); #endif /* _MMCAMCORDER_RM_SUPPORT */ } } - _mmcam_dbg_log("Current mode[%d]", hcamcorder->type); + MMCAM_LOG_INFO("Current mode[%d]", hcamcorder->type); /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (!videosink_name) { - _mmcam_dbg_err("failed to get videosink name"); + MMCAM_LOG_ERROR("failed to get videosink name"); goto pipeline_creation_error; } _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_QUE, "queue", "videosink_queue", element_list, err); - _mmcam_dbg_log("videosink_name: %s", videosink_name); + MMCAM_LOG_INFO("videosink_name: %s", videosink_name); if (display_surface_type == MM_DISPLAY_SURFACE_REMOTE) { _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, "ipc_sink", element_list, err); @@ -710,7 +708,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) MMCAM_DISPLAY_SOCKET_PATH, &socket_path, &socket_path_len, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get socket path failed 0x%x", err); + MMCAM_LOG_WARNING("Get socket path failed 0x%x", err); SAFE_FREE(err_name); goto pipeline_creation_error; } @@ -722,10 +720,10 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) _mmcamcorder_conf_get_value_element_name(sc->VideoconvertElement, &videoconvert_name); if (videoconvert_name) { - _mmcam_dbg_log("videoconvert element name : %s", videoconvert_name); + MMCAM_LOG_INFO("videoconvert element name : %s", videoconvert_name); _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_CLS, videoconvert_name, "videosink_cls", element_list, err); } else - _mmcam_dbg_err("failed to get videoconvert element name"); + MMCAM_LOG_ERROR("failed to get videoconvert element name"); } /* check sink element in attribute */ @@ -737,7 +735,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) int attr_index = 0; MMHandleType attrs = MMF_CAMCORDER_ATTRS(handle); - _mmcam_dbg_log("reuse sink element %p in attribute", sink_element); + MMCAM_LOG_INFO("reuse sink element %p in attribute", sink_element); _MMCAMCORDER_ELEMENT_ADD(sc, sc->element, _MMCAMCORDER_VIDEOSINK_SINK, sink_element, element_list, err); @@ -747,7 +745,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) mm_attrs_set_data(attrs, attr_index, NULL, 0); mm_attrs_commit(attrs, attr_index); } else { - _mmcam_dbg_warn("attribute is NULL"); + MMCAM_LOG_WARNING("attribute is NULL"); err = MM_ERROR_CAMCORDER_NOT_INITIALIZED; goto pipeline_creation_error; } @@ -758,7 +756,7 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) } if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) { - _mmcam_dbg_err("_mmcamcorder_videosink_window_set error"); + MMCAM_LOG_ERROR("_mmcamcorder_videosink_window_set error"); err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; goto pipeline_creation_error; } @@ -769,14 +767,14 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) /* add elements to main pipeline */ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), element_list)) { - _mmcam_dbg_err("element_list add error."); + MMCAM_LOG_ERROR("element_list add error."); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } /* link elements */ if (!_mmcamcorder_link_elements(element_list)) { - _mmcam_dbg_err("element link error."); + MMCAM_LOG_ERROR("element link error."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -844,7 +842,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); err = _mmcamcorder_check_audiocodec_fileformat_compatibility(handle); if (err != MM_ERROR_NONE) @@ -864,7 +862,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) MMCAM_SOUND_STREAM_INDEX, &stream_index, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -874,7 +872,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) if (((GObject *)sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst)->ref_count > 0) gst_object_unref(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst); - _mmcam_dbg_log("_MMCAMCORDER_AUDIOSRC_BIN is Already existed. Unref once..."); + MMCAM_LOG_INFO("_MMCAMCORDER_AUDIOSRC_BIN is Already existed. Unref once..."); } /* Create bin element */ @@ -888,7 +886,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) } if (cat_name == NULL) { - _mmcam_dbg_err("strdup failed."); + MMCAM_LOG_ERROR("strdup failed."); err = MM_ERROR_CAMCORDER_LOW_MEMORY; goto pipeline_creation_error; } @@ -902,7 +900,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) free(cat_name); cat_name = NULL; - _mmcam_dbg_log("Audio src name : %s", audiosrc_name); + MMCAM_LOG_INFO("Audio src name : %s", audiosrc_name); _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, "audiosrc_src", element_list, err); @@ -919,7 +917,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) &buffer_interval); if (_mmcamcorder_get_audiosrc_blocksize(rate, format, channel, buffer_interval, &blocksize)) { - _mmcam_dbg_log("set audiosrc block size %d", blocksize); + MMCAM_LOG_INFO("set audiosrc block size %d", blocksize); MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "blocksize", blocksize); } @@ -958,7 +956,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) "channels", G_TYPE_INT, channel, "format", G_TYPE_STRING, format_name, NULL); - _mmcam_dbg_log("caps [x-raw, rate:%d, channel:%d, depth:%d], volume %lf", + MMCAM_LOG_INFO("caps [x-raw, rate:%d, channel:%d, depth:%d], volume %lf", rate, channel, depth, volume); } else { /* what are the audio encoder which should get audio/x-raw-float? */ @@ -967,12 +965,12 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) "channels", G_TYPE_INT, channel, "format", G_TYPE_STRING, GST_AUDIO_NE(F32), NULL); - _mmcam_dbg_log("caps [x-raw (F32), rate:%d, channel:%d, endianness:%d, width:32]", + MMCAM_LOG_INFO("caps [x-raw (F32), rate:%d, channel:%d, endianness:%d, width:32]", rate, channel, BYTE_ORDER); } /* Replay Gain */ - _mmcam_dbg_log("Replay gain - enable : %d, reference level : %lf", + MMCAM_LOG_INFO("Replay gain - enable : %d, reference level : %lf", replay_gain_enable, replay_gain_ref_level); if (replay_gain_enable) { @@ -987,19 +985,19 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) gst_caps_unref(caps); caps = NULL; } else { - _mmcam_dbg_err("create caps error"); + MMCAM_LOG_ERROR("create caps error"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst), element_list)) { - _mmcam_dbg_err("element add error."); + MMCAM_LOG_ERROR("element add error."); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } if (!_mmcamcorder_link_elements(element_list)) { - _mmcam_dbg_err("element link error."); + MMCAM_LOG_ERROR("element link error."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1009,7 +1007,7 @@ int _mmcamcorder_create_audiosrc_bin(MMHandleType handle) if (!gst_element_add_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, gst_ghost_pad_new("src", pad))) { gst_object_unref(pad); pad = NULL; - _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN."); + MMCAM_LOG_ERROR("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1045,12 +1043,12 @@ void _mmcamcorder_set_encoder_bitrate(MMCamcorderEncoderType type, int codec, in int set_value = 0; if (!element) { - _mmcam_dbg_warn("NULL element, will be applied later - type %d, bitrate %d", type, bitrate); + MMCAM_LOG_WARNING("NULL element, will be applied later - type %d, bitrate %d", type, bitrate); return; } if (bitrate <= 0) { - _mmcam_dbg_warn("[type %d, codec %d] too small bitrate[%d], use default", + MMCAM_LOG_WARNING("[type %d, codec %d] too small bitrate[%d], use default", type, codec, bitrate); return; } @@ -1060,25 +1058,25 @@ void _mmcamcorder_set_encoder_bitrate(MMCamcorderEncoderType type, int codec, in switch (codec) { case MM_AUDIO_CODEC_AMR: set_value = __mmcamcorder_get_amrnb_bitrate_mode(bitrate); - _mmcam_dbg_log("Set AMR encoder mode [%d]", set_value); + MMCAM_LOG_INFO("Set AMR encoder mode [%d]", set_value); MMCAMCORDER_G_OBJECT_SET(element, "band-mode", set_value); break; case MM_AUDIO_CODEC_MP3: set_value = bitrate / 1000; - _mmcam_dbg_log("Set MP3 encoder bitrate [%d] kbps", set_value); + MMCAM_LOG_INFO("Set MP3 encoder bitrate [%d] kbps", set_value); MMCAMCORDER_G_OBJECT_SET(element, "bitrate", set_value); break; case MM_AUDIO_CODEC_AAC: - _mmcam_dbg_log("Set AAC encoder bitrate [%d] bps", bitrate); + MMCAM_LOG_INFO("Set AAC encoder bitrate [%d] bps", bitrate); MMCAMCORDER_G_OBJECT_SET(element, "bitrate", bitrate); break; default: - _mmcam_dbg_warn("Not AMR, MP3 and AAC codec, need to add code for audio bitrate"); + MMCAM_LOG_WARNING("Not AMR, MP3 and AAC codec, need to add code for audio bitrate"); break; } } else { /* video encoder bitrate setting */ - _mmcam_dbg_log("Set video encoder bitrate %d", bitrate); + MMCAM_LOG_INFO("Set video encoder bitrate %d", bitrate); MMCAMCORDER_G_OBJECT_SET(element, "bitrate", bitrate); } @@ -1131,14 +1129,14 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log("start - profile : %d", profile); + MMCAM_LOG_INFO("start - profile : %d", profile); /* Check existence */ if (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst) { if (((GObject *)sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst)->ref_count > 0) gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst); - _mmcam_dbg_log("_MMCAMCORDER_ENCSINK_BIN is Already existed."); + MMCAM_LOG_INFO("_MMCAMCORDER_ENCSINK_BIN is Already existed."); } /* Create bin element */ @@ -1162,14 +1160,14 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin /* set capsfilter */ if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) { if (_mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { - _mmcam_dbg_log("get pad from videosrc_filter"); + MMCAM_LOG_INFO("get pad from videosrc_filter"); pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src"); } else { - _mmcam_dbg_log("get pad from videosrc_que"); + MMCAM_LOG_INFO("get pad from videosrc_que"); pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src"); } if (!pad) { - _mmcam_dbg_err("get videosrc_que src pad failed"); + MMCAM_LOG_ERROR("get videosrc_que src pad failed"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1189,7 +1187,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin } if (!video_caps) { - _mmcam_dbg_err("create recording pipeline caps failed"); + MMCAM_LOG_ERROR("create recording pipeline caps failed"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1211,7 +1209,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin caps_str = gst_caps_to_string(video_caps); - _mmcam_dbg_log("encodebin caps [%s]", caps_str); + MMCAM_LOG_INFO("encodebin caps [%s]", caps_str); g_free(caps_str); caps_str = NULL; @@ -1225,7 +1223,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO && sc->info_video->use_videoscale) { if (!videoscale_caps) { - _mmcam_dbg_err("no videoscale caps"); + MMCAM_LOG_ERROR("no videoscale caps"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1241,14 +1239,14 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin &VideoscaleElement); if (!_mmcamcorder_conf_get_value_element_name(VideoscaleElement, &gst_element_vscale_name)) { - _mmcam_dbg_err("failed to get videoscale element name"); + MMCAM_LOG_ERROR("failed to get videoscale element name"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } caps_str = gst_caps_to_string(videoscale_caps); - _mmcam_dbg_log("encodebin videocale [%s][%s]", gst_element_vscale_name, caps_str); + MMCAM_LOG_INFO("encodebin videocale [%s][%s]", gst_element_vscale_name, caps_str); g_free(caps_str); caps_str = NULL; @@ -1294,16 +1292,16 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (err != MM_ERROR_NONE) { if (err_name) { - _mmcam_dbg_err("failed to get attributes [%s][0x%x]", err_name, err); + MMCAM_LOG_ERROR("failed to get attributes [%s][0x%x]", err_name, err); SAFE_FREE(err_name); } else { - _mmcam_dbg_err("failed to get attributes [0x%x]", err); + MMCAM_LOG_ERROR("failed to get attributes [0x%x]", err); } goto pipeline_creation_error; } - _mmcam_dbg_log("Profile[%d]", profile); + MMCAM_LOG_INFO("Profile[%d]", profile); /* Set information */ if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) { @@ -1328,7 +1326,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aar, &auto_audio_resample); _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_acs, &auto_color_space); - _mmcam_dbg_log("Profile:%d, AutoAudioConvert:%d, AutoAudioResample:%d, AutoColorSpace:%d", + MMCAM_LOG_INFO("Profile:%d, AutoAudioConvert:%d, AutoAudioResample:%d, AutoColorSpace:%d", encodebin_profile, auto_audio_convert, auto_audio_resample, auto_color_space); MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "profile", encodebin_profile); @@ -1347,7 +1345,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin VideoencElement = _mmcamcorder_get_type_element(handle, MM_CAM_VIDEO_ENCODER); if (!VideoencElement) { - _mmcam_dbg_err("Fail to get type element"); + MMCAM_LOG_ERROR("Fail to get type element"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1360,19 +1358,19 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin } if (gst_element_venc_name) { - _mmcam_dbg_log("video encoder name [%s]", gst_element_venc_name); + MMCAM_LOG_INFO("video encoder name [%s]", gst_element_venc_name); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "venc-name", gst_element_venc_name); _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC, "video-encode", err); } else { - _mmcam_dbg_err("Fail to get video encoder name"); + MMCAM_LOG_ERROR("Fail to get video encoder name"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } /* set color space converting element */ if (auto_color_space) { - _mmcam_dbg_log("set video convert element [%s]", videoconvert_name); + MMCAM_LOG_INFO("set video convert element [%s]", videoconvert_name); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "vconv-name", videoconvert_name); _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VCONV, "video-convert", err); @@ -1392,10 +1390,10 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin gst_caps_unref(video_caps); video_caps = NULL; } else { - _mmcam_dbg_warn("failed to create caps"); + MMCAM_LOG_WARNING("failed to create caps"); } } else { - _mmcam_dbg_log("current video codec is not openmax but [%s]", gst_element_venc_name); + MMCAM_LOG_INFO("current video codec is not openmax but [%s]", gst_element_venc_name); } } } @@ -1414,7 +1412,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin AudioencElement = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER); if (!AudioencElement) { - _mmcam_dbg_err("Fail to get type element"); + MMCAM_LOG_ERROR("Fail to get type element"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1440,7 +1438,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", audio_caps); gst_caps_unref(audio_caps); audio_caps = NULL; - _mmcam_dbg_log("***** MM_AUDIO_CODEC_OGG : setting audio/x-raw-int "); + MMCAM_LOG_INFO("***** MM_AUDIO_CODEC_OGG : setting audio/x-raw-int "); } _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, @@ -1458,7 +1456,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (cap_format == MM_PIXEL_FORMAT_ENCODED) { ImageencElement = _mmcamcorder_get_type_element(handle, MM_CAM_IMAGE_ENCODER); if (!ImageencElement) { - _mmcam_dbg_err("Fail to get type element"); + MMCAM_LOG_ERROR("Fail to get type element"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1477,7 +1475,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (profile != MM_CAMCORDER_ENCBIN_PROFILE_IMAGE) { MuxElement = _mmcamcorder_get_type_element(handle, MM_CAM_FILE_FORMAT); if (!MuxElement) { - _mmcam_dbg_err("Fail to get type element"); + MMCAM_LOG_ERROR("Fail to get type element"); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } @@ -1526,23 +1524,23 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin a_bitrate, sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst); } - _mmcam_dbg_log("Element creation complete"); + MMCAM_LOG_INFO("Element creation complete"); /* Add element to bin */ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst), element_list)) { - _mmcam_dbg_err("element add error."); + MMCAM_LOG_ERROR("element add error."); err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto pipeline_creation_error; } - _mmcam_dbg_log("Element add complete"); + MMCAM_LOG_INFO("Element add complete"); if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) { pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video"); if (!gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("video_sink0", pad))) { gst_object_unref(pad); pad = NULL; - _mmcam_dbg_err("failed to create ghost video_sink0 on _MMCAMCORDER_ENCSINK_BIN."); + MMCAM_LOG_ERROR("failed to create ghost video_sink0 on _MMCAMCORDER_ENCSINK_BIN."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1554,7 +1552,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (!gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad))) { gst_object_unref(pad); pad = NULL; - _mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN."); + MMCAM_LOG_ERROR("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1566,7 +1564,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (!gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad))) { gst_object_unref(pad); pad = NULL; - _mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN."); + MMCAM_LOG_ERROR("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1578,7 +1576,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (!gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("image_sink0", pad))) { gst_object_unref(pad); pad = NULL; - _mmcam_dbg_err("failed to create ghost image_sink0 on _MMCAMCORDER_ENCSINK_BIN."); + MMCAM_LOG_ERROR("failed to create ghost image_sink0 on _MMCAMCORDER_ENCSINK_BIN."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1586,11 +1584,11 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin pad = NULL; } - _mmcam_dbg_log("Get pad complete"); + MMCAM_LOG_INFO("Get pad complete"); /* Link internal element */ if (!_mmcamcorder_link_elements(element_list)) { - _mmcam_dbg_err("element link error."); + MMCAM_LOG_ERROR("element link error."); err = MM_ERROR_CAMCORDER_GST_LINK; goto pipeline_creation_error; } @@ -1598,7 +1596,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin if (element_list) g_list_free(element_list); - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return MM_ERROR_NONE; @@ -1646,7 +1644,7 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /** Create gstreamer element **/ /* Main pipeline */ @@ -1659,10 +1657,10 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle) /* Set data probe function */ if (sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst) { - _mmcam_dbg_log("add video dataprobe to videosrc queue"); + MMCAM_LOG_INFO("add video dataprobe to videosrc queue"); srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src"); } else { - _mmcam_dbg_err("there is no queue plugin"); + MMCAM_LOG_ERROR("there is no queue plugin"); goto pipeline_creation_error; } @@ -1673,7 +1671,7 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle) gst_object_unref(srcpad); srcpad = NULL; } else { - _mmcam_dbg_err("failed to get srcpad"); + MMCAM_LOG_ERROR("failed to get srcpad"); goto pipeline_creation_error; } @@ -1714,7 +1712,7 @@ void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpoi mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; - /*_mmcam_dbg_log("start");*/ + /*MMCAM_LOG_INFO("start");*/ mmf_return_if_fail(hcamcorder); mmf_return_if_fail(hcamcorder->sub_context); @@ -1723,7 +1721,7 @@ void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpoi /* set flag */ if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_INIT) { sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_RUN; - _mmcam_dbg_warn("set push_encoding_buffer RUN"); + MMCAM_LOG_WARNING("set push_encoding_buffer RUN"); } } @@ -1759,7 +1757,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -1787,10 +1785,10 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi NULL); if (err != MM_ERROR_NONE) { if (err_name) { - _mmcam_dbg_err("failed to get attributes [%s][0x%x]", err_name, err); + MMCAM_LOG_ERROR("failed to get attributes [%s][0x%x]", err_name, err); SAFE_FREE(err_name); } else { - _mmcam_dbg_err("failed to get attributes [0x%x]", err); + MMCAM_LOG_ERROR("failed to get attributes [0x%x]", err); } return err; @@ -1799,20 +1797,20 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi _mmcamcorder_conf_get_value_element_name(VideosinkElement, &videosink_name); if (!videosink_name) { - _mmcam_dbg_err("failed to get videosink name"); + MMCAM_LOG_ERROR("failed to get videosink name"); return MM_ERROR_CAMCORDER_INTERNAL; } - _mmcam_dbg_log("(dp_handle=%p, size=%d)", dp_handle, size); + MMCAM_LOG_INFO("(dp_handle=%p, size=%d)", dp_handle, size); /* Set display handle */ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) { if (dp_handle) { xid = *dp_handle; - _mmcam_dbg_log("xid = %lu )", xid); + MMCAM_LOG_INFO("xid = %lu )", xid); gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), xid); } else { - _mmcam_dbg_warn("Handle is NULL. Set xid as 0.. but, it's not recommended."); + MMCAM_LOG_WARNING("Handle is NULL. Set xid as 0.. but, it's not recommended."); gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), 0); } #ifdef _MMCAMCORDER_RM_SUPPORT @@ -1822,27 +1820,27 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi MMCAMCORDER_G_OBJECT_SET(vsink, "device-scaler", display_scaler); #endif /* _MMCAMCORDER_RM_SUPPORT */ } else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) { - _mmcam_dbg_log("videosink : %s, handle : %p", videosink_name, dp_handle); + MMCAM_LOG_INFO("videosink : %s, handle : %p", videosink_name, dp_handle); if (dp_handle) { MMCAMCORDER_G_OBJECT_SET_POINTER(vsink, "evas-object", dp_handle); MMCAMCORDER_G_OBJECT_SET(vsink, "origin-size", !do_scaling); } else { - _mmcam_dbg_err("display handle(eavs object) is NULL"); + MMCAM_LOG_ERROR("display handle(eavs object) is NULL"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } } else if (!strcmp(videosink_name, "tizenwlsink")) { if (dp_handle) { window_info = (MMCamWindowInfo *)dp_handle; - _mmcam_dbg_log("wayland global surface id : %d", window_info->surface_id); + MMCAM_LOG_INFO("wayland global surface id : %d", window_info->surface_id); gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(vsink), window_info->surface_id); } else { - _mmcam_dbg_warn("Handle is NULL. skip setting."); + MMCAM_LOG_WARNING("Handle is NULL. skip setting."); } } else if (!strcmp(videosink_name, "directvideosink")) { if (dp_handle) { window_info = (MMCamWindowInfo *)dp_handle; - _mmcam_dbg_log("wayland global surface id : %d, x,y,w,h (%d,%d,%d,%d)", + MMCAM_LOG_INFO("wayland global surface id : %d, x,y,w,h (%d,%d,%d,%d)", window_info->surface_id, window_info->rect.x, window_info->rect.y, @@ -1855,7 +1853,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi window_info->rect.width, window_info->rect.height); } else { - _mmcam_dbg_warn("dp_handle is null"); + MMCAM_LOG_WARNING("dp_handle is null"); } #ifdef _MMCAMCORDER_RM_SUPPORT if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER_SUB) @@ -1863,10 +1861,10 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi MMCAMCORDER_G_OBJECT_SET(vsink, "device-scaler", display_scaler); #endif /* _MMCAMCORDER_RM_SUPPORT */ } else { - _mmcam_dbg_warn("Who are you?? (Videosink: %s)", videosink_name); + MMCAM_LOG_WARNING("Who are you?? (Videosink: %s)", videosink_name); } - _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[%d],flip[%d]", + MMCAM_LOG_INFO("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[%d],flip[%d]", videosink_name, display_geometry_method, origin_size, visible, rotation, flip); /* Set attribute */ @@ -1889,7 +1887,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi zoom_level = 3; break; default: - _mmcam_dbg_warn("Unsupported zoom value. set as default."); + MMCAM_LOG_WARNING("Unsupported zoom value. set as default."); zoom_level = 1; break; } @@ -1938,14 +1936,14 @@ int _mmcamcorder_video_frame_stabilize(MMHandleType handle, int cmd) category = CONFIGURE_CATEGORY_CTRL_CAPTURE; break; default: - _mmcam_dbg_warn("unknown command : %d", cmd); + MMCAM_LOG_WARNING("unknown command : %d", cmd); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl, category, "FrameStabilityCount", &sc->frame_stability_count); - _mmcam_dbg_log("[cmd %d] frame stability count : %d", + MMCAM_LOG_INFO("[cmd %d] frame stability count : %d", cmd, sc->frame_stability_count); return MM_ERROR_NONE; @@ -1978,7 +1976,7 @@ gboolean _mmcamcorder_get_device_info(MMHandleType handle) if (exif_info.focal_len_denominator != 0) focal_len = ((double)exif_info.focal_len_numerator) / ((double) exif_info.focal_len_denominator); } else { - _mmcam_dbg_err("Fail to get camera control interface!"); + MMCAM_LOG_ERROR("Fail to get camera control interface!"); focal_len = 0.0; } } @@ -1988,12 +1986,12 @@ gboolean _mmcamcorder_get_device_info(MMHandleType handle) MMCAM_CAMERA_FOCAL_LENGTH, focal_len, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_err("Set attributes error(%s:%x)!", err_name, err); + MMCAM_LOG_ERROR("Set attributes error(%s:%x)!", err_name, err); SAFE_FREE(err_name); return FALSE; } } else { - _mmcam_dbg_warn("Sub context isn't exist."); + MMCAM_LOG_WARNING("Sub context isn't exist."); return FALSE; } @@ -2022,15 +2020,15 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP if (sc->drop_vframe > 0) { if (sc->pass_first_vframe > 0) { sc->pass_first_vframe--; - _mmcam_dbg_log("Pass video frame by pass_first_vframe"); + MMCAM_LOG_INFO("Pass video frame by pass_first_vframe"); } else { sc->drop_vframe--; - _mmcam_dbg_log("Drop video frame by drop_vframe"); + MMCAM_LOG_INFO("Drop video frame by drop_vframe"); return GST_PAD_PROBE_DROP; } } else if (sc->frame_stability_count > 0) { sc->frame_stability_count--; - _mmcam_dbg_log("Drop video frame by frame_stability_count"); + MMCAM_LOG_INFO("Drop video frame by frame_stability_count"); return GST_PAD_PROBE_DROP; } @@ -2044,7 +2042,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP kpi->init_video_time.tv_usec == kpi->last_video_time.tv_usec && kpi->init_video_time.tv_usec == 0) { /* - _mmcam_dbg_log("START to measure FPS"); + MMCAM_LOG_INFO("START to measure FPS"); */ gettimeofday(&(kpi->init_video_time), NULL); } @@ -2065,7 +2063,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP kpi->last_video_time.tv_sec = current_video_time.tv_sec; kpi->last_video_time.tv_usec = current_video_time.tv_usec; /* - _mmcam_dbg_log("current fps(%d), average(%d)", kpi->current_fps, kpi->average_fps); + MMCAM_LOG_INFO("current fps(%d), average(%d)", kpi->current_fps, kpi->average_fps); */ } } @@ -2073,7 +2071,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP /* The first H.264 frame should not be skipped for vstream cb. */ if (hcamcorder->state < MM_CAMCORDER_STATE_PREPARE && sc->info_image->preview_format != MM_PIXEL_FORMAT_ENCODED_H264) { - _mmcam_dbg_warn("Not ready for stream callback"); + MMCAM_LOG_WARNING("Not ready for stream callback"); return GST_PAD_PROBE_OK; } @@ -2109,7 +2107,7 @@ GstPadProbeReturn __mmcamcorder_muxed_dataprobe(GstPad *pad, GstPadProbeInfo *in mmf_return_val_if_fail(sc, GST_PAD_PROBE_OK); if (!gst_buffer_map(buffer, &mapinfo, GST_MAP_READ)) { - _mmcam_dbg_warn("map failed : buffer %p", buffer); + MMCAM_LOG_WARNING("map failed : buffer %p", buffer); return GST_PAD_PROBE_OK; } @@ -2150,18 +2148,18 @@ GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo case GST_EVENT_LATENCY: /* downstream serialized events */ case GST_EVENT_BUFFERSIZE: - _mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_INFO("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); break; case GST_EVENT_TAG: { GstTagList *tag_list = NULL; _MMCamcorderReplayGain *replay_gain = NULL; - _mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_INFO("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); hcamcorder = MMF_CAMCORDER(u_data); if (!hcamcorder || !hcamcorder->sub_context) { - _mmcam_dbg_warn("NULL handle"); + MMCAM_LOG_WARNING("NULL handle"); break; } @@ -2169,58 +2167,58 @@ GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo gst_event_parse_tag(event, &tag_list); if (!tag_list) { - _mmcam_dbg_warn("failed to get tag list"); + MMCAM_LOG_WARNING("failed to get tag list"); break; } if (!gst_tag_list_get_double(tag_list, GST_TAG_TRACK_PEAK, &replay_gain->track_peak)) { - _mmcam_dbg_warn("failed to get GST_TAG_TRACK_PEAK"); + MMCAM_LOG_WARNING("failed to get GST_TAG_TRACK_PEAK"); break; } if (!gst_tag_list_get_double(tag_list, GST_TAG_TRACK_GAIN, &replay_gain->track_gain)) { - _mmcam_dbg_warn("failed to get GST_TAG_TRACK_GAIN"); + MMCAM_LOG_WARNING("failed to get GST_TAG_TRACK_GAIN"); break; } if (!gst_tag_list_get_double(tag_list, GST_TAG_ALBUM_PEAK, &replay_gain->album_peak)) { - _mmcam_dbg_warn("failed to get GST_TAG_ALBUM_PEAK"); + MMCAM_LOG_WARNING("failed to get GST_TAG_ALBUM_PEAK"); break; } if (!gst_tag_list_get_double(tag_list, GST_TAG_ALBUM_GAIN, &replay_gain->album_gain)) { - _mmcam_dbg_warn("failed to get GST_TAG_ALBUM_PEAK"); + MMCAM_LOG_WARNING("failed to get GST_TAG_ALBUM_PEAK"); break; } - _mmcam_dbg_log("Track [peak %lf, gain %lf], Album [peak %lf, gain %lf]", + MMCAM_LOG_INFO("Track [peak %lf, gain %lf], Album [peak %lf, gain %lf]", replay_gain->track_peak, replay_gain->track_gain, replay_gain->album_peak, replay_gain->album_gain); } break; case GST_EVENT_SEGMENT: - _mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_INFO("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); hcamcorder = MMF_CAMCORDER(u_data); if (!hcamcorder) { - _mmcam_dbg_warn("NULL handle"); + MMCAM_LOG_WARNING("NULL handle"); break; } sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); if (!sc) { - _mmcam_dbg_warn("NULL sub context"); + MMCAM_LOG_WARNING("NULL sub context"); break; } if (!sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst) { - _mmcam_dbg_warn("no encoder sink"); + MMCAM_LOG_WARNING("no encoder sink"); break; } parent = gst_pad_get_parent(pad); if (!parent) { - _mmcam_dbg_warn("get parent failed"); + MMCAM_LOG_WARNING("get parent failed"); break; } @@ -2228,7 +2226,7 @@ GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo const GstSegment *segment; gst_event_parse_segment(event, &segment); if (segment->format == GST_FORMAT_BYTES) { - _mmcam_dbg_log("change current offset %llu -> %"G_GUINT64_FORMAT, + MMCAM_LOG_INFO("change current offset %llu -> %"G_GUINT64_FORMAT, sc->muxed_stream_offset, segment->start); sc->muxed_stream_offset = (unsigned long long)segment->start; @@ -2239,15 +2237,15 @@ GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo parent = NULL; break; case GST_EVENT_EOS: - _mmcam_dbg_warn("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_WARNING("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); break; /* bidirectional events */ case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_STOP: - _mmcam_dbg_err("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_ERROR("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); break; default: - _mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); + MMCAM_LOG_INFO("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event)); break; } @@ -2292,22 +2290,22 @@ int _mmcamcorder_get_eos_message(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log("START"); + MMCAM_LOG_INFO("START"); _MMCAMCORDER_LOCK(handle); if (sc->bget_eos == FALSE) { end_time = g_get_monotonic_time() + 3 * G_TIME_SPAN_SECOND; if (_MMCAMCORDER_WAIT_UNTIL(handle, end_time)) { - _mmcam_dbg_log("EOS signal received"); + MMCAM_LOG_INFO("EOS signal received"); } else { - _mmcam_dbg_err("EOS wait time out"); + MMCAM_LOG_ERROR("EOS wait time out"); if (hcamcorder->error_code == MM_ERROR_NONE) hcamcorder->error_code = MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT; } } else { - _mmcam_dbg_log("already got EOS"); + MMCAM_LOG_INFO("already got EOS"); } _MMCAMCORDER_UNLOCK(handle); @@ -2324,10 +2322,10 @@ int _mmcamcorder_get_eos_message(MMHandleType handle) } } else { ret = hcamcorder->error_code; - _mmcam_dbg_err("error 0x%x", ret); + MMCAM_LOG_ERROR("error 0x%x", ret); } - _mmcam_dbg_log("END"); + MMCAM_LOG_INFO("END"); return ret; } @@ -2341,7 +2339,7 @@ void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int mmf_return_if_fail(handle && remove_element); mmf_return_if_fail((first_elem >= 0) && (last_elem > 0) && (last_elem > first_elem)); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); for (i = first_elem ; i <= last_elem ; i++) { remove_element[i].gst = NULL; @@ -2361,26 +2359,26 @@ int _mmcamcorder_check_codec_fileformat_compatibility(const char *codec_type, in if (codec > MM_AUDIO_CODEC_INVALID && codec < MM_AUDIO_CODEC_NUM && file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { if (audiocodec_fileformat_compatibility_table[codec][file_format] == 0) { - _mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.", codec, file_format); + MMCAM_LOG_ERROR("Audio codec[%d] and file format[%d] compatibility FAILED.", codec, file_format); return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE; } - _mmcam_dbg_log("Audio codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format); + MMCAM_LOG_INFO("Audio codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format); } else { - _mmcam_dbg_err("Audio codec[%d] or file format[%d] is INVALID.", codec, file_format); + MMCAM_LOG_ERROR("Audio codec[%d] or file format[%d] is INVALID.", codec, file_format); return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE; } } else if (!strcmp(codec_type, MMCAM_VIDEO_ENCODER)) { if (codec > MM_VIDEO_CODEC_INVALID && codec < MM_VIDEO_CODEC_NUM && file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { if (videocodec_fileformat_compatibility_table[codec][file_format] == 0) { - _mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.", codec, file_format); + MMCAM_LOG_ERROR("Video codec[%d] and file format[%d] compatibility FAILED.", codec, file_format); return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE; } - _mmcam_dbg_log("Video codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format); + MMCAM_LOG_INFO("Video codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format); } else { - _mmcam_dbg_err("Video codec[%d] or file format[%d] is INVALID.", codec, file_format); + MMCAM_LOG_ERROR("Video codec[%d] or file format[%d] is INVALID.", codec, file_format); return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE; } } @@ -2402,7 +2400,7 @@ int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle) MMCAM_FILE_FORMAT, &file_format, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -2427,7 +2425,7 @@ int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle) MMCAM_FILE_FORMAT, &file_format, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -2457,7 +2455,7 @@ bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate, /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -2465,14 +2463,14 @@ bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate, !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "directvideosink")) { MMCAMCORDER_G_OBJECT_SET(sc->element[videosink_index].gst, "rotate", display_rotate); - _mmcam_dbg_log("Set display-rotate [%d] done.", display_rotate); + MMCAM_LOG_INFO("Set display-rotate [%d] done.", display_rotate); } else { - _mmcam_dbg_warn("[%s] does not support DISPLAY_ROTATION, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support DISPLAY_ROTATION, but no error", videosink_name); } return TRUE; } else { - _mmcam_dbg_err("Videosink element is null"); + MMCAM_LOG_ERROR("Videosink element is null"); return FALSE; } } @@ -2496,7 +2494,7 @@ bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip, int vi /* Get videosink name */ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); if (videosink_name == NULL) { - _mmcam_dbg_err("Please check videosink element in configuration file"); + MMCAM_LOG_ERROR("Please check videosink element in configuration file"); return FALSE; } @@ -2504,14 +2502,14 @@ bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip, int vi !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "directvideosink")) { MMCAMCORDER_G_OBJECT_SET(sc->element[videosink_index].gst, "flip", display_flip); - _mmcam_dbg_log("Set display flip [%d] done.", display_flip); + MMCAM_LOG_INFO("Set display flip [%d] done.", display_flip); } else { - _mmcam_dbg_warn("[%s] does not support DISPLAY_FLIP, but no error", videosink_name); + MMCAM_LOG_WARNING("[%s] does not support DISPLAY_FLIP, but no error", videosink_name); } return TRUE; } else { - _mmcam_dbg_err("Videosink element is null"); + MMCAM_LOG_ERROR("Videosink element is null"); return FALSE; } } @@ -2529,7 +2527,7 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc) { - _mmcam_dbg_log("sub context is not initialized"); + MMCAM_LOG_INFO("sub context is not initialized"); return TRUE; } @@ -2539,7 +2537,7 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate MMCAM_CAMERA_FPS, &fps, NULL); - _mmcam_dbg_log("set rotate %d", videosrc_rotate); + MMCAM_LOG_INFO("set rotate %d", videosrc_rotate); return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, sc->info_video->preview_width, sc->info_video->preview_height, @@ -2567,17 +2565,17 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc || !(sc->element)) { - _mmcam_dbg_log("sub context is not initialized"); + MMCAM_LOG_INFO("sub context is not initialized"); return TRUE; } if (!sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { - _mmcam_dbg_err("Video src is NULL!"); + MMCAM_LOG_ERROR("Video src is NULL!"); return FALSE; } if (!sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst) { - _mmcam_dbg_err("Video filter is NULL!"); + MMCAM_LOG_ERROR("Video filter is NULL!"); return FALSE; } @@ -2594,7 +2592,7 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in MMCAM_VIDEO_WIDTH, &sc->info_video->video_width, MMCAM_VIDEO_HEIGHT, &sc->info_video->video_height, NULL); - _mmcam_dbg_log("motion rate %f, capture size %dx%d, fps auto %d, video size %dx%d", + MMCAM_LOG_INFO("motion rate %f, capture size %dx%d, fps auto %d, video size %dx%d", motion_rate, capture_width, capture_height, fps_auto, sc->info_video->video_width, sc->info_video->video_height); @@ -2640,7 +2638,7 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in set_width = width; set_height = height; - _mmcam_dbg_warn("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]", rotate); + MMCAM_LOG_WARNING("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]", rotate); } MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", &caps); @@ -2668,9 +2666,9 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in if (_mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { if (set_width == caps_width && set_height == caps_height && set_rotate == caps_rotate && fps == caps_fps) { - _mmcam_dbg_log("No need to replace caps."); + MMCAM_LOG_INFO("No need to replace caps."); } else { - _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", + MMCAM_LOG_INFO("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", caps_fourcc, caps_fourcc>>8, caps_fourcc>>16, caps_fourcc>>24, caps_width, caps_height, caps_fps, caps_rotate, fourcc, fourcc>>8, fourcc>>16, fourcc>>24, @@ -2680,9 +2678,9 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in } else { if (set_width == caps_width && set_height == caps_height && fourcc == caps_fourcc && set_rotate == caps_rotate && fps == caps_fps) { - _mmcam_dbg_log("No need to replace caps."); + MMCAM_LOG_INFO("No need to replace caps."); } else { - _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", + MMCAM_LOG_INFO("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", caps_fourcc, caps_fourcc>>8, caps_fourcc>>16, caps_fourcc>>24, caps_width, caps_height, caps_fps, caps_rotate, fourcc, fourcc>>8, fourcc>>16, fourcc>>24, @@ -2693,9 +2691,9 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in #else /*_MMCAMCORDER_PRODUCT_TV */ if (set_width == caps_width && set_height == caps_height && fourcc == caps_fourcc && set_rotate == caps_rotate && fps == caps_fps) { - _mmcam_dbg_log("No need to replace caps."); + MMCAM_LOG_INFO("No need to replace caps."); } else { - _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", + MMCAM_LOG_INFO("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", caps_fourcc, caps_fourcc>>8, caps_fourcc>>16, caps_fourcc>>24, caps_width, caps_height, caps_fps, caps_rotate, fourcc, fourcc>>8, fourcc>>16, fourcc>>24, @@ -2704,11 +2702,11 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in } #endif /*_MMCAMCORDER_PRODUCT_TV */ } else { - _mmcam_dbg_log("can not get structure of caps. set new one..."); + MMCAM_LOG_INFO("can not get structure of caps. set new one..."); do_set_caps = TRUE; } } else { - _mmcam_dbg_log("No caps. set new one..."); + MMCAM_LOG_INFO("No caps. set new one..."); do_set_caps = TRUE; } @@ -2729,7 +2727,7 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in if (display_surface_type != MM_DISPLAY_SURFACE_NULL && __mmcamcorder_find_max_resolution(handle, &maxwidth, &maxheight) == false) { - _mmcam_dbg_err("can not find max resolution limitation"); + MMCAM_LOG_ERROR("can not find max resolution limitation"); return false; } else if (display_surface_type == MM_DISPLAY_SURFACE_NULL) { maxwidth = set_width; @@ -2774,18 +2772,18 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in gchar *caps_str = gst_caps_to_string(caps); if (caps_str) { - _mmcam_dbg_log("vidoesrc new caps set [%s]", caps_str); + MMCAM_LOG_INFO("vidoesrc new caps set [%s]", caps_str); g_free(caps_str); caps_str = NULL; } else { - _mmcam_dbg_warn("caps string failed"); + MMCAM_LOG_WARNING("caps string failed"); } MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps); gst_caps_unref(caps); caps = NULL; } else { - _mmcam_dbg_err("There are no caps"); + MMCAM_LOG_ERROR("There are no caps"); } } @@ -2809,7 +2807,7 @@ bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int videosrc_flip) if (!sc) return TRUE; - _mmcam_dbg_log("Set FLIP %d", videosrc_flip); + MMCAM_LOG_INFO("Set FLIP %d", videosrc_flip); if (sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { int hflip = 0; @@ -2820,16 +2818,16 @@ bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int videosrc_flip) hflip = (videosrc_flip & MM_FLIP_HORIZONTAL) == MM_FLIP_HORIZONTAL; vflip = (videosrc_flip & MM_FLIP_VERTICAL) == MM_FLIP_VERTICAL; - _mmcam_dbg_log("videosrc flip H:%d, V:%d", hflip, vflip); + MMCAM_LOG_INFO("videosrc flip H:%d, V:%d", hflip, vflip); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hflip", hflip); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", vflip); } else { - _mmcam_dbg_warn("ITLV format does not support FLIP. Ignore FLIP[%d]", + MMCAM_LOG_WARNING("ITLV format does not support FLIP. Ignore FLIP[%d]", videosrc_flip); } } else { - _mmcam_dbg_warn("element is NULL"); + MMCAM_LOG_WARNING("element is NULL"); return FALSE; } @@ -2854,7 +2852,7 @@ bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake) v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst; if (!v_src) { - _mmcam_dbg_warn("videosrc element is NULL"); + MMCAM_LOG_WARNING("videosrc element is NULL"); return FALSE; } @@ -2862,16 +2860,16 @@ bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake) /* set anti-shake with camera control */ if (!GST_IS_CAMERA_CONTROL(v_src)) { - _mmcam_dbg_warn("Can't cast Video source into camera control."); + MMCAM_LOG_WARNING("Can't cast Video source into camera control."); return FALSE; } control = GST_CAMERA_CONTROL(v_src); if (gst_camera_control_set_ahs(control, set_value)) { - _mmcam_dbg_log("Succeed in operating anti-handshake. value[%d]", set_value); + MMCAM_LOG_INFO("Succeed in operating anti-handshake. value[%d]", set_value); return TRUE; } else { - _mmcam_dbg_warn("Failed to operate anti-handshake. value[%d]", set_value); + MMCAM_LOG_WARNING("Failed to operate anti-handshake. value[%d]", set_value); } return FALSE; @@ -2891,7 +2889,7 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst; if (!v_src) { - _mmcam_dbg_warn("videosrc element is NULL"); + MMCAM_LOG_WARNING("videosrc element is NULL"); return FALSE; } @@ -2901,7 +2899,7 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat int video_height = 0; if (stabilization == MM_CAMCORDER_VIDEO_STABILIZATION_ON) { - _mmcam_dbg_log("ENABLE video stabilization"); + MMCAM_LOG_INFO("ENABLE video stabilization"); /* VDIS mode only supports NV12 and [720p or 1080p or 1088 * 1088] */ mm_camcorder_get_attributes(handle, NULL, @@ -2910,14 +2908,14 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat NULL); if (sc->info_image->preview_format == MM_PIXEL_FORMAT_NV12 && video_width >= 1080 && video_height >= 720) { - _mmcam_dbg_log("NV12, video size %dx%d, ENABLE video stabilization", + MMCAM_LOG_INFO("NV12, video size %dx%d, ENABLE video stabilization", video_width, video_height); /* set vdis mode */ g_object_set(G_OBJECT(v_src), "enable-vdis-mode", TRUE, NULL); } else { - _mmcam_dbg_warn("invalid preview format %c%c%c%c or video size %dx%d", + MMCAM_LOG_WARNING("invalid preview format %c%c%c%c or video size %dx%d", sc->fourcc, sc->fourcc>>8, sc->fourcc>>16, sc->fourcc>>24, video_width, video_height); return FALSE; @@ -2928,13 +2926,13 @@ bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilizat "enable-vdis-mode", FALSE, NULL); - _mmcam_dbg_log("DISABLE video stabilization"); + MMCAM_LOG_INFO("DISABLE video stabilization"); } } else if (stabilization == MM_CAMCORDER_VIDEO_STABILIZATION_ON) { - _mmcam_dbg_err("no property for video stabilization, so can not set ON"); + MMCAM_LOG_ERROR("no property for video stabilization, so can not set ON"); return FALSE; } else { - _mmcam_dbg_warn("no property for video stabilization"); + MMCAM_LOG_WARNING("no property for video stabilization"); } return TRUE; @@ -2958,7 +2956,7 @@ bool _mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int heig MMCAM_CAMERA_FPS, &fps, NULL); - _mmcam_dbg_log("set %dx%d", width, height); + MMCAM_LOG_INFO("set %dx%d", width, height); return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, sc->videosrc_rotate); } @@ -2969,22 +2967,22 @@ bool _mmcamcorder_set_encoded_preview_bitrate(MMHandleType handle, int bitrate) _MMCamcorderSubContext *sc = NULL; if ((void *)handle == NULL) { - _mmcam_dbg_warn("handle is NULL"); + MMCAM_LOG_WARNING("handle is NULL"); return FALSE; } sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc) { - _mmcam_dbg_warn("subcontext is NULL"); + MMCAM_LOG_WARNING("subcontext is NULL"); return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst == NULL) { - _mmcam_dbg_warn("videosrc plugin is NULL"); + MMCAM_LOG_WARNING("videosrc plugin is NULL"); return FALSE; } - _mmcam_dbg_log("set encoded preview bitrate : %d bps", bitrate); + MMCAM_LOG_INFO("set encoded preview bitrate : %d bps", bitrate); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "bitrate", bitrate); @@ -2997,22 +2995,22 @@ bool _mmcamcorder_set_encoded_preview_gop_interval(MMHandleType handle, int gop_ _MMCamcorderSubContext *sc = NULL; if ((void *)handle == NULL) { - _mmcam_dbg_warn("handle is NULL"); + MMCAM_LOG_WARNING("handle is NULL"); return FALSE; } sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc) { - _mmcam_dbg_warn("subcontext is NULL"); + MMCAM_LOG_WARNING("subcontext is NULL"); return FALSE; } if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst == NULL) { - _mmcam_dbg_warn("videosrc plugin is NULL"); + MMCAM_LOG_WARNING("videosrc plugin is NULL"); return FALSE; } - _mmcam_dbg_log("set encoded preview GOP interval : %d ms", gop_interval); + MMCAM_LOG_INFO("set encoded preview GOP interval : %d ms", gop_interval); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "gop-interval", gop_interval); @@ -3026,7 +3024,7 @@ bool _mmcamcorder_set_sound_stream_info(GstElement *element, char *stream_type, char stream_props[64] = {'\0',}; if (element == NULL || stream_type == NULL || stream_index < 0) { - _mmcam_dbg_err("invalid argument %p %p %d", element, stream_type, stream_index); + MMCAM_LOG_ERROR("invalid argument %p %p %d", element, stream_type, stream_index); return FALSE; } @@ -3034,11 +3032,11 @@ bool _mmcamcorder_set_sound_stream_info(GstElement *element, char *stream_type, "props,media.role=%s, media.parent_id=%d", stream_type, stream_index); - _mmcam_dbg_warn("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props); + MMCAM_LOG_WARNING("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props); props = gst_structure_from_string(stream_props, NULL); if (!props) { - _mmcam_dbg_err("failed to create GstStructure"); + MMCAM_LOG_ERROR("failed to create GstStructure"); return FALSE; } @@ -3064,7 +3062,7 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) #endif /* _MMCAMCORDER_RM_SUPPORT */ if ((void *)handle == NULL) { - _mmcam_dbg_warn("handle is NULL"); + MMCAM_LOG_WARNING("handle is NULL"); return FALSE; } @@ -3072,13 +3070,13 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc) { - _mmcam_dbg_warn("subcontext is NULL"); + MMCAM_LOG_WARNING("subcontext is NULL"); return FALSE; } if (_mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format) == false || hcamcorder->recreate_decoder == FALSE) { - _mmcam_dbg_log("skip this fuction - format %d, recreate decoder %d", + MMCAM_LOG_INFO("skip this fuction - format %d, recreate decoder %d", sc->info_image->preview_format, hcamcorder->recreate_decoder); return TRUE; } @@ -3088,41 +3086,41 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) NULL); if (display_surface_type == MM_DISPLAY_SURFACE_NULL) { - _mmcam_dbg_log("no need to control decoder element"); + MMCAM_LOG_INFO("no need to control decoder element"); return TRUE; } if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst == NULL || sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst == NULL) { - _mmcam_dbg_warn("main pipeline or decoder plugin is NULL"); + MMCAM_LOG_WARNING("main pipeline or decoder plugin is NULL"); return FALSE; } - _mmcam_dbg_log("start"); + MMCAM_LOG_INFO("start"); _mmcamcorder_conf_get_value_element_name(sc->VideodecoderElementH264, &videodecoder_name); if (videodecoder_name == NULL) { - _mmcam_dbg_err("failed to get decoder element name from %p", sc->VideodecoderElementH264); + MMCAM_LOG_ERROR("failed to get decoder element name from %p", sc->VideodecoderElementH264); return FALSE; } /* set state as NULL */ ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, GST_STATE_NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to set NULL to decoder"); + MMCAM_LOG_ERROR("failed to set NULL to decoder"); return FALSE; } /* remove decoder - pads will be unlinked automatically in remove function */ if (!gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst)) { - _mmcam_dbg_err("failed to remove decoder from pipeline"); + MMCAM_LOG_ERROR("failed to remove decoder from pipeline"); return FALSE; } /* check decoder element */ if (sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst) { - _mmcam_dbg_log("decoder[%p] is still alive - ref count %d", + MMCAM_LOG_INFO("decoder[%p] is still alive - ref count %d", G_OBJECT(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst), ((GObject *)sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst)->ref_count); } @@ -3133,27 +3131,27 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) decoder_index = 1; snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); - _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); + MMCAM_LOG_INFO("encoded preview decoder_name %s", decoder_name); } else { /* MJPEG */ if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER) snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_uhd_mjpegdec"); else snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_mjpegdec"); - _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); + MMCAM_LOG_INFO("encoded preview decoder_name %s", decoder_name); } /* create decoder */ sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst = gst_element_factory_make(decoder_name, "videosrc_decode"); if (sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst == NULL) { - _mmcam_dbg_err("Decoder[%s] creation fail", decoder_name); + MMCAM_LOG_ERROR("Decoder[%s] creation fail", decoder_name); return FALSE; } #else /* _MMCAMCORDER_RM_SUPPORT */ /* create new decoder */ sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst = gst_element_factory_make(videodecoder_name, "videosrc_decode"); if (sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst == NULL) { - _mmcam_dbg_err("Decoder [%s] creation fail", videodecoder_name); + MMCAM_LOG_ERROR("Decoder [%s] creation fail", videodecoder_name); return FALSE; } #endif /* _MMCAMCORDER_RM_SUPPORT */ @@ -3166,7 +3164,7 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) /* add to pipeline */ if (!gst_bin_add(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst)) { - _mmcam_dbg_err("failed to add decoder to pipeline"); + MMCAM_LOG_ERROR("failed to add decoder to pipeline"); gst_object_unref(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst); return FALSE; } @@ -3174,28 +3172,28 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) /* link */ if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst), GST_ELEMENT(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst))) { - _mmcam_dbg_log("Link videosrc_queue to decoder OK"); + MMCAM_LOG_INFO("Link videosrc_queue to decoder OK"); } else { - _mmcam_dbg_err("Link videosrc_queue to decoder FAILED"); + MMCAM_LOG_ERROR("Link videosrc_queue to decoder FAILED"); return FALSE; } if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst), GST_ELEMENT(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst))) { - _mmcam_dbg_log("Link decoder to videosink_queue OK"); + MMCAM_LOG_INFO("Link decoder to videosink_queue OK"); } else { - _mmcam_dbg_err("Link decoder to videosink_queue FAILED"); + MMCAM_LOG_ERROR("Link decoder to videosink_queue FAILED"); return FALSE; } /* set state READY */ ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, GST_STATE_READY); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to set READY to decoder"); + MMCAM_LOG_ERROR("failed to set READY to decoder"); return FALSE; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return TRUE; } @@ -3222,35 +3220,35 @@ static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_wid sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, "sink"); if (!sinkpad) { - _mmcam_dbg_err("There are no decoder caps"); + MMCAM_LOG_ERROR("There are no decoder caps"); return false; } decsink_caps = gst_pad_get_pad_template_caps(sinkpad); if (!decsink_caps) { gst_object_unref(sinkpad); - _mmcam_dbg_err("There is no decoder sink caps"); + MMCAM_LOG_ERROR("There is no decoder sink caps"); return false; } for (index = 0; index < gst_caps_get_size(decsink_caps); index++) { decsink_struct = gst_caps_get_structure(decsink_caps, index); if (!decsink_struct) { - _mmcam_dbg_err("There are no structure from caps"); + MMCAM_LOG_ERROR("There are no structure from caps"); gst_object_unref(decsink_caps); gst_object_unref(sinkpad); return false; } mime = gst_structure_get_name(decsink_struct); if (!strcmp(mime, "video/x-h264")) { - _mmcam_dbg_log("h264 caps structure found"); + MMCAM_LOG_INFO("h264 caps structure found"); if (gst_structure_has_field(decsink_struct, "maxwidth")) *max_width = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxwidth")); if (gst_structure_has_field(decsink_struct, "maxheight")) *max_height = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxheight")); break; } else if (!strcmp(mime, "video/x-jpeg")) { - _mmcam_dbg_log("mjpeg caps structure found"); + MMCAM_LOG_INFO("mjpeg caps structure found"); if (gst_structure_has_field(decsink_struct, "maxwidth")) *max_width = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxwidth")); if (gst_structure_has_field(decsink_struct, "maxheight")) @@ -3258,7 +3256,7 @@ static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_wid break; } } - _mmcam_dbg_log("maxwidth = %d , maxheight = %d", (int)*max_width, (int)*max_height); + MMCAM_LOG_INFO("maxwidth = %d , maxheight = %d", (int)*max_width, (int)*max_height); gst_object_unref(decsink_caps); gst_object_unref(sinkpad); diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index 354609d..6fd655b 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -45,6 +45,9 @@ #include "mm_camcorder_rm.h" #endif /* _MMCAMCORDER_RM_SUPPORT */ +/* log level */ +int mmcam_log_level; + /*--------------------------------------------------------------------------------------- | LOCAL VARIABLE DEFINITIONS for internal | ---------------------------------------------------------------------------------------*/ @@ -103,14 +106,14 @@ static gint __mmcamcorder_init_handle(mmf_camcorder_t **hcamcorder, int device_t mmf_camcorder_t *new_handle = NULL; if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } /* Create mmf_camcorder_t handle and initialize every variable */ new_handle = (mmf_camcorder_t *)malloc(sizeof(mmf_camcorder_t)); if (!new_handle) { - _mmcam_dbg_err("new handle allocation failed"); + MMCAM_LOG_ERROR("new handle allocation failed"); return MM_ERROR_CAMCORDER_LOW_MEMORY; } @@ -119,7 +122,7 @@ static gint __mmcamcorder_init_handle(mmf_camcorder_t **hcamcorder, int device_t /* set device type */ new_handle->device_type = device_type; - _mmcam_dbg_warn("Device Type : %d", new_handle->device_type); + MMCAM_LOG_WARNING("Device Type : %d", new_handle->device_type); new_handle->type = MM_CAMCORDER_MODE_VIDEO_CAPTURE; new_handle->state = MM_CAMCORDER_STATE_NONE; @@ -170,7 +173,7 @@ static gint __mmcamcorder_init_handle(mmf_camcorder_t **hcamcorder, int device_t new_handle->task_thread = g_thread_try_new("MMCAM_TASK_THREAD", (GThreadFunc)_mmcamcorder_util_task_thread_func, (gpointer)new_handle, NULL); if (new_handle->task_thread == NULL) { - _mmcam_dbg_err("_mmcamcorder_create::failed to create task thread"); + MMCAM_LOG_ERROR("_mmcamcorder_create::failed to create task thread"); ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto _INIT_HANDLE_FAILED; } @@ -178,7 +181,7 @@ static gint __mmcamcorder_init_handle(mmf_camcorder_t **hcamcorder, int device_t /* Get Camera Configure information from Camcorder INI file */ ret = _mmcamcorder_conf_get_info((MMHandleType)new_handle, CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &new_handle->conf_main); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Failed to get configure(main) info."); + MMCAM_LOG_ERROR("Failed to get configure(main) info."); goto _INIT_HANDLE_FAILED; } @@ -191,7 +194,7 @@ static gint __mmcamcorder_init_handle(mmf_camcorder_t **hcamcorder, int device_t *hcamcorder = new_handle; - _mmcam_dbg_log("new handle %p", new_handle); + MMCAM_LOG_INFO("new handle %p", new_handle); return MM_ERROR_NONE; @@ -204,7 +207,7 @@ _INIT_HANDLE_FAILED: static void __mmcamcorder_deinit_handle(mmf_camcorder_t *hcamcorder) { if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return; } @@ -226,7 +229,7 @@ static void __mmcamcorder_deinit_handle(mmf_camcorder_t *hcamcorder) /* remove task thread */ if (hcamcorder->task_thread) { g_mutex_lock(&hcamcorder->task_thread_lock); - _mmcam_dbg_log("send signal for task thread exit"); + MMCAM_LOG_INFO("send signal for task thread exit"); hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT; g_cond_signal(&hcamcorder->task_thread_cond); g_mutex_unlock(&hcamcorder->task_thread_lock); @@ -287,24 +290,24 @@ static void __mmcamcorder_get_system_info(mmf_camcorder_t *hcamcorder) int ret = 0; if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return; } /* get shutter sound policy */ vconf_get_int(VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY, &hcamcorder->shutter_sound_policy); - _mmcam_dbg_log("current shutter sound policy : %d", hcamcorder->shutter_sound_policy); + MMCAM_LOG_INFO("current shutter sound policy : %d", hcamcorder->shutter_sound_policy); /* get model name */ ret = system_info_get_platform_string("http://tizen.org/system/model_name", &hcamcorder->model_name); - _mmcam_dbg_warn("model name [%s], ret 0x%x", + MMCAM_LOG_WARNING("model name [%s], ret 0x%x", hcamcorder->model_name ? hcamcorder->model_name : "NULL", ret); /* get software version */ ret = system_info_get_platform_string("http://tizen.org/system/build.string", &hcamcorder->software_version); - _mmcam_dbg_warn("software version [%s], ret 0x%x", + MMCAM_LOG_WARNING("software version [%s], ret 0x%x", hcamcorder->software_version ? hcamcorder->software_version : "NULL", ret); return; @@ -333,7 +336,7 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord #endif if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } @@ -343,7 +346,7 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord ret_conf = camera_conf_mgr_get_ids(devicetype, __MMCAMCORDER_DEVICE_TYPE_STRING_LEN, &hcamcorder->conf_device_info); if (ret_conf != CAMERA_CONF_MGR_ERROR_NONE) { - _mmcam_dbg_err("Device [%s] is not found", devicetype); + MMCAM_LOG_ERROR("Device [%s] is not found", devicetype); return MM_ERROR_CAMCORDER_NOT_SUPPORTED; } @@ -351,12 +354,12 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->conf_device_info.vendor_id, hcamcorder->conf_device_info.product_id); - _mmcam_dbg_log("Load control configure file [%d][%s][%s]", hcamcorder->device_type, + MMCAM_LOG_INFO("Load control configure file [%d][%s][%s]", hcamcorder->device_type, conf_file_name, hcamcorder->conf_device_info.node); #else snprintf(conf_file_name, sizeof(conf_file_name), "%s%d.ini", CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->device_type); - _mmcam_dbg_log("Load control configure file [%d][%s]", hcamcorder->device_type, conf_file_name); + MMCAM_LOG_INFO("Load control configure file [%d][%s]", hcamcorder->device_type, conf_file_name); #endif ret = _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, @@ -368,11 +371,11 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord ret = _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_CTRL, (const char *)conf_file_name, &hcamcorder->conf_ctrl); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Failed to get configure(control) info."); + MMCAM_LOG_ERROR("Failed to get configure(control) info."); return ret; } #else - _mmcam_dbg_err("Failed to get configure(control) info."); + MMCAM_LOG_ERROR("Failed to get configure(control) info."); return ret; #endif } @@ -382,17 +385,17 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord */ ret = _mmcamcorder_init_convert_table((MMHandleType)hcamcorder); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("converting table initialize error!!"); + MMCAM_LOG_WARNING("converting table initialize error!!"); return MM_ERROR_CAMCORDER_INTERNAL; } ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder, MM_CAMCONVERT_CATEGORY_ALL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("attribute initialize from configure error!!"); + MMCAM_LOG_WARNING("attribute initialize from configure error!!"); return MM_ERROR_CAMCORDER_INTERNAL; } - /* Get device info, recommend preview fmt and display rotation from INI */ + /* Get device information for supported features from INI */ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAMERA, "RecommendPreviewFormatCapture", @@ -433,30 +436,26 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord "SupportZSL", &hcamcorder->support_zsl_capture); - _mmcam_dbg_log("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, dev cnt %d, cam facing dir %d, step denom %d, support zsl %d", + MMCAM_LOG_INFO("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, dev cnt %d, cam facing dir %d, step denom %d, support zsl %d", rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation, play_capture_sound, camera_device_count, camera_facing_direction, hcamcorder->brightness_step_denominator, hcamcorder->support_zsl_capture); - /* Get UseZeroCopyFormat value from INI */ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "UseZeroCopyFormat", &hcamcorder->use_zero_copy_format); - /* Get SupportUserBuffer value from INI */ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "SupportUserBuffer", &hcamcorder->support_user_buffer); - /* Get SupportMediaPacketPreviewCb value from INI */ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "SupportMediaPacketPreviewCb", &hcamcorder->support_media_packet_preview_cb); - /* Get UseVideoconvert value from INI */ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, "UseVideoconvert", @@ -467,21 +466,27 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord MMCAM_CAMERA_HEIGHT, &resolution_height, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("get attribute[resolution] error"); + MMCAM_LOG_ERROR("get attribute[resolution] error"); return MM_ERROR_CAMCORDER_INTERNAL; } ret = mm_camcorder_get_fps_list_by_resolution((MMHandleType)hcamcorder, resolution_width, resolution_height, &fps_info); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("get fps list failed with [%dx%d]", resolution_width, resolution_height); + MMCAM_LOG_ERROR("get fps list failed with [%dx%d]", resolution_width, resolution_height); return MM_ERROR_CAMCORDER_INTERNAL; } - _mmcam_dbg_log("ZeroCopy %d, UserBuffer %d, Videoconvert %d, MPPreviewCb %d", + _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_GENERAL, + "LogLevel", + &mmcam_log_level); + + MMCAM_LOG_INFO("ZeroCopy %d, UserBuffer %d, Videoconvert %d, MPPreviewCb %d, LogLevel %d", hcamcorder->use_zero_copy_format, hcamcorder->support_user_buffer, - hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb); + hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb, + mmcam_log_level); - _mmcam_dbg_log("res : %d X %d, Default FPS by resolution : %d", + MMCAM_LOG_INFO("res : %d X %d, Default FPS by resolution : %d", resolution_width, resolution_height, fps_info.int_array.def); if (camera_facing_direction == 1) { @@ -490,10 +495,9 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord else camera_default_flip = MM_FLIP_HORIZONTAL; - _mmcam_dbg_log("camera_default_flip : [%d]", camera_default_flip); + MMCAM_LOG_INFO("camera_default_flip : [%d]", camera_default_flip); } - /* Get platform privilege */ _mmcamcorder_conf_get_value_string((MMHandleType)hcamcorder, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_GENERAL, "PlatformPrivilegeCamera", @@ -514,9 +518,10 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord MMCAM_CAPTURE_SOUND_ENABLE, play_capture_sound, MMCAM_PLATFORM_PRIVILEGE_CAMERA, platform_privilege_camera, platform_privilege_camera ? strlen(platform_privilege_camera) : 0, + MMCAM_LOG_LEVEL, mmcam_log_level, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("[0x%x] Set %s FAILED.", ret, err_attr_name ? err_attr_name : "[UNKNOWN]"); + MMCAM_LOG_ERROR("[0x%x] Set %s FAILED.", ret, err_attr_name ? err_attr_name : "[UNKNOWN]"); SAFE_FREE(err_attr_name); return MM_ERROR_CAMCORDER_INTERNAL; } @@ -526,11 +531,11 @@ static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcord MMCAM_FILTER_BRIGHTNESS, &hcamcorder->brightness_default, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Get brightness FAILED."); + MMCAM_LOG_ERROR("Get brightness FAILED."); return MM_ERROR_CAMCORDER_INTERNAL; } - _mmcam_dbg_log("Default brightness : %d", hcamcorder->brightness_default); + MMCAM_LOG_INFO("Default brightness : %d", hcamcorder->brightness_default); return ret; } @@ -542,7 +547,7 @@ static gint __mmcamcorder_init_configure_audio(mmf_camcorder_t *hcamcorder) int camera_device_count = 0; if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } @@ -555,13 +560,13 @@ static gint __mmcamcorder_init_configure_audio(mmf_camcorder_t *hcamcorder) MMCAM_CAMERA_DEVICE_COUNT, camera_device_count, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Set device count FAILED"); + MMCAM_LOG_ERROR("Set device count FAILED"); return MM_ERROR_CAMCORDER_INTERNAL; } ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder, MM_CAMCONVERT_CATEGORY_AUDIO); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("there is no audio device"); + MMCAM_LOG_ERROR("there is no audio device"); return MM_ERROR_CAMCORDER_NOT_SUPPORTED; } @@ -572,7 +577,7 @@ static gint __mmcamcorder_init_configure_audio(mmf_camcorder_t *hcamcorder) static void __mmcamcorder_deinit_configure(mmf_camcorder_t *hcamcorder) { if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return; } @@ -595,14 +600,14 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) int ret = MM_ERROR_NONE; mmf_camcorder_t *hcamcorder = NULL; - _mmcam_dbg_log("Entered"); + MMCAM_LOG_INFO("Entered"); mmf_return_val_if_fail(handle && info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); /* check device type */ if (info->videodev_type < MM_VIDEO_DEVICE_NONE || info->videodev_type >= MM_VIDEO_DEVICE_NUM) { - _mmcam_dbg_err("video device type[%d] is out of range.", info->videodev_type); + MMCAM_LOG_ERROR("video device type[%d] is out of range.", info->videodev_type); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } @@ -614,7 +619,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) /* get DPM handle for camera/microphone restriction */ hcamcorder->dpm_handle = dpm_manager_create(); - _mmcam_dbg_warn("DPM handle %p", hcamcorder->dpm_handle); + MMCAM_LOG_WARNING("DPM handle %p", hcamcorder->dpm_handle); if (hcamcorder->device_type != MM_VIDEO_DEVICE_NONE) { ret = __mmcamcorder_init_configure_video_capture(hcamcorder); @@ -627,11 +632,11 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) ret = dpm_add_policy_changed_cb(hcamcorder->dpm_handle, "camera", _mmcamcorder_dpm_camera_policy_changed_cb, (void *)hcamcorder, &hcamcorder->dpm_camera_cb_id); if (ret != DPM_ERROR_NONE) { - _mmcam_dbg_err("add DPM changed cb failed, keep going..."); + MMCAM_LOG_ERROR("add DPM changed cb failed, keep going..."); hcamcorder->dpm_camera_cb_id = 0; } - _mmcam_dbg_log("DPM camera changed cb id %d", hcamcorder->dpm_camera_cb_id); + MMCAM_LOG_INFO("DPM camera changed cb id %d", hcamcorder->dpm_camera_cb_id); } #ifdef _MMCAMCORDER_MM_RM_SUPPORT @@ -640,7 +645,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) __mmcamcorder_resource_release_cb, hcamcorder, &hcamcorder->resource_manager); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("failed to initialize resource manager"); + MMCAM_LOG_ERROR("failed to initialize resource manager"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_DEFAULT_VALUE_INIT; } @@ -659,7 +664,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) traceEnd(TTRACE_TAG_CAMERA); if (!ret) { - _mmcam_dbg_err("Failed to initialize gstreamer!!"); + MMCAM_LOG_ERROR("Failed to initialize gstreamer!!"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; goto _ERR_DEFAULT_VALUE_INIT; } @@ -676,7 +681,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) /* Set initial state */ _mmcamcorder_set_state((MMHandleType)hcamcorder, MM_CAMCORDER_STATE_NULL); - _mmcam_dbg_log("created handle %p", hcamcorder); + MMCAM_LOG_INFO("created handle %p", hcamcorder); *handle = (MMHandleType)hcamcorder; @@ -691,7 +696,7 @@ _ERR_DEFAULT_VALUE_INIT: /* release DPM related handle */ if (hcamcorder->dpm_handle) { - _mmcam_dbg_log("release DPM handle %p, camera changed cb id %d", + MMCAM_LOG_INFO("release DPM handle %p, camera changed cb id %d", hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id); /* remove camera policy changed callback */ @@ -699,7 +704,7 @@ _ERR_DEFAULT_VALUE_INIT: dpm_remove_policy_changed_cb(hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id); hcamcorder->dpm_camera_cb_id = 0; } else { - _mmcam_dbg_warn("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id); + MMCAM_LOG_WARNING("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id); } dpm_manager_destroy(hcamcorder->dpm_handle); @@ -725,23 +730,23 @@ int _mmcamcorder_destroy(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; goto _ERR_CAMCORDER_CMD_PRECON; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_NULL) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -753,7 +758,7 @@ int _mmcamcorder_destroy(MMHandleType handle) if (sink_element) { GstStateChangeReturn result = gst_element_set_state(sink_element, GST_STATE_NULL); - _mmcam_dbg_warn("remove sink element %p, set state NULL result %d", sink_element, result); + MMCAM_LOG_WARNING("remove sink element %p, set state NULL result %d", sink_element, result); gst_object_unref(sink_element); sink_element = NULL; @@ -778,7 +783,7 @@ int _mmcamcorder_destroy(MMHandleType handle) if (hcamcorder->resource_manager != NULL) { ret = mm_resource_manager_destroy(hcamcorder->resource_manager); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) - _mmcam_dbg_err("failed to de-initialize resource manager 0x%x", ret); + MMCAM_LOG_ERROR("failed to de-initialize resource manager 0x%x", ret); } _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); @@ -786,7 +791,7 @@ int _mmcamcorder_destroy(MMHandleType handle) /* Remove idle function which is not called yet */ if (hcamcorder->setting_event_id) { - _mmcam_dbg_log("Remove remaining idle function"); + MMCAM_LOG_INFO("Remove remaining idle function"); g_source_remove(hcamcorder->setting_event_id); hcamcorder->setting_event_id = 0; } @@ -800,7 +805,7 @@ int _mmcamcorder_destroy(MMHandleType handle) /* release DPM handle */ if (hcamcorder->dpm_handle) { - _mmcam_dbg_log("release DPM handle %p, camera changed cb id %d", + MMCAM_LOG_INFO("release DPM handle %p, camera changed cb id %d", hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id); /* remove camera policy changed callback */ @@ -808,7 +813,7 @@ int _mmcamcorder_destroy(MMHandleType handle) dpm_remove_policy_changed_cb(hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id); hcamcorder->dpm_camera_cb_id = 0; } else { - _mmcam_dbg_warn("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id); + MMCAM_LOG_WARNING("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id); } dpm_manager_destroy(hcamcorder->dpm_handle); @@ -826,9 +831,9 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: if (hcamcorder) - _mmcam_dbg_err("Destroy fail (type %d, state %d)", hcamcorder->type, state); + MMCAM_LOG_ERROR("Destroy fail (type %d, state %d)", hcamcorder->type, state); - _mmcam_dbg_err("Destroy fail (ret %x)", ret); + MMCAM_LOG_ERROR("Destroy fail (ret %x)", ret); return ret; } @@ -848,23 +853,23 @@ int _mmcamcorder_realize(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_NULL) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -876,12 +881,12 @@ int _mmcamcorder_realize(MMHandleType handle) NULL); if (!hcamcorder->gdbus_conn) { - _mmcam_dbg_err("gdbus connection NULL"); + MMCAM_LOG_ERROR("gdbus connection NULL"); ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } - _mmcam_dbg_log("Profile mode [%d], gdbus connection [%p]", + MMCAM_LOG_INFO("Profile mode [%d], gdbus connection [%p]", hcamcorder->type, hcamcorder->gdbus_conn); mm_camcorder_get_attributes(handle, NULL, @@ -904,7 +909,7 @@ int _mmcamcorder_realize(MMHandleType handle) CONFIGURE_CATEGORY_MAIN_CAPTURE, "UseEncodebin", &(hcamcorder->sub_context->bencbin_capture)); - _mmcam_dbg_warn("UseEncodebin [%d]", hcamcorder->sub_context->bencbin_capture); + MMCAM_LOG_WARNING("UseEncodebin [%d]", hcamcorder->sub_context->bencbin_capture); if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { /* get video recording info */ @@ -912,13 +917,13 @@ int _mmcamcorder_realize(MMHandleType handle) CONFIGURE_CATEGORY_MAIN_RECORD, "SupportDualStream", &(hcamcorder->sub_context->info_video->support_dual_stream)); - _mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream); + MMCAM_LOG_WARNING("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream); _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, "UseVideoscale", &(hcamcorder->sub_context->info_video->use_videoscale)); - _mmcam_dbg_warn("UseVideoscale [%d]", hcamcorder->sub_context->info_video->use_videoscale); + MMCAM_LOG_WARNING("UseVideoscale [%d]", hcamcorder->sub_context->info_video->use_videoscale); } switch (display_surface_type) { @@ -939,7 +944,7 @@ int _mmcamcorder_realize(MMHandleType handle) MMCAM_DISPLAY_SOCKET_PATH, &socket_path, &socket_path_len, NULL); if (socket_path == NULL) { - _mmcam_dbg_warn("REMOTE surface, but socket path is NULL -> to NullSink"); + MMCAM_LOG_WARNING("REMOTE surface, but socket path is NULL -> to NullSink"); videosink_element_type = strdup("VideosinkElementNull"); } else { videosink_element_type = strdup("VideosinkElementRemote"); @@ -959,7 +964,7 @@ int _mmcamcorder_realize(MMHandleType handle) free(videosink_element_type); videosink_element_type = NULL; } else { - _mmcam_dbg_warn("strdup failed(display_surface_type %d). Use default X type", + MMCAM_LOG_WARNING("strdup failed(display_surface_type %d). Use default X type", display_surface_type); _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main, @@ -969,7 +974,7 @@ int _mmcamcorder_realize(MMHandleType handle) } _mmcamcorder_conf_get_value_element_name(hcamcorder->sub_context->VideosinkElement, &videosink_name); - _mmcam_dbg_log("Videosink name : %s", videosink_name); + MMCAM_LOG_INFO("Videosink name : %s", videosink_name); /* get videoconvert element */ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main, @@ -981,7 +986,7 @@ int _mmcamcorder_realize(MMHandleType handle) CONFIGURE_CATEGORY_CTRL_CAPTURE, "SensorEncodedCapture", &(hcamcorder->sub_context->SensorEncodedCapture)); - _mmcam_dbg_log("Support sensor encoded capture : %d", hcamcorder->sub_context->SensorEncodedCapture); + MMCAM_LOG_INFO("Support sensor encoded capture : %d", hcamcorder->sub_context->SensorEncodedCapture); if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) { int dpm_camera_state = DPM_ALLOWED; @@ -989,9 +994,9 @@ int _mmcamcorder_realize(MMHandleType handle) /* check camera policy from DPM */ if (hcamcorder->dpm_handle) { if (dpm_restriction_get_camera_state(hcamcorder->dpm_handle, &dpm_camera_state) == DPM_ERROR_NONE) { - _mmcam_dbg_log("DPM camera state %d", dpm_camera_state); + MMCAM_LOG_INFO("DPM camera state %d", dpm_camera_state); if (dpm_camera_state == DPM_DISALLOWED) { - _mmcam_dbg_err("CAMERA DISALLOWED by DPM"); + MMCAM_LOG_ERROR("CAMERA DISALLOWED by DPM"); ret = MM_ERROR_POLICY_RESTRICTED; _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "camera"); @@ -999,10 +1004,10 @@ int _mmcamcorder_realize(MMHandleType handle) goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } else { - _mmcam_dbg_err("get DPM camera state failed, keep going..."); + MMCAM_LOG_ERROR("get DPM camera state failed, keep going..."); } } else { - _mmcam_dbg_warn("NULL dpm_handle"); + MMCAM_LOG_WARNING("NULL dpm_handle"); } #ifdef _MMCAMCORDER_MM_RM_SUPPORT @@ -1014,13 +1019,13 @@ int _mmcamcorder_realize(MMHandleType handle) 1, &hcamcorder->camera_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not prepare for camera resource"); + MMCAM_LOG_ERROR("could not prepare for camera resource"); ret = MM_ERROR_RESOURCE_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } else { - _mmcam_dbg_log("camera already acquired"); + MMCAM_LOG_INFO("camera already acquired"); } /* prepare resource manager for "video_overlay only if display surface is X" */ @@ -1031,20 +1036,20 @@ int _mmcamcorder_realize(MMHandleType handle) MM_RESOURCE_MANAGER_RES_VOLUME_FULL, &hcamcorder->video_overlay_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not prepare for overlay resource"); + MMCAM_LOG_ERROR("could not prepare for overlay resource"); ret = MM_ERROR_RESOURCE_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } else { - _mmcam_dbg_log("overlay already acquired"); + MMCAM_LOG_INFO("overlay already acquired"); } } /* acquire resources */ ret = mm_resource_manager_commit(hcamcorder->resource_manager); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not acquire resources"); + MMCAM_LOG_ERROR("could not acquire resources"); ret = MM_ERROR_RESOURCE_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; @@ -1055,12 +1060,12 @@ int _mmcamcorder_realize(MMHandleType handle) #ifdef _MMCAMCORDER_RM_SUPPORT ret = _mmcamcorder_rm_create(handle); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Resource create failed"); + MMCAM_LOG_ERROR("Resource create failed"); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } ret = _mmcamcorder_rm_allocate(handle); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Resource allocation request failed"); + MMCAM_LOG_ERROR("Resource allocation request failed"); _mmcamcorder_rm_release(handle); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1078,7 +1083,7 @@ int _mmcamcorder_realize(MMHandleType handle) /* check internal error of gstreamer */ if (hcamcorder->error_code != MM_ERROR_NONE) { ret = hcamcorder->error_code; - _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + MMCAM_LOG_INFO("gstreamer error is occurred. return it %x", ret); } /* release sub context */ @@ -1130,7 +1135,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _ERR_CAMCORDER_CMD_PRECON: - _mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); + MMCAM_LOG_ERROR("Realize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; } @@ -1143,23 +1148,23 @@ int _mmcamcorder_unrealize(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1175,7 +1180,7 @@ int _mmcamcorder_unrealize(MMHandleType handle) #ifdef _MMCAMCORDER_MM_RM_SUPPORT _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); - _mmcam_dbg_warn("lock resource - cb calling %d", hcamcorder->is_release_cb_calling); + MMCAM_LOG_WARNING("lock resource - cb calling %d", hcamcorder->is_release_cb_calling); if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE && hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_RM && @@ -1186,10 +1191,10 @@ int _mmcamcorder_unrealize(MMHandleType handle) ret = mm_resource_manager_mark_for_release(hcamcorder->resource_manager, hcamcorder->camera_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not mark camera resource for release"); + MMCAM_LOG_ERROR("could not mark camera resource for release"); ret = MM_ERROR_CAMCORDER_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_log("unlock resource"); + MMCAM_LOG_INFO("unlock resource"); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } @@ -1198,10 +1203,10 @@ int _mmcamcorder_unrealize(MMHandleType handle) ret = mm_resource_manager_mark_for_release(hcamcorder->resource_manager, hcamcorder->video_overlay_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not mark overlay resource for release"); + MMCAM_LOG_ERROR("could not mark overlay resource for release"); ret = MM_ERROR_CAMCORDER_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_log("unlock resource"); + MMCAM_LOG_INFO("unlock resource"); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } @@ -1209,11 +1214,11 @@ int _mmcamcorder_unrealize(MMHandleType handle) ret = mm_resource_manager_commit(hcamcorder->resource_manager); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("failed to release resource, ret(0x%x)", ret); + MMCAM_LOG_ERROR("failed to release resource, ret(0x%x)", ret); ret = MM_ERROR_CAMCORDER_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_log("unlock resource"); + MMCAM_LOG_INFO("unlock resource"); goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } else { @@ -1226,7 +1231,7 @@ int _mmcamcorder_unrealize(MMHandleType handle) _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_warn("unlock resource"); + MMCAM_LOG_WARNING("unlock resource"); #endif /* _MMCAMCORDER_MM_RM_SUPPORT */ #ifdef _MMCAMCORDER_RM_SUPPORT @@ -1247,7 +1252,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Unrealize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); + MMCAM_LOG_ERROR("Unrealize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; } @@ -1260,10 +1265,10 @@ int _mmcamcorder_start(MMHandleType handle) _MMCamcorderSubContext *sc = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } @@ -1272,14 +1277,14 @@ int _mmcamcorder_start(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1296,7 +1301,7 @@ int _mmcamcorder_start(MMHandleType handle) /* check internal error of gstreamer */ if (hcamcorder->error_code != MM_ERROR_NONE) { ret = hcamcorder->error_code; - _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + MMCAM_LOG_INFO("gstreamer error is occurred. return it %x", ret); } goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1320,10 +1325,10 @@ _ERR_CAMCORDER_CMD_PRECON: ret = hcamcorder->error_code; hcamcorder->error_code = MM_ERROR_NONE; - _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + MMCAM_LOG_INFO("gstreamer error is occurred. return it %x", ret); } - _mmcam_dbg_err("Start fail (type %d, state %d, ret %x)", + MMCAM_LOG_ERROR("Start fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; @@ -1336,23 +1341,23 @@ int _mmcamcorder_stop(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1367,14 +1372,14 @@ int _mmcamcorder_stop(MMHandleType handle) /* unsubscribe remained unsubscribed signal */ g_mutex_lock(&hcamcorder->gdbus_info_sound.sync_mutex); if (hcamcorder->gdbus_info_sound.subscribe_id > 0) { - _mmcam_dbg_warn("subscribe_id[%u] is remained. remove it.", hcamcorder->gdbus_info_sound.subscribe_id); + MMCAM_LOG_WARNING("subscribe_id[%u] is remained. remove it.", hcamcorder->gdbus_info_sound.subscribe_id); g_dbus_connection_signal_unsubscribe(hcamcorder->gdbus_conn, hcamcorder->gdbus_info_sound.subscribe_id); } g_mutex_unlock(&hcamcorder->gdbus_info_sound.sync_mutex); g_mutex_lock(&hcamcorder->gdbus_info_solo_sound.sync_mutex); if (hcamcorder->gdbus_info_solo_sound.subscribe_id > 0) { - _mmcam_dbg_warn("subscribe_id[%u] is remained. remove it.", hcamcorder->gdbus_info_solo_sound.subscribe_id); + MMCAM_LOG_WARNING("subscribe_id[%u] is remained. remove it.", hcamcorder->gdbus_info_solo_sound.subscribe_id); g_dbus_connection_signal_unsubscribe(hcamcorder->gdbus_conn, hcamcorder->gdbus_info_solo_sound.subscribe_id); } g_mutex_unlock(&hcamcorder->gdbus_info_solo_sound.sync_mutex); @@ -1389,7 +1394,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Stop fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); + MMCAM_LOG_ERROR("Stop fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; } @@ -1405,23 +1410,23 @@ int _mmcamcorder_capture_start(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != state_FROM_0 && state != state_FROM_1 && state != state_FROM_2) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1429,7 +1434,7 @@ int _mmcamcorder_capture_start(MMHandleType handle) /* Handle capture in recording case */ if (state == state_FROM_1 || state == state_FROM_2) { if (hcamcorder->capture_in_recording == TRUE) { - _mmcam_dbg_err("Capturing in recording (%d)", state); + MMCAM_LOG_ERROR("Capturing in recording (%d)", state); ret = MM_ERROR_CAMCORDER_DEVICE_BUSY; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } else { @@ -1437,11 +1442,11 @@ int _mmcamcorder_capture_start(MMHandleType handle) if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_NONE) { hcamcorder->capture_in_recording = TRUE; hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING; - _mmcam_dbg_log("send signal for capture in recording"); + MMCAM_LOG_INFO("send signal for capture in recording"); g_cond_signal(&hcamcorder->task_thread_cond); g_mutex_unlock(&hcamcorder->task_thread_lock); } else { - _mmcam_dbg_err("task thread busy : %d", hcamcorder->task_thread_state); + MMCAM_LOG_ERROR("task thread busy : %d", hcamcorder->task_thread_state); g_mutex_unlock(&hcamcorder->task_thread_lock); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; @@ -1461,7 +1466,7 @@ int _mmcamcorder_capture_start(MMHandleType handle) /* Init break continuous shot attr */ if (mm_camcorder_set_attributes(handle, NULL, MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT, 0, NULL) != MM_ERROR_NONE) - _mmcam_dbg_warn("capture-break-cont-shot set 0 failed"); + MMCAM_LOG_WARNING("capture-break-cont-shot set 0 failed"); return MM_ERROR_NONE; @@ -1474,7 +1479,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Capture start fail (type %d, state %d, ret %x)", + MMCAM_LOG_ERROR("Capture start fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; @@ -1486,23 +1491,23 @@ int _mmcamcorder_capture_stop(MMHandleType handle) int state = MM_CAMCORDER_STATE_NONE; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_CAPTURING) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1522,7 +1527,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Capture stop fail (type %d, state %d, ret %x)", + MMCAM_LOG_ERROR("Capture stop fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; @@ -1537,10 +1542,10 @@ int _mmcamcorder_record(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder || !MMF_CAMCORDER_SUBCONTEXT(hcamcorder)) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } @@ -1548,14 +1553,14 @@ int _mmcamcorder_record(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_PREPARE && state != MM_CAMCORDER_STATE_PAUSED) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1573,9 +1578,9 @@ int _mmcamcorder_record(MMHandleType handle) /* check mic policy from DPM */ if (hcamcorder->dpm_handle && sc->audio_disable == FALSE) { if (dpm_restriction_get_microphone_state(hcamcorder->dpm_handle, &dpm_mic_state) == DPM_ERROR_NONE) { - _mmcam_dbg_log("DPM mic state %d", dpm_mic_state); + MMCAM_LOG_INFO("DPM mic state %d", dpm_mic_state); if (dpm_mic_state == DPM_DISALLOWED) { - _mmcam_dbg_err("MIC DISALLOWED by DPM"); + MMCAM_LOG_ERROR("MIC DISALLOWED by DPM"); ret = MM_ERROR_COMMON_INVALID_PERMISSION; _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "microphone"); @@ -1583,10 +1588,10 @@ int _mmcamcorder_record(MMHandleType handle) goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } } else { - _mmcam_dbg_err("get DPM mic state failed, keep going..."); + MMCAM_LOG_ERROR("get DPM mic state failed, keep going..."); } } else { - _mmcam_dbg_warn("skip dpm check - handle %p, audio disable %d", + MMCAM_LOG_WARNING("skip dpm check - handle %p, audio disable %d", hcamcorder->dpm_handle, sc->audio_disable); } @@ -1595,7 +1600,7 @@ int _mmcamcorder_record(MMHandleType handle) /* check internal error of gstreamer */ if (hcamcorder->error_code != MM_ERROR_NONE) { ret = hcamcorder->error_code; - _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + MMCAM_LOG_INFO("gstreamer error is occurred. return it %x", ret); } goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1615,10 +1620,10 @@ _ERR_CAMCORDER_CMD_PRECON: ret = hcamcorder->error_code; hcamcorder->error_code = MM_ERROR_NONE; - _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + MMCAM_LOG_INFO("gstreamer error is occurred. return it %x", ret); } - _mmcam_dbg_err("Record fail (type %d, state %d, ret %x)", + MMCAM_LOG_ERROR("Record fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; @@ -1632,23 +1637,23 @@ int _mmcamcorder_pause(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1668,7 +1673,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Pause fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); + MMCAM_LOG_ERROR("Pause fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; } @@ -1681,23 +1686,23 @@ int _mmcamcorder_commit(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_RECORDING && state != MM_CAMCORDER_STATE_PAUSED) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1720,7 +1725,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Commit fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); + MMCAM_LOG_ERROR("Commit fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; } @@ -1733,23 +1738,23 @@ int _mmcamcorder_cancel(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED; return ret; } if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING; goto _ERR_CAMCORDER_CMD_PRECON; } state = _mmcamcorder_get_state(handle); if (state != MM_CAMCORDER_STATE_RECORDING && state != MM_CAMCORDER_STATE_PAUSED) { - _mmcam_dbg_err("Wrong state(%d)", state); + MMCAM_LOG_ERROR("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } @@ -1769,7 +1774,7 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Cancel fail (type %d, state %d, ret %x)", + MMCAM_LOG_ERROR("Cancel fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); return ret; @@ -1779,9 +1784,9 @@ _ERR_CAMCORDER_CMD_PRECON: int _mmcamcorder_commit_async_end(MMHandleType handle) { - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); - _mmcam_dbg_warn("_mmcamcorder_commit_async_end : MM_CAMCORDER_STATE_PREPARE"); + MMCAM_LOG_WARNING("_mmcamcorder_commit_async_end : MM_CAMCORDER_STATE_PREPARE"); _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE); return MM_ERROR_NONE; @@ -1792,15 +1797,15 @@ int _mmcamcorder_set_message_callback(MMHandleType handle, MMMessageCallback cal { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log("%p", hcamcorder); + MMCAM_LOG_INFO("%p", hcamcorder); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Message Callback is disabled, because application sets it to NULL"); + MMCAM_LOG_WARNING("Message Callback is disabled, because application sets it to NULL"); if (!_MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(hcamcorder)) { - _mmcam_dbg_warn("Application's message callback is running now"); + MMCAM_LOG_WARNING("Application's message callback is running now"); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } @@ -1818,12 +1823,12 @@ int _mmcamcorder_set_video_stream_callback(MMHandleType handle, mm_camcorder_vid { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Video Stream Callback is disabled, because application sets it to NULL"); + MMCAM_LOG_WARNING("Video Stream Callback is disabled, because application sets it to NULL"); _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(hcamcorder); @@ -1840,15 +1845,15 @@ int _mmcamcorder_set_audio_stream_callback(MMHandleType handle, mm_camcorder_aud { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Audio Stream Callback is disabled, because application sets it to NULL"); + MMCAM_LOG_WARNING("Audio Stream Callback is disabled, because application sets it to NULL"); if (!_MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(hcamcorder)) { - _mmcam_dbg_warn("Application's audio stream callback is running now"); + MMCAM_LOG_WARNING("Application's audio stream callback is running now"); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } @@ -1865,15 +1870,15 @@ int _mmcamcorder_set_muxed_stream_callback(MMHandleType handle, mm_camcorder_mux { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Muxed Stream Callback is disabled, because application sets it to NULL"); + MMCAM_LOG_WARNING("Muxed Stream Callback is disabled, because application sets it to NULL"); if (!_MMCAMCORDER_TRYLOCK_MSTREAM_CALLBACK(hcamcorder)) { - _mmcam_dbg_warn("Application's muxed stream callback is running now"); + MMCAM_LOG_WARNING("Application's muxed stream callback is running now"); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } @@ -1890,15 +1895,15 @@ int _mmcamcorder_set_video_capture_callback(MMHandleType handle, mm_camcorder_vi { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Video Capture Callback is disabled, because application sets it to NULLL"); + MMCAM_LOG_WARNING("Video Capture Callback is disabled, because application sets it to NULLL"); if (!_MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(hcamcorder)) { - _mmcam_dbg_warn("Application's video capture callback is running now"); + MMCAM_LOG_WARNING("Application's video capture callback is running now"); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } @@ -1915,15 +1920,15 @@ int _mmcamcorder_set_video_encode_decision_callback(MMHandleType handle, mm_camc { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (callback == NULL) - _mmcam_dbg_warn("Video Encode Decision Callback is disabled, because application sets it to NULL"); + MMCAM_LOG_WARNING("Video Encode Decision Callback is disabled, because application sets it to NULL"); if (!_MMCAMCORDER_TRYLOCK_VEDECISION_CALLBACK(hcamcorder)) { - _mmcam_dbg_warn("Application's video encode decision callback is running now"); + MMCAM_LOG_WARNING("Application's video encode decision callback is running now"); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } @@ -1940,7 +1945,7 @@ int _mmcamcorder_get_current_state(MMHandleType handle) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -1961,7 +1966,7 @@ int _mmcamcorder_init_focusing(MMHandleType handle) _MMCamcorderSubContext *sc = NULL; GstCameraControl *control = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); hcamcorder = MMF_CAMCORDER(handle); mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -1970,7 +1975,7 @@ int _mmcamcorder_init_focusing(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -1978,27 +1983,27 @@ int _mmcamcorder_init_focusing(MMHandleType handle) if (state == MM_CAMCORDER_STATE_CAPTURING || state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Not proper state. state[%d]", state); + MMCAM_LOG_ERROR("Not proper state. state[%d]", state); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_CAMCORDER_INVALID_STATE; } if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_CAMCORDER_INTERNAL; } ret = gst_camera_control_stop_auto_focus(control); if (!ret) { - _mmcam_dbg_err("Auto focusing stop fail."); + MMCAM_LOG_ERROR("Auto focusing stop fail."); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_CAMCORDER_DEVICE_IO; } @@ -2016,17 +2021,17 @@ int _mmcamcorder_init_focusing(MMHandleType handle) if (current_focus_mode != sensor_focus_mode || current_af_range != sensor_af_range) { ret = gst_camera_control_set_focus(control, sensor_focus_mode, sensor_af_range); } else { - _mmcam_dbg_log("No need to init FOCUS [mode:%d, range:%d]", focus_mode, af_range); + MMCAM_LOG_INFO("No need to init FOCUS [mode:%d, range:%d]", focus_mode, af_range); ret = TRUE; } _MMCAMCORDER_UNLOCK_CMD(hcamcorder); if (ret) { - _mmcam_dbg_log("Lens init success."); + MMCAM_LOG_INFO("Lens init success."); return MM_ERROR_NONE; } else { - _mmcam_dbg_err("Lens init fail."); + MMCAM_LOG_ERROR("Lens init fail."); return MM_ERROR_CAMCORDER_DEVICE_IO; } } @@ -2041,16 +2046,16 @@ int _mmcamcorder_adjust_focus(MMHandleType handle, int direction) mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(direction, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } state = _mmcamcorder_get_state(handle); if (state == MM_CAMCORDER_STATE_CAPTURING || state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Not proper state. state[%d]", state); + MMCAM_LOG_ERROR("Not proper state. state[%d]", state); _MMCAMCORDER_UNLOCK_CMD(handle); return MM_ERROR_CAMCORDER_INVALID_STATE; } @@ -2060,7 +2065,7 @@ int _mmcamcorder_adjust_focus(MMHandleType handle, int direction) MMCAM_CAMERA_FOCUS_MODE, &focus_mode, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get focus-mode fail. (%s:%x)", err_attr_name, ret); + MMCAM_LOG_WARNING("Get focus-mode fail. (%s:%x)", err_attr_name, ret); SAFE_FREE(err_attr_name); _MMCAMCORDER_UNLOCK_CMD(handle); return ret; @@ -2076,7 +2081,7 @@ int _mmcamcorder_adjust_focus(MMHandleType handle, int direction) ret = _mmcamcorder_adjust_auto_focus(handle); break; default: - _mmcam_dbg_err("It doesn't adjust focus. Focusing mode(%d)", focus_mode); + MMCAM_LOG_ERROR("It doesn't adjust focus. Focusing mode(%d)", focus_mode); ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED; } @@ -2096,7 +2101,7 @@ int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction) _MMCamcorderSubContext *sc = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(_MMFCAMCORDER_FOCUS_TOTAL_LEVEL != 1, MM_ERROR_CAMCORDER_NOT_SUPPORTED); @@ -2108,24 +2113,24 @@ int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return MM_ERROR_NONE; } control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); if (control == NULL) { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); return MM_ERROR_CAMCORDER_INTERNAL; } /* TODO : get max, min level */ if (max_level - min_level + 1 < _MMFCAMCORDER_FOCUS_TOTAL_LEVEL) - _mmcam_dbg_warn("Total level of manual focus of MMF is greater than that of the camera driver."); + MMCAM_LOG_WARNING("Total level of manual focus of MMF is greater than that of the camera driver."); unit_level = ((float)max_level - (float)min_level)/(float)(_MMFCAMCORDER_FOCUS_TOTAL_LEVEL - 1); if (!gst_camera_control_get_focus_level(control, &cur_level)) { - _mmcam_dbg_err("Can't get current level of manual focus."); + MMCAM_LOG_ERROR("Can't get current level of manual focus."); return MM_ERROR_CAMCORDER_DEVICE_IO; } @@ -2141,7 +2146,7 @@ int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction) focus_level = min_level; if (!gst_camera_control_set_focus_level(control, focus_level)) { - _mmcam_dbg_err("Manual focusing fail."); + MMCAM_LOG_ERROR("Manual focusing fail."); return MM_ERROR_CAMCORDER_DEVICE_IO; } @@ -2158,12 +2163,12 @@ int _mmcamcorder_adjust_auto_focus(MMHandleType handle) mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); return MM_ERROR_NONE; } @@ -2172,15 +2177,15 @@ int _mmcamcorder_adjust_auto_focus(MMHandleType handle) /* Start AF */ ret = gst_camera_control_start_auto_focus(control); } else { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); ret = FALSE; } if (ret) { - _mmcam_dbg_log("Auto focusing start success."); + MMCAM_LOG_INFO("Auto focusing start success."); return MM_ERROR_NONE; } else { - _mmcam_dbg_err("Auto focusing start fail."); + MMCAM_LOG_ERROR("Auto focusing start fail."); return MM_ERROR_CAMCORDER_DEVICE_IO; } } @@ -2195,24 +2200,24 @@ int _mmcamcorder_stop_focusing(MMHandleType handle) mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_err("Another command is running."); + MMCAM_LOG_ERROR("Another command is running."); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } state = _mmcamcorder_get_state(handle); if (state == MM_CAMCORDER_STATE_CAPTURING || state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_err("Not proper state. state[%d]", state); + MMCAM_LOG_ERROR("Not proper state. state[%d]", state); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_CAMCORDER_INVALID_STATE; } if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("Can't cast Video source into camera control."); + MMCAM_LOG_INFO("Can't cast Video source into camera control."); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; } @@ -2221,17 +2226,17 @@ int _mmcamcorder_stop_focusing(MMHandleType handle) if (control) { ret = gst_camera_control_stop_auto_focus(control); } else { - _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed"); ret = FALSE; } _MMCAMCORDER_UNLOCK_CMD(hcamcorder); if (ret) { - _mmcam_dbg_log("Auto focusing stop success."); + MMCAM_LOG_INFO("Auto focusing stop success."); return MM_ERROR_NONE; } else { - _mmcam_dbg_err("Auto focusing stop fail."); + MMCAM_LOG_ERROR("Auto focusing stop fail."); return MM_ERROR_CAMCORDER_DEVICE_IO; } } @@ -2253,7 +2258,7 @@ static gboolean __mmcamcorder_init_gstreamer(camera_conf *conf) mmf_return_val_if_fail(conf, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* alloc */ argc = malloc(sizeof(int)); @@ -2279,15 +2284,15 @@ static gboolean __mmcamcorder_init_gstreamer(camera_conf *conf) argv[*argc] = g_strdup(GSTInitOption->value[(*argc)-1]); } - _mmcam_dbg_log("initializing gstreamer with following parameter[argc:%d]", *argc); + MMCAM_LOG_INFO("initializing gstreamer with following parameter[argc:%d]", *argc); for (i = 0; i < *argc; i++) - _mmcam_dbg_log("argv[%d] : %s", i, argv[i]); + MMCAM_LOG_INFO("argv[%d] : %s", i, argv[i]); /* initializing gstreamer */ ret = gst_init_check(argc, &argv, &err); if (!ret) { - _mmcam_dbg_err("Could not initialize GStreamer: %s ", err ? err->message : "unknown error occurred"); + MMCAM_LOG_ERROR("Could not initialize GStreamer: %s ", err ? err->message : "unknown error occurred"); if (err) g_error_free(err); } @@ -2313,7 +2318,7 @@ static gboolean __mmcamcorder_init_gstreamer(camera_conf *conf) return ret; ERROR: - _mmcam_dbg_err("failed to initialize gstreamer"); + MMCAM_LOG_ERROR("failed to initialize gstreamer"); if (argv) { free(argv); @@ -2339,7 +2344,7 @@ int _mmcamcorder_get_state(MMHandleType handle) _MMCAMCORDER_LOCK_STATE(handle); state = hcamcorder->state; - /*_mmcam_dbg_log("state=%d",state);*/ + /*MMCAM_LOG_INFO("state=%d",state);*/ _MMCAMCORDER_UNLOCK_STATE(handle); @@ -2372,7 +2377,7 @@ void _mmcamcorder_set_state(MMHandleType handle, int state) mmf_return_if_fail(hcamcorder); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ _MMCAMCORDER_LOCK_STATE(handle); @@ -2381,7 +2386,7 @@ void _mmcamcorder_set_state(MMHandleType handle, int state) hcamcorder->state = state; hcamcorder->old_state = old_state; - _mmcam_dbg_log("set state[%d -> %d] and send state-changed message", old_state, state); + MMCAM_LOG_INFO("set state[%d -> %d] and send state-changed message", old_state, state); /* To discern who changes the state */ switch (hcamcorder->state_change_by_system) { @@ -2403,7 +2408,7 @@ void _mmcamcorder_set_state(MMHandleType handle, int state) msg.param.state.previous = old_state; msg.param.state.current = state; - /*_mmcam_dbg_log("_mmcamcorder_send_message : msg : %p, id:%x", &msg, msg.id);*/ + /*MMCAM_LOG_INFO("_mmcamcorder_send_message : msg : %p, id:%x", &msg, msg.id);*/ _mmcamcorder_send_message(handle, &msg); } @@ -2418,14 +2423,10 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type) int i; _MMCamcorderSubContext *sc = NULL; - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ /* alloc container */ - sc = (_MMCamcorderSubContext *)malloc(sizeof(_MMCamcorderSubContext)); - mmf_return_val_if_fail(sc, NULL); - - /* init members */ - memset(sc, 0x00, sizeof(_MMCamcorderSubContext)); + sc = (_MMCamcorderSubContext *)g_malloc0(sizeof(_MMCamcorderSubContext)); sc->element_num = _MMCAMCORDER_PIPELINE_ELEMENT_NUM; sc->encode_element_num = _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM; @@ -2434,43 +2435,20 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type) switch (type) { case MM_CAMCORDER_MODE_AUDIO: sc->info_audio = g_malloc0(sizeof(_MMCamcorderAudioInfo)); - if (!sc->info_audio) { - _mmcam_dbg_err("Failed to alloc info structure"); - goto ALLOC_SUBCONTEXT_FAILED; - } break; case MM_CAMCORDER_MODE_VIDEO_CAPTURE: default: sc->info_image = g_malloc0(sizeof(_MMCamcorderImageInfo)); - if (!sc->info_image) { - _mmcam_dbg_err("Failed to alloc info structure"); - goto ALLOC_SUBCONTEXT_FAILED; - } + sc->info_video = g_malloc0(sizeof(_MMCamcorderVideoInfo)); - /* init sound status */ sc->info_image->sound_status = _SOUND_STATUS_INIT; - - sc->info_video = g_malloc0(sizeof(_MMCamcorderVideoInfo)); - if (!sc->info_video) { - _mmcam_dbg_err("Failed to alloc info structure"); - goto ALLOC_SUBCONTEXT_FAILED; - } g_mutex_init(&sc->info_video->size_check_lock); break; } /* alloc element array */ - sc->element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->element_num); - if (!sc->element) { - _mmcam_dbg_err("Failed to alloc element structure"); - goto ALLOC_SUBCONTEXT_FAILED; - } - - sc->encode_element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->encode_element_num); - if (!sc->encode_element) { - _mmcam_dbg_err("Failed to alloc encode element structure"); - goto ALLOC_SUBCONTEXT_FAILED; - } + sc->element = (_MMCamcorderGstElement *)g_malloc(sizeof(_MMCamcorderGstElement) * sc->element_num); + sc->encode_element = (_MMCamcorderGstElement *)g_malloc(sizeof(_MMCamcorderGstElement) * sc->encode_element_num); for (i = 0 ; i < sc->element_num ; i++) { sc->element[i].id = _MMCAMCORDER_NONE; @@ -2489,70 +2467,48 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type) sc->is_modified_rate = FALSE; return sc; - -ALLOC_SUBCONTEXT_FAILED: - if (sc) { - SAFE_G_FREE(sc->info_audio); - SAFE_G_FREE(sc->info_image); - if (sc->info_video) - g_mutex_clear(&sc->info_video->size_check_lock); - - SAFE_G_FREE(sc->info_video); - if (sc->element) { - free(sc->element); - sc->element = NULL; - } - if (sc->encode_element) { - free(sc->encode_element); - sc->encode_element = NULL; - } - free(sc); - sc = NULL; - } - - return NULL; } void _mmcamcorder_dealloc_subcontext(_MMCamcorderSubContext *sc) { - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (sc) { if (sc->element) { - _mmcam_dbg_log("release element"); - free(sc->element); + MMCAM_LOG_INFO("release element"); + g_free(sc->element); sc->element = NULL; } if (sc->encode_element) { - _mmcam_dbg_log("release encode_element"); - free(sc->encode_element); + MMCAM_LOG_INFO("release encode_element"); + g_free(sc->encode_element); sc->encode_element = NULL; } if (sc->info_image) { - _mmcam_dbg_log("release info_image"); - free(sc->info_image); + MMCAM_LOG_INFO("release info_image"); + g_free(sc->info_image); sc->info_image = NULL; } if (sc->info_video) { - _mmcam_dbg_log("release info_video"); + MMCAM_LOG_INFO("release info_video"); SAFE_G_FREE(sc->info_video->filename); g_mutex_clear(&sc->info_video->size_check_lock); - free(sc->info_video); + g_free(sc->info_video); sc->info_video = NULL; } if (sc->info_audio) { - _mmcam_dbg_log("release info_audio"); + MMCAM_LOG_INFO("release info_audio"); SAFE_G_FREE(sc->info_audio->filename); - free(sc->info_audio); + g_free(sc->info_audio); sc->info_audio = NULL; } - free(sc); + g_free(sc); sc = NULL; } @@ -2564,7 +2520,7 @@ int _mmcamcorder_set_functions(MMHandleType handle, int type) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ switch (type) { case MM_CAMCORDER_MODE_AUDIO: @@ -2587,15 +2543,15 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi mmf_return_val_if_fail(hcamcorder, FALSE); mmf_return_val_if_fail(message, FALSE); - /* _mmcam_dbg_log("message type=(%d)", GST_MESSAGE_TYPE(message)); */ + /* MMCAM_LOG_INFO("message type=(%d)", GST_MESSAGE_TYPE(message)); */ switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_UNKNOWN: - _mmcam_dbg_log("GST_MESSAGE_UNKNOWN"); + MMCAM_LOG_INFO("GST_MESSAGE_UNKNOWN"); break; case GST_MESSAGE_EOS: { - _mmcam_dbg_err("Got EOS from element \"%s\"... but should not be reached here!", + MMCAM_LOG_ERROR("Got EOS from element \"%s\"... but should not be reached here!", GST_STR_NULL(GST_ELEMENT_NAME(GST_MESSAGE_SRC(message)))); break; } @@ -2609,13 +2565,13 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi __mmcamcorder_handle_gst_error((MMHandleType)hcamcorder, message, err); if (err) { - _mmcam_dbg_err("GSTERR: %s", err->message); + MMCAM_LOG_ERROR("GSTERR: %s", err->message); g_error_free(err); err = NULL; } if (debug) { - _mmcam_dbg_err("Error Debug: %s", debug); + MMCAM_LOG_ERROR("Error Debug: %s", debug); g_free(debug); debug = NULL; } @@ -2627,7 +2583,7 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi gchar *debug; gst_message_parse_warning(message, &err, &debug); - _mmcam_dbg_warn("GSTWARN: %s", err->message); + MMCAM_LOG_WARNING("GSTWARN: %s", err->message); __mmcamcorder_handle_gst_warning((MMHandleType)hcamcorder, message, err); @@ -2636,13 +2592,13 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi break; } case GST_MESSAGE_INFO: - _mmcam_dbg_log("GST_MESSAGE_INFO"); + MMCAM_LOG_INFO("GST_MESSAGE_INFO"); break; case GST_MESSAGE_TAG: - _mmcam_dbg_log("GST_MESSAGE_TAG"); + MMCAM_LOG_INFO("GST_MESSAGE_TAG"); break; case GST_MESSAGE_BUFFERING: - _mmcam_dbg_log("GST_MESSAGE_BUFFERING"); + MMCAM_LOG_INFO("GST_MESSAGE_BUFFERING"); break; case GST_MESSAGE_STATE_CHANGED: { @@ -2658,9 +2614,9 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi vnewstate = gst_structure_get_value(gst_message_get_structure(message), "new-state"); if (vnewstate) { newstate = (GstState)vnewstate->data[0].v_int; - _mmcam_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]", gst_element_state_get_name(newstate)); + MMCAM_LOG_INFO("GST_MESSAGE_STATE_CHANGED[%s]", gst_element_state_get_name(newstate)); } else { - _mmcam_dbg_warn("get new state failed from msg"); + MMCAM_LOG_WARNING("get new state failed from msg"); } } } @@ -2668,62 +2624,62 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi break; } case GST_MESSAGE_STATE_DIRTY: - _mmcam_dbg_log("GST_MESSAGE_STATE_DIRTY"); + MMCAM_LOG_INFO("GST_MESSAGE_STATE_DIRTY"); break; case GST_MESSAGE_STEP_DONE: - _mmcam_dbg_log("GST_MESSAGE_STEP_DONE"); + MMCAM_LOG_INFO("GST_MESSAGE_STEP_DONE"); break; case GST_MESSAGE_CLOCK_PROVIDE: - _mmcam_dbg_log("GST_MESSAGE_CLOCK_PROVIDE"); + MMCAM_LOG_INFO("GST_MESSAGE_CLOCK_PROVIDE"); break; case GST_MESSAGE_CLOCK_LOST: - _mmcam_dbg_log("GST_MESSAGE_CLOCK_LOST"); + MMCAM_LOG_INFO("GST_MESSAGE_CLOCK_LOST"); break; case GST_MESSAGE_NEW_CLOCK: { GstClock *pipe_clock = NULL; gst_message_parse_new_clock(message, &pipe_clock); - /*_mmcam_dbg_log("GST_MESSAGE_NEW_CLOCK : %s", (clock ? GST_OBJECT_NAME (clock) : "NULL"));*/ + /*MMCAM_LOG_INFO("GST_MESSAGE_NEW_CLOCK : %s", (clock ? GST_OBJECT_NAME (clock) : "NULL"));*/ break; } case GST_MESSAGE_STRUCTURE_CHANGE: - _mmcam_dbg_log("GST_MESSAGE_STRUCTURE_CHANGE"); + MMCAM_LOG_INFO("GST_MESSAGE_STRUCTURE_CHANGE"); break; case GST_MESSAGE_STREAM_STATUS: - /*_mmcam_dbg_log("GST_MESSAGE_STREAM_STATUS");*/ + /*MMCAM_LOG_INFO("GST_MESSAGE_STREAM_STATUS");*/ break; case GST_MESSAGE_APPLICATION: - _mmcam_dbg_log("GST_MESSAGE_APPLICATION"); + MMCAM_LOG_INFO("GST_MESSAGE_APPLICATION"); break; case GST_MESSAGE_ELEMENT: - /*_mmcam_dbg_log("GST_MESSAGE_ELEMENT");*/ + /*MMCAM_LOG_INFO("GST_MESSAGE_ELEMENT");*/ break; case GST_MESSAGE_SEGMENT_START: - _mmcam_dbg_log("GST_MESSAGE_SEGMENT_START"); + MMCAM_LOG_INFO("GST_MESSAGE_SEGMENT_START"); break; case GST_MESSAGE_SEGMENT_DONE: - _mmcam_dbg_log("GST_MESSAGE_SEGMENT_DONE"); + MMCAM_LOG_INFO("GST_MESSAGE_SEGMENT_DONE"); break; case GST_MESSAGE_DURATION_CHANGED: - _mmcam_dbg_log("GST_MESSAGE_DURATION_CHANGED"); + MMCAM_LOG_INFO("GST_MESSAGE_DURATION_CHANGED"); break; case GST_MESSAGE_LATENCY: - _mmcam_dbg_log("GST_MESSAGE_LATENCY"); + MMCAM_LOG_INFO("GST_MESSAGE_LATENCY"); break; case GST_MESSAGE_ASYNC_START: - _mmcam_dbg_log("GST_MESSAGE_ASYNC_START"); + MMCAM_LOG_INFO("GST_MESSAGE_ASYNC_START"); break; case GST_MESSAGE_ASYNC_DONE: - /*_mmcam_dbg_log("GST_MESSAGE_ASYNC_DONE");*/ + /*MMCAM_LOG_INFO("GST_MESSAGE_ASYNC_DONE");*/ break; case GST_MESSAGE_ANY: - _mmcam_dbg_log("GST_MESSAGE_ANY"); + MMCAM_LOG_INFO("GST_MESSAGE_ANY"); break; case GST_MESSAGE_QOS: - /* _mmcam_dbg_log("GST_MESSAGE_QOS"); */ + /* MMCAM_LOG_INFO("GST_MESSAGE_QOS"); */ break; default: - _mmcam_dbg_log("not handled message type=(%d)", GST_MESSAGE_TYPE(message)); + MMCAM_LOG_INFO("not handled message type=(%d)", GST_MESSAGE_TYPE(message)); break; } @@ -2751,13 +2707,13 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage gst_message_parse_error(message, &err, &debug_info); if (debug_info) { - _mmcam_dbg_err("GST ERROR : %s", debug_info); + MMCAM_LOG_ERROR("GST ERROR : %s", debug_info); g_free(debug_info); debug_info = NULL; } if (!err) { - _mmcam_dbg_warn("failed to parse error message"); + MMCAM_LOG_WARNING("failed to parse error message"); return GST_BUS_PASS; } @@ -2768,40 +2724,40 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage if (err->domain == GST_RESOURCE_ERROR && GST_ELEMENT_CAST(message->src) == element) { switch (err->code) { case GST_RESOURCE_ERROR_BUSY: - _mmcam_dbg_err("Camera device [busy]"); + MMCAM_LOG_ERROR("Camera device [busy]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY; break; case GST_RESOURCE_ERROR_OPEN_WRITE: - _mmcam_dbg_err("Camera device [open failed]"); + MMCAM_LOG_ERROR("Camera device [open failed]"); hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION; /* sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN; // SECURITY PART REQUEST PRIVILEGE */ break; case GST_RESOURCE_ERROR_OPEN_READ_WRITE: - _mmcam_dbg_err("Camera device [open failed]"); + MMCAM_LOG_ERROR("Camera device [open failed]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN; break; case GST_RESOURCE_ERROR_OPEN_READ: - _mmcam_dbg_err("Camera device [register trouble]"); + MMCAM_LOG_ERROR("Camera device [register trouble]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE; break; case GST_RESOURCE_ERROR_NOT_FOUND: - _mmcam_dbg_err("Camera device [device not found]"); + MMCAM_LOG_ERROR("Camera device [device not found]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND; break; case GST_RESOURCE_ERROR_TOO_LAZY: - _mmcam_dbg_err("Camera device [timeout]"); + MMCAM_LOG_ERROR("Camera device [timeout]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_TIMEOUT; break; case GST_RESOURCE_ERROR_SETTINGS: - _mmcam_dbg_err("Camera device [not supported]"); + MMCAM_LOG_ERROR("Camera device [not supported]"); hcamcorder->error_code = MM_ERROR_CAMCORDER_NOT_SUPPORTED; break; case GST_RESOURCE_ERROR_FAILED: - _mmcam_dbg_err("Camera device [working failed]."); + MMCAM_LOG_ERROR("Camera device [working failed]."); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_IO; break; default: - _mmcam_dbg_err("Camera device [General(%d)]", err->code); + MMCAM_LOG_ERROR("Camera device [General(%d)]", err->code); hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE; break; } @@ -2831,7 +2787,7 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage int focus_state = 0; gst_structure_get_int(gst_message_get_structure(message), "focus-state", &focus_state); - _mmcam_dbg_log("Focus State:%d", focus_state); + MMCAM_LOG_INFO("Focus State:%d", focus_state); msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED; msg.param.code = focus_state; @@ -2844,7 +2800,7 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage if (gst_structure_get_int(gst_message_get_structure(message), "progress", &progress)) { gst_structure_get_int(gst_message_get_structure(message), "status", &status); - _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status); + MMCAM_LOG_INFO("HDR progress %d percent, status %d", progress, status); msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS; msg.param.code = progress; @@ -2862,60 +2818,46 @@ GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value); if (fd_info == NULL) { - _mmcam_dbg_warn("fd_info is NULL"); + MMCAM_LOG_WARNING("fd_info is NULL"); goto DROP_MESSAGE; } cam_fd_info = (MMCamFaceDetectInfo *)g_malloc(sizeof(MMCamFaceDetectInfo)); - if (cam_fd_info == NULL) { - _mmcam_dbg_warn("cam_fd_info alloc failed"); - SAFE_FREE(fd_info); - goto DROP_MESSAGE; - } /* set total face count */ cam_fd_info->num_of_faces = fd_info->num_of_faces; if (cam_fd_info->num_of_faces > 0) { cam_fd_info->face_info = (MMCamFaceInfo *)g_malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces); - if (cam_fd_info->face_info) { - /* set information of each face */ - for (i = 0 ; i < fd_info->num_of_faces ; i++) { - cam_fd_info->face_info[i].id = fd_info->face_info[i].id; - cam_fd_info->face_info[i].score = fd_info->face_info[i].score; - cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x; - cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y; - cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width; - cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height; - /* - _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]", - fd_info->face_info[i].id, - fd_info->face_info[i].score, - fd_info->face_info[i].rect.x, - fd_info->face_info[i].rect.y, - fd_info->face_info[i].rect.width, - fd_info->face_info[i].rect.height); - */ - } - } else { - _mmcam_dbg_warn("MMCamFaceInfo alloc failed"); - - /* free allocated memory that is not sent */ - SAFE_G_FREE(cam_fd_info); + MMCAM_LOG_DEBUG("face detection - count %d", cam_fd_info->num_of_faces); + /* set information of each face */ + for (i = 0 ; i < cam_fd_info->num_of_faces ; i++) { + cam_fd_info->face_info[i].id = fd_info->face_info[i].id; + cam_fd_info->face_info[i].score = fd_info->face_info[i].score; + cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x; + cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y; + cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width; + cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height; + + MMCAM_LOG_VERBOSE(" [%d] id %d, score %d, [%d,%d,%dx%d]", + i, fd_info->face_info[i].id, + fd_info->face_info[i].score, + fd_info->face_info[i].rect.x, + fd_info->face_info[i].rect.y, + fd_info->face_info[i].rect.width, + fd_info->face_info[i].rect.height); } } else { cam_fd_info->face_info = NULL; } - if (cam_fd_info) { - /* send message - cam_fd_info should be freed by application */ - msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO; - msg.param.data = cam_fd_info; - msg.param.size = sizeof(MMCamFaceDetectInfo); - msg.param.code = 0; + /* send message - cam_fd_info should be freed by application */ + msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO; + msg.param.data = cam_fd_info; + msg.param.size = sizeof(MMCamFaceDetectInfo); + msg.param.code = 0; - _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - } + _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); /* free fd_info allocated by plugin */ free(fd_info); @@ -2950,14 +2892,14 @@ static GstBusSyncReply __mmcamcorder_gst_handle_sync_audio_error(mmf_camcorder_t _MMCamcorderMsgItem msg; if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return GST_BUS_PASS; } switch (err_code) { case GST_RESOURCE_ERROR_OPEN_READ_WRITE: case GST_RESOURCE_ERROR_OPEN_WRITE: - _mmcam_dbg_err("audio device [open failed]"); + MMCAM_LOG_ERROR("audio device [open failed]"); /* post error to application */ hcamcorder->error_occurs = TRUE; @@ -2968,7 +2910,7 @@ static GstBusSyncReply __mmcamcorder_gst_handle_sync_audio_error(mmf_camcorder_t _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - _mmcam_dbg_err("error : sc->error_occurs %d", hcamcorder->error_occurs); + MMCAM_LOG_ERROR("error : sc->error_occurs %d", hcamcorder->error_occurs); return GST_BUS_DROP; default: @@ -2987,7 +2929,7 @@ static GstBusSyncReply __mmcamcorder_gst_handle_sync_others_error(mmf_camcorder_ _MMCamcorderSubContext *sc = NULL; if (!hcamcorder) { - _mmcam_dbg_err("NULL handle"); + MMCAM_LOG_ERROR("NULL handle"); return GST_BUS_PASS; } @@ -3009,35 +2951,35 @@ static GstBusSyncReply __mmcamcorder_gst_handle_sync_others_error(mmf_camcorder_ storage_get_state(hcamcorder->storage_info.id, &storage_state); if (storage_state == STORAGE_STATE_REMOVED || storage_state == STORAGE_STATE_UNMOUNTABLE) { - _mmcam_dbg_err("storage was removed! [storage state %d]", storage_state); + MMCAM_LOG_ERROR("storage was removed! [storage state %d]", storage_state); hcamcorder->error_code = MM_ERROR_OUT_OF_STORAGE; } else { - _mmcam_dbg_err("File write error, storage state %d", storage_state); + MMCAM_LOG_ERROR("File write error, storage state %d", storage_state); hcamcorder->error_code = MM_ERROR_FILE_WRITE; } if (sc->ferror_send == FALSE) { sc->ferror_send = TRUE; } else { - _mmcam_dbg_err("error was already sent"); + MMCAM_LOG_ERROR("error was already sent"); _MMCAMCORDER_UNLOCK(hcamcorder); return GST_BUS_DROP; } break; case GST_RESOURCE_ERROR_NO_SPACE_LEFT: - _mmcam_dbg_err("No left space"); + MMCAM_LOG_ERROR("No left space"); hcamcorder->error_code = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE; break; case GST_RESOURCE_ERROR_OPEN_WRITE: - _mmcam_dbg_err("Out of storage"); + MMCAM_LOG_ERROR("Out of storage"); hcamcorder->error_code = MM_ERROR_OUT_OF_STORAGE; break; case GST_RESOURCE_ERROR_SEEK: - _mmcam_dbg_err("File read(seek)"); + MMCAM_LOG_ERROR("File read(seek)"); hcamcorder->error_code = MM_ERROR_FILE_READ; break; default: - _mmcam_dbg_err("Resource error(%d)", err_code); + MMCAM_LOG_ERROR("Resource error(%d)", err_code); hcamcorder->error_code = MM_ERROR_CAMCORDER_GST_RESOURCE; break; } @@ -3066,7 +3008,7 @@ static GstBusSyncReply __mmcamcorder_handle_gst_sync_error(mmf_camcorder_t *hcam _MMCamcorderSubContext *sc = NULL; if (!message || !hcamcorder) { - _mmcam_dbg_err("NULL message(%p) or handle(%p)", message, hcamcorder); + MMCAM_LOG_ERROR("NULL message(%p) or handle(%p)", message, hcamcorder); return GST_BUS_PASS; } @@ -3077,13 +3019,13 @@ static GstBusSyncReply __mmcamcorder_handle_gst_sync_error(mmf_camcorder_t *hcam gst_message_parse_error(message, &err, &debug_info); if (debug_info) { - _mmcam_dbg_err("GST ERROR : %s", debug_info); + MMCAM_LOG_ERROR("GST ERROR : %s", debug_info); g_free(debug_info); debug_info = NULL; } if (!err) { - _mmcam_dbg_warn("failed to parse error message"); + MMCAM_LOG_WARNING("failed to parse error message"); return GST_BUS_PASS; } @@ -3114,7 +3056,7 @@ GstBusSyncReply _mmcamcorder_encode_pipeline_bus_sync_callback(GstBus *bus, GstM mmf_return_val_if_fail(sc, GST_BUS_PASS); if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS) { - _mmcam_dbg_log("got EOS from pipeline"); + MMCAM_LOG_INFO("got EOS from pipeline"); _MMCAMCORDER_LOCK(hcamcorder); @@ -3145,11 +3087,11 @@ void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *val current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); if (current_state <= MM_CAMCORDER_STATE_NONE || current_state >= MM_CAMCORDER_STATE_NUM) { - _mmcam_dbg_err("Abnormal state. Or null handle. (%p, %d)", hcamcorder, current_state); + MMCAM_LOG_ERROR("Abnormal state. Or null handle. (%p, %d)", hcamcorder, current_state); return; } - _mmcam_dbg_warn("camera policy [%s], current state [%d]", value, current_state); + MMCAM_LOG_WARNING("camera policy [%s], current state [%d]", value, current_state); if (!strcmp(value, "disallowed")) { _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); @@ -3161,7 +3103,7 @@ void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *val _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "camera"); } - _mmcam_dbg_warn("done"); + MMCAM_LOG_WARNING("done"); return; } @@ -3174,7 +3116,7 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type) _MMCamcorderSubContext *sc = NULL; GstElement *pipeline = NULL; - _mmcam_dbg_log("handle : %p, type : %d", handle, type); + MMCAM_LOG_INFO("handle : %p, type : %d", handle, type); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -3213,12 +3155,12 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type) } #ifdef _MMCAMCORDER_GET_DEVICE_INFO if (!_mmcamcorder_get_device_info(handle)) - _mmcam_dbg_err("Getting device information error!!"); + MMCAM_LOG_ERROR("Getting device information error!!"); #endif - _mmcam_dbg_log("ret[%x]", ret); + MMCAM_LOG_INFO("ret[%x]", ret); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("error : destroy pipeline"); + MMCAM_LOG_ERROR("error : destroy pipeline"); _mmcamcorder_destroy_pipeline(handle, hcamcorder->type); } @@ -3240,7 +3182,7 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_if_fail(sc); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Inside each pipeline destroy function, Set GST_STATE_NULL to Main pipeline */ switch (type) { @@ -3257,11 +3199,11 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type) _mmcamcorder_destroy_audio_pipeline(handle); break; default: - _mmcam_dbg_err("unknown type %d", type); + MMCAM_LOG_ERROR("unknown type %d", type); break; } - _mmcam_dbg_log("Pipeline clear!!"); + MMCAM_LOG_INFO("Pipeline clear!!"); /* Remove pipeline message callback */ if (hcamcorder->pipeline_cb_event_id > 0) { @@ -3285,14 +3227,14 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type) for (i = 0 ; i < element_num ; i++) { if (element[i].gst) { if (GST_IS_ELEMENT(element[i].gst)) { - _mmcam_dbg_warn("Still alive element - ID[%d], name [%s], ref count[%d], status[%s]", + MMCAM_LOG_WARNING("Still alive element - ID[%d], name [%s], ref count[%d], status[%s]", element[i].id, GST_OBJECT_NAME(element[i].gst), GST_OBJECT_REFCOUNT(element[i].gst), gst_element_state_get_name(GST_STATE(element[i].gst))); g_object_weak_unref(G_OBJECT(element[i].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sc); } else { - _mmcam_dbg_warn("The element[%d] is still aliving, check it", element[i].id); + MMCAM_LOG_WARNING("The element[%d] is still alive, check it", element[i].id); } element[i].id = _MMCAMCORDER_NONE; @@ -3311,14 +3253,14 @@ static gboolean __mmcamcorder_set_attr_to_camsensor_cb(gpointer data) mmf_return_val_if_fail(hcamcorder, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); _mmcamcorder_set_attribute_to_camsensor((MMHandleType)hcamcorder); /* initialize */ hcamcorder->setting_event_id = 0; - _mmcam_dbg_log("Done"); + MMCAM_LOG_INFO("Done"); /* once */ return FALSE; @@ -3341,10 +3283,10 @@ int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstSta mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst == pipeline) { - _mmcam_dbg_log("Set state to %d - PREVIEW PIPELINE", target_state); + MMCAM_LOG_INFO("Set state to %d - PREVIEW PIPELINE", target_state); state_lock = &_MMCAMCORDER_GET_GST_STATE_LOCK(handle); } else { - _mmcam_dbg_log("Set state to %d - ENDODE PIPELINE", target_state); + MMCAM_LOG_INFO("Set state to %d - ENDODE PIPELINE", target_state); state_lock = &_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle); } @@ -3352,34 +3294,34 @@ int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstSta for (k = 0; k < _MMCAMCORDER_STATE_SET_COUNT; k++) { setChangeReturn = gst_element_set_state(pipeline, target_state); - _mmcam_dbg_log("gst_element_set_state[%d] return %d", target_state, setChangeReturn); + MMCAM_LOG_INFO("gst_element_set_state[%d] return %d", target_state, setChangeReturn); if (setChangeReturn != GST_STATE_CHANGE_FAILURE) { getChangeReturn = gst_element_get_state(pipeline, &pipeline_state, NULL, get_timeout); switch (getChangeReturn) { case GST_STATE_CHANGE_NO_PREROLL: - _mmcam_dbg_log("status=GST_STATE_CHANGE_NO_PREROLL."); + MMCAM_LOG_INFO("status=GST_STATE_CHANGE_NO_PREROLL."); /* fall through */ case GST_STATE_CHANGE_SUCCESS: /* if we reached the final target state, exit */ if (pipeline_state == target_state) { - _mmcam_dbg_log("Set state to %d - DONE", target_state); + MMCAM_LOG_INFO("Set state to %d - DONE", target_state); g_mutex_unlock(state_lock); return MM_ERROR_NONE; } break; case GST_STATE_CHANGE_ASYNC: - _mmcam_dbg_log("status=GST_STATE_CHANGE_ASYNC."); + MMCAM_LOG_INFO("status=GST_STATE_CHANGE_ASYNC."); break; default: g_mutex_unlock(state_lock); - _mmcam_dbg_log("status=GST_STATE_CHANGE_FAILURE."); + MMCAM_LOG_INFO("status=GST_STATE_CHANGE_FAILURE."); return MM_ERROR_CAMCORDER_GST_STATECHANGE; } g_mutex_unlock(state_lock); - _mmcam_dbg_err("timeout of gst_element_get_state()!!"); + MMCAM_LOG_ERROR("timeout of gst_element_get_state()!!"); return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT; } @@ -3389,7 +3331,7 @@ int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstSta g_mutex_unlock(state_lock); - _mmcam_dbg_err("Failure. gst_element_set_state timeout!!"); + MMCAM_LOG_ERROR("Failure. gst_element_set_state timeout!!"); return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT; } @@ -3456,10 +3398,10 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s do { if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { if (cmd_try_count++ < __MMCAMCORDER_FORCE_STOP_TRY_COUNT) { - _mmcam_dbg_warn("Another command is running. try again after %d ms", __MMCAMCORDER_FORCE_STOP_WAIT_TIME/1000); + MMCAM_LOG_WARNING("Another command is running. try again after %d ms", __MMCAMCORDER_FORCE_STOP_WAIT_TIME/1000); usleep(__MMCAMCORDER_FORCE_STOP_WAIT_TIME); } else { - _mmcam_dbg_err("wait timeout"); + MMCAM_LOG_ERROR("wait timeout"); break; } } else { @@ -3470,13 +3412,13 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); - _mmcam_dbg_warn("Force STOP MMFW Camcorder by %d", state_change_by_system); + MMCAM_LOG_WARNING("Force STOP MMFW Camcorder by %d", state_change_by_system); /* set state_change_by_system for state change message */ hcamcorder->state_change_by_system = state_change_by_system; if (current_state >= MM_CAMCORDER_STATE_READY) { - _mmcam_dbg_warn("send state change started message to notify"); + MMCAM_LOG_WARNING("send state change started message to notify"); memset(&msg, 0x0, sizeof(_MMCamcorderMsgItem)); @@ -3495,7 +3437,7 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s msg.param.state.code = hcamcorder->interrupt_code; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); } else { - _mmcam_dbg_err("should not be reached here %d", state_change_by_system); + MMCAM_LOG_ERROR("should not be reached here %d", state_change_by_system); } } @@ -3510,9 +3452,9 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s mmf_return_if_fail(sc); mmf_return_if_fail((info = sc->info_image)); - _mmcam_dbg_warn("Stop capturing."); + MMCAM_LOG_WARNING("Stop capturing."); - /* if caturing isn't finished, waiting for 2 sec to finish real capture operation. check 'info->capturing'. */ + /* if capturing isn't finished, waiting for 2 sec to finish real capture operation. check 'info->capturing'. */ mm_camcorder_set_attributes((MMHandleType)hcamcorder, NULL, MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT, TRUE, NULL); @@ -3521,20 +3463,20 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s usleep(100000); if (i == 20) - _mmcam_dbg_err("Timeout. Can't check stop capturing."); + MMCAM_LOG_ERROR("Timeout. Can't check stop capturing."); while ((itr_cnt--) && ((result = _mmcamcorder_capture_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) - _mmcam_dbg_warn("Can't stop capturing.(%x)", result); + MMCAM_LOG_WARNING("Can't stop capturing.(%x)", result); break; } case MM_CAMCORDER_STATE_RECORDING: case MM_CAMCORDER_STATE_PAUSED: { - _mmcam_dbg_warn("Stop recording."); + MMCAM_LOG_WARNING("Stop recording."); while ((itr_cnt--) && ((result = _mmcamcorder_commit((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) { - _mmcam_dbg_warn("Can't commit.(%x), cancel it.", result); + MMCAM_LOG_WARNING("Can't commit.(%x), cancel it.", result); _mmcamcorder_cancel((MMHandleType)hcamcorder); } @@ -3542,24 +3484,24 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s } case MM_CAMCORDER_STATE_PREPARE: { - _mmcam_dbg_warn("Stop preview."); + MMCAM_LOG_WARNING("Stop preview."); while ((itr_cnt--) && ((result = _mmcamcorder_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) - _mmcam_dbg_warn("Can't stop preview.(%x)", result); + MMCAM_LOG_WARNING("Can't stop preview.(%x)", result); break; } case MM_CAMCORDER_STATE_READY: { - _mmcam_dbg_warn("unrealize"); + MMCAM_LOG_WARNING("unrealize"); if ((result = _mmcamcorder_unrealize((MMHandleType)hcamcorder)) != MM_ERROR_NONE) - _mmcam_dbg_warn("Can't unrealize.(%x)", result); + MMCAM_LOG_WARNING("Can't unrealize.(%x)", result); break; } default: - _mmcam_dbg_warn("Already stopped."); + MMCAM_LOG_WARNING("Already stopped."); break; } @@ -3569,7 +3511,7 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s /* restore */ hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL; - _mmcam_dbg_warn("Done."); + MMCAM_LOG_WARNING("Done."); return; } @@ -3587,7 +3529,7 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* filtering filesink related errors */ if (hcamcorder->state == MM_CAMCORDER_STATE_RECORDING && @@ -3597,7 +3539,7 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * msg.param.code = __mmcamcorder_gst_handle_resource_error(handle, error->code, message); } else { sc->ferror_count++; - _mmcam_dbg_warn("Skip error"); + MMCAM_LOG_WARNING("Skip error"); return TRUE; } } @@ -3611,7 +3553,7 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * } else if (error->domain == GST_STREAM_ERROR) { msg.param.code = __mmcamcorder_gst_handle_stream_error(handle, error->code, message); } else { - _mmcam_dbg_warn("This error domain is not defined."); + MMCAM_LOG_WARNING("This error domain is not defined."); /* we treat system error as an internal error */ msg.param.code = MM_ERROR_CAMCORDER_INTERNAL; @@ -3619,17 +3561,17 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * if (message->src) { msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src)); - _mmcam_dbg_err("-Msg src : [%s] Domain : [%s] Error : [%s] Code : [%d] is tranlated to error code : [0x%x]", + MMCAM_LOG_ERROR("-Msg src : [%s] Domain : [%s] Error : [%s] Code : [%d] is tranlated to error code : [0x%x]", msg_src_element, g_quark_to_string(error->domain), error->message, error->code, msg.param.code); } else { - _mmcam_dbg_err("Domain : [%s] Error : [%s] Code : [%d] is tranlated to error code : [0x%x]", + MMCAM_LOG_ERROR("Domain : [%s] Error : [%s] Code : [%d] is tranlated to error code : [0x%x]", g_quark_to_string(error->domain), error->message, error->code, msg.param.code); } #ifdef _MMCAMCORDER_SKIP_GST_FLOW_ERROR /* Check whether send this error to application */ if (msg.param.code == MM_ERROR_CAMCORDER_GST_FLOW_ERROR) { - _mmcam_dbg_log("We got the error. But skip it."); + MMCAM_LOG_INFO("We got the error. But skip it."); return TRUE; } #endif /* _MMCAMCORDER_SKIP_GST_FLOW_ERROR */ @@ -3651,7 +3593,7 @@ static gint __mmcamcorder_gst_handle_core_error(MMHandleType handle, int code, G _MMCamcorderSubContext *sc = NULL; GstElement *element = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -3697,7 +3639,7 @@ static gint __mmcamcorder_gst_handle_library_error(MMHandleType handle, int code mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Specific plugin - NONE */ @@ -3710,7 +3652,7 @@ static gint __mmcamcorder_gst_handle_library_error(MMHandleType handle, int code case GST_LIBRARY_ERROR_SETTINGS: case GST_LIBRARY_ERROR_ENCODE: default: - _mmcam_dbg_err("Library error(%d)", code); + MMCAM_LOG_ERROR("Library error(%d)", code); return MM_ERROR_CAMCORDER_GST_LIBRARY; } } @@ -3727,17 +3669,17 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Specific plugin */ /* video sink */ element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst); if (GST_ELEMENT_CAST(message->src) == element) { if (code == GST_RESOURCE_ERROR_WRITE) { - _mmcam_dbg_err("Display device [Off]"); + MMCAM_LOG_ERROR("Display device [Off]"); return MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF; } else { - _mmcam_dbg_err("Display device [General(%d)]", code); + MMCAM_LOG_ERROR("Display device [General(%d)]", code); } } @@ -3748,7 +3690,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod int ret = MM_ERROR_NONE; int current_state = MM_CAMCORDER_STATE_NONE; - _mmcam_dbg_err("DPM mic DISALLOWED - current state %d", current_state); + MMCAM_LOG_ERROR("DPM mic DISALLOWED - current state %d", current_state); _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); @@ -3758,10 +3700,10 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_DPM; ret = _mmcamcorder_commit((MMHandleType)hcamcorder); - _mmcam_dbg_log("commit result : 0x%x", ret); + MMCAM_LOG_INFO("commit result : 0x%x", ret); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("commit failed, cancel it"); + MMCAM_LOG_ERROR("commit failed, cancel it"); ret = _mmcamcorder_cancel((MMHandleType)hcamcorder); } } @@ -3781,10 +3723,10 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst); if (GST_ELEMENT_CAST(message->src) == element) { if (code == GST_RESOURCE_ERROR_FAILED) { - _mmcam_dbg_err("Encoder [Resource error]"); + MMCAM_LOG_ERROR("Encoder [Resource error]"); return MM_ERROR_CAMCORDER_ENCODER_BUFFER; } else { - _mmcam_dbg_err("Encoder [General(%d)]", code); + MMCAM_LOG_ERROR("Encoder [General(%d)]", code); return MM_ERROR_CAMCORDER_ENCODER; } } @@ -3792,16 +3734,16 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod /* General */ switch (code) { case GST_RESOURCE_ERROR_WRITE: - _mmcam_dbg_err("File write error"); + MMCAM_LOG_ERROR("File write error"); return MM_ERROR_FILE_WRITE; case GST_RESOURCE_ERROR_NO_SPACE_LEFT: - _mmcam_dbg_err("No left space"); + MMCAM_LOG_ERROR("No left space"); return MM_MESSAGE_CAMCORDER_NO_FREE_SPACE; case GST_RESOURCE_ERROR_OPEN_WRITE: - _mmcam_dbg_err("Out of storage"); + MMCAM_LOG_ERROR("Out of storage"); return MM_ERROR_OUT_OF_STORAGE; case GST_RESOURCE_ERROR_SEEK: - _mmcam_dbg_err("File read(seek)"); + MMCAM_LOG_ERROR("File read(seek)"); return MM_ERROR_FILE_READ; case GST_RESOURCE_ERROR_NOT_FOUND: case GST_RESOURCE_ERROR_FAILED: @@ -3814,7 +3756,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod case GST_RESOURCE_ERROR_SYNC: case GST_RESOURCE_ERROR_SETTINGS: default: - _mmcam_dbg_err("Resource error(%d)", code); + MMCAM_LOG_ERROR("Resource error(%d)", code); return MM_ERROR_CAMCORDER_GST_RESOURCE; } } @@ -3831,7 +3773,7 @@ static gint __mmcamcorder_gst_handle_stream_error(MMHandleType handle, int code, sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Specific plugin */ /* video encoder */ @@ -3839,16 +3781,16 @@ static gint __mmcamcorder_gst_handle_stream_error(MMHandleType handle, int code, if (GST_ELEMENT_CAST(message->src) == element) { switch (code) { case GST_STREAM_ERROR_WRONG_TYPE: - _mmcam_dbg_err("Video encoder [wrong stream type]"); + MMCAM_LOG_ERROR("Video encoder [wrong stream type]"); return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE; case GST_STREAM_ERROR_ENCODE: - _mmcam_dbg_err("Video encoder [encode error]"); + MMCAM_LOG_ERROR("Video encoder [encode error]"); return MM_ERROR_CAMCORDER_ENCODER_WORKING; case GST_STREAM_ERROR_FAILED: - _mmcam_dbg_err("Video encoder [stream failed]"); + MMCAM_LOG_ERROR("Video encoder [stream failed]"); return MM_ERROR_CAMCORDER_ENCODER_WORKING; default: - _mmcam_dbg_err("Video encoder [General(%d)]", code); + MMCAM_LOG_ERROR("Video encoder [General(%d)]", code); return MM_ERROR_CAMCORDER_ENCODER; } } @@ -3856,10 +3798,10 @@ static gint __mmcamcorder_gst_handle_stream_error(MMHandleType handle, int code, /* General plugin */ switch (code) { case GST_STREAM_ERROR_FORMAT: - _mmcam_dbg_err("General [negotiation error(%d)]", code); + MMCAM_LOG_ERROR("General [negotiation error(%d)]", code); return MM_ERROR_CAMCORDER_GST_NEGOTIATION; case GST_STREAM_ERROR_FAILED: - _mmcam_dbg_err("General [flow error(%d)]", code); + MMCAM_LOG_ERROR("General [flow error(%d)]", code); return MM_ERROR_CAMCORDER_GST_FLOW_ERROR; case GST_STREAM_ERROR_TYPE_NOT_FOUND: case GST_STREAM_ERROR_DECODE: @@ -3873,7 +3815,7 @@ static gint __mmcamcorder_gst_handle_stream_error(MMHandleType handle, int code, case GST_STREAM_ERROR_DECRYPT_NOKEY: case GST_STREAM_ERROR_WRONG_TYPE: default: - _mmcam_dbg_err("General [error(%d)]", code); + MMCAM_LOG_ERROR("General [error(%d)]", code); return MM_ERROR_CAMCORDER_GST_STREAM; } } @@ -3888,21 +3830,21 @@ static gboolean __mmcamcorder_handle_gst_warning(MMHandleType handle, GstMessage mmf_return_val_if_fail(hcamcorder, FALSE); mmf_return_val_if_fail(error, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); gst_message_parse_warning(message, &err, &debug); if (error->domain == GST_CORE_ERROR) { - _mmcam_dbg_warn("GST warning: GST_CORE domain"); + MMCAM_LOG_WARNING("GST warning: GST_CORE domain"); } else if (error->domain == GST_LIBRARY_ERROR) { - _mmcam_dbg_warn("GST warning: GST_LIBRARY domain"); + MMCAM_LOG_WARNING("GST warning: GST_LIBRARY domain"); } else if (error->domain == GST_RESOURCE_ERROR) { - _mmcam_dbg_warn("GST warning: GST_RESOURCE domain"); + MMCAM_LOG_WARNING("GST warning: GST_RESOURCE domain"); __mmcamcorder_gst_handle_resource_warning(handle, message, error); } else if (error->domain == GST_STREAM_ERROR) { - _mmcam_dbg_warn("GST warning: GST_STREAM domain"); + MMCAM_LOG_WARNING("GST warning: GST_STREAM domain"); } else { - _mmcam_dbg_warn("This error domain(%d) is not defined.", error->domain); + MMCAM_LOG_WARNING("This error domain(%d) is not defined.", error->domain); } if (err != NULL) { @@ -3910,7 +3852,7 @@ static gboolean __mmcamcorder_handle_gst_warning(MMHandleType handle, GstMessage err = NULL; } if (debug != NULL) { - _mmcam_dbg_err("Debug: %s", debug); + MMCAM_LOG_ERROR("Debug: %s", debug); g_free(debug); debug = NULL; } @@ -3931,7 +3873,7 @@ static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMe sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Special message handling */ /* video source */ @@ -3939,7 +3881,7 @@ static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMe if (GST_ELEMENT_CAST(message->src) == element) { if (error->code == GST_RESOURCE_ERROR_FAILED) { msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src)); - _mmcam_dbg_warn("-Msg src:[%s] Domain:[%s] Error:[%s]", + MMCAM_LOG_WARNING("-Msg src:[%s] Domain:[%s] Error:[%s]", msg_src_element, g_quark_to_string(error->domain), error->message); return MM_ERROR_NONE; } @@ -3962,7 +3904,7 @@ static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMe case GST_RESOURCE_ERROR_SYNC: case GST_RESOURCE_ERROR_SETTINGS: default: - _mmcam_dbg_warn("General GST warning(%d)", error->code); + MMCAM_LOG_WARNING("General GST warning(%d)", error->code); break; } @@ -3977,7 +3919,7 @@ void _mmcamcorder_emit_signal(MMHandleType handle, const char *object_name, mmf_return_if_fail(hcamcorder && object_name && interface_name && signal_name); - _mmcam_dbg_log("object %s, interface %s, signal %s, value %d", + MMCAM_LOG_INFO("object %s, interface %s, signal %s, value %d", object_name, interface_name, signal_name, value); _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, object_name, interface_name, signal_name, value); @@ -3994,7 +3936,7 @@ static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, mmf_return_val_if_fail(hcamcorder, FALSE); - _mmcam_dbg_warn("enter"); + MMCAM_LOG_WARNING("enter"); _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); @@ -4008,7 +3950,7 @@ static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, if (res == hcamcorder->video_encoder_resource) { /* Stop video recording */ if (_mmcamcorder_commit((MMHandleType)hcamcorder) != MM_ERROR_NONE) { - _mmcam_dbg_err("commit failed, cancel it"); + MMCAM_LOG_ERROR("commit failed, cancel it"); _mmcamcorder_cancel((MMHandleType)hcamcorder); } } else { @@ -4032,7 +3974,7 @@ static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_warn("leave"); + MMCAM_LOG_WARNING("leave"); return TRUE; } @@ -4047,12 +3989,12 @@ int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); - _mmcam_dbg_warn("storage state %d", storage_state); + MMCAM_LOG_WARNING("storage state %d", storage_state); /* check storage state */ if (storage_state != STORAGE_STATE_UNMOUNTABLE && storage_state != STORAGE_STATE_REMOVED) { - _mmcam_dbg_warn("nothing to do"); + MMCAM_LOG_WARNING("nothing to do"); return MM_ERROR_NONE; } @@ -4061,16 +4003,16 @@ int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_ /* check recording state */ current_state = _mmcamcorder_get_state(handle); - _mmcam_dbg_warn("current_state %d", current_state); + MMCAM_LOG_WARNING("current_state %d", current_state); if (current_state < MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_warn("no recording now"); + MMCAM_LOG_WARNING("no recording now"); goto _MANAGE_DONE; } /* check storage type */ if (hcamcorder->storage_info.type != STORAGE_TYPE_EXTERNAL) { - _mmcam_dbg_warn("external storage is not used"); + MMCAM_LOG_WARNING("external storage is not used"); goto _MANAGE_DONE; } @@ -4086,7 +4028,7 @@ int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_ _MANAGE_DONE: _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); - _mmcam_dbg_warn("done - ret 0x%x", ret); + MMCAM_LOG_WARNING("done - ret 0x%x", ret); return ret; } diff --git a/src/mm_camcorder_platform.c b/src/mm_camcorder_platform.c index 495f1fb..4f87e9f 100644 --- a/src/mm_camcorder_platform.c +++ b/src/mm_camcorder_platform.c @@ -679,8 +679,6 @@ int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int ms mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - /* _mmcam_dbg_log("attr_idx(%d), mslval(%d)", attr_idx, mslval); */ - info = hcamcorder->caminfo_convert; for (i = 0; i < size; i++) { @@ -689,26 +687,31 @@ int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int ms enum_convert = info[i].enum_convert; if (enum_convert == NULL) { - /* _mmcam_dbg_log("enum_convert is NULL. Just return the original value."); */ + MMCAM_LOG_VERBOSE("[attr:%d] NULL enum_convert, just return original[%d]", + attr_idx, mslval); return mslval; } if (enum_convert->enum_arr == NULL) { - _mmcam_dbg_warn("Unexpected error. Array pointer of enum_convert is NULL. Just return the original value."); + MMCAM_LOG_WARNING("[attr:%d] NULL array pointer, just return original[%d]", + attr_idx, mslval); return mslval; } if (enum_convert->total_enum_num > mslval && mslval >= 0) { - /* _mmcam_dbg_log("original value(%d) -> converted value(%d)", mslval, enum_convert->enum_arr[mslval]); */ + MMCAM_LOG_VERBOSE("[attr:%d] original[%d] -> converted[%d]", + attr_idx, mslval, enum_convert->enum_arr[mslval]); return enum_convert->enum_arr[mslval]; } else { - _mmcam_dbg_warn("Input mslval[%d] is invalid(out of array[idx:%d,size:%d]), so can not convert. Just return the original value.", mslval, attr_idx, enum_convert->total_enum_num); + MMCAM_LOG_WARNING("[attr:%d] invalid input mslval[%d][size:%d], just return original.", + attr_idx, mslval, enum_convert->total_enum_num); return mslval; } } } - _mmcam_dbg_warn("There is no category to match. Just return the original value."); + MMCAM_LOG_WARNING("[attr:%d] no category to match, just return original[%d]", + attr_idx, mslval); return mslval; } @@ -725,17 +728,17 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - /* _mmcam_dbg_log("prev resolution w:%d, h:%d", width, height); */ + MMCAM_LOG_DEBUG("resolution %dx%d", width, height); infoW = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo)); if (infoW == NULL) { - _mmcam_dbg_err("failed to alloc infoW"); + MMCAM_LOG_ERROR("failed to alloc infoW"); return MM_ERROR_CAMCORDER_LOW_MEMORY; } infoH = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo)); if (infoH == NULL) { - _mmcam_dbg_err("failed to alloc infoH"); + MMCAM_LOG_ERROR("failed to alloc infoH"); free(infoW); infoW = NULL; @@ -747,11 +750,11 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_HEIGHT, infoH); for (i = 0; i < infoW->int_array.count; i++) { - /* _mmcam_dbg_log("width :%d, height : %d\n", infoW->int_array.array[i], infoH->int_array.array[i]); */ + MMCAM_LOG_VERBOSE("check resolution %dx%d", infoW->int_array.array[i], infoH->int_array.array[i]); if (infoW->int_array.array[i] == width && infoH->int_array.array[i] == height) { valid_check = true; snprintf(nameFps, sizeof(nameFps), "FPS%d", i); - _mmcam_dbg_log("nameFps : %s!!!", nameFps); + MMCAM_LOG_INFO("nameFps[%s]", nameFps); break; } } @@ -762,12 +765,12 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int infoH = NULL; if (!valid_check) { - _mmcam_dbg_err("FAILED : Can't find the valid resolution from attribute."); + MMCAM_LOG_ERROR("FAILED : Can't find the valid resolution from attribute."); return MM_ERROR_CAMCORDER_NOT_SUPPORTED; } if (!_mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAMERA, nameFps, &fps_array)) { - _mmcam_dbg_err("FAILED : Can't find the valid FPS array."); + MMCAM_LOG_ERROR("FAILED : Can't find the valid FPS array."); return MM_ERROR_CAMCORDER_CREATE_CONFIGURE; } @@ -796,34 +799,40 @@ int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int se enum_convert = info[i].enum_convert; if (enum_convert == NULL) { - /* _mmcam_dbg_log("enum_convert is NULL. Just return the original value."); */ + MMCAM_LOG_VERBOSE("[attr:%d] NULL enum_convert, just return original[%d]", + attr_idx, sensval); return sensval; } if (enum_convert->enum_arr == NULL) { - _mmcam_dbg_warn("Unexpected error. Array pointer of enum_convert is NULL. Just return the original value."); + MMCAM_LOG_WARNING("[attr:%d] NULL array pointer, just return original[%d]", + attr_idx, sensval); return sensval; } for (j = 0 ; j < enum_convert->total_enum_num ; j++) { if (sensval == enum_convert->enum_arr[j]) { - /* _mmcam_dbg_log("original value(%d) -> converted value(%d)", sensval, j); */ + MMCAM_LOG_VERBOSE("[attr:%d] original[%d] -> converted[%d]", + attr_idx, sensval, j); return j; } } - _mmcam_dbg_warn("There is no sensor value matched with input param. Just return the original value."); + MMCAM_LOG_WARNING("[attr:%d] no sensor value matched, just return original[%d]", + attr_idx, sensval); + return sensval; } } - _mmcam_dbg_log("There is no category to match. Just return the original value."); + MMCAM_LOG_INFO("[attr:%d] no category to match, just return original[%d]", + attr_idx, sensval); + return sensval; } -static int -__mmcamcorder_get_valid_array(int * original_array, int original_count, int ** valid_array, int * valid_default) +static int __mmcamcorder_get_valid_array(int *original_array, int original_count, int **valid_array, int *valid_default) { int i = 0; int valid_count = 0; @@ -842,12 +851,12 @@ __mmcamcorder_get_valid_array(int * original_array, int original_count, int ** v for (i = 0; i < original_count; i++) { if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) { (*valid_array)[valid_count++] = i; - /*_mmcam_dbg_log( "valid_array[%d] = %d", valid_count-1, (*valid_array)[valid_count-1] );*/ + MMCAM_LOG_VERBOSE("valid_array[%d] = %d", valid_count-1, (*valid_array)[valid_count-1]); if (original_array[i] == *valid_default && new_default == _MMCAMCORDER_SENSOR_ENUM_NONE) { new_default = i; - /*_mmcam_dbg_log( "converted MSL default[%d]", new_default );*/ + MMCAM_LOG_VERBOSE("converted MSL default[%d]", new_default); } } } @@ -873,7 +882,7 @@ int _mmcamcorder_init_attr_from_configure(MMHandleType handle, MMCamConvertingCa mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log("category : %d", category); + MMCAM_LOG_INFO("category : %d", category); if (category & MM_CAMCONVERT_CATEGORY_CAMERA) { /* Initialize attribute related to camera control */ @@ -881,7 +890,7 @@ int _mmcamcorder_init_attr_from_configure(MMHandleType handle, MMCamConvertingCa table_size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting); ret = __mmcamcorder_set_info_to_attr(handle, info, table_size); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("camera info set error : 0x%x", ret); + MMCAM_LOG_ERROR("camera info set error : 0x%x", ret); return ret; } } @@ -892,7 +901,7 @@ int _mmcamcorder_init_attr_from_configure(MMHandleType handle, MMCamConvertingCa table_size = sizeof(g_display_info) / sizeof(_MMCamcorderInfoConverting); ret = __mmcamcorder_set_info_to_attr(handle, info, table_size); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("display info set error : 0x%x", ret); + MMCAM_LOG_ERROR("display info set error : 0x%x", ret); return ret; } } @@ -903,12 +912,12 @@ int _mmcamcorder_init_attr_from_configure(MMHandleType handle, MMCamConvertingCa table_size = sizeof(g_audio_info) / sizeof(_MMCamcorderInfoConverting); ret = __mmcamcorder_set_info_to_attr(handle, info, table_size); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("audio info set error : 0x%x", ret); + MMCAM_LOG_ERROR("audio info set error : 0x%x", ret); return ret; } } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return ret; } @@ -930,26 +939,21 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti camera_conf *conf_info = NULL; for (i = 0; i < table_size; i++) { - /* - _mmcam_dbg_log("%d,%d,%d,%d,%s,%d", + MMCAM_LOG_DEBUG("[type:%d][cat:%d][attr:%d][attr_pair:%d][key:%s][ctype:%d]", info[i].type, info[i].category, info[i].attr_idx, info[i].attr_idx_pair, info[i].keyword, info[i].conv_type); - */ if (ret != MM_ERROR_NONE) break; - if (info[i].type == CONFIGURE_TYPE_MAIN) { + if (info[i].type == CONFIGURE_TYPE_MAIN) conf_info = hcamcorder->conf_main; - /*_mmcam_dbg_log("MAIN configure [%s]", info[i].keyword);*/ - } else { + else conf_info = hcamcorder->conf_ctrl; - /*_mmcam_dbg_log("CTRL configure [%s]", info[i].keyword);*/ - } switch (info[i].conv_type) { case MM_CAMCONVERT_TYPE_INT: @@ -985,10 +989,7 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti } if (iarray_size > 0) { - /* - _mmcam_dbg_log("INT Array. attr idx=%d array=%p, size=%d, default=%d", - info[i].attr_idx, iarray, iarray_size, idefault); - */ + MMCAM_LOG_INFO("INT Array - size[%d], default[%d]", iarray_size, idefault); /* "mm_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */ /* mm_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY); */ @@ -1011,7 +1012,8 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti break; /* skip to set, but not error */ if (irange) { - /* _mmcam_dbg_log("INT Range. m:%d, s:%d, min=%d, max=%d", info[i].main_key, info[i].sub_key1, irange->min, irange->max); */ + MMCAM_LOG_VERBOSE("INT Range - min[%d], max[%d]", irange->min, irange->max); + /* "mm_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */ /* mm_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE); */ mm_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max, irange->default_value); @@ -1024,29 +1026,21 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti case MM_CAMCONVERT_TYPE_STRING: { const char *cString = NULL; - unsigned int iString_len = 0; if (!_mmcamcorder_conf_get_value_string(handle, conf_info, info[i].category, info[i].keyword, &cString)) { ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE; break; /* skip to set */ } - /* _mmcam_dbg_log("String. m:%d, s:%d, cString=%s", info[i].main_key, info[i].sub_key1, cString); */ - /* strlen makes a crash when null pointer is passed. */ - if (cString) - iString_len = strlen(cString); - else - iString_len = 0; + MMCAM_LOG_VERBOSE("String - string[%s]", cString); - ret = mm_attrs_set_string(attrs, info[i].attr_idx, cString, iString_len); + ret = mm_attrs_set_string(attrs, info[i].attr_idx, cString, cString ? strlen(cString) : 0); break; } case MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY: { type_int_pair_array *pair_array = NULL; - /*_mmcam_dbg_log("INT PAIR Array. type:%d, attr_idx:%d, attr_idx_pair:%d", info[i].type, info[i].attr_idx, info[i].attr_idx_pair);*/ - if (!_mmcamcorder_conf_get_value_int_pair_array(conf_info, info[i].category, info[i].keyword, &pair_array)) break; /* skip to set, but not error */ @@ -1064,6 +1058,9 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti pair_array->count, pair_array->default_value[1]); + MMCAM_LOG_VERBOSE("INT PAIR Array - default[%d,%d]", + pair_array->default_value[0], pair_array->default_value[1]); + mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, pair_array->default_value[0]); mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx_pair, pair_array->default_value[1]); } @@ -1072,7 +1069,7 @@ int __mmcamcorder_set_info_to_attr(MMHandleType handle, _MMCamcorderInfoConverti case MM_CAMCONVERT_TYPE_USER: default: - _mmcam_dbg_log("default : s:%d", info[i].attr_idx); + MMCAM_LOG_WARNING("default - [attr:%d]", info[i].attr_idx); break; } } @@ -1198,10 +1195,9 @@ double _mmcamcorder_convert_volume(int mslVal) newVal = 1; break; default: - _mmcam_dbg_warn("out of range"); + MMCAM_LOG_WARNING("out of range"); break; } return newVal; } - diff --git a/src/mm_camcorder_rm.c b/src/mm_camcorder_rm.c index 104f3b2..024baaf 100644 --- a/src/mm_camcorder_rm.c +++ b/src/mm_camcorder_rm.c @@ -41,14 +41,14 @@ static rm_cb_result __mmcamcorder_rm_callback(int handle, rm_callback_type event current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); - _mmcam_dbg_warn("current state %d (handle %p)", current_state, hcamcorder); + MMCAM_LOG_WARNING("current state %d (handle %p)", current_state, hcamcorder); _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); /* set RM event code for sending it to application */ hcamcorder->interrupt_code = event_src; - _mmcam_dbg_log("RM conflict callback : event code 0x%x", event_src); + MMCAM_LOG_INFO("RM conflict callback : event code 0x%x", event_src); switch (event_src) { case RM_CALLBACK_TYPE_RESOURCE_CONFLICT: case RM_CALLBACK_TYPE_RESOURCE_CONFLICT_UD: @@ -73,7 +73,7 @@ int _mmcamcorder_rm_create(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } @@ -92,7 +92,7 @@ int _mmcamcorder_rm_create(MMHandleType handle) &(hcamcorder->rm_handle), (rci.app_id[0] != '\0') ? &rci : NULL); if (ret != RM_OK) { - _mmcam_dbg_err("rm_register fail ret = %d",ret); + MMCAM_LOG_ERROR("rm_register fail ret = %d",ret); return MM_ERROR_RESOURCE_INTERNAL; } } @@ -111,7 +111,7 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (!hcamcorder) { - _mmcam_dbg_err("Not initialized"); + MMCAM_LOG_ERROR("Not initialized"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } @@ -132,7 +132,7 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) 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); + MMCAM_LOG_INFO("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER); resource_count++; } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { @@ -143,13 +143,13 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) 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); + MMCAM_LOG_INFO("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; hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER; - _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER); + MMCAM_LOG_INFO("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER); resource_count++; } @@ -158,7 +158,7 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) if (resource_count > 0) { qret = rm_query(hcamcorder->rm_handle, RM_QUERY_ALLOCATION, &(hcamcorder->request_resources), &qret_avail); if (qret != RM_OK || qret_avail != 1) { - _mmcam_dbg_log("rm query failed. retry with sub devices"); + MMCAM_LOG_INFO("rm query failed. retry with sub devices"); resource_count = 0; memset(&hcamcorder->request_resources, 0x0, sizeof(rm_category_request_s)); @@ -167,25 +167,25 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) 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_VIDEO_DECODER_SUB; - _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB); + MMCAM_LOG_INFO("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_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_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); + MMCAM_LOG_INFO("request dec rsc - category 0x%x", RM_CATEGORY_MJPEG_DECODER); resource_count++; } if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) { 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; - _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB); + MMCAM_LOG_INFO("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", RM_CATEGORY_SCALER); + MMCAM_LOG_INFO("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER); resource_count++; } } @@ -197,11 +197,11 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_CAMERA; hcamcorder->request_resources.request_num = resource_count + 1; - _mmcam_dbg_log("request camera rsc - category 0x%x", RM_CATEGORY_CAMERA); + MMCAM_LOG_INFO("request camera rsc - category 0x%x", RM_CATEGORY_CAMERA); iret = rm_allocate_resources(hcamcorder->rm_handle, &(hcamcorder->request_resources), &hcamcorder->returned_devices); if (iret != RM_OK) { - _mmcam_dbg_err("Resource allocation request failed ret = %d",iret); + MMCAM_LOG_ERROR("Resource allocation request failed ret = %d",iret); return MM_ERROR_RESOURCE_INTERNAL; } @@ -219,7 +219,7 @@ int _mmcamcorder_rm_deallocate(MMHandleType handle) rm_device_return_s *r_devices; if (!hcamcorder->rm_handle) { - _mmcam_dbg_err("Resource is not initialized "); + MMCAM_LOG_ERROR("Resource is not initialized "); return MM_ERROR_RESOURCE_NOT_INITIALIZED; } @@ -233,7 +233,7 @@ int _mmcamcorder_rm_deallocate(MMHandleType handle) rm_ret = rm_deallocate_resources(hcamcorder->rm_handle, &requested); if (rm_ret != RM_OK) - _mmcam_dbg_err("Resource deallocation request failed "); + MMCAM_LOG_ERROR("Resource deallocation request failed "); } for (idx = 0; idx < r_devices->allocated_num; idx++) { @@ -257,14 +257,14 @@ int _mmcamcorder_rm_release(MMHandleType handle) mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); if (!hcamcorder->rm_handle) { - _mmcam_dbg_err("Resource is not initialized "); + MMCAM_LOG_ERROR("Resource is not initialized "); return MM_ERROR_RESOURCE_NOT_INITIALIZED; } /* unregister RM */ rm_ret = rm_unregister(hcamcorder->rm_handle); if (rm_ret != RM_OK) - _mmcam_dbg_err("rm_unregister() failed"); + MMCAM_LOG_ERROR("rm_unregister() failed"); hcamcorder->rm_handle = 0; return MM_ERROR_NONE; diff --git a/src/mm_camcorder_sound.c b/src/mm_camcorder_sound.c index 7182fa4..4b2f3d5 100644 --- a/src/mm_camcorder_sound.c +++ b/src/mm_camcorder_sound.c @@ -54,7 +54,7 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) /* check sound state */ if (info->state > _MMCAMCORDER_SOUND_STATE_NONE) { - _mmcam_dbg_warn("already initialized [%d]", info->state); + MMCAM_LOG_WARNING("already initialized [%d]", info->state); g_mutex_unlock(&info->open_mutex); return TRUE; } @@ -63,9 +63,9 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_CAPTURE_SOUND_ENABLE, &sound_enable, NULL); - _mmcam_dbg_log("Capture sound enable %d", sound_enable); + MMCAM_LOG_INFO("Capture sound enable %d", sound_enable); if (!sound_enable) { - _mmcam_dbg_warn("capture sound disabled"); + MMCAM_LOG_WARNING("capture sound disabled"); g_mutex_unlock(&info->open_mutex); return FALSE; } @@ -73,14 +73,14 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) /* check shutter sound policy and status of system */ if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_OFF && hcamcorder->sub_context->info_image->sound_status == FALSE) { - _mmcam_dbg_warn("skip sound init : Sound Policy OFF and Silent status"); + MMCAM_LOG_WARNING("skip sound init : Sound Policy OFF and Silent status"); g_mutex_unlock(&info->open_mutex); return FALSE; } info->state = _MMCAMCORDER_SOUND_STATE_INIT; - _mmcam_dbg_log("init DONE"); + MMCAM_LOG_INFO("init DONE"); g_mutex_unlock(&info->open_mutex); @@ -102,9 +102,9 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, g mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_CAPTURE_SOUND_ENABLE, &sound_enable, NULL); - _mmcam_dbg_log("Capture sound enable %d", sound_enable); + MMCAM_LOG_INFO("Capture sound enable %d", sound_enable); if (!sound_enable) { - _mmcam_dbg_warn("capture sound disabled"); + MMCAM_LOG_WARNING("capture sound disabled"); return FALSE; } @@ -113,7 +113,7 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, g g_mutex_lock(&info->open_mutex); if (info->state < _MMCAMCORDER_SOUND_STATE_INIT) { - _mmcam_dbg_log("not initialized state:[%d]", info->state); + MMCAM_LOG_INFO("not initialized state:[%d]", info->state); g_mutex_unlock(&info->open_mutex); return FALSE; } @@ -123,14 +123,14 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, g else if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP)) volume_gain = "camcording"; - _mmcam_dbg_log("Play start - sample name [%s]", sample_name); + MMCAM_LOG_INFO("Play start - sample name [%s]", sample_name); _mmcamcorder_send_sound_play_message(hcamcorder->gdbus_conn, &hcamcorder->gdbus_info_sound, sample_name, "system", volume_gain, sync_play); g_mutex_unlock(&info->open_mutex); - _mmcam_dbg_log("Done"); + MMCAM_LOG_INFO("Done"); return TRUE; } @@ -145,19 +145,19 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle) info = &(hcamcorder->snd_info); - _mmcam_dbg_err("START"); + MMCAM_LOG_ERROR("START"); g_mutex_lock(&info->open_mutex); if (info->state < _MMCAMCORDER_SOUND_STATE_INIT) { - _mmcam_dbg_warn("not initialized"); + MMCAM_LOG_WARNING("not initialized"); g_mutex_unlock(&info->open_mutex); return TRUE; } info->state = _MMCAMCORDER_SOUND_STATE_NONE; - _mmcam_dbg_err("DONE"); + MMCAM_LOG_ERROR("DONE"); g_mutex_unlock(&info->open_mutex); @@ -174,13 +174,13 @@ int _mmcamcorder_sound_solo_play(MMHandleType handle, const char *sample_name, g mmf_return_val_if_fail(hcamcorder && sample_name, FALSE); - _mmcam_dbg_log("START : [%s]", sample_name); + MMCAM_LOG_INFO("START : [%s]", sample_name); _mmcamcorder_sound_solo_play_wait(handle); current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_warn("invalid state %d", current_state); + MMCAM_LOG_WARNING("invalid state %d", current_state); return FALSE; } @@ -188,24 +188,24 @@ int _mmcamcorder_sound_solo_play(MMHandleType handle, const char *sample_name, g mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_CAPTURE_SOUND_ENABLE, &sound_enable, NULL); - _mmcam_dbg_log("Capture sound enable %d", sound_enable); + MMCAM_LOG_INFO("Capture sound enable %d", sound_enable); if (!sound_enable) { - _mmcam_dbg_warn("capture sound disabled"); + MMCAM_LOG_WARNING("capture sound disabled"); return FALSE; } - _mmcam_dbg_log("Play start - sample name [%s]", sample_name); + MMCAM_LOG_INFO("Play start - sample name [%s]", sample_name); if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON || hcamcorder->sub_context->info_image->sound_status) { _mmcamcorder_send_sound_play_message(hcamcorder->gdbus_conn, &hcamcorder->gdbus_info_solo_sound, sample_name, "system", "shutter1", sync_play); } else { - _mmcam_dbg_warn("skip shutter sound : sound policy %d, sound status %d", + MMCAM_LOG_WARNING("skip shutter sound : sound policy %d, sound status %d", hcamcorder->shutter_sound_policy, hcamcorder->sub_context->info_image->sound_status); } - _mmcam_dbg_log("Done"); + MMCAM_LOG_INFO("Done"); return TRUE; } @@ -217,7 +217,7 @@ void _mmcamcorder_sound_solo_play_wait(MMHandleType handle) mmf_return_if_fail(hcamcorder); - _mmcam_dbg_log("START"); + MMCAM_LOG_INFO("START"); /* check playing sound count */ g_mutex_lock(&hcamcorder->gdbus_info_solo_sound.sync_mutex); @@ -225,23 +225,23 @@ void _mmcamcorder_sound_solo_play_wait(MMHandleType handle) if (hcamcorder->gdbus_info_solo_sound.is_playing) { gint64 end_time = 0; - _mmcam_dbg_log("Wait for signal"); + MMCAM_LOG_INFO("Wait for signal"); end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND; if (g_cond_wait_until(&hcamcorder->gdbus_info_solo_sound.sync_cond, &hcamcorder->gdbus_info_solo_sound.sync_mutex, end_time)) { - _mmcam_dbg_log("signal received."); + MMCAM_LOG_INFO("signal received."); } else { - _mmcam_dbg_warn("capture sound play timeout."); + MMCAM_LOG_WARNING("capture sound play timeout."); } } else { - _mmcam_dbg_warn("no playing sound"); + MMCAM_LOG_WARNING("no playing sound"); } g_mutex_unlock(&hcamcorder->gdbus_info_solo_sound.sync_mutex); - _mmcam_dbg_log("DONE"); + MMCAM_LOG_INFO("DONE"); return; } diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index ca6e28f..cdd2b1a 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -39,7 +39,7 @@ ---------------------------------------------------------------------------------------*/ #define EXIF_SET_ERR(return_type, tag_id) \ do { \ - _mmcam_dbg_err("error=%x,tag=%x", return_type, tag_id); \ + MMCAM_LOG_ERROR("error=%x,tag=%x", return_type, tag_id); \ if (return_type == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) { \ goto exit; \ } \ @@ -92,10 +92,10 @@ int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Create gstreamer element */ - _mmcam_dbg_log("Using Encodebin for capturing"); + MMCAM_LOG_INFO("Using Encodebin for capturing"); /* Create capture pipeline */ _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "capture_pipeline", err); @@ -146,7 +146,7 @@ int _mmcamcorder_connect_capture_signal(MMHandleType handle) /* check video source element */ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { - _mmcam_dbg_warn("connect capture signal to _MMCAMCORDER_VIDEOSRC_SRC"); + MMCAM_LOG_WARNING("connect capture signal to _MMCAMCORDER_VIDEOSRC_SRC"); MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, _MMCAMCORDER_HANDLER_STILLSHOT, "still-capture", G_CALLBACK(__mmcamcorder_image_capture_cb), @@ -154,7 +154,7 @@ int _mmcamcorder_connect_capture_signal(MMHandleType handle) return MM_ERROR_NONE; } else { - _mmcam_dbg_err("videosrc element is not created yet"); + MMCAM_LOG_ERROR("videosrc element is not created yet"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } } @@ -171,13 +171,13 @@ int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* Check pipeline */ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) { ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Faile to change encode main pipeline state [0x%x]", ret); + MMCAM_LOG_ERROR("Faile to change encode main pipeline state [0x%x]", ret); return ret; } @@ -196,9 +196,9 @@ int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle) /* release encode main pipeline */ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst); - _mmcam_dbg_log("Encoder pipeline removed"); + MMCAM_LOG_INFO("Encoder pipeline removed"); } else { - _mmcam_dbg_log("encode main pipeline is already removed"); + MMCAM_LOG_INFO("encode main pipeline is already removed"); } return MM_ERROR_NONE; @@ -219,7 +219,7 @@ void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_if_fail(sc && sc->element); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); @@ -230,30 +230,30 @@ void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle) MMCAM_DISPLAY_REUSE_HINT, &display_reuse_hint, NULL); - _mmcam_dbg_log("display reuse hint %d", display_reuse_hint); + MMCAM_LOG_INFO("display reuse hint %d", display_reuse_hint); if (!display_reuse_hint) goto _REUSE_CHECK_DONE; sink_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst; if (!sink_element) { - _mmcam_dbg_warn("sink element is NULL"); + MMCAM_LOG_WARNING("sink element is NULL"); goto _REUSE_CHECK_DONE; } attrs = MMF_CAMCORDER_ATTRS(handle); if (!attrs) { - _mmcam_dbg_warn("attribute is NULL"); + MMCAM_LOG_WARNING("attribute is NULL"); goto _REUSE_CHECK_DONE; } - _mmcam_dbg_log("REF sink element %p and set it to attribute", sink_element); + MMCAM_LOG_INFO("REF sink element %p and set it to attribute", sink_element); /* ref element before remove it from pipeline */ gst_object_ref(sink_element); if (!gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), sink_element)) - _mmcam_dbg_warn("failed to remove sink element from pipeline"); + MMCAM_LOG_WARNING("failed to remove sink element from pipeline"); /* reset floating reference flag to avoid leak after next use */ g_object_force_floating(G_OBJECT(sink_element)); @@ -320,12 +320,12 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); info = sc->info_image; if (info->capturing) { - _mmcam_dbg_err("already capturing"); + MMCAM_LOG_ERROR("already capturing"); return MM_ERROR_CAMCORDER_DEVICE_BUSY; } @@ -361,7 +361,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAM_TAG_ORIENTATION, &tag_orientation, NULL); if (err_name) { - _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret); + MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret); SAFE_FREE(err_name); } @@ -369,7 +369,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* check capture count */ if (info->count < 1) { - _mmcam_dbg_err("capture count[%d] is invalid", info->count); + MMCAM_LOG_ERROR("capture count[%d] is invalid", info->count); ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; goto cmd_done; } else if (info->count == 1) { @@ -383,34 +383,34 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) _mmcamcorder_sound_init(handle); } - _mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d), interval (%d)", + MMCAM_LOG_INFO("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d), interval (%d)", width, height, info->preview_format, info->width, info->height, info->capture_format, info->count, info->hdr_capture_mode, info->interval); /* check state */ if (current_state >= MM_CAMCORDER_STATE_RECORDING) { if (sc->bencbin_capture) { - _mmcam_dbg_err("could not capture in this target while recording"); + MMCAM_LOG_ERROR("could not capture in this target while recording"); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto cmd_done; } if (info->type == _MMCamcorder_MULTI_SHOT || info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF) { - _mmcam_dbg_err("does not support multi/HDR capture while recording"); + MMCAM_LOG_ERROR("does not support multi/HDR capture while recording"); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto cmd_done; } /* check capture size if ZSL is not supported*/ if (hcamcorder->support_zsl_capture == FALSE) { - _mmcam_dbg_warn("Capture size should be same with preview size while recording"); - _mmcam_dbg_warn("Capture size %dx%d -> %dx%d", info->width, info->height, width, height); + MMCAM_LOG_WARNING("Capture size should be same with preview size while recording"); + MMCAM_LOG_WARNING("Capture size %dx%d -> %dx%d", info->width, info->height, width, height); info->width = width; info->height = height; - _mmcam_dbg_log("set capture width and height [%dx%d] to camera plugin", width, height); + MMCAM_LOG_INFO("set capture width and height [%dx%d] to camera plugin", width, height); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", width); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", height); @@ -429,7 +429,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) if ((sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) || hcamcorder->support_zsl_capture || is_modified_size) { cap_fourcc = _mmcamcorder_get_fourcc(info->capture_format, image_encoder, hcamcorder->use_zero_copy_format); - _mmcam_dbg_log("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size); + MMCAM_LOG_INFO("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size); } else { /* no need to encode internally if ITLV format */ if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) @@ -437,14 +437,14 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) cap_fourcc = _mmcamcorder_get_fourcc(info->preview_format, image_encoder, hcamcorder->use_zero_copy_format); - _mmcam_dbg_log("MSL JPEG Capture : capture fourcc %c%c%c%c", + MMCAM_LOG_INFO("MSL JPEG Capture : capture fourcc %c%c%c%c", cap_fourcc, cap_fourcc>>8, cap_fourcc>>16, cap_fourcc>>24); } } else { cap_fourcc = _mmcamcorder_get_fourcc(info->capture_format, MM_IMAGE_CODEC_INVALID, hcamcorder->use_zero_copy_format); } - _mmcam_dbg_log("capture format (%d)", info->capture_format); + MMCAM_LOG_INFO("capture format (%d)", info->capture_format); /* Note: width/height of capture is set in commit function of attribute or in create function of pipeline */ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-fourcc", cap_fourcc); @@ -452,7 +452,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", info->count); if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control."); + MMCAM_LOG_ERROR("Can't cast Video source into camera control."); ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED; goto cmd_done; } @@ -476,7 +476,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) if (need_change) { int rotation = 0; - _mmcam_dbg_log("Need to change resolution"); + MMCAM_LOG_INFO("Need to change resolution"); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); @@ -486,7 +486,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); return MM_ERROR_CAMCORDER_INTERNAL; } @@ -494,7 +494,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to set state PAUSED %x", ret); + MMCAM_LOG_ERROR("failed to set state PAUSED %x", ret); goto cmd_done; } @@ -510,14 +510,14 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAM_CAMERA_ROTATION, &rotation, NULL); if (err_name) { - _mmcam_dbg_warn("get_attributes err %s", err_name); + MMCAM_LOG_WARNING("get_attributes err %s", err_name); SAFE_FREE(err_name); } /* set new caps */ ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, set_width, set_height, fps, rotation); if (!ret) { - _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed"); + MMCAM_LOG_ERROR("_mmcamcorder_set_videosrc_caps failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto cmd_done; } @@ -530,20 +530,20 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* make pipeline state as PLAYING */ ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to set state PLAYING %x", ret); + MMCAM_LOG_ERROR("failed to set state PLAYING %x", ret); goto cmd_done; } - _mmcam_dbg_log("Change to target resolution(%d, %d)", set_width, set_height); + MMCAM_LOG_INFO("Change to target resolution(%d, %d)", set_width, set_height); } else { - _mmcam_dbg_log("No need to change resolution. Open toggle now."); + MMCAM_LOG_INFO("No need to change resolution. Open toggle now."); info->resolution_change = FALSE; } /* add encodesinkbin */ ret = _mmcamcorder_create_stillshot_pipeline((MMHandleType)hcamcorder); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to create encodesinkbin %x", ret); + MMCAM_LOG_ERROR("failed to create encodesinkbin %x", ret); goto cmd_done; } @@ -551,7 +551,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality, NULL); if (err_name) { - _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret); + MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret); SAFE_FREE(err_name); } @@ -571,7 +571,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* make encode pipeline state as PLAYING */ ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to set state PLAYING %x", ret); + MMCAM_LOG_ERROR("failed to set state PLAYING %x", ret); goto cmd_done; } } @@ -610,10 +610,10 @@ cmd_done: if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) { hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE; - _mmcam_dbg_log("send signal for capture in recording"); + MMCAM_LOG_INFO("send signal for capture in recording"); g_cond_signal(&hcamcorder->task_thread_cond); } else { - _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state); + MMCAM_LOG_WARNING("unexpected task thread state : %d", hcamcorder->task_thread_state); } g_mutex_unlock(&hcamcorder->task_thread_lock); @@ -653,7 +653,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - /*_mmcam_dbg_log("");*/ + /*MMCAM_LOG_INFO("");*/ pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; info = sc->info_image; @@ -674,15 +674,15 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) info->capturing = FALSE; current_state = _mmcamcorder_get_state(handle); - _mmcam_dbg_log("current state [%d]", current_state); + MMCAM_LOG_INFO("current state [%d]", current_state); if (!sc->bencbin_capture) { - _mmcam_dbg_log("Preview start"); + MMCAM_LOG_INFO("Preview start"); /* just set capture stop command if current state is CAPTURING */ if (current_state == MM_CAMCORDER_STATE_CAPTURING) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control."); + MMCAM_LOG_ERROR("Can't cast Video source into camera control."); return MM_ERROR_CAMCORDER_NOT_SUPPORTED; } @@ -706,11 +706,11 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) MMCAM_CAMERA_FOCUS_MODE, &focus_mode, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, ret); SAFE_FREE(err_name); } - _mmcam_dbg_log("focus mode %d", focus_mode); + MMCAM_LOG_INFO("focus mode %d", focus_mode); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto); @@ -720,10 +720,10 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) mm_attrs_set_modified(attrs, MM_CAM_CAMERA_FOCUS_MODE); mm_attrs_commit(attrs, MM_CAM_CAMERA_FOCUS_MODE); } else { - _mmcam_dbg_log("focus mode is not supported"); + MMCAM_LOG_INFO("focus mode is not supported"); } } else { - _mmcam_dbg_err("failed to get attributes"); + MMCAM_LOG_ERROR("failed to get attributes"); } } } @@ -740,11 +740,11 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) if (hcamcorder->support_zsl_capture == FALSE) { MMHandleType attrs = MMF_CAMCORDER_ATTRS(handle); - /* Set strobe mode - strobe mode can not be set to driver while captuing */ + /* Set strobe mode - strobe mode can not be set to driver while capturing */ if (attrs) { mm_attrs_set_modified(attrs, MM_CAM_STROBE_MODE); if (mm_attrs_commit(attrs, MM_CAM_STROBE_MODE) == -1) - _mmcam_dbg_warn("Failed to set strobe mode"); + MMCAM_LOG_WARNING("Failed to set strobe mode"); } while (current_framecount >= sc->kpi.video_framecount && @@ -758,7 +758,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); } - _mmcam_dbg_log("Wait Frame Done. count before[%d],after[%d], try_count[%d]", + MMCAM_LOG_INFO("Wait Frame Done. count before[%d],after[%d], try_count[%d]", current_framecount, sc->kpi.video_framecount, try_count); } else { ret = _mmcamcorder_remove_stillshot_pipeline(handle); @@ -773,7 +773,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); return MM_ERROR_CAMCORDER_INTERNAL; } @@ -791,14 +791,14 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) MMCAM_CAMERA_ROTATION, &rotation, NULL); if (err_name) { - _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret); + MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret); SAFE_FREE(err_name); } /* set new caps */ ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, rotation); if (!ret) { - _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed"); + MMCAM_LOG_ERROR("_mmcamcorder_set_videosrc_caps failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto cmd_error; } @@ -825,7 +825,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) _mmcamcorder_set_encoded_preview_bitrate(handle, bitrate); _mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval); } else { - _mmcam_dbg_err("failed to get encoded preview setting"); + MMCAM_LOG_ERROR("failed to get encoded preview setting"); } } @@ -847,7 +847,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) /* get sound status/volume level and register changed_cb */ if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_OFF && info->sound_status == _SOUND_STATUS_INIT) { - _mmcam_dbg_log("register vconf changed_cb and get sound status"); + MMCAM_LOG_INFO("register vconf changed_cb and get sound status"); /* register changed_cb */ vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb, hcamcorder); @@ -855,7 +855,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) /* get sound status */ vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status)); - _mmcam_dbg_log("sound status %d", info->sound_status); + MMCAM_LOG_INFO("sound status %d", info->sound_status); } } @@ -877,7 +877,7 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle) _MMCamcorderSubContext *sc = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -890,7 +890,7 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle) NULL); if (strobe_mode == MM_CAMCORDER_STROBE_MODE_PERMANENT && GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_log("current strobe mode is PERMANENT, set OFF"); + MMCAM_LOG_INFO("current strobe mode is PERMANENT, set OFF"); /* get camera control */ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); @@ -901,16 +901,16 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle) /* set strobe OFF */ gst_camera_control_set_strobe(control, GST_CAMERA_CONTROL_STROBE_MODE, set_strobe); - _mmcam_dbg_log("set strobe OFF done - value: %d", set_strobe); + MMCAM_LOG_INFO("set strobe OFF done - value: %d", set_strobe); } else { - _mmcam_dbg_warn("cast CAMERA_CONTROL failed"); + MMCAM_LOG_WARNING("cast CAMERA_CONTROL failed"); } } pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) { - _mmcam_dbg_log("pipeline is exist so need to remove pipeline and sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst=%p", + MMCAM_LOG_INFO("pipeline is exist so need to remove pipeline and sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst=%p", sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst); _mmcamcorder_remove_recorder_pipeline(handle); } @@ -919,7 +919,7 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle) MMCAM_DISPLAY_REUSE_HINT, &display_reuse_hint, NULL); - _mmcam_dbg_log("display reuse hint %d", display_reuse_hint); + MMCAM_LOG_INFO("display reuse hint %d", display_reuse_hint); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "keep-camera-preview", display_reuse_hint); @@ -940,7 +940,7 @@ int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle) /* deregister sound status callback */ if (sc->info_image->sound_status != _SOUND_STATUS_INIT) { - _mmcam_dbg_log("deregister sound status callback"); + MMCAM_LOG_INFO("deregister sound status callback"); vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb); @@ -963,7 +963,7 @@ int _mmcamcorder_video_capture_command(MMHandleType handle, int command) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log("command %d", command); + MMCAM_LOG_INFO("command %d", command); switch (command) { case _MMCamcorder_CMD_CAPTURE: @@ -1007,7 +1007,7 @@ void __mmcamcorder_init_stillshot_info(MMHandleType handle) info = sc->info_image; - _mmcam_dbg_log("capture type[%d], capture send count[%d]", info->type, info->capture_send_count); + MMCAM_LOG_INFO("capture type[%d], capture send count[%d]", info->type, info->capture_send_count); if (info->type == _MMCamcorder_SINGLE_SHOT || info->capture_send_count == info->count) { info->capture_cur_count = 0; @@ -1035,14 +1035,14 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); mmf_return_val_if_fail(sc, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (!original || original->data == NULL || original->length == 0) { if (original) { - _mmcam_dbg_err("data=%p, length=%d", + MMCAM_LOG_ERROR("data=%p, length=%d", original->data, original->length); } else { - _mmcam_dbg_err("original is null"); + MMCAM_LOG_ERROR("original is null"); } return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; @@ -1055,7 +1055,7 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD if (provide_exif == FALSE) { if (thumbnail) { if (thumbnail->data && thumbnail->length > 0) { - _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d", + MMCAM_LOG_INFO("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d", thumbnail->data, thumbnail->width, thumbnail->height); /* add thumbnail exif info */ @@ -1065,7 +1065,7 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD thumbnail->height, thumbnail->length); } else { - _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)", + MMCAM_LOG_ERROR("Skip adding thumbnail (data=%p, length=%d)", thumbnail->data, thumbnail->length); } } @@ -1077,10 +1077,10 @@ int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureD /* write jpeg with exif */ ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length, hcamcorder->exif_info, data, datalen); if (ret != MM_ERROR_NONE) - _mmcam_dbg_err("mm_exif_write_exif_jpeg_to_memory error! [0x%x]", ret); + MMCAM_LOG_ERROR("mm_exif_write_exif_jpeg_to_memory error! [0x%x]", ret); } - _mmcam_dbg_log("END ret 0x%x", ret); + MMCAM_LOG_INFO("END ret 0x%x", ret); return ret; } @@ -1096,13 +1096,13 @@ void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capt caps = gst_sample_get_caps(sample); if (caps == NULL) { - _mmcam_dbg_err("failed to get caps"); + MMCAM_LOG_ERROR("failed to get caps"); goto GET_FAILED; } structure = gst_caps_get_structure(caps, 0); if (structure == NULL) { - _mmcam_dbg_err("failed to get structure"); + MMCAM_LOG_ERROR("failed to get structure"); goto GET_FAILED; } @@ -1116,7 +1116,7 @@ void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capt capture_data->length = mapinfo.size; gst_buffer_unmap(gst_sample_get_buffer(sample), &mapinfo); - _mmcam_dbg_warn("buffer data[%p],size[%dx%d],length[%d],format[%d]", + MMCAM_LOG_WARNING("buffer data[%p],size[%dx%d],length[%d],format[%d]", capture_data->data, capture_data->width, capture_data->height, capture_data->length, capture_data->format); return; @@ -1140,10 +1140,10 @@ int __mmcamcorder_set_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* if tag enable and doesn't provide exif, we make it */ - _mmcam_dbg_log("Add exif information if existed(thumbnail[%p])", thumbnail); + MMCAM_LOG_INFO("Add exif information if existed(thumbnail[%p])", thumbnail); if (thumbnail && thumbnail->data) return __mmcamcorder_capture_save_exifinfo(handle, dest, thumbnail, provide_exif); else @@ -1162,7 +1162,7 @@ void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureData sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); mmf_return_if_fail(sc); - _mmcam_dbg_log("tag : %d, provide exif : %d", tag_enable, provide_exif); + MMCAM_LOG_INFO("tag : %d, provide exif : %d", tag_enable, provide_exif); /* if dest->data is allocated in MSL, release it */ if (tag_enable && !provide_exif) { @@ -1170,10 +1170,10 @@ void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureData free(dest->data); dest->length = 0; dest->data = NULL; - _mmcam_dbg_log("Jpeg is released!"); + MMCAM_LOG_INFO("Jpeg is released!"); } } else { - _mmcam_dbg_log("No need to release"); + MMCAM_LOG_INFO("No need to release"); } return; @@ -1231,7 +1231,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl /* get current state */ current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); - _mmcam_dbg_err("START - current state %d", current_state); + MMCAM_LOG_ERROR("START - current state %d", current_state); /* check capture state */ if (info->type == _MMCamcorder_MULTI_SHOT && info->capture_send_count > 0) @@ -1240,7 +1240,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl NULL); if (!info->capturing || stop_cont_shot) { - _mmcam_dbg_warn("stop command[%d] or not capturing state[%d]. skip this...", stop_cont_shot, info->capturing); + MMCAM_LOG_WARNING("stop command[%d] or not capturing state[%d]. skip this...", stop_cont_shot, info->capturing); /* set FALSE here for the case that info->capturing is still FALSE (== capture_send_count is 0 at the time _mmcamcorder_commit_capture_break_cont_shot is called) */ @@ -1263,18 +1263,18 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl wait for 2 seconds at worst case */ try_lock_count = 0; do { - _mmcam_dbg_log("Try command LOCK"); + MMCAM_LOG_INFO("Try command LOCK"); if (_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { - _mmcam_dbg_log("command LOCK OK"); + MMCAM_LOG_INFO("command LOCK OK"); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); break; } if (try_lock_count++ < TRY_LOCK_MAX_COUNT) { - _mmcam_dbg_warn("command LOCK Failed, retry...[count %d]", try_lock_count); + MMCAM_LOG_WARNING("command LOCK Failed, retry...[count %d]", try_lock_count); usleep(TRY_LOCK_TIME); } else { - _mmcam_dbg_err("failed to lock command LOCK"); + MMCAM_LOG_ERROR("failed to lock command LOCK"); break; } } while (TRUE); @@ -1284,7 +1284,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl or preview format is ITLV(because of AF and flash control in plugin) */ if (info->type == _MMCamcorder_MULTI_SHOT) { g_mutex_lock(&hcamcorder->task_thread_lock); - _mmcam_dbg_log("send signal for sound play"); + MMCAM_LOG_INFO("send signal for sound play"); hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START; g_cond_signal(&hcamcorder->task_thread_cond); g_mutex_unlock(&hcamcorder->task_thread_lock); @@ -1301,19 +1301,19 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl /* Prepare main, thumbnail buffer */ pixtype_main = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample1)); if (pixtype_main == MM_PIXEL_FORMAT_INVALID) { - _mmcam_dbg_err("Unsupported pixel type"); + MMCAM_LOG_ERROR("Unsupported pixel type"); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); goto error; } /* Main image buffer */ if (!sample1 || !gst_buffer_map(gst_sample_get_buffer(sample1), &mapinfo1, GST_MAP_READ)) { - _mmcam_dbg_err("sample1[%p] is NULL or gst_buffer_map failed", sample1); + MMCAM_LOG_ERROR("sample1[%p] is NULL or gst_buffer_map failed", sample1); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); goto error; } else { if ((mapinfo1.data == NULL) && (mapinfo1.size == 0)) { - _mmcam_dbg_err("mapinfo1 is wrong (%p, size %zu)", mapinfo1.data, mapinfo1.size); + MMCAM_LOG_ERROR("mapinfo1 is wrong (%p, size %zu)", mapinfo1.data, mapinfo1.size); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1); goto error; @@ -1323,26 +1323,26 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl } if (!sample2 || !gst_buffer_map(gst_sample_get_buffer(sample2), &mapinfo2, GST_MAP_READ)) - _mmcam_dbg_log("sample2[%p] is NULL or gst_buffer_map failed. Not Error.", sample2); + MMCAM_LOG_INFO("sample2[%p] is NULL or gst_buffer_map failed. Not Error.", sample2); if (!sample3 || !gst_buffer_map(gst_sample_get_buffer(sample3), &mapinfo3, GST_MAP_READ)) - _mmcam_dbg_log("sample3[%p] is NULL or gst_buffer_map failed. Not Error.", sample3); + MMCAM_LOG_INFO("sample3[%p] is NULL or gst_buffer_map failed. Not Error.", sample3); /* Screennail image buffer */ attrs = MMF_CAMCORDER_ATTRS(hcamcorder); mm_attrs_get_index(attrs, MMCAM_CAPTURED_SCREENNAIL, &attr_index_for_screennail); if (sample3 && mapinfo3.data && mapinfo3.size != 0) { - _mmcam_dbg_log("Screennail (sample3=%p,size=%zu)", sample3, mapinfo3.size); + MMCAM_LOG_INFO("Screennail (sample3=%p,size=%zu)", sample3, mapinfo3.size); pixtype_scrnl = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3)); __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_scrnl, sample3); /* Set screennail attribute for application */ ret = mm_attrs_set_data(attrs, attr_index_for_screennail, &scrnail, sizeof(scrnail)); - _mmcam_dbg_log("Screennail set attribute data %p, size %zu, ret %x", &scrnail, sizeof(scrnail), ret); + MMCAM_LOG_INFO("Screennail set attribute data %p, size %zu, ret %x", &scrnail, sizeof(scrnail), ret); } else { - _mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)", sample3); + MMCAM_LOG_INFO("Sample3 has wrong pointer. Not Error. (sample3=%p)", sample3); mm_attrs_set_data(attrs, attr_index_for_screennail, NULL, 0); } @@ -1357,11 +1357,11 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl /* Thumbnail image buffer */ if (sample2 && mapinfo2.data && (mapinfo2.size != 0)) { - _mmcam_dbg_log("Thumbnail (buffer2=%p)", gst_sample_get_buffer(sample2)); + MMCAM_LOG_INFO("Thumbnail (buffer2=%p)", gst_sample_get_buffer(sample2)); pixtype_thumb = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample2)); __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_thumb, sample2); } else { - _mmcam_dbg_log("Sample2 has wrong pointer. Not Error. (sample2 %p)", sample2); + MMCAM_LOG_INFO("Sample2 has wrong pointer. Not Error. (sample2 %p)", sample2); if (pixtype_main == MM_PIXEL_FORMAT_ENCODED && provide_exif) { ExifLoader *l; @@ -1403,16 +1403,16 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl thumb.height = atoi(height); internal_thumb_data = thumb.data; } else { - _mmcam_dbg_err("failed to alloc thumbnail data"); + MMCAM_LOG_ERROR("failed to alloc thumbnail data"); } } exif_data_unref(ed); ed = NULL; } else { - _mmcam_dbg_warn("failed to get exif data"); + MMCAM_LOG_WARNING("failed to get exif data"); } } else { - _mmcam_dbg_warn("failed to create exif loader"); + MMCAM_LOG_WARNING("failed to create exif loader"); } } @@ -1435,7 +1435,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl unsigned char *thumb_raw_data = NULL; /* encode image */ - _mmcam_dbg_log("Encode Thumbnail"); + MMCAM_LOG_INFO("Encode Thumbnail"); if (encode_src.width > THUMBNAIL_WIDTH) { /* calculate thumbnail size */ @@ -1444,7 +1444,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl if (thumb_height % 2 != 0) thumb_height += 1; - _mmcam_dbg_log("need to resize : thumbnail size %dx%d, format %d", + MMCAM_LOG_INFO("need to resize : thumbnail size %dx%d, format %d", thumb_width, thumb_height, encode_src.format); if ((encode_src.format == MM_PIXEL_FORMAT_UYVY || @@ -1454,21 +1454,21 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl if (!_mmcamcorder_downscale_UYVYorYUYV(encode_src.data, encode_src.width, encode_src.height, &thumb_raw_data, thumb_width, thumb_height)) { thumb_raw_data = NULL; - _mmcam_dbg_warn("_mmcamcorder_downscale_UYVYorYUYV failed. skip thumbnail making..."); + MMCAM_LOG_WARNING("_mmcamcorder_downscale_UYVYorYUYV failed. skip thumbnail making..."); } } else { if (!_mmcamcorder_resize_frame(encode_src.data, encode_src.width, encode_src.height, encode_src.length, encode_src.format, &thumb_raw_data, &thumb_width, &thumb_height, &thumb_length)) { thumb_raw_data = NULL; - _mmcam_dbg_warn("_mmcamcorder_resize_frame failed. skip thumbnail making..."); + MMCAM_LOG_WARNING("_mmcamcorder_resize_frame failed. skip thumbnail making..."); } } } else { thumb_width = encode_src.width; thumb_height = encode_src.height; - _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height); + MMCAM_LOG_INFO("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height); thumb_raw_data = encode_src.data; thumb_length = encode_src.length; @@ -1479,7 +1479,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl encode_src.format, thumb_length, THUMBNAIL_JPEG_QUALITY, (void **)&internal_thumb_data, &internal_thumb_length); if (ret) { - _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d", internal_thumb_data, internal_thumb_length); + MMCAM_LOG_INFO("encode THUMBNAIL done - data %p, length %d", internal_thumb_data, internal_thumb_length); thumb.data = internal_thumb_data; thumb.length = internal_thumb_length; @@ -1487,21 +1487,21 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl thumb.height = thumb_height; thumb.format = MM_PIXEL_FORMAT_ENCODED; } else { - _mmcam_dbg_warn("failed to encode THUMBNAIL"); + MMCAM_LOG_WARNING("failed to encode THUMBNAIL"); } /* release allocated raw data memory */ if (thumb_raw_data != encode_src.data) { free(thumb_raw_data); thumb_raw_data = NULL; - _mmcam_dbg_log("release thumb_raw_data"); + MMCAM_LOG_INFO("release thumb_raw_data"); } } else { - _mmcam_dbg_warn("thumb_raw_data is NULL"); + MMCAM_LOG_WARNING("thumb_raw_data is NULL"); } } else { /* no raw data src for thumbnail */ - _mmcam_dbg_log("no need to encode thumbnail"); + MMCAM_LOG_INFO("no need to encode thumbnail"); } } @@ -1510,13 +1510,13 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality, NULL); - _mmcam_dbg_log("Start Internal Encode - capture_quality %d", capture_quality); + MMCAM_LOG_INFO("Start Internal Encode - capture_quality %d", capture_quality); ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height, pixtype_main, dest.length, capture_quality, (void **)&internal_main_data, &internal_main_length); if (!ret) { - _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed"); + MMCAM_LOG_ERROR("_mmcamcorder_encode_jpeg failed"); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); @@ -1528,11 +1528,11 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl dest.length = internal_main_length; dest.format = MM_PIXEL_FORMAT_ENCODED; - _mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length); + MMCAM_LOG_INFO("Done Internal Encode - data %p, length %d", dest.data, dest.length); } if (info->capture_format != MM_PIXEL_FORMAT_ENCODED) { - _mmcam_dbg_log("not encoded format, skip exif related sequence"); + MMCAM_LOG_INFO("not encoded format, skip exif related sequence"); goto _CAPTURE_CB_EXIF_DONE; } @@ -1542,25 +1542,25 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl } else { /* load from jpeg buffer dest.data */ ret = mm_exif_load_exif_info(&(hcamcorder->exif_info), dest.data, dest.length); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Failed to load exif_info [%x], try to create EXIF", ret); + MMCAM_LOG_ERROR("Failed to load exif_info [%x], try to create EXIF", ret); provide_exif = FALSE; ret = mm_exif_create_exif_info(&(hcamcorder->exif_info)); } } if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Failed to create exif_info [%x], but keep going...", ret); + MMCAM_LOG_ERROR("Failed to create exif_info [%x], but keep going...", ret); } else { /* add basic exif info */ if (!provide_exif) { - _mmcam_dbg_log("add basic exif info"); + MMCAM_LOG_INFO("add basic exif info"); ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height); } else { - _mmcam_dbg_log("update exif info"); + MMCAM_LOG_INFO("update exif info"); ret = __mmcamcorder_update_exif_info((MMHandleType)hcamcorder, dest.data, dest.length); } if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Failed set_exif_basic_info [%x], but keep going...", ret); + MMCAM_LOG_WARNING("Failed set_exif_basic_info [%x], but keep going...", ret); ret = MM_ERROR_NONE; } } @@ -1574,12 +1574,12 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl if (exif_raw_data) { memcpy(exif_raw_data, hcamcorder->exif_info->data, hcamcorder->exif_info->size); mm_attrs_set_data(attrs, attr_index_for_exif, exif_raw_data, hcamcorder->exif_info->size); - _mmcam_dbg_log("set EXIF raw data %p, size %d", exif_raw_data, hcamcorder->exif_info->size); + MMCAM_LOG_INFO("set EXIF raw data %p, size %d", exif_raw_data, hcamcorder->exif_info->size); } else { - _mmcam_dbg_warn("failed to alloc for EXIF, size %d", hcamcorder->exif_info->size); + MMCAM_LOG_WARNING("failed to alloc for EXIF, size %d", hcamcorder->exif_info->size); } } else { - _mmcam_dbg_warn("failed to create EXIF. set EXIF as NULL"); + MMCAM_LOG_WARNING("failed to create EXIF. set EXIF as NULL"); mm_attrs_set_data(attrs, attr_index_for_exif, NULL, 0); } @@ -1594,7 +1594,7 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_IMAGE_ENCODER, &codectype, NULL); - _mmcam_dbg_log("codectype %d", codectype); + MMCAM_LOG_INFO("codectype %d", codectype); switch (codectype) { case MM_IMAGE_CODEC_JPEG: @@ -1602,13 +1602,13 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sampl case MM_IMAGE_CODEC_JPEG_SRW: ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb, provide_exif); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Error on setting extra data to jpeg"); + MMCAM_LOG_ERROR("Error on setting extra data to jpeg"); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, ret); goto error; } break; default: - _mmcam_dbg_err("The codectype is not supported. (%d)", codectype); + MMCAM_LOG_ERROR("The codectype is not supported. (%d)", codectype); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); goto error; } @@ -1620,15 +1620,15 @@ _CAPTURE_CB_EXIF_DONE: _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(hcamcorder); if (hcamcorder->vcapture_cb) { - _mmcam_dbg_log("APPLICATION CALLBACK START"); + MMCAM_LOG_INFO("APPLICATION CALLBACK START"); if (thumb.data) ret = hcamcorder->vcapture_cb(&dest, &thumb, hcamcorder->vcapture_cb_param); else ret = hcamcorder->vcapture_cb(&dest, NULL, hcamcorder->vcapture_cb_param); - _mmcam_dbg_log("APPLICATION CALLBACK END"); + MMCAM_LOG_INFO("APPLICATION CALLBACK END"); } else { - _mmcam_dbg_err("Capture callback is NULL."); + MMCAM_LOG_ERROR("Capture callback is NULL."); MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); @@ -1672,18 +1672,18 @@ error: if (dest.data && compare_data && dest.data != compare_data) { - _mmcam_dbg_log("release internal allocated data %p", dest.data); + MMCAM_LOG_INFO("release internal allocated data %p", dest.data); free(dest.data); dest.data = NULL; dest.length = 0; } if (internal_main_data) { - _mmcam_dbg_log("release internal main data %p", internal_main_data); + MMCAM_LOG_INFO("release internal main data %p", internal_main_data); free(internal_main_data); internal_main_data = NULL; } if (internal_thumb_data) { - _mmcam_dbg_log("release internal thumb data %p", internal_thumb_data); + MMCAM_LOG_INFO("release internal thumb data %p", internal_thumb_data); free(internal_thumb_data); internal_thumb_data = NULL; } @@ -1730,10 +1730,10 @@ error: g_mutex_lock(&hcamcorder->task_thread_lock); if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) { - _mmcam_dbg_log("send signal for capture in recording"); + MMCAM_LOG_INFO("send signal for capture in recording"); g_cond_signal(&hcamcorder->task_thread_cond); } else { - _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state); + MMCAM_LOG_WARNING("unexpected task thread state : %d", hcamcorder->task_thread_state); } g_mutex_unlock(&hcamcorder->task_thread_lock); @@ -1741,7 +1741,7 @@ error: _MMCAMCORDER_CMD_SIGNAL(hcamcorder); } - _mmcam_dbg_err("END"); + MMCAM_LOG_ERROR("END"); return; } @@ -1757,7 +1757,7 @@ gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); mmf_return_val_if_fail(sc && sc->element, FALSE); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); /* 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); @@ -1779,7 +1779,7 @@ static ExifData *__mmcamcorder_update_exif_orientation(MMHandleType handle, Exif int ret = MM_ERROR_NONE; mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL); - _mmcam_dbg_log("get orientation [%d]", value); + MMCAM_LOG_INFO("get orientation [%d]", value); if (value == 0) value = MM_EXIF_ORIENTATION; @@ -1800,14 +1800,14 @@ static ExifData *__mmcamcorder_update_exif_make(MMHandleType handle, ExifData *e char *make = strdup(MM_MAKER_NAME); if (make) { - _mmcam_dbg_log("maker [%s]", make); + MMCAM_LOG_INFO("maker [%s]", make); ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MAKE, EXIF_FORMAT_ASCII, strlen(make)+1, (const char *)make); free(make); if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_MAKE); } else { - _mmcam_dbg_err("strdup failed [%s]", MM_MAKER_NAME); + MMCAM_LOG_ERROR("strdup failed [%s]", MM_MAKER_NAME); } exit: @@ -1821,7 +1821,7 @@ static ExifData *__mmcamcorder_update_exif_software(MMHandleType handle, ExifDat mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle; if (hcamcorder == NULL || ed == NULL) { - _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed); + MMCAM_LOG_ERROR("NULL parameter %p,%p", hcamcorder, ed); return NULL; } @@ -1829,10 +1829,10 @@ static ExifData *__mmcamcorder_update_exif_software(MMHandleType handle, ExifDat ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE, EXIF_FORMAT_ASCII, strlen(hcamcorder->software_version)+1, (const char *)hcamcorder->software_version); - _mmcam_dbg_log("set software_version[%s] ret[0x%x]", + MMCAM_LOG_INFO("set software_version[%s] ret[0x%x]", hcamcorder->software_version, ret); } else { - _mmcam_dbg_err("model_name is NULL"); + MMCAM_LOG_ERROR("model_name is NULL"); } return ed; @@ -1845,7 +1845,7 @@ static ExifData *__mmcamcorder_update_exif_model(MMHandleType handle, ExifData * mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle; if (hcamcorder == NULL || ed == NULL) { - _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed); + MMCAM_LOG_ERROR("NULL parameter %p,%p", hcamcorder, ed); return NULL; } @@ -1853,10 +1853,10 @@ static ExifData *__mmcamcorder_update_exif_model(MMHandleType handle, ExifData * ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MODEL, EXIF_FORMAT_ASCII, strlen(hcamcorder->model_name)+1, (const char *)hcamcorder->model_name); - _mmcam_dbg_err("set model name[%s] ret[0x%x]", + MMCAM_LOG_ERROR("set model name[%s] ret[0x%x]", hcamcorder->model_name, ret); } else { - _mmcam_dbg_err("model_name is NULL"); + MMCAM_LOG_ERROR("model_name is NULL"); } return ed; @@ -1875,7 +1875,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed if (ret == MM_ERROR_NONE && gps_enable) { ExifByte GpsVersion[4] = {2, 2, 0, 0}; - _mmcam_dbg_log("Tag for GPS is ENABLED."); + MMCAM_LOG_INFO("Tag for GPS is ENABLED."); ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_VERSION_ID, EXIF_FORMAT_BYTE, 4, (const char *)&GpsVersion); @@ -1887,12 +1887,12 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed MMCAM_TAG_LONGITUDE, &longitude, MMCAM_TAG_ALTITUDE, &altitude, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("failed to get gps info [%x][%s]", ret, err_name); + MMCAM_LOG_ERROR("failed to get gps info [%x][%s]", ret, err_name); SAFE_FREE(err_name); goto exit; } - _mmcam_dbg_log("latitude [%f]", latitude); + MMCAM_LOG_INFO("latitude [%f]", latitude); if (latitude != INVALID_GPS_VALUE) { unsigned char *b = NULL; unsigned int deg; @@ -1918,7 +1918,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed min = (unsigned int)((latitude-deg) * 60); sec = (unsigned int)(((latitude-deg) * 3600) - min * 60); - _mmcam_dbg_log("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec); + MMCAM_LOG_INFO("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec); b = malloc(3 * sizeof(ExifRational)); if (b) { rData.numerator = deg; @@ -1935,11 +1935,11 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE); } else { - _mmcam_dbg_warn("malloc failed"); + MMCAM_LOG_WARNING("malloc failed"); } } - _mmcam_dbg_log("longitude [%f]", longitude); + MMCAM_LOG_INFO("longitude [%f]", longitude); if (longitude != INVALID_GPS_VALUE) { unsigned char *b = NULL; unsigned int deg; @@ -1965,7 +1965,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed min = (unsigned int)((longitude-deg) * 60); sec = (unsigned int)(((longitude-deg) * 3600) - min * 60); - _mmcam_dbg_log("longitude deg[%d], min[%d], sec[%d]", deg, min, sec); + MMCAM_LOG_INFO("longitude deg[%d], min[%d], sec[%d]", deg, min, sec); b = malloc(3 * sizeof(ExifRational)); if (b) { rData.numerator = deg; @@ -1981,11 +1981,11 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE); } else { - _mmcam_dbg_warn("malloc failed"); + MMCAM_LOG_WARNING("malloc failed"); } } - _mmcam_dbg_log("f_altitude [%f]", altitude); + MMCAM_LOG_INFO("f_altitude [%f]", altitude); if (altitude != INVALID_GPS_VALUE) { ExifByte alt_ref = 0; unsigned char *b = NULL; @@ -2000,7 +2000,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE_REF, EXIF_FORMAT_BYTE, 1, (const char *)&alt_ref); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF); + MMCAM_LOG_ERROR("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF); if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) { free(b); b = NULL; @@ -2017,14 +2017,14 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE); } else { - _mmcam_dbg_warn("malloc failed"); + MMCAM_LOG_WARNING("malloc failed"); } } { double gps_timestamp = INVALID_GPS_VALUE; mm_camcorder_get_attributes(handle, NULL, "tag-gps-time-stamp", &gps_timestamp, NULL); - _mmcam_dbg_log("Gps timestamp [%f]", gps_timestamp); + MMCAM_LOG_INFO("Gps timestamp [%f]", gps_timestamp); if (gps_timestamp > 0.0) { unsigned char *b = NULL; unsigned int hour; @@ -2036,7 +2036,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed min = (unsigned int)((gps_timestamp - 3600 * hour) / 60); microsec = (unsigned int)(((double)((double)gps_timestamp -(double)(3600 * hour)) -(double)(60 * min)) * 1000000); - _mmcam_dbg_log("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec); + MMCAM_LOG_INFO("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec); b = malloc(3 * sizeof(ExifRational)); if (b) { rData.numerator = hour; @@ -2057,7 +2057,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } } @@ -2069,7 +2069,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed mm_camcorder_get_attributes(handle, NULL, "tag-gps-date-stamp", &date_stamp, &date_stamp_len, NULL); if (date_stamp) { - _mmcam_dbg_log("Date stamp [%s]", date_stamp); + MMCAM_LOG_INFO("Date stamp [%s]", date_stamp); /* cause it should include NULL char */ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP, @@ -2086,7 +2086,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed mm_camcorder_get_attributes(handle, NULL, "tag-gps-processing-method", &processing_method, &processing_method_len, NULL); if (processing_method) { - _mmcam_dbg_log("Processing method [%s]", processing_method); + MMCAM_LOG_INFO("Processing method [%s]", processing_method); ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_PROCESSING_METHOD, EXIF_FORMAT_UNDEFINED, processing_method_len, (const char *)processing_method); @@ -2095,7 +2095,7 @@ static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed } } } else { - _mmcam_dbg_log("Tag for GPS is DISABLED."); + MMCAM_LOG_INFO("Tag for GPS is DISABLED."); } exit: @@ -2117,7 +2117,7 @@ int __mmcamcorder_update_exif_info(MMHandleType handle, void* imagedata, int img /*ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);*/ if (ed == NULL) { - _mmcam_dbg_err("get exif data error!!"); + MMCAM_LOG_ERROR("get exif data error!!"); return MM_ERROR_INVALID_HANDLE; } @@ -2130,7 +2130,7 @@ int __mmcamcorder_update_exif_info(MMHandleType handle, void* imagedata, int img __mmcamcorder_update_exif_gps(handle, ed); ret = mm_exif_set_exif_to_info(hcamcorder->exif_info, ed); if (ret != MM_ERROR_NONE) - _mmcam_dbg_err("mm_exif_set_exif_to_info err!! [%x]", ret); + MMCAM_LOG_ERROR("mm_exif_set_exif_to_info err!! [%x]", ret); exif_data_unref(ed); ed = NULL; @@ -2158,7 +2158,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -2168,7 +2168,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int CLEAR(avsys_exif_info); if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control. Skip camera control values..."); + MMCAM_LOG_ERROR("Can't cast Video source into camera control. Skip camera control values..."); } else { control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); /* get device information */ @@ -2178,7 +2178,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /* get ExifData from exif info */ ed = mm_exif_get_exif_from_info(hcamcorder->exif_info); if (ed == NULL) { - _mmcam_dbg_err("get exif data error!!"); + MMCAM_LOG_ERROR("get exif data error!!"); return MM_ERROR_INVALID_HANDLE; } @@ -2207,7 +2207,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_X_DIMENSION); - _mmcam_dbg_log("width[%d]", value); + MMCAM_LOG_INFO("width[%d]", value); /*2. EXIF_TAG_IMAGE_LENGTH*/ /*EXIF_TAG_PIXEL_Y_DIMENSION*/ value = image_height; @@ -2223,7 +2223,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_Y_DIMENSION); - _mmcam_dbg_log("height[%d]", value); + MMCAM_LOG_INFO("height[%d]", value); /*4. EXIF_TAG_DATE_TIME */ @@ -2284,7 +2284,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (str_value && str_val_len > 0) { char *description = strdup(str_value); - _mmcam_dbg_log("description [%s]", str_value); + MMCAM_LOG_INFO("description [%s]", str_value); if (description) { ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, @@ -2295,10 +2295,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION); } else { - _mmcam_dbg_err("strdup failed for [%s]", str_value); + MMCAM_LOG_ERROR("strdup failed for [%s]", str_value); } } else { - _mmcam_dbg_warn("failed to get description"); + MMCAM_LOG_WARNING("failed to get description"); } /*7. EXIF_TAG_SOFTWARE*/ @@ -2310,7 +2310,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned int len = 0; len = snprintf(software, sizeof(software), "%x.%x ", avsys_exif_info.software_used>>8, (avsys_exif_info.software_used & 0xff)); - _mmcam_dbg_log("software [%s], len [%d]", software, len); + MMCAM_LOG_INFO("software [%s], len [%d]", software, len); ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE, EXIF_FORMAT_ASCII, len, (const char *)software); if (ret != MM_ERROR_NONE) { @@ -2327,7 +2327,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /*FIXME : get user comment from real user */ user_comment = strdup(MM_USER_COMMENT); if (user_comment) { - _mmcam_dbg_log("user_comment=%s", user_comment); + MMCAM_LOG_INFO("user_comment=%s", user_comment); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_USER_COMMENT, EXIF_FORMAT_ASCII, strlen(user_comment), (const char *)user_comment); free(user_comment); @@ -2350,7 +2350,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /*10. EXIF_TAG_COMPONENTS_CONFIGURATION */ if (control != NULL) { config = avsys_exif_info.component_configuration; - _mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ", config); + MMCAM_LOG_INFO("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ", config); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, EXIF_FORMAT_UNDEFINED, 4, (const char *)&config); if (ret != MM_ERROR_NONE) @@ -2368,7 +2368,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifRational rData; - _mmcam_dbg_log("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]", avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator); b = malloc(sizeof(ExifRational)); @@ -2383,10 +2383,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_TIME); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("Skip set EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]", avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator); } @@ -2395,7 +2395,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifRational rData; - _mmcam_dbg_log("EXIF_TAG_FNUMBER numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("EXIF_TAG_FNUMBER numerator [%d], denominator [%d]", avsys_exif_info.aperture_f_num_numerator, avsys_exif_info.aperture_f_num_denominator); b = malloc(sizeof(ExifRational)); @@ -2409,10 +2409,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_FNUMBER); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_FNUMBER numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("Skip set EXIF_TAG_FNUMBER numerator [%d], denominator [%d]", avsys_exif_info.aperture_f_num_numerator, avsys_exif_info.aperture_f_num_denominator); } @@ -2427,7 +2427,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /*17. EXIF_TAG_ISO_SPEED_RATINGS*/ if (avsys_exif_info.iso) { - _mmcam_dbg_log("EXIF_TAG_ISO_SPEED_RATINGS [%d]", avsys_exif_info.iso); + MMCAM_LOG_INFO("EXIF_TAG_ISO_SPEED_RATINGS [%d]", avsys_exif_info.iso); exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.iso); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_ISO_SPEED_RATINGS, EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]); @@ -2440,7 +2440,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifSRational rsData; - _mmcam_dbg_log("EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]", avsys_exif_info.shutter_speed_numerator, avsys_exif_info.shutter_speed_denominator); b = malloc(sizeof(ExifSRational)); @@ -2454,10 +2454,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_SHUTTER_SPEED_VALUE); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("Skip set EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]", avsys_exif_info.shutter_speed_numerator, avsys_exif_info.shutter_speed_denominator); } @@ -2466,7 +2466,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifRational rData; - _mmcam_dbg_log("EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX); + MMCAM_LOG_INFO("EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX); b = malloc(sizeof(ExifRational)); if (b) { @@ -2479,10 +2479,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_APERTURE_VALUE); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX); + MMCAM_LOG_INFO("Skip set EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX); } /*20. EXIF_TAG_BRIGHTNESS_VALUE*/ @@ -2490,7 +2490,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifSRational rsData; - _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominator [%d]", avsys_exif_info.brigtness_numerator, avsys_exif_info.brightness_denominator); b = malloc(sizeof(ExifSRational)); @@ -2504,10 +2504,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_BRIGHTNESS_VALUE); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominatorr [%d]", + MMCAM_LOG_INFO("Skip set EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominatorr [%d]", avsys_exif_info.brigtness_numerator, avsys_exif_info.brightness_denominator); } @@ -2518,7 +2518,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifSRational rsData; - _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d", + MMCAM_LOG_INFO("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d", value, hcamcorder->brightness_default, hcamcorder->brightness_step_denominator); b = malloc(sizeof(ExifSRational)); @@ -2527,7 +2527,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (hcamcorder->brightness_step_denominator != 0) { rsData.denominator = hcamcorder->brightness_step_denominator; } else { - _mmcam_dbg_warn("brightness_step_denominator is ZERO, so set 1"); + MMCAM_LOG_WARNING("brightness_step_denominator is ZERO, so set 1"); rsData.denominator = 1; } exif_set_srational(b, exif_data_get_byte_order(ed), rsData); @@ -2537,10 +2537,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_BIAS_VALUE); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("failed to get MMCAM_FILTER_BRIGHTNESS [%x]", ret); + MMCAM_LOG_INFO("failed to get MMCAM_FILTER_BRIGHTNESS [%x]", ret); } /*22 EXIF_TAG_MAX_APERTURE_VALUE*/ @@ -2549,7 +2549,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifRational rData; - _mmcam_dbg_log("EXIF_TAG_MAX_APERTURE_VALUE [%d]", avsys_exif_info.max_lens_aperture_in_APEX); + MMCAM_LOG_INFO("EXIF_TAG_MAX_APERTURE_VALUE [%d]", avsys_exif_info.max_lens_aperture_in_APEX); b = malloc(sizeof(ExifRational)); if (b) { @@ -2562,18 +2562,18 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_MAX_APERTURE_VALUE); } else { - _mmcam_dbg_warn("failed to alloc for MAX aperture value"); + MMCAM_LOG_WARNING("failed to alloc for MAX aperture value"); } } */ /*23. EXIF_TAG_SUBJECT_DISTANCE*/ - /* defualt : none */ + /* default : none */ /*24. EXIF_TAG_METERING_MODE */ if (control != NULL) { exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.metering_mode); - _mmcam_dbg_log("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode); + MMCAM_LOG_INFO("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE, EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]); if (ret != MM_ERROR_NONE) @@ -2585,7 +2585,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /*26. EXIF_TAG_FLASH*/ if (control != NULL) { exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.flash); - _mmcam_dbg_log("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash); + MMCAM_LOG_INFO("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]); if (ret != MM_ERROR_NONE) @@ -2597,7 +2597,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int unsigned char *b = NULL; ExifRational rData; - _mmcam_dbg_log("EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]", avsys_exif_info.focal_len_numerator, avsys_exif_info.focal_len_denominator); b = malloc(sizeof(ExifRational)); @@ -2611,10 +2611,10 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH); } else { - _mmcam_dbg_warn("malloc failed."); + MMCAM_LOG_WARNING("malloc failed."); } } else { - _mmcam_dbg_log("Skip set EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]", + MMCAM_LOG_INFO("Skip set EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]", avsys_exif_info.focal_len_numerator, avsys_exif_info.focal_len_denominator); } @@ -2660,7 +2660,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_WB, &value, NULL); if (ret == MM_ERROR_NONE) { int set_value = 0; - _mmcam_dbg_log("WHITE BALANCE [%d]", value); + MMCAM_LOG_INFO("WHITE BALANCE [%d]", value); if (value == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC) set_value = 0; @@ -2673,14 +2673,14 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_WHITE_BALANCE); } else { - _mmcam_dbg_warn("failed to get white balance [%x]", ret); + MMCAM_LOG_WARNING("failed to get white balance [%x]", ret); } /*33. EXIF_TAG_DIGITAL_ZOOM_RATIO*/ /* ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_DIGITAL_ZOOM, &value, NULL); if (ret == MM_ERROR_NONE) { - _mmcam_dbg_log("DIGITAL ZOOM [%d]", value); + MMCAM_LOG_INFO("DIGITAL ZOOM [%d]", value); exif_set_long(&elong[cntl], exif_data_get_byte_order(ed), value); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO, @@ -2688,7 +2688,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_DIGITAL_ZOOM_RATIO); } else { - _mmcam_dbg_warn("failed to get digital zoom [%x]", ret); + MMCAM_LOG_WARNING("failed to get digital zoom [%x]", ret); } */ @@ -2709,7 +2709,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &value, NULL); if (ret == MM_ERROR_NONE) { - _mmcam_dbg_log("Scene mode(program mode) [%d]", value); + MMCAM_LOG_INFO("Scene mode(program mode) [%d]", value); switch (value) { case MM_CAMCORDER_SCENE_MODE_NORMAL: @@ -2735,7 +2735,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_SCENE_CAPTURE_TYPE); } else { - _mmcam_dbg_warn("failed to get scene mode [%x]", ret); + MMCAM_LOG_WARNING("failed to get scene mode [%x]", ret); } } @@ -2763,7 +2763,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (irange != NULL) { mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_CONTRAST, &value, NULL); - _mmcam_dbg_log("CONTRAST current [%d], default [%d]", value, irange->default_value); + MMCAM_LOG_INFO("CONTRAST current [%d], default [%d]", value, irange->default_value); if (value == irange->default_value) level = MM_VALUE_NORMAL; @@ -2778,7 +2778,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_CONTRAST); } else { - _mmcam_dbg_warn("failed to get range of contrast"); + MMCAM_LOG_WARNING("failed to get range of contrast"); } } @@ -2794,7 +2794,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (irange != NULL) { mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SATURATION, &value, NULL); - _mmcam_dbg_log("SATURATION current [%d], default [%d]", value, irange->default_value); + MMCAM_LOG_INFO("SATURATION current [%d], default [%d]", value, irange->default_value); if (value == irange->default_value) level = MM_VALUE_NORMAL; @@ -2809,7 +2809,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_SATURATION); } else { - _mmcam_dbg_warn("failed to get range of saturation"); + MMCAM_LOG_WARNING("failed to get range of saturation"); } } @@ -2825,7 +2825,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (irange != NULL) { mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SHARPNESS, &value, NULL); - _mmcam_dbg_log("SHARPNESS current [%d], default [%d]", value, irange->default_value); + MMCAM_LOG_INFO("SHARPNESS current [%d], default [%d]", value, irange->default_value); if (value == irange->default_value) level = MM_VALUE_NORMAL; @@ -2840,14 +2840,14 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int if (ret != MM_ERROR_NONE) EXIF_SET_ERR(ret, EXIF_TAG_SHARPNESS); } else { - _mmcam_dbg_warn("failed to get range of sharpness"); + MMCAM_LOG_WARNING("failed to get range of sharpness"); } } /*40. EXIF_TAG_SUBJECT_DISTANCE_RANGE*/ /*FIXME*/ value = MM_SUBJECT_DISTANCE_RANGE; - _mmcam_dbg_log("DISTANCE_RANGE [%d]", value); + MMCAM_LOG_INFO("DISTANCE_RANGE [%d]", value); exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value); ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE_RANGE, EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]); @@ -2857,14 +2857,14 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /* GPS information */ __mmcamcorder_update_exif_gps(handle, ed); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); ret = mm_exif_set_exif_to_info(hcamcorder->exif_info, ed); if (ret != MM_ERROR_NONE) - _mmcam_dbg_err("mm_exif_set_exif_to_info err!! [%x]", ret); + MMCAM_LOG_ERROR("mm_exif_set_exif_to_info err!! [%x]", ret); exit: - _mmcam_dbg_log("finished!! [%x]", ret); + MMCAM_LOG_INFO("finished!! [%x]", ret); if (ed) exif_data_unref(ed); @@ -2880,13 +2880,13 @@ static void __sound_status_changed_cb(keynode_t* node, void *data) mmf_return_if_fail(hcamcorder && hcamcorder->sub_context && hcamcorder->sub_context->info_image); - _mmcam_dbg_log("START"); + MMCAM_LOG_INFO("START"); info = hcamcorder->sub_context->info_image; vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status)); - _mmcam_dbg_log("DONE : sound status %d", info->sound_status); + MMCAM_LOG_INFO("DONE : sound status %d", info->sound_status); return; } diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index 290dce3..983e386 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -54,14 +54,14 @@ #define FPUTC_CHECK(x_char, x_file) \ { \ if (fputc(x_char, x_file) == EOF) { \ - _mmcam_dbg_err("[Critical] fputc() returns fail.\n"); \ + MMCAM_LOG_ERROR("[Critical] fputc() returns fail.\n"); \ return FALSE; \ } \ } #define FPUTS_CHECK(x_str, x_file) \ { \ if (fputs(x_str, x_file) == EOF) { \ - _mmcam_dbg_err("[Critical] fputs() returns fail.\n"); \ + MMCAM_LOG_ERROR("[Critical] fputs() returns fail.\n"); \ SAFE_G_FREE(str); \ return FALSE; \ } \ @@ -101,22 +101,22 @@ static int __gdbus_method_call_sync(GDBusConnection *conn, const char *bus_name, GVariant *dbus_reply = NULL; if (!conn || !object || !iface || !method) { - _mmcam_dbg_err("Invalid Argument %p %p %p %p", + MMCAM_LOG_ERROR("Invalid Argument %p %p %p %p", conn, object, iface, method); return MM_ERROR_INVALID_ARGUMENT; } - _mmcam_dbg_warn("Dbus call - obj [%s], iface [%s], method [%s]", object, iface, method); + MMCAM_LOG_WARNING("Dbus call - obj [%s], iface [%s], method [%s]", object, iface, method); if (is_sync) { dbus_reply = g_dbus_connection_call_sync(conn, bus_name, object, iface, method, args, NULL, G_DBUS_CALL_FLAGS_NONE, G_DBUS_TIMEOUT, NULL, NULL); if (dbus_reply) { - _mmcam_dbg_warn("Method Call '%s.%s' Success", iface, method); + MMCAM_LOG_WARNING("Method Call '%s.%s' Success", iface, method); *result = dbus_reply; } else { - _mmcam_dbg_err("dbus method call sync reply failed"); + MMCAM_LOG_ERROR("dbus method call sync reply failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; } } else { @@ -124,7 +124,7 @@ static int __gdbus_method_call_sync(GDBusConnection *conn, const char *bus_name, G_DBUS_CALL_FLAGS_NONE, G_DBUS_TIMEOUT, NULL, NULL, NULL); } - _mmcam_dbg_warn("done"); + MMCAM_LOG_WARNING("done"); return ret; } @@ -136,23 +136,23 @@ static int __gdbus_subscribe_signal(GDBusConnection *conn, guint subs_id = 0; if (!conn || !object_name || !iface_name || !signal_name || !signal_cb || !subscribe_id) { - _mmcam_dbg_err("Invalid Argument %p %p %p %p %p %p", + MMCAM_LOG_ERROR("Invalid Argument %p %p %p %p %p %p", conn, object_name, iface_name, signal_name, signal_cb, subscribe_id); return MM_ERROR_INVALID_ARGUMENT; } - _mmcam_dbg_log("subscirbe signal Obj %s, iface_name %s, sig_name %s", + MMCAM_LOG_INFO("subscirbe signal Obj %s, iface_name %s, sig_name %s", object_name, iface_name, signal_name); subs_id = g_dbus_connection_signal_subscribe(conn, NULL, iface_name, signal_name, object_name, NULL, G_DBUS_SIGNAL_FLAGS_NONE, signal_cb, userdata, NULL); if (!subs_id) { - _mmcam_dbg_err("g_dbus_connection_signal_subscribe() failed"); + MMCAM_LOG_ERROR("g_dbus_connection_signal_subscribe() failed"); return MM_ERROR_CAMCORDER_INTERNAL; } else { *subscribe_id = subs_id; - _mmcam_dbg_log("subs_id %u", subs_id); + MMCAM_LOG_INFO("subs_id %u", subs_id); } return MM_ERROR_NONE; @@ -167,10 +167,10 @@ static void __gdbus_stream_eos_cb(GDBusConnection *connection, _MMCamcorderGDbusCbInfo *gdbus_info = NULL; mmf_camcorder_t *hcamcorder = NULL; - _mmcam_dbg_warn("entered"); + MMCAM_LOG_WARNING("entered"); if (!param || !user_data) { - _mmcam_dbg_err("invalid parameter %p %p", param, user_data); + MMCAM_LOG_ERROR("invalid parameter %p %p", param, user_data); return; } @@ -181,7 +181,7 @@ static void __gdbus_stream_eos_cb(GDBusConnection *connection, g_mutex_lock(&gdbus_info->sync_mutex); - _mmcam_dbg_warn("gdbus_info->param %d, played_idx : %d, handle : %p", + MMCAM_LOG_WARNING("gdbus_info->param %d, played_idx : %d, handle : %p", gdbus_info->param, played_idx, hcamcorder); if (gdbus_info->param == played_idx) { @@ -196,7 +196,7 @@ static void __gdbus_stream_eos_cb(GDBusConnection *connection, g_mutex_unlock(&gdbus_info->sync_mutex); - _mmcam_dbg_warn("done"); + MMCAM_LOG_WARNING("done"); return; } @@ -207,16 +207,16 @@ static int __gdbus_wait_for_cb_return(_MMCamcorderGDbusCbInfo *gdbus_info, int t gint64 end_time = 0; if (!gdbus_info) { - _mmcam_dbg_err("invalid info"); + MMCAM_LOG_ERROR("invalid info"); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } g_mutex_lock(&gdbus_info->sync_mutex); - _mmcam_dbg_warn("entered"); + MMCAM_LOG_WARNING("entered"); if (gdbus_info->is_playing == FALSE) { - _mmcam_dbg_log("callback is already returned"); + MMCAM_LOG_INFO("callback is already returned"); g_mutex_unlock(&gdbus_info->sync_mutex); return MM_ERROR_NONE; } @@ -224,15 +224,15 @@ static int __gdbus_wait_for_cb_return(_MMCamcorderGDbusCbInfo *gdbus_info, int t end_time = g_get_monotonic_time() + (time_out * G_TIME_SPAN_MILLISECOND); if (g_cond_wait_until(&gdbus_info->sync_cond, &gdbus_info->sync_mutex, end_time)) { - _mmcam_dbg_warn("wait signal received"); + MMCAM_LOG_WARNING("wait signal received"); } else { - _mmcam_dbg_err("wait time is expired"); + MMCAM_LOG_ERROR("wait time is expired"); ret = MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT; } g_mutex_unlock(&gdbus_info->sync_mutex); - _mmcam_dbg_warn("done"); + MMCAM_LOG_WARNING("done"); return ret; } @@ -257,17 +257,17 @@ gint _mmcamcorder_find_tag(FILE *f, guint32 tag_fourcc, gboolean do_rewind) uint32_t buf_fourcc = 0; if (read_item < 8) { - _mmcam_dbg_err("fread failed : %zu", read_item); + MMCAM_LOG_ERROR("fread failed : %zu", read_item); break; } buf_fourcc = MMCAM_FOURCC(buf[4], buf[5], buf[6], buf[7]); if (tag_fourcc == buf_fourcc) { - _mmcam_dbg_log("find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); + MMCAM_LOG_INFO("find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); return TRUE; } else { - _mmcam_dbg_log("skip [%c%c%c%c] tag", MMCAM_FOURCC_ARGS(buf_fourcc)); + MMCAM_LOG_INFO("skip [%c%c%c%c] tag", MMCAM_FOURCC_ARGS(buf_fourcc)); buf_size = _mmcamcorder_get_container_size(buf); @@ -276,7 +276,7 @@ gint _mmcamcorder_find_tag(FILE *f, guint32 tag_fourcc, gboolean do_rewind) buf_size == 1) { read_item = fread(&buf, sizeof(guchar), 8, f); if (read_item < 8) { - _mmcam_dbg_err("fread failed"); + MMCAM_LOG_ERROR("fread failed"); return FALSE; } @@ -286,15 +286,15 @@ gint _mmcamcorder_find_tag(FILE *f, guint32 tag_fourcc, gboolean do_rewind) buf_size = buf_size - 8; /* include tag */ } - _mmcam_dbg_log("seek %"PRIu64, buf_size); + MMCAM_LOG_INFO("seek %"PRIu64, buf_size); if (fseeko(f, (off_t)buf_size, SEEK_CUR) != 0) { - _mmcam_dbg_err("fseeko() fail"); + MMCAM_LOG_ERROR("fseeko() fail"); return FALSE; } } } - _mmcam_dbg_log("cannot find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); + MMCAM_LOG_INFO("cannot find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); return FALSE; } @@ -312,14 +312,14 @@ gboolean _mmcamcorder_find_fourcc(FILE *f, guint32 tag_fourcc, gboolean do_rewin uint32_t buf_fourcc = 0; if (read_item < 8) { - _mmcam_dbg_err("fread failed : %zu", read_item); + MMCAM_LOG_ERROR("fread failed : %zu", read_item); break; } buf_fourcc = MMCAM_FOURCC(buf[4], buf[5], buf[6], buf[7]); if (tag_fourcc == buf_fourcc) { - _mmcam_dbg_log("find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); + MMCAM_LOG_INFO("find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); return TRUE; } else if (buf_fourcc == MMCAM_FOURCC('m', 'o', 'o', 'v') && tag_fourcc != buf_fourcc) { @@ -328,7 +328,7 @@ gboolean _mmcamcorder_find_fourcc(FILE *f, guint32 tag_fourcc, gboolean do_rewin else continue; } else { - _mmcam_dbg_log("skip [%c%c%c%c] tag", MMCAM_FOURCC_ARGS(buf_fourcc)); + MMCAM_LOG_INFO("skip [%c%c%c%c] tag", MMCAM_FOURCC_ARGS(buf_fourcc)); buf_size = _mmcamcorder_get_container_size(buf); @@ -337,7 +337,7 @@ gboolean _mmcamcorder_find_fourcc(FILE *f, guint32 tag_fourcc, gboolean do_rewin buf_size == 1) { read_item = fread(&buf, sizeof(guchar), 8, f); if (read_item < 8) { - _mmcam_dbg_err("fread failed"); + MMCAM_LOG_ERROR("fread failed"); return FALSE; } @@ -347,24 +347,24 @@ gboolean _mmcamcorder_find_fourcc(FILE *f, guint32 tag_fourcc, gboolean do_rewin buf_size = buf_size - 8; /* include tag */ } - _mmcam_dbg_log("seek %"PRIu64, buf_size); + MMCAM_LOG_INFO("seek %"PRIu64, buf_size); if (fseeko(f, (off_t)buf_size, SEEK_CUR) != 0) { - _mmcam_dbg_err("fseeko() fail"); + MMCAM_LOG_ERROR("fseeko() fail"); return FALSE; } } } - _mmcam_dbg_log("cannot find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); + MMCAM_LOG_INFO("cannot find tag : %c%c%c%c", MMCAM_FOURCC_ARGS(tag_fourcc)); return FALSE; } gboolean _mmcamcorder_update_size(FILE *f, gint64 prev_pos, gint64 curr_pos) { - _mmcam_dbg_log("size : %"G_GINT64_FORMAT"", curr_pos-prev_pos); + MMCAM_LOG_INFO("size : %"G_GINT64_FORMAT"", curr_pos-prev_pos); if (fseeko(f, prev_pos, SEEK_SET) != 0) { - _mmcam_dbg_err("fseeko() fail"); + MMCAM_LOG_ERROR("fseeko() fail"); return FALSE; } @@ -372,7 +372,7 @@ gboolean _mmcamcorder_update_size(FILE *f, gint64 prev_pos, gint64 curr_pos) return FALSE; if (fseeko(f, curr_pos, SEEK_SET) != 0) { - _mmcam_dbg_err("fseeko() fail"); + MMCAM_LOG_ERROR("fseeko() fail"); return FALSE; } @@ -384,10 +384,10 @@ gboolean _mmcamcorder_write_loci(FILE *f, _MMCamcorderLocationInfo info) gint64 current_pos, pos; gchar *str = NULL; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if ((pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } @@ -435,7 +435,7 @@ gboolean _mmcamcorder_write_loci(FILE *f, _MMCamcorderLocationInfo info) FPUTC_CHECK('\0', f); if ((current_pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } @@ -504,10 +504,10 @@ gboolean _mmcamcorder_write_geodata(FILE *f, _MMCamcorderLocationInfo info) { gint64 current_pos, pos; - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if ((pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } @@ -526,7 +526,7 @@ gboolean _mmcamcorder_write_geodata(FILE *f, _MMCamcorderLocationInfo info) FPUTC_CHECK(0x2F, f); if ((current_pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } @@ -541,52 +541,52 @@ gboolean _mmcamcorder_write_udta(FILE *f, int gps_enable, _MMCamcorderLocationIn { gint64 current_pos, pos; - _mmcam_dbg_log("gps enable : %d", gps_enable); + MMCAM_LOG_INFO("gps enable : %d", gps_enable); if (gps_enable == FALSE) { - _mmcam_dbg_log("no need to write udta"); + MMCAM_LOG_INFO("no need to write udta"); return TRUE; } if ((pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } /* size */ if (!write_to_32(f, 0)) { - _mmcam_dbg_err("failed to write size"); + MMCAM_LOG_ERROR("failed to write size"); return FALSE; } /* type */ if (!write_tag(f, "udta")) { - _mmcam_dbg_err("failed to write type udta"); + MMCAM_LOG_ERROR("failed to write type udta"); return FALSE; } if (gps_enable) { if (!_mmcamcorder_write_loci(f, info)) { - _mmcam_dbg_err("failed to write loci"); + MMCAM_LOG_ERROR("failed to write loci"); return FALSE; } if (!_mmcamcorder_write_geodata(f, geotag)) { - _mmcam_dbg_err("failed to write geodata"); + MMCAM_LOG_ERROR("failed to write geodata"); return FALSE; } } if ((current_pos = ftello(f)) < 0) { - _mmcam_dbg_err("ftello() returns negative value"); + MMCAM_LOG_ERROR("ftello() returns negative value"); return FALSE; } if (!_mmcamcorder_update_size(f, pos, current_pos)) { - _mmcam_dbg_err("failed to update size"); + MMCAM_LOG_ERROR("failed to update size"); return FALSE; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return TRUE; } @@ -605,7 +605,7 @@ guint64 _mmcamcorder_get_container_size(const guchar *size) result = result | (temp << 8); result = result | size[3]; - _mmcam_dbg_log("result : %"G_GUINT64_FORMAT, result); + MMCAM_LOG_INFO("result : %"G_GUINT64_FORMAT, result); return result; } @@ -632,7 +632,7 @@ guint64 _mmcamcorder_get_container_size64(const guchar *size) result = result | (temp << 8); result = result | size[7]; - _mmcam_dbg_log("result : %"G_GUINT64_FORMAT, result); + MMCAM_LOG_INFO("result : %"G_GUINT64_FORMAT, result); return result; } @@ -678,7 +678,7 @@ gboolean _mmcamcorder_update_composition_matrix(FILE *f, int orientation) write_to_32(f, 0); write_to_32(f, 0x40000000); - _mmcam_dbg_log("orientation : %d, write data 0x%x 0x%x 0x%x 0x%x", + MMCAM_LOG_INFO("orientation : %d, write data 0x%x 0x%x 0x%x 0x%x", orientation, a, b, c, d); return TRUE; @@ -691,7 +691,7 @@ static int __mmcamcorder_storage_supported_cb(int storage_id, storage_type_e typ _MMCamcorderStorageInfo *info = (_MMCamcorderStorageInfo *)user_data; if (!info) { - _mmcam_dbg_err("NULL info"); + MMCAM_LOG_ERROR("NULL info"); return FALSE; } @@ -716,7 +716,7 @@ int _mmcamcorder_get_storage_validity(MMHandleType handle, const char *filename, mmf_return_val_if_fail(storage_validity, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); if (!filename) { - _mmcam_dbg_warn("NULL filename, but keep going..."); + MMCAM_LOG_WARNING("NULL filename, but keep going..."); *storage_validity = TRUE; return MM_ERROR_NONE; } @@ -726,29 +726,29 @@ int _mmcamcorder_get_storage_validity(MMHandleType handle, const char *filename, err = _mmcamcorder_get_storage_info(dir_name, hcamcorder->root_directory, &hcamcorder->storage_info); if (err != 0) { - _mmcam_dbg_err("get storage info failed"); + MMCAM_LOG_ERROR("get storage info failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto _CHECK_DONE; } err = _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space); if (err != 0) { - _mmcam_dbg_err("get free space failed"); + MMCAM_LOG_ERROR("get free space failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto _CHECK_DONE; } - _mmcam_dbg_warn("current free space - %s [%" G_GUINT64_FORMAT "]", dir_name, free_space); + MMCAM_LOG_WARNING("current free space - %s [%" G_GUINT64_FORMAT "]", dir_name, free_space); _CHECK_DONE: g_free(dir_name); if (ret == MM_ERROR_NONE && free_space > min_space) { *storage_validity = TRUE; - _mmcam_dbg_log("validity and free space of storage : OK"); + MMCAM_LOG_INFO("validity and free space of storage : OK"); } else { *storage_validity = FALSE; - _mmcam_dbg_err("OUT of STORAGE [err:%d or free space [%"G_GUINT64_FORMAT"] is smaller than [%"G_GUINT64_FORMAT"]", + MMCAM_LOG_ERROR("OUT of STORAGE [err:%d or free space [%"G_GUINT64_FORMAT"] is smaller than [%"G_GUINT64_FORMAT"]", err, free_space, min_space); } @@ -771,11 +771,11 @@ void _mmcamcorder_adjust_recording_max_size(const char *filename, guint64 *max_s /* MSDOS_SUPER_MAGIC : 0x4d44 */ if (file_system_type == MSDOS_SUPER_MAGIC && (*max_size == 0 || *max_size > FAT32_FILE_SYSTEM_MAX_SIZE)) { - _mmcam_dbg_warn("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %lu", + MMCAM_LOG_WARNING("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %lu", *max_size, FAT32_FILE_SYSTEM_MAX_SIZE); *max_size = FAT32_FILE_SYSTEM_MAX_SIZE; } else { - _mmcam_dbg_warn("file system 0x%x, max size %"G_GUINT64_FORMAT, + MMCAM_LOG_WARNING("file system 0x%x, max size %"G_GUINT64_FORMAT, file_system_type, *max_size); } } @@ -791,18 +791,18 @@ int _mmcamcorder_get_storage_info(const gchar *path, const gchar *root_directory struct stat stat_root; if (!path || !root_directory || !info) { - _mmcam_dbg_err("invalid parameter %p %p %p", path, root_directory, info); + MMCAM_LOG_ERROR("invalid parameter %p %p %p", path, root_directory, info); return -1; } if (strlen(root_directory) > 0) { if (stat(path, &stat_path) != 0) { - _mmcam_dbg_err("failed to stat for [%s][errno %d]", path, errno); + MMCAM_LOG_ERROR("failed to stat for [%s][errno %d]", path, errno); return -1; } if (stat(root_directory, &stat_root) != 0) { - _mmcam_dbg_err("failed to stat for [%s][errno %d]", root_directory, errno); + MMCAM_LOG_ERROR("failed to stat for [%s][errno %d]", root_directory, errno); return -1; } @@ -812,16 +812,16 @@ int _mmcamcorder_get_storage_info(const gchar *path, const gchar *root_directory info->type = STORAGE_TYPE_EXTERNAL; } else { info->type = STORAGE_TYPE_INTERNAL; - _mmcam_dbg_warn("invalid length of root directory, assume that it's internal storage."); + MMCAM_LOG_WARNING("invalid length of root directory, assume that it's internal storage."); } ret = storage_foreach_device_supported((storage_device_supported_cb)__mmcamcorder_storage_supported_cb, info); if (ret != STORAGE_ERROR_NONE) { - _mmcam_dbg_err("storage_foreach_device_supported failed 0x%x", ret); + MMCAM_LOG_ERROR("storage_foreach_device_supported failed 0x%x", ret); return -1; } - _mmcam_dbg_log("storage info - type %d, id %d", info->type, info->id); + MMCAM_LOG_INFO("storage info - type %d, id %d", info->type, info->id); return 0; } @@ -839,14 +839,14 @@ int _mmcamcorder_get_freespace(storage_type_e type, guint64 *free_space) if (ret != STORAGE_ERROR_NONE) { *free_space = 0; - _mmcam_dbg_err("get memory size failed [type %d] 0x%x", type, ret); + MMCAM_LOG_ERROR("get memory size failed [type %d] 0x%x", type, ret); return -1; } *free_space = vfs.f_bsize * vfs.f_bavail; /* - _mmcam_dbg_log("vfs.f_bsize [%lu], vfs.f_bavail [%lu]", vfs.f_bsize, vfs.f_bavail); - _mmcam_dbg_log("memory size %"G_GUINT64_FORMAT" [%s]", *free_space, path); + MMCAM_LOG_INFO("vfs.f_bsize [%lu], vfs.f_bavail [%lu]", vfs.f_bsize, vfs.f_bavail); + MMCAM_LOG_INFO("memory size %"G_GUINT64_FORMAT" [%s]", *free_space, path); */ return 0; } @@ -859,12 +859,12 @@ int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type) g_assert(path); if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { - _mmcam_dbg_log("File(%s) doesn't exist.", path); + MMCAM_LOG_INFO("File(%s) doesn't exist.", path); return -2; } if (-1 == statfs(path, &fs)) { - _mmcam_dbg_log("statfs failed.(%s)", path); + MMCAM_LOG_INFO("statfs failed.(%s)", path); return -1; } @@ -885,16 +885,16 @@ int _mmcamcorder_get_device_flash_brightness(GDBusConnection *conn, int *brightn "/Org/Tizen/System/DeviceD/Led", "org.tizen.system.deviced.Led", "GetBrightnessForCamera", params, &result, TRUE); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Dbus Call on Client Error"); + MMCAM_LOG_ERROR("Dbus Call on Client Error"); return ret; } if (result) { g_variant_get(result, "(i)", &get_value); *brightness = get_value; - _mmcam_dbg_log("flash brightness : %d", *brightness); + MMCAM_LOG_INFO("flash brightness : %d", *brightness); } else { - _mmcam_dbg_err("replied result is null"); + MMCAM_LOG_ERROR("replied result is null"); ret = MM_ERROR_CAMCORDER_INTERNAL; } @@ -912,7 +912,7 @@ int _mmcamcorder_send_sound_play_message(GDBusConnection *conn, _MMCamcorderGDbu guint subs_id = 0; if (!conn || !gdbus_info) { - _mmcam_dbg_err("Invalid parameter %p %p", conn, gdbus_info); + MMCAM_LOG_ERROR("Invalid parameter %p %p", conn, gdbus_info); return MM_ERROR_CAMCORDER_INTERNAL; } @@ -922,22 +922,22 @@ int _mmcamcorder_send_sound_play_message(GDBusConnection *conn, _MMCamcorderGDbu "/org/pulseaudio/SoundPlayer", "org.pulseaudio.SoundPlayer", "SamplePlay", params, &result, TRUE); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Dbus Call on Client Error"); + MMCAM_LOG_ERROR("Dbus Call on Client Error"); return ret; } if (result) { g_variant_get(result, "(i)", &get_value); - _mmcam_dbg_log("played index : %d", get_value); + MMCAM_LOG_INFO("played index : %d", get_value); } else { - _mmcam_dbg_err("replied result is null"); + MMCAM_LOG_ERROR("replied result is null"); return MM_ERROR_CAMCORDER_INTERNAL; } g_mutex_lock(&gdbus_info->sync_mutex); if (gdbus_info->subscribe_id > 0) { - _mmcam_dbg_warn("subscribe_id[%u] is remained. remove it.", gdbus_info->subscribe_id); + MMCAM_LOG_WARNING("subscribe_id[%u] is remained. remove it.", gdbus_info->subscribe_id); g_dbus_connection_signal_unsubscribe(conn, gdbus_info->subscribe_id); @@ -971,7 +971,7 @@ void _mmcamcorder_request_dpm_popup(GDBusConnection *conn, const char *restricte GVariant *result = NULL; if (!conn || !restricted_policy) { - _mmcam_dbg_err("Invalid parameter %p %p", conn, restricted_policy); + MMCAM_LOG_ERROR("Invalid parameter %p %p", conn, restricted_policy); return; } @@ -983,15 +983,15 @@ void _mmcamcorder_request_dpm_popup(GDBusConnection *conn, const char *restricte "org.tizen.DevicePolicyManager.Syspopup", "show", params, &result, TRUE); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Dbus Call on Client Error 0x%x", ret); + MMCAM_LOG_ERROR("Dbus Call on Client Error 0x%x", ret); return; } if (result) { g_variant_get(result, "(b)", &get_value); - _mmcam_dbg_log("request result : %d", get_value); + MMCAM_LOG_INFO("request result : %d", get_value); } else { - _mmcam_dbg_err("replied result is null"); + MMCAM_LOG_ERROR("replied result is null"); } return; @@ -1018,35 +1018,35 @@ void _mmcamcorder_remove_buffer_probe(MMHandleType handle, _MMCamcorderHandlerCa mmf_return_if_fail(hcamcorder); if (!hcamcorder->buffer_probes) { - _mmcam_dbg_warn("list for buffer probe is NULL"); + MMCAM_LOG_WARNING("list for buffer probe is NULL"); return; } - _mmcam_dbg_log("start - category : 0x%x", category); + MMCAM_LOG_INFO("start - category : 0x%x", category); list = hcamcorder->buffer_probes; while (list) { item = list->data; if (!item) { - _mmcam_dbg_err("Remove buffer probe faild, the item is NULL"); + MMCAM_LOG_ERROR("Remove buffer probe failed, the item is NULL"); list = g_list_next(list); continue; } if (item->category & category) { if (item->object && GST_IS_PAD(item->object)) { - _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]", + MMCAM_LOG_INFO("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); gst_pad_remove_probe(GST_PAD(item->object), item->handler_id); } else { - _mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it"); + MMCAM_LOG_WARNING("Remove buffer probe failed, the pad is null or not pad, just remove item from list and free it"); } list = g_list_next(list); hcamcorder->buffer_probes = g_list_remove(hcamcorder->buffer_probes, item); SAFE_G_FREE(item); } else { - _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); + MMCAM_LOG_INFO("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); list = g_list_next(list); } } @@ -1056,7 +1056,7 @@ void _mmcamcorder_remove_buffer_probe(MMHandleType handle, _MMCamcorderHandlerCa hcamcorder->buffer_probes = NULL; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return; } @@ -1071,28 +1071,28 @@ void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object) mmf_return_if_fail(hcamcorder); if (!hcamcorder->buffer_probes) { - _mmcam_dbg_warn("list for buffer probe is NULL"); + MMCAM_LOG_WARNING("list for buffer probe is NULL"); return; } - _mmcam_dbg_log("start - object : %p", object); + MMCAM_LOG_INFO("start - object : %p", object); list = hcamcorder->buffer_probes; while (list) { item = list->data; if (!item) { - _mmcam_dbg_err("Remove buffer probe faild, the item is NULL"); + MMCAM_LOG_ERROR("Remove buffer probe failed, the item is NULL"); list = g_list_next(list); continue; } if (item->object && item->object == object) { if (GST_IS_PAD(item->object)) { - _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]", + MMCAM_LOG_INFO("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); gst_pad_remove_probe(GST_PAD(item->object), item->handler_id); } else { - _mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it"); + MMCAM_LOG_WARNING("Remove buffer probe failed, the pad is null or not pad, just remove item from list and free it"); } list = g_list_next(list); @@ -1101,12 +1101,12 @@ void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object) break; } else { - _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); + MMCAM_LOG_INFO("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); list = g_list_next(list); } } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return; } @@ -1121,35 +1121,35 @@ void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCat mmf_return_if_fail(hcamcorder); if (!hcamcorder->event_probes) { - _mmcam_dbg_warn("list for event probe is NULL"); + MMCAM_LOG_WARNING("list for event probe is NULL"); return; } - _mmcam_dbg_log("start - category : 0x%x", category); + MMCAM_LOG_INFO("start - category : 0x%x", category); list = hcamcorder->event_probes; while (list) { item = list->data; if (!item) { - _mmcam_dbg_err("Remove event probe faild, the item is NULL"); + MMCAM_LOG_ERROR("Remove event probe failed, the item is NULL"); list = g_list_next(list); continue; } if (item->category & category) { if (item->object && GST_IS_PAD(item->object)) { - _mmcam_dbg_log("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]", + MMCAM_LOG_INFO("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); gst_pad_remove_probe(GST_PAD(item->object), item->handler_id); } else { - _mmcam_dbg_warn("Remove event probe faild, the pad is null or not pad, just remove item from list and free it"); + MMCAM_LOG_WARNING("Remove event probe failed, the pad is null or not pad, just remove item from list and free it"); } list = g_list_next(list); hcamcorder->event_probes = g_list_remove(hcamcorder->event_probes, item); SAFE_G_FREE(item); } else { - _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); + MMCAM_LOG_INFO("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); list = g_list_next(list); } } @@ -1159,7 +1159,7 @@ void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCat hcamcorder->event_probes = NULL; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return; } @@ -1174,17 +1174,17 @@ void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCate mmf_return_if_fail(hcamcorder); if (!hcamcorder->signals) { - _mmcam_dbg_warn("list for signal is NULL"); + MMCAM_LOG_WARNING("list for signal is NULL"); return; } - _mmcam_dbg_log("start - category : 0x%x", category); + MMCAM_LOG_INFO("start - category : 0x%x", category); list = hcamcorder->signals; while (list) { item = list->data; if (!item) { - _mmcam_dbg_err("Fail to Disconnecting signal, the item is NULL"); + MMCAM_LOG_ERROR("Fail to Disconnecting signal, the item is NULL"); list = g_list_next(list); continue; } @@ -1192,22 +1192,22 @@ void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCate if (item->category & category) { if (item->object && GST_IS_ELEMENT(item->object)) { if (g_signal_handler_is_connected(item->object, item->handler_id)) { - _mmcam_dbg_log("Disconnect signal from [%s] : [ID : %lu], [Category : %x]", + MMCAM_LOG_INFO("Disconnect signal from [%s] : [ID : %lu], [Category : %x]", GST_OBJECT_NAME(item->object), item->handler_id, item->category); g_signal_handler_disconnect(item->object, item->handler_id); } else { - _mmcam_dbg_warn("Signal was not connected, cannot disconnect it : [%s] [ID : %lu], [Category : %x]", + MMCAM_LOG_WARNING("Signal was not connected, cannot disconnect it : [%s] [ID : %lu], [Category : %x]", GST_OBJECT_NAME(item->object), item->handler_id, item->category); } } else { - _mmcam_dbg_err("Fail to Disconnecting signal, the element is null or not element, just remove item from list and free it"); + MMCAM_LOG_ERROR("Fail to Disconnecting signal, the element is null or not element, just remove item from list and free it"); } list = g_list_next(list); hcamcorder->signals = g_list_remove(hcamcorder->signals, item); SAFE_G_FREE(item); } else { - _mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); + MMCAM_LOG_INFO("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category); list = g_list_next(list); } } @@ -1217,7 +1217,7 @@ void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCate hcamcorder->signals = NULL; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return; } @@ -1227,7 +1227,7 @@ void _mmcamcorder_remove_all_handlers(MMHandleType handle, _MMCamcorderHandlerC { mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle); - _mmcam_dbg_log("ENTER"); + MMCAM_LOG_INFO("ENTER"); if (hcamcorder->signals) _mmcamcorder_disconnect_signal((MMHandleType)hcamcorder, category); @@ -1236,7 +1236,7 @@ void _mmcamcorder_remove_all_handlers(MMHandleType handle, _MMCamcorderHandlerC if (hcamcorder->buffer_probes) _mmcamcorder_remove_buffer_probe((MMHandleType)hcamcorder, category); - _mmcam_dbg_log("LEAVE"); + MMCAM_LOG_INFO("LEAVE"); } @@ -1250,7 +1250,7 @@ void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_ for (i = 0 ; i < _MMCAMCORDER_PIPELINE_ELEMENT_NUM ; i++) { if (sc->element[i].gst && (G_OBJECT(sc->element[i].gst) == where_the_object_was)) { - _mmcam_dbg_warn("The element[%d][%p] is finalized", sc->element[i].id, sc->element[i].gst); + MMCAM_LOG_WARNING("The element[%d][%p] is finalized", sc->element[i].id, sc->element[i].gst); sc->element[i].gst = NULL; sc->element[i].id = _MMCAMCORDER_NONE; return; @@ -1261,14 +1261,14 @@ void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_ for (i = 0 ; i < _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM ; i++) { if (sc->encode_element[i].gst && (G_OBJECT(sc->encode_element[i].gst) == where_the_object_was)) { - _mmcam_dbg_warn("The encode element[%d][%p] is finalized", sc->encode_element[i].id, sc->encode_element[i].gst); + MMCAM_LOG_WARNING("The encode element[%d][%p] is finalized", sc->encode_element[i].id, sc->encode_element[i].gst); sc->encode_element[i].gst = NULL; sc->encode_element[i].id = _MMCAMCORDER_ENCODE_NONE; return; } } - _mmcam_dbg_warn("there is no matching element %p", where_the_object_was); + MMCAM_LOG_WARNING("there is no matching element %p", where_the_object_was); return; } @@ -1285,20 +1285,20 @@ gboolean _mmcamcorder_msg_callback(void *data) hcamcorder = MMF_CAMCORDER(item->handle); if (hcamcorder == NULL) { - _mmcam_dbg_warn("msg id:0x%x, item:%p, handle is NULL", item->id, item); + MMCAM_LOG_WARNING("msg id:0x%x, item:%p, handle is NULL", item->id, item); goto MSG_CALLBACK_DONE; } - /*_mmcam_dbg_log("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item);*/ + /*MMCAM_LOG_INFO("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item);*/ _MMCAMCORDER_LOCK(hcamcorder); /* remove item from msg data */ if (hcamcorder->msg_data) { - /*_mmcam_dbg_log("remove item %p", item);*/ + /*MMCAM_LOG_INFO("remove item %p", item);*/ hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item); } else { - _mmcam_dbg_warn("msg_data is NULL but item[%p] will be removed", item); + MMCAM_LOG_WARNING("msg_data is NULL but item[%p] will be removed", item); } _MMCAMCORDER_UNLOCK(hcamcorder); @@ -1384,29 +1384,26 @@ gboolean _mmcamcorder_send_message(MMHandleType handle, _MMCamcorderMsgItem *dat #ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK item = g_malloc(sizeof(_MMCamcorderMsgItem)); - if (item) { - memcpy(item, data, sizeof(_MMCamcorderMsgItem)); - item->handle = handle; - g_mutex_init(&item->lock); - _MMCAMCORDER_LOCK(handle); - hcamcorder->msg_data = g_list_append(hcamcorder->msg_data, item); - /*_mmcam_dbg_log("item[%p]", item);*/ + memcpy(item, data, sizeof(_MMCamcorderMsgItem)); + item->handle = handle; + g_mutex_init(&item->lock); - /* Use DEFAULT priority */ - g_idle_add_full(G_PRIORITY_DEFAULT, _mmcamcorder_msg_callback, item, NULL); + _MMCAMCORDER_LOCK(handle); + hcamcorder->msg_data = g_list_append(hcamcorder->msg_data, item); + /*MMCAM_LOG_INFO("item[%p]", item);*/ - _MMCAMCORDER_UNLOCK(handle); - } else { - _mmcam_dbg_err("item[id:0x%x] malloc failed : %d", data->id, sizeof(_MMCamcorderMsgItem)); - } + /* Use DEFAULT priority */ + g_idle_add_full(G_PRIORITY_DEFAULT, _mmcamcorder_msg_callback, item, NULL); + + _MMCAMCORDER_UNLOCK(handle); #else /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */ _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder); if (hcamcorder->msg_cb) hcamcorder->msg_cb(data->id, (MMMessageParamType*)(&(data->param)), hcamcorder->msg_cb_param); else - _mmcam_dbg_log("message callback is NULL. message id %d", data->id); + MMCAM_LOG_INFO("message callback is NULL. message id %d", data->id); _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(hcamcorder); @@ -1448,7 +1445,7 @@ void _mmcamcorder_remove_message_all(MMHandleType handle) #ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK if (!hcamcorder->msg_data) { - _mmcam_dbg_log("No message data is remained."); + MMCAM_LOG_INFO("No message data is remained."); } else { list = hcamcorder->msg_data; @@ -1457,16 +1454,16 @@ void _mmcamcorder_remove_message_all(MMHandleType handle) list = g_list_next(list); if (!item) { - _mmcam_dbg_err("Fail to remove message. The item is NULL"); + MMCAM_LOG_ERROR("Fail to remove message. The item is NULL"); } else { if (g_mutex_trylock(&(item->lock))) { ret = g_idle_remove_by_data(item); - _mmcam_dbg_log("remove msg item[%p], ret[%d]", item, ret); + MMCAM_LOG_INFO("remove msg item[%p], ret[%d]", item, ret); if (ret == FALSE) { item->handle = 0; - _mmcam_dbg_warn("failed to remove msg cb for item %p, it will be called later with NULL handle", item); + MMCAM_LOG_WARNING("failed to remove msg cb for item %p, it will be called later with NULL handle", item); } /* release allocated memory */ @@ -1494,17 +1491,17 @@ void _mmcamcorder_remove_message_all(MMHandleType handle) SAFE_G_FREE(item); - _mmcam_dbg_log("remove msg done"); + MMCAM_LOG_INFO("remove msg done"); } } else { - _mmcam_dbg_warn("item lock failed. it's being called..."); + MMCAM_LOG_WARNING("item lock failed. it's being called..."); end_time = g_get_monotonic_time() + (100 * G_TIME_SPAN_MILLISECOND); if (_MMCAMCORDER_WAIT_UNTIL(handle, end_time)) - _mmcam_dbg_warn("signal received"); + MMCAM_LOG_WARNING("signal received"); else - _mmcam_dbg_warn("timeout"); + MMCAM_LOG_WARNING("timeout"); } } } @@ -1517,7 +1514,7 @@ void _mmcamcorder_remove_message_all(MMHandleType handle) /* remove idle function for playing capture sound */ do { ret = g_idle_remove_by_data(hcamcorder); - _mmcam_dbg_log("remove idle function for playing capture sound. ret[%d]", ret); + MMCAM_LOG_INFO("remove idle function for playing capture sound. ret[%d]", ret); } while (ret); _MMCAMCORDER_UNLOCK(handle); @@ -1539,35 +1536,35 @@ int _mmcamcorder_get_pixel_format(GstCaps *caps) structure = gst_caps_get_structure(caps, 0); media_type = gst_structure_get_name(structure); if (media_type == NULL) { - _mmcam_dbg_err("failed to get media_type"); + MMCAM_LOG_ERROR("failed to get media_type"); return MM_PIXEL_FORMAT_INVALID; } gst_video_info_init(&media_info); if (!strcmp(media_type, "image/jpeg")) { - _mmcam_dbg_log("It is jpeg."); + MMCAM_LOG_INFO("It is jpeg."); type = MM_PIXEL_FORMAT_ENCODED; } else if (!strcmp(media_type, "video/x-raw") && gst_video_info_from_caps(&media_info, caps) && GST_VIDEO_INFO_IS_YUV(&media_info)) { - _mmcam_dbg_log("It is yuv."); + MMCAM_LOG_INFO("It is yuv."); fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info)); type = _mmcamcorder_get_pixtype(fourcc); } else if (!strcmp(media_type, "video/x-raw") && gst_video_info_from_caps(&media_info, caps) && GST_VIDEO_INFO_IS_RGB(&media_info)) { - _mmcam_dbg_log("It is rgb."); + MMCAM_LOG_INFO("It is rgb."); type = MM_PIXEL_FORMAT_RGB888; } else if (!strcmp(media_type, "video/x-h264")) { - _mmcam_dbg_log("It is H264"); + MMCAM_LOG_INFO("It is H264"); type = MM_PIXEL_FORMAT_ENCODED_H264; } else { - _mmcam_dbg_err("Not supported format [%s]", media_type); + MMCAM_LOG_ERROR("Not supported format [%s]", media_type); type = MM_PIXEL_FORMAT_INVALID; } - /*_mmcam_dbg_log( "Type [%d]", type );*/ + /*MMCAM_LOG_INFO( "Type [%d]", type );*/ return type; } @@ -1576,7 +1573,7 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co { unsigned int fourcc = 0; - /*_mmcam_dbg_log("pixtype(%d)", pixtype);*/ + /*MMCAM_LOG_INFO("pixtype(%d)", pixtype);*/ switch (pixtype) { case MM_PIXEL_FORMAT_NV12: @@ -1659,7 +1656,7 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co fourcc = GST_MAKE_FOURCC('I', 'N', 'V', 'Z'); break; default: - _mmcam_dbg_log("Not proper pixel type[%d]. Set default - I420", pixtype); + MMCAM_LOG_INFO("Not proper pixel type[%d]. Set default - I420", pixtype); if (use_zero_copy_format) fourcc = GST_MAKE_FOURCC('S', '4', '2', '0'); else @@ -1678,7 +1675,7 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc) /* char *pfourcc = (char*)&fourcc; - _mmcam_dbg_log("fourcc(%c%c%c%c)", + MMCAM_LOG_INFO("fourcc(%c%c%c%c)", pfourcc[0], pfourcc[1], pfourcc[2], pfourcc[3]); */ @@ -1743,7 +1740,7 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc) pixtype = MM_PIXEL_FORMAT_INVZ; break; default: - _mmcam_dbg_log("Not supported fourcc type(%c%c%c%c)", fourcc, fourcc>>8, fourcc>>16, fourcc>>24); + MMCAM_LOG_INFO("Not supported fourcc type(%c%c%c%c)", fourcc, fourcc>>8, fourcc>>16, fourcc>>24); pixtype = MM_PIXEL_FORMAT_INVALID; break; } @@ -1763,12 +1760,12 @@ gboolean _mmcamcorder_add_elements_to_bin(GstBin *bin, GList *element_list) element = (_MMCamcorderGstElement*)local_list->data; if (element && element->gst) { if (!gst_bin_add(bin, GST_ELEMENT(element->gst))) { - _mmcam_dbg_err("Add element [%s] to bin [%s] FAILED", + MMCAM_LOG_ERROR("Add element [%s] to bin [%s] FAILED", GST_ELEMENT_NAME(GST_ELEMENT(element->gst)), GST_ELEMENT_NAME(GST_ELEMENT(bin))); return FALSE; } else { - _mmcam_dbg_log("Add element [%s] to bin [%s] OK", + MMCAM_LOG_INFO("Add element [%s] to bin [%s] OK", GST_ELEMENT_NAME(GST_ELEMENT(element->gst)), GST_ELEMENT_NAME(GST_ELEMENT(bin))); } @@ -1794,11 +1791,11 @@ gboolean _mmcamcorder_link_elements(GList *element_list) element = (_MMCamcorderGstElement*)local_list->data; if (pre_element && pre_element->gst && element && element->gst) { if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(pre_element->gst), GST_ELEMENT(element->gst))) { - _mmcam_dbg_log("Link [%s] to [%s] OK", + MMCAM_LOG_INFO("Link [%s] to [%s] OK", GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)), GST_ELEMENT_NAME(GST_ELEMENT(element->gst))); } else { - _mmcam_dbg_err("Link [%s] to [%s] FAILED", + MMCAM_LOG_ERROR("Link [%s] to [%s] FAILED", GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)), GST_ELEMENT_NAME(GST_ELEMENT(element->gst))); return FALSE; @@ -1821,7 +1818,7 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid mm_util_image_h dst_image = NULL; if (!src_data || !dst_data || !dst_width || !dst_height || !dst_length) { - _mmcam_dbg_err("something is NULL %p,%p,%p,%p,%p", + MMCAM_LOG_ERROR("something is NULL %p,%p,%p,%p,%p", src_data, dst_data, dst_width, dst_height, dst_length); return FALSE; } @@ -1847,33 +1844,33 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid input_format = MM_UTIL_COLOR_RGB24; break; default: - _mmcam_dbg_err("NOT supported format [%d]", src_format); + MMCAM_LOG_ERROR("NOT supported format [%d]", src_format); return FALSE; } - _mmcam_dbg_log("src size %dx%d -> dst size %dx%d", src_width, src_height, *dst_width, *dst_height); + MMCAM_LOG_INFO("src size %dx%d -> dst size %dx%d", src_width, src_height, *dst_width, *dst_height); mm_ret = mm_image_create_image(src_width, src_height, input_format, src_data, (size_t)src_length, &src_image); if (mm_ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_image_create_image failed 0x%x", mm_ret); + MMCAM_LOG_ERROR("mm_image_create_image failed 0x%x", mm_ret); return FALSE; } mm_ret = mm_util_resize_image(src_image, *dst_width, *dst_height, &dst_image); mm_image_destroy_image(src_image); if (mm_ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_util_resize_image failed 0x%x", mm_ret); + MMCAM_LOG_ERROR("mm_util_resize_image failed 0x%x", mm_ret); return FALSE; } mm_ret = mm_image_get_image(dst_image, dst_width, dst_height, NULL, dst_data, dst_length); mm_image_destroy_image(dst_image); if (mm_ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_image_get_image failed 0x%x", mm_ret); + MMCAM_LOG_ERROR("mm_image_get_image failed 0x%x", mm_ret); return FALSE; } - _mmcam_dbg_log("resize done %dx%d -> %dx%d, %p, length %zu", + MMCAM_LOG_INFO("resize done %dx%d -> %dx%d, %p, length %zu", src_width, src_height, *dst_width, *dst_height, *dst_data, *dst_length); return TRUE; @@ -1953,14 +1950,14 @@ gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsign free(converted_src); converted_src = NULL; } - _mmcam_dbg_err("color convert error source format[%d], jpeg format[%d]", src_format, jpeg_format); + MMCAM_LOG_ERROR("color convert error source format[%d], jpeg format[%d]", src_format, jpeg_format); return FALSE; } converted_src_size = (converted_src && (converted_src != src_data)) ? converted_src_size : src_length; ret = mm_image_create_image(src_width, src_height, jpeg_format, converted_src, (size_t)converted_src_size, &decoded); if (ret != MM_UTIL_ERROR_NONE) { - _mmcam_dbg_err("mm_image_create_image error [%d]", ret); + MMCAM_LOG_ERROR("mm_image_create_image error [%d]", ret); if (converted_src && (converted_src != src_data)) free(converted_src); return FALSE; @@ -1975,7 +1972,7 @@ gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsign } if (ret != MM_UTIL_ERROR_NONE) { - _mmcam_dbg_err("No encoder supports %d format, error code %x", src_format, ret); + MMCAM_LOG_ERROR("No encoder supports %d format, error code %x", src_format, ret); if (encoded_data) free(encoded_data); return FALSE; @@ -2004,13 +2001,13 @@ gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_ unsigned char *result = NULL; if (src == NULL || dst == NULL) { - _mmcam_dbg_err("src[%p] or dst[%p] is NULL", src, dst); + MMCAM_LOG_ERROR("src[%p] or dst[%p] is NULL", src, dst); return FALSE; } result = (unsigned char *)malloc((dst_width * dst_height)<<1); if (!result) { - _mmcam_dbg_err("failed to alloc dst data"); + MMCAM_LOG_ERROR("failed to alloc dst data"); return FALSE; } @@ -2019,7 +2016,7 @@ gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_ line_width = src_width << 1; jump_width = ratio_width << 1; - _mmcam_dbg_warn("[src %dx%d] [dst %dx%d] [line width %d] [ratio width %d, height %d]", + MMCAM_LOG_WARNING("[src %dx%d] [dst %dx%d] [line width %d] [ratio width %d, height %d]", src_width, src_height, dst_width, dst_height, line_width, ratio_width, ratio_height); for (i = 0 ; i < src_height ; i += ratio_height) { @@ -2042,7 +2039,7 @@ gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_ *dst = result; - _mmcam_dbg_warn("converting done - result %p", result); + MMCAM_LOG_WARNING("converting done - result %p", result); return TRUE; } @@ -2095,20 +2092,20 @@ void *_mmcamcorder_util_task_thread_func(void *data) mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)data; if (!hcamcorder) { - _mmcam_dbg_err("handle is NULL"); + MMCAM_LOG_ERROR("handle is NULL"); return NULL; } - _mmcam_dbg_warn("start thread"); + MMCAM_LOG_WARNING("start thread"); g_mutex_lock(&hcamcorder->task_thread_lock); while (hcamcorder->task_thread_state != _MMCAMCORDER_TASK_THREAD_STATE_EXIT) { switch (hcamcorder->task_thread_state) { case _MMCAMCORDER_TASK_THREAD_STATE_NONE: - _mmcam_dbg_warn("wait for task signal"); + MMCAM_LOG_WARNING("wait for task signal"); g_cond_wait(&hcamcorder->task_thread_cond, &hcamcorder->task_thread_lock); - _mmcam_dbg_warn("task signal received : state %d", hcamcorder->task_thread_state); + MMCAM_LOG_WARNING("task signal received : state %d", hcamcorder->task_thread_state); break; case _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START: _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE02, FALSE); @@ -2124,25 +2121,25 @@ void *_mmcamcorder_util_task_thread_func(void *data) /* Play record start sound */ _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_START, FALSE); - _mmcam_dbg_log("_mmcamcorder_video_prepare_record return 0x%x", ret); + MMCAM_LOG_INFO("_mmcamcorder_video_prepare_record return 0x%x", ret); hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE; break; case _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING: { gint64 end_time = 0; - _mmcam_dbg_warn("wait for capture data in recording. wait signal..."); + MMCAM_LOG_WARNING("wait for capture data in recording. wait signal..."); end_time = g_get_monotonic_time() + (5 * G_TIME_SPAN_SECOND); if (g_cond_wait_until(&hcamcorder->task_thread_cond, &hcamcorder->task_thread_lock, end_time)) { - _mmcam_dbg_warn("signal received"); + MMCAM_LOG_WARNING("signal received"); } else { _MMCamcorderMsgItem message; memset(&message, 0x0, sizeof(_MMCamcorderMsgItem)); - _mmcam_dbg_err("capture data wait time out, send error message"); + MMCAM_LOG_ERROR("capture data wait time out, send error message"); message.id = MM_MESSAGE_CAMCORDER_ERROR; message.param.code = MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT; @@ -2156,7 +2153,7 @@ void *_mmcamcorder_util_task_thread_func(void *data) } break; default: - _mmcam_dbg_warn("invalid task thread state %d", hcamcorder->task_thread_state); + MMCAM_LOG_WARNING("invalid task thread state %d", hcamcorder->task_thread_state); hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT; break; } @@ -2164,7 +2161,7 @@ void *_mmcamcorder_util_task_thread_func(void *data) g_mutex_unlock(&hcamcorder->task_thread_lock); - _mmcam_dbg_warn("exit thread"); + MMCAM_LOG_WARNING("exit thread"); return NULL; } @@ -2183,17 +2180,17 @@ static gboolean _mmcamcorder_convert_YUYV_to_I420(unsigned char *src, guint widt unsigned char *dst_data = NULL; if (!src || !dst || !dst_len) { - _mmcam_dbg_err("NULL pointer %p, %p, %p", src, dst, dst_len); + MMCAM_LOG_ERROR("NULL pointer %p, %p, %p", src, dst, dst_len); return FALSE; } dst_size = (width * height * 3) >> 1; - _mmcam_dbg_log("YUVY -> I420 : %dx%d, dst size %d", width, height, dst_size); + MMCAM_LOG_INFO("YUVY -> I420 : %dx%d, dst size %d", width, height, dst_size); dst_data = (unsigned char *)malloc(dst_size); if (!dst_data) { - _mmcam_dbg_err("failed to alloc dst_data. size %d", dst_size); + MMCAM_LOG_ERROR("failed to alloc dst_data. size %d", dst_size); return FALSE; } @@ -2201,7 +2198,7 @@ static gboolean _mmcamcorder_convert_YUYV_to_I420(unsigned char *src, guint widt dst_u_offset = width * height; dst_v_offset = dst_u_offset + (dst_u_offset >> 2); - _mmcam_dbg_log("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); + MMCAM_LOG_INFO("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); for (i = 0 ; i < height ; i++) { for (j = 0 ; j < loop_length ; j += 2) { @@ -2221,7 +2218,7 @@ static gboolean _mmcamcorder_convert_YUYV_to_I420(unsigned char *src, guint widt *dst = dst_data; *dst_len = dst_size; - _mmcam_dbg_log("DONE: YUVY -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); + MMCAM_LOG_INFO("DONE: YUVY -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); return TRUE; } @@ -2240,17 +2237,17 @@ static gboolean _mmcamcorder_convert_UYVY_to_I420(unsigned char *src, guint widt unsigned char *dst_data = NULL; if (!src || !dst || !dst_len) { - _mmcam_dbg_err("NULL pointer %p, %p, %p", src, dst, dst_len); + MMCAM_LOG_ERROR("NULL pointer %p, %p, %p", src, dst, dst_len); return FALSE; } dst_size = (width * height * 3) >> 1; - _mmcam_dbg_log("UYVY -> I420 : %dx%d, dst size %d", width, height, dst_size); + MMCAM_LOG_INFO("UYVY -> I420 : %dx%d, dst size %d", width, height, dst_size); dst_data = (unsigned char *)malloc(dst_size); if (!dst_data) { - _mmcam_dbg_err("failed to alloc dst_data. size %d", dst_size); + MMCAM_LOG_ERROR("failed to alloc dst_data. size %d", dst_size); return FALSE; } @@ -2258,7 +2255,7 @@ static gboolean _mmcamcorder_convert_UYVY_to_I420(unsigned char *src, guint widt dst_u_offset = width * height; dst_v_offset = dst_u_offset + (dst_u_offset >> 2); - _mmcam_dbg_log("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); + MMCAM_LOG_INFO("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); for (i = 0 ; i < height ; i++) { for (j = 0 ; j < loop_length ; j += 2) { @@ -2278,7 +2275,7 @@ static gboolean _mmcamcorder_convert_UYVY_to_I420(unsigned char *src, guint widt *dst = dst_data; *dst_len = dst_size; - _mmcam_dbg_log("DONE: UYVY -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); + MMCAM_LOG_INFO("DONE: UYVY -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); return TRUE; } @@ -2296,23 +2293,23 @@ static gboolean _mmcamcorder_convert_NV12_to_I420(unsigned char *src, guint widt unsigned char *dst_data = NULL; if (!src || !dst || !dst_len) { - _mmcam_dbg_err("NULL pointer %p, %p, %p", src, dst, dst_len); + MMCAM_LOG_ERROR("NULL pointer %p, %p, %p", src, dst, dst_len); return FALSE; } /* buffer overflow prevention check */ if (width > __MMCAMCORDER_MAX_WIDTH || height > __MMCAMCORDER_MAX_HEIGHT) { - _mmcam_dbg_err("too large size %d x %d", width, height); + MMCAM_LOG_ERROR("too large size %d x %d", width, height); return FALSE; } dst_size = (width * height * 3) >> 1; - _mmcam_dbg_log("NV12 -> I420 : %dx%d, dst size %d", width, height, dst_size); + MMCAM_LOG_INFO("NV12 -> I420 : %dx%d, dst size %d", width, height, dst_size); dst_data = (unsigned char *)malloc(dst_size); if (!dst_data) { - _mmcam_dbg_err("failed to alloc dst_data. size %d", dst_size); + MMCAM_LOG_ERROR("failed to alloc dst_data. size %d", dst_size); return FALSE; } @@ -2320,7 +2317,7 @@ static gboolean _mmcamcorder_convert_NV12_to_I420(unsigned char *src, guint widt dst_u_offset = width * height; dst_v_offset = dst_u_offset + (dst_u_offset >> 2); - _mmcam_dbg_log("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); + MMCAM_LOG_INFO("offset y %d, u %d, v %d", dst_y_offset, dst_u_offset, dst_v_offset); /* memcpy Y */ memcpy(dst_data, src, dst_u_offset); @@ -2339,7 +2336,7 @@ static gboolean _mmcamcorder_convert_NV12_to_I420(unsigned char *src, guint widt *dst = dst_data; *dst_len = dst_size; - _mmcam_dbg_log("DONE: NV12 -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); + MMCAM_LOG_INFO("DONE: NV12 -> I420 : %dx%d, dst data %p, size %d", width, height, *dst, dst_size); return TRUE; } @@ -2349,7 +2346,7 @@ void _mmcamcorder_emit_dbus_signal(GDBusConnection *conn, const char *object_nam const char *interface_name, const char *signal_name, int value) { if (!conn || !object_name || !interface_name || !signal_name) { - _mmcam_dbg_err("NULL pointer %p %p %p %p", + MMCAM_LOG_ERROR("NULL pointer %p %p %p %p", conn, object_name, interface_name, signal_name); return; } @@ -2357,11 +2354,11 @@ void _mmcamcorder_emit_dbus_signal(GDBusConnection *conn, const char *object_nam if (!g_dbus_connection_emit_signal(conn, NULL, object_name, interface_name, signal_name, g_variant_new("(i)", value), NULL)) { - _mmcam_dbg_warn("failed to emit signal"); + MMCAM_LOG_WARNING("failed to emit signal"); } else { - _mmcam_dbg_log("emit signal done - value 0x%.8x", value); + MMCAM_LOG_INFO("emit signal done - value 0x%.8x", value); g_dbus_connection_flush(conn, NULL, NULL, NULL); - _mmcam_dbg_log("signal flush done"); + MMCAM_LOG_INFO("signal flush done"); } return; @@ -2373,12 +2370,12 @@ int _mmcamcorder_get_audiosrc_blocksize(int samplerate, int format, int channel, int depth = 8; if (!blocksize) { - _mmcam_dbg_err("NULL ptr"); + MMCAM_LOG_ERROR("NULL ptr"); return FALSE; } if (samplerate == 0 || channel == 0 || interval == 0) { - _mmcam_dbg_err("invalid param %d %d %d", samplerate, channel, interval); + MMCAM_LOG_ERROR("invalid param %d %d %d", samplerate, channel, interval); return FALSE; } diff --git a/src/mm_camcorder_videorec.c b/src/mm_camcorder_videorec.c index be08f34..23e15fb 100644 --- a/src/mm_camcorder_videorec.c +++ b/src/mm_camcorder_videorec.c @@ -89,20 +89,19 @@ gboolean _mmcamcorder_video_push_buffer(void *handle, GstBuffer *buffer) int ret = 0; GstClock *clock = NULL; - /* - _mmcam_dbg_log("GST_BUFFER_FLAG_DELTA_UNIT is set : %d", + MMCAM_LOG_VERBOSE("GST_BUFFER_FLAG_DELTA_UNIT is set : %d", GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)); - */ + current_ts = GST_BUFFER_PTS(buffer); if (info_video->is_first_frame) { /* check first I frame for H.264 stream */ if (info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)) { - _mmcam_dbg_warn("NOT I frame.. skip this buffer"); + MMCAM_LOG_WARNING("NOT I frame.. skip this buffer"); return TRUE; } else { - _mmcam_dbg_warn("[H.264] first I frame"); + MMCAM_LOG_WARNING("[H.264] first I frame"); } } @@ -119,7 +118,7 @@ gboolean _mmcamcorder_video_push_buffer(void *handle, GstBuffer *buffer) /* for image capture with encodebin and v4l2src */ if (sc->bencbin_capture && info_image->capturing) { g_mutex_lock(&hcamcorder->task_thread_lock); - _mmcam_dbg_log("send signal for sound play"); + MMCAM_LOG_INFO("send signal for sound play"); hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_SOUND_SOLO_PLAY_START; g_cond_signal(&hcamcorder->task_thread_cond); g_mutex_unlock(&hcamcorder->task_thread_lock); @@ -128,17 +127,18 @@ gboolean _mmcamcorder_video_push_buffer(void *handle, GstBuffer *buffer) } } else { if (_mmcamcorder_invoke_video_stream_cb(handle, buffer, FALSE) == FALSE) { - /*_mmcam_dbg_warn("do not push buffer to encode by app's return value");*/ /* increase base video timestamp by frame duration, it will remove delay of dropped buffer when play recorded file. */ info_video->base_video_ts += current_ts - info_video->last_video_ts; + MMCAM_LOG_DEBUG("do not push buffer to encode by app's return value"); goto _VIDEO_PUSH_BUFFER_DONE; } } GST_BUFFER_DTS(buffer) = GST_BUFFER_PTS(buffer) = current_ts - info_video->base_video_ts; - /*_mmcam_dbg_log("buffer %p, timestamp %"GST_TIME_FORMAT, buffer, GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/ + MMCAM_LOG_DEBUG("buffer %p, timestamp %"GST_TIME_FORMAT, + buffer, GST_TIME_ARGS(GST_BUFFER_PTS(buffer))); if (info_video->record_dual_stream) { /* It will NOT INCREASE reference count of buffer */ @@ -148,7 +148,7 @@ gboolean _mmcamcorder_video_push_buffer(void *handle, GstBuffer *buffer) g_signal_emit_by_name(element[_MMCAMCORDER_ENCSINK_SRC].gst, "push-buffer", buffer, &ret); } - /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/ + MMCAM_LOG_VERBOSE("push buffer result : 0x%x", ret); _VIDEO_PUSH_BUFFER_DONE: info_video->last_video_ts = current_ts; @@ -158,7 +158,7 @@ _VIDEO_PUSH_BUFFER_DONE: /* drop buffer if it's from tizen allocator */ if (gst_is_tizen_memory(gst_buffer_peek_memory(buffer, 0))) { - _mmcam_dbg_warn("drop first buffer from tizen allocator to avoid copy in basesrc"); + MMCAM_LOG_WARNING("drop first buffer from tizen allocator to avoid copy in basesrc"); return FALSE; } } @@ -169,12 +169,12 @@ _VIDEO_PUSH_BUFFER_DONE: info_video->fps > _MMCAMCORDER_FRAME_PASS_MIN_FPS) { if (info_video->prev_preview_ts != 0) { if (GST_BUFFER_PTS(buffer) - info_video->prev_preview_ts < _MMCAMCORDER_MIN_TIME_TO_PASS_FRAME) { - _mmcam_dbg_log("it's too fast. drop frame..."); + MMCAM_LOG_VERBOSE("it's too fast. drop frame..."); return FALSE; } } - /*_mmcam_dbg_log("diff %llu", diff);*/ + MMCAM_LOG_VERBOSE("display buffer [%p]", buffer); info_video->prev_preview_ts = GST_BUFFER_PTS(buffer); } @@ -210,7 +210,7 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_warn("start"); + MMCAM_LOG_WARNING("start"); err = _mmcamcorder_check_videocodec_fileformat_compatibility(handle); if (err != MM_ERROR_NONE) @@ -218,7 +218,7 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle) /* Main pipeline */ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) { - _mmcam_dbg_log("pipeline is exist so need to remove pipeline _MMCAMCORDER_ENCODE_MAIN_PIPE = %p", + MMCAM_LOG_INFO("pipeline is exist so need to remove pipeline _MMCAMCORDER_ENCODE_MAIN_PIPE = %p", sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst); _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder); } @@ -230,7 +230,7 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle) MMCAM_AUDIO_DISABLE, &sc->audio_disable, NULL); - _mmcam_dbg_log("MMCAM_AUDIO_DISABLE %d, is_modified_rate %d, ved_cb %p", + MMCAM_LOG_INFO("MMCAM_AUDIO_DISABLE %d, is_modified_rate %d, ved_cb %p", sc->audio_disable, sc->is_modified_rate, hcamcorder->vedecision_cb); if (sc->is_modified_rate || hcamcorder->vedecision_cb) @@ -301,7 +301,7 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle) _mmcamcorder_conf_get_value_element_name(RecordsinkElement, &gst_element_rsink_name); if (!gst_element_rsink_name) { - _mmcam_dbg_err("failed to get recordsink name"); + MMCAM_LOG_ERROR("failed to get recordsink name"); err = MM_ERROR_CAMCORDER_INTERNAL; goto pipeline_creation_error; } @@ -407,7 +407,7 @@ int _mmcamcorder_remove_audio_pipeline(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst != NULL) { srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src"); @@ -428,7 +428,7 @@ int _mmcamcorder_remove_audio_pipeline(MMHandleType handle) */ _mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN, _MMCAMCORDER_AUDIOSRC_VOL); - _mmcam_dbg_log("Audio pipeline removed"); + MMCAM_LOG_INFO("Audio pipeline removed"); } return MM_ERROR_NONE; @@ -450,7 +450,7 @@ int _mmcamcorder_remove_encode_pipeline(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst != NULL) { /* release request pad */ @@ -482,12 +482,12 @@ int _mmcamcorder_remove_encode_pipeline(MMHandleType handle) /* _mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, _MMCAMCORDER_ENCSINK_SINK); */ - _mmcam_dbg_warn("Encoder pipeline removed"); + MMCAM_LOG_WARNING("Encoder pipeline removed"); #ifdef _MMCAMCORDER_MM_RM_SUPPORT _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); - _mmcam_dbg_warn("lock resource - cb calling %d", hcamcorder->is_release_cb_calling); + MMCAM_LOG_WARNING("lock resource - cb calling %d", hcamcorder->is_release_cb_calling); if (hcamcorder->is_release_cb_calling == FALSE) { /* release resource */ @@ -496,16 +496,16 @@ int _mmcamcorder_remove_encode_pipeline(MMHandleType handle) if (ret == MM_RESOURCE_MANAGER_ERROR_NONE) hcamcorder->video_encoder_resource = NULL; - _mmcam_dbg_warn("mark resource for release 0x%x", ret); + MMCAM_LOG_WARNING("mark resource for release 0x%x", ret); ret = mm_resource_manager_commit(hcamcorder->resource_manager); - _mmcam_dbg_warn("commit resource release 0x%x", ret); + MMCAM_LOG_WARNING("commit resource release 0x%x", ret); } _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _mmcam_dbg_warn("unlock resource"); + MMCAM_LOG_WARNING("unlock resource"); #endif /* _MMCAMCORDER_MM_RM_SUPPORT */ } @@ -525,10 +525,10 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log("start"); + MMCAM_LOG_INFO("start"); if (!sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) { - _mmcam_dbg_warn("pipeline is not existed."); + MMCAM_LOG_WARNING("pipeline is not existed."); return MM_ERROR_NONE; } @@ -536,7 +536,7 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle) ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Failed to change encode main pipeline [0x%x]", ret); + MMCAM_LOG_ERROR("Failed to change encode main pipeline [0x%x]", ret); return ret; } @@ -545,13 +545,13 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle) /* remove audio pipeline first */ ret = _mmcamcorder_remove_audio_pipeline(handle); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Fail to remove audio pipeline"); + MMCAM_LOG_ERROR("Fail to remove audio pipeline"); return ret; } ret = _mmcamcorder_remove_encode_pipeline(handle); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Fail to remove encoder pipeline"); + MMCAM_LOG_ERROR("Fail to remove encoder pipeline"); return ret; } @@ -573,7 +573,7 @@ int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle) bus = NULL; } - _mmcam_dbg_log("done"); + MMCAM_LOG_INFO("done"); return ret; } @@ -607,7 +607,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) info = sc->info_video; - _mmcam_dbg_log("Command(%d)", command); + MMCAM_LOG_INFO("Command(%d)", command); pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; @@ -624,7 +624,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) int root_directory_length = 0; /* Recording */ - _mmcam_dbg_log("Record Start - dual stream %d", info->support_dual_stream); + MMCAM_LOG_INFO("Record Start - dual stream %d", info->support_dual_stream); #ifdef _MMCAMCORDER_MM_RM_SUPPORT _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); @@ -636,19 +636,19 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MM_RESOURCE_MANAGER_RES_VOLUME_FULL, &hcamcorder->video_encoder_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not prepare for encoder resource"); + MMCAM_LOG_ERROR("could not prepare for encoder resource"); ret = MM_ERROR_RESOURCE_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); goto _ERR_CAMCORDER_VIDEO_COMMAND; } } else { - _mmcam_dbg_log("encoder already acquired"); + MMCAM_LOG_INFO("encoder already acquired"); } /* acquire resources */ ret = mm_resource_manager_commit(hcamcorder->resource_manager); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { - _mmcam_dbg_err("could not acquire resources"); + MMCAM_LOG_ERROR("could not acquire resources"); ret = MM_ERROR_RESOURCE_INTERNAL; _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); goto _ERR_CAMCORDER_VIDEO_COMMAND; @@ -675,13 +675,13 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MMCAM_ROOT_DIRECTORY, &hcamcorder->root_directory, &root_directory_length, NULL); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, ret); SAFE_FREE(err_name); goto _ERR_CAMCORDER_VIDEO_COMMAND; } if (!target_filename && !hcamcorder->mstream_cb) { - _mmcam_dbg_err("filename is not set and muxed stream cb is NULL"); + MMCAM_LOG_ERROR("filename is not set and muxed stream cb is NULL"); ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; goto _ERR_CAMCORDER_VIDEO_COMMAND; } @@ -701,7 +701,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) ret = _mmcamcorder_get_storage_validity(hcamcorder, target_filename, _MMCAMCORDER_VIDEO_MINIMUM_SPACE, &storage_validity); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("storage validation failed[0x%x]:%d", ret, storage_validity); + MMCAM_LOG_ERROR("storage validation failed[0x%x]:%d", ret, storage_validity); return ret; } @@ -715,17 +715,17 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) } g_mutex_unlock(&hcamcorder->task_thread_lock); - _mmcam_dbg_warn("video size [%dx%d]", info->video_width, info->video_height); + MMCAM_LOG_WARNING("video size [%dx%d]", info->video_width, info->video_height); if (info->video_width == 0 || info->video_height == 0) { - _mmcam_dbg_warn("video size is invalid [%dx%d] use preview size [%dx%d]", + MMCAM_LOG_WARNING("video size is invalid [%dx%d] use preview size [%dx%d]", info->video_width, info->video_height, info->preview_width, info->preview_height); info->video_width = info->preview_width; info->video_height = info->preview_height; } if (info->support_dual_stream) { - _mmcam_dbg_warn("DUAL STREAM MODE"); + MMCAM_LOG_WARNING("DUAL STREAM MODE"); info->record_dual_stream = TRUE; @@ -737,7 +737,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 && info->preview_width == info->video_width && info->preview_height == info->video_height) { - _mmcam_dbg_log("H264 preview mode and same resolution"); + MMCAM_LOG_INFO("H264 preview mode and same resolution"); /* No need to restart preview */ info->restart_preview = FALSE; @@ -756,7 +756,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (info->restart_preview) { /* stop preview and set new size */ - _mmcam_dbg_log("restart preview"); + MMCAM_LOG_INFO("restart preview"); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); @@ -766,7 +766,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_VIDEO_COMMAND; } @@ -789,11 +789,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) goto _ERR_CAMCORDER_VIDEO_COMMAND; if (motion_rate < 1.0) { - _mmcam_dbg_warn("wait for stabilization of frame"); + MMCAM_LOG_WARNING("wait for stabilization of frame"); usleep(300000); } } else { - _mmcam_dbg_log("no need to restart preview"); + MMCAM_LOG_INFO("no need to restart preview"); } _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, @@ -806,7 +806,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) "PassFirstVideoFrame", &(sc->pass_first_vframe)); - _mmcam_dbg_log("Drop video frame count[%d], Pass fisrt video frame count[%d]", + MMCAM_LOG_INFO("Drop video frame count[%d], Pass fisrt video frame count[%d]", sc->drop_vframe, sc->pass_first_vframe); info->record_drop_count = (guint)motion_rate; @@ -816,7 +816,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) else info->record_timestamp_ratio = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; - _mmcam_dbg_warn("recording fps %d, motion rate %f, timestamp_ratio %f", + MMCAM_LOG_WARNING("recording fps %d, motion rate %f, timestamp_ratio %f", fps, info->record_motion_rate, info->record_timestamp_ratio); /* set push buffer flag */ @@ -835,12 +835,12 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (CameraControl) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE); - _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_START"); + MMCAM_LOG_INFO("GST_CAMERA_CONTROL_RECORD_COMMAND_START"); gst_camera_control_set_record_command(CameraControl, GST_CAMERA_CONTROL_RECORD_COMMAND_START); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE); } else { - _mmcam_dbg_err("could not get camera control"); + MMCAM_LOG_ERROR("could not get camera control"); } } @@ -889,19 +889,19 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (CameraControl) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE); - _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); + MMCAM_LOG_INFO("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); gst_camera_control_set_record_command(CameraControl, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE); } else { - _mmcam_dbg_err("failed to get camera control"); + MMCAM_LOG_ERROR("failed to get camera control"); } } /* Remove recorder pipeline and recording file which size maybe zero */ _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder); if (info->filename) { - _mmcam_dbg_log("file delete(%s)", info->filename); + MMCAM_LOG_INFO("file delete(%s)", info->filename); unlink(info->filename); } goto _ERR_CAMCORDER_VIDEO_COMMAND; @@ -913,7 +913,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, &gop_interval, NULL) == MM_ERROR_NONE) _mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval); else - _mmcam_dbg_err("get gop interval failed"); + MMCAM_LOG_ERROR("get gop interval failed"); } } else { /* Resume case */ @@ -922,19 +922,19 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, &gop_interval, NULL) == MM_ERROR_NONE) _mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval); else - _mmcam_dbg_err("get gop interval failed"); + MMCAM_LOG_ERROR("get gop interval failed"); } MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", FALSE); - _mmcam_dbg_log("Object property settings done"); + MMCAM_LOG_INFO("Object property settings done"); } } break; case _MMCamcorder_CMD_PAUSE: { if (info->b_committing) { - _mmcam_dbg_warn("now on committing previous file!!(command : %d)", command); + MMCAM_LOG_WARNING("now on committing previous file!!(command : %d)", command); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -944,10 +944,10 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Pause fail, frame count %"G_GUINT64_FORMAT, info->video_frame_count); + MMCAM_LOG_ERROR("Pause fail, frame count %"G_GUINT64_FORMAT, info->video_frame_count); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } else { - _mmcam_dbg_warn("Waiting for enough video frame, retrial[%d], frame %"G_GUINT64_FORMAT, count, info->video_frame_count); + MMCAM_LOG_WARNING("Waiting for enough video frame, retrial[%d], frame %"G_GUINT64_FORMAT, count, info->video_frame_count); } usleep(_MMCAMCORDER_FRAME_WAIT_TIME); @@ -956,11 +956,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME && info->audio_frame_count) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Pause fail, frame count VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]", + MMCAM_LOG_ERROR("Pause fail, frame count VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]", info->video_frame_count, info->audio_frame_count); return MM_ERROR_CAMCORDER_INVALID_CONDITION; } else { - _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]", + MMCAM_LOG_WARNING("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]", count, info->video_frame_count, info->audio_frame_count); } @@ -975,7 +975,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) case _MMCamcorder_CMD_CANCEL: { if (info->b_committing) { - _mmcam_dbg_warn("now on committing previous file!!(command : %d)", command); + MMCAM_LOG_WARNING("now on committing previous file!!(command : %d)", command); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } @@ -984,11 +984,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (hcamcorder->capture_in_recording == FALSE) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Failed to Wait capture data"); + MMCAM_LOG_ERROR("Failed to Wait capture data"); hcamcorder->capture_in_recording = FALSE; break; } else { - _mmcam_dbg_warn("Waiting for capture data - retrial [%d]", count); + MMCAM_LOG_WARNING("Waiting for capture data - retrial [%d]", count); } usleep(_MMCAMCORDER_FRAME_WAIT_TIME); @@ -1010,12 +1010,12 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (CameraControl) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE); - _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); + MMCAM_LOG_INFO("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); gst_camera_control_set_record_command(CameraControl, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE); } else { - _mmcam_dbg_err("failed to get camera control"); + MMCAM_LOG_ERROR("failed to get camera control"); } } @@ -1029,7 +1029,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; } @@ -1055,7 +1055,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) /* remove target file */ if (info->filename) { - _mmcam_dbg_log("file delete(%s)", info->filename); + MMCAM_LOG_INFO("file delete(%s)", info->filename); unlink(info->filename); } @@ -1075,10 +1075,10 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) guint64 free_space; if (info->b_committing) { - _mmcam_dbg_err("now on committing previous file!!(command : %d)", command); + MMCAM_LOG_ERROR("now on committing previous file!!(command : %d)", command); return MM_ERROR_CAMCORDER_CMD_IS_RUNNING; } else { - _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start"); + MMCAM_LOG_INFO("_MMCamcorder_CMD_COMMIT : start"); info->b_committing = TRUE; sc->bget_eos = FALSE; } @@ -1090,17 +1090,17 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) hcamcorder->capture_in_recording == FALSE) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Commit fail, frame count is %"G_GUINT64_FORMAT", capturing %d", + MMCAM_LOG_ERROR("Commit fail, frame count is %"G_GUINT64_FORMAT", capturing %d", info->video_frame_count, hcamcorder->capture_in_recording); if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) { - _mmcam_dbg_warn("video frames are enough. keep going..."); + MMCAM_LOG_WARNING("video frames are enough. keep going..."); } else { info->b_committing = FALSE; return MM_ERROR_CAMCORDER_INVALID_CONDITION; } } else { - _mmcam_dbg_warn("Waiting for enough video frame, retrial [%d], frame %"G_GUINT64_FORMAT", capturing %d", + MMCAM_LOG_WARNING("Waiting for enough video frame, retrial [%d], frame %"G_GUINT64_FORMAT", capturing %d", count, info->video_frame_count, hcamcorder->capture_in_recording); } } else { @@ -1110,11 +1110,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) hcamcorder->capture_in_recording == FALSE) { break; } else if (count == _MMCAMCORDER_RETRIAL_COUNT) { - _mmcam_dbg_err("Commit fail, VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d", + MMCAM_LOG_ERROR("Commit fail, VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d", info->video_frame_count, info->audio_frame_count, hcamcorder->capture_in_recording); if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME && info->audio_frame_count) { - _mmcam_dbg_warn("video/audio frames are enough. keep going..."); + MMCAM_LOG_WARNING("video/audio frames are enough. keep going..."); } else { info->b_committing = FALSE; return MM_ERROR_CAMCORDER_INVALID_CONDITION; @@ -1122,7 +1122,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) return MM_ERROR_CAMCORDER_INVALID_CONDITION; } else { - _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d", + MMCAM_LOG_WARNING("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d", count, info->video_frame_count, info->audio_frame_count, hcamcorder->capture_in_recording); } } @@ -1130,7 +1130,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (hcamcorder->capture_in_recording) { gint64 end_time = g_get_monotonic_time() + (200 * G_TIME_SPAN_MILLISECOND); if (!_MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time)) - _mmcam_dbg_warn("timeout"); + MMCAM_LOG_WARNING("timeout"); } else { usleep(_MMCAMCORDER_FRAME_WAIT_TIME); } @@ -1138,26 +1138,26 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) /* block push buffer */ info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP; - _mmcam_dbg_log("block push buffer to appsrc"); + MMCAM_LOG_INFO("block push buffer to appsrc"); _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space); if (free_space < _MMCAMCORDER_MINIMUM_SPACE) { - _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space); + MMCAM_LOG_WARNING("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space); ret = MM_ERROR_OUT_OF_STORAGE; goto _ERR_CAMCORDER_VIDEO_COMMAND; } if (sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst != NULL) { if (gst_element_send_event(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, gst_event_new_eos())) { - _mmcam_dbg_warn("VIDEO: send eos to appsrc done"); + MMCAM_LOG_WARNING("VIDEO: send eos to appsrc done"); } else { - _mmcam_dbg_err("VIDEO: send EOS failed"); + MMCAM_LOG_ERROR("VIDEO: send EOS failed"); info->b_committing = FALSE; ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_VIDEO_COMMAND; } } else { - _mmcam_dbg_err("No video stream source"); + MMCAM_LOG_ERROR("No video stream source"); info->b_committing = FALSE; ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_VIDEO_COMMAND; @@ -1165,15 +1165,15 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst != NULL) { if (gst_element_send_event(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos())) { - _mmcam_dbg_warn("AUDIO: send eos to audiosrc done"); + MMCAM_LOG_WARNING("AUDIO: send eos to audiosrc done"); } else { - _mmcam_dbg_err("AUDIO: send EOS failed"); + MMCAM_LOG_ERROR("AUDIO: send EOS failed"); info->b_committing = FALSE; ret = MM_ERROR_CAMCORDER_INTERNAL; goto _ERR_CAMCORDER_VIDEO_COMMAND; } } else { - _mmcam_dbg_log("No audio stream"); + MMCAM_LOG_INFO("No audio stream"); } /* sc */ @@ -1181,7 +1181,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) sc->previous_slot_time = 0; /* Wait EOS */ - _mmcam_dbg_log("Start to wait EOS"); + MMCAM_LOG_INFO("Start to wait EOS"); ret = _mmcamcorder_get_eos_message(handle); if (ret != MM_ERROR_NONE) { info->b_committing = FALSE; @@ -1227,7 +1227,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) info = sc->info_video; - _mmcam_dbg_err(""); + MMCAM_LOG_ERROR(""); /* Play record stop sound */ _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, FALSE); @@ -1241,7 +1241,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) ret = _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder); if (ret != MM_ERROR_NONE) - _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline failed. error[%x]", ret); + MMCAM_LOG_WARNING("_MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline failed. error[%x]", ret); /* set recording hint */ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "recording-hint", FALSE); @@ -1252,29 +1252,29 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) if (control) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE); - _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); + MMCAM_LOG_INFO("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP"); gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE); } else { - _mmcam_dbg_err("failed to get camera control"); + MMCAM_LOG_ERROR("failed to get camera control"); } } if (enabletag && !(sc->ferror_send)) { ret = __mmcamcorder_add_metadata((MMHandleType)hcamcorder, info->fileformat); - _mmcam_dbg_log("Writing location information [%s] !!", ret ? "SUCCEEDED" : "FAILED"); + MMCAM_LOG_INFO("Writing location information [%s] !!", ret ? "SUCCEEDED" : "FAILED"); } /* Check file size */ if (info->max_size > 0) { _mmcamcorder_get_file_size(info->filename, &file_size); - _mmcam_dbg_log("MAX size %"G_GUINT64_FORMAT" byte - created filesize %"G_GUINT64_FORMAT" byte", + MMCAM_LOG_INFO("MAX size %"G_GUINT64_FORMAT" byte - created filesize %"G_GUINT64_FORMAT" byte", info->max_size, file_size); if (file_size > info->max_size) { _MMCamcorderMsgItem message; - _mmcam_dbg_err("File size is greater than max size !!"); + MMCAM_LOG_ERROR("File size is greater than max size !!"); message.id = MM_MESSAGE_CAMCORDER_ERROR; message.param.code = MM_ERROR_CAMCORDER_FILE_SIZE_OVER; _mmcamcorder_send_message((MMHandleType)hcamcorder, &message); @@ -1287,12 +1287,12 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "keep-camera-preview", TRUE); - _mmcam_dbg_log("Set state of pipeline as READY"); + MMCAM_LOG_INFO("Set state of pipeline as READY"); ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY); /* check decoder recreation */ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { - _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); ret = MM_ERROR_CAMCORDER_INTERNAL; } @@ -1305,7 +1305,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) msg.id = MM_MESSAGE_CAMCORDER_ERROR; msg.param.code = ret; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - _mmcam_dbg_err("Failed to set state READY[%x]", ret); + MMCAM_LOG_ERROR("Failed to set state READY[%x]", ret); } /* reset restart_preview for inset window layout */ @@ -1316,7 +1316,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) msg.id = MM_MESSAGE_CAMCORDER_ERROR; msg.param.code = MM_ERROR_CAMCORDER_INTERNAL; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - _mmcam_dbg_err("Failed to set camera resolution %dx%d", + MMCAM_LOG_ERROR("Failed to set camera resolution %dx%d", info->preview_width, info->preview_height); } @@ -1327,23 +1327,19 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) msg.id = MM_MESSAGE_CAMCORDER_ERROR; msg.param.code = ret; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - _mmcam_dbg_err("Failed to set state PLAYING[%x]", ret); + MMCAM_LOG_ERROR("Failed to set state PLAYING[%x]", ret); } } else { - _mmcam_dbg_log("No need to restart preview"); + MMCAM_LOG_INFO("No need to restart preview"); } /* Send recording report to application */ msg.id = MM_MESSAGE_CAMCORDER_VIDEO_CAPTURED; report = (MMCamRecordingReport *)g_malloc(sizeof(MMCamRecordingReport)); - if (!report) { - _mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename); - } else { - report->recording_filename = g_strdup(info->filename); - msg.param.data = report; - msg.param.code = 1; - _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - } + report->recording_filename = g_strdup(info->filename); + msg.param.data = report; + msg.param.code = 1; + _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); /* Finishing */ sc->pipeline_time = 0; @@ -1360,7 +1356,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) /* check recording stop sound */ _mmcamcorder_sound_solo_play_wait(handle); - _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end"); + MMCAM_LOG_ERROR("_MMCamcorder_CMD_COMMIT : end"); return TRUE; } @@ -1387,15 +1383,13 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPad /* get buffer size */ if (!gst_buffer_map(buffer, &mapinfo, GST_MAP_READ)) { - _mmcam_dbg_warn("map failed : buffer %p", buffer); + MMCAM_LOG_WARNING("map failed : buffer %p", buffer); return GST_PAD_PROBE_OK; } buffer_size = mapinfo.size; gst_buffer_unmap(buffer, &mapinfo); - /*_mmcam_dbg_err("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/ - g_mutex_lock(&videoinfo->size_check_lock); if (videoinfo->audio_frame_count == 0) { @@ -1406,7 +1400,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPad } if (sc->ferror_send || sc->isMaxsizePausing) { - _mmcam_dbg_warn("Recording is paused, drop frames"); + MMCAM_LOG_WARNING("Recording is paused, drop frames"); g_mutex_unlock(&videoinfo->size_check_lock); return GST_PAD_PROBE_DROP; } @@ -1422,9 +1416,9 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPad if (videoinfo->max_size > 0 && videoinfo->max_size < max_size) { GstState pipeline_state = GST_STATE_VOID_PENDING; GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; - _mmcam_dbg_warn("Max size!!! Recording is paused."); - _mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \ - " buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]", + + MMCAM_LOG_WARNING("Max size[%"G_GUINT64_FORMAT"], current size[%"G_GUINT64_FORMAT"],"\ + " buffer size[%"G_GUINT64_FORMAT"], trailer size[%"G_GUINT64_FORMAT"]", videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size); if (!sc->isMaxsizePausing) { @@ -1445,6 +1439,9 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPad videoinfo->filesize += buffer_size; videoinfo->audio_frame_count++; + MMCAM_LOG_DEBUG("video rec[%"GST_TIME_FORMAT"], size[%"G_GUINT64_FORMAT"(trailer:%"G_GUINT64_FORMAT")]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), videoinfo->filesize + trailer_size, trailer_size); + g_mutex_unlock(&videoinfo->size_check_lock); return GST_PAD_PROBE_OK; @@ -1477,9 +1474,8 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP mmf_return_val_if_fail(sc && sc->info_video, GST_PAD_PROBE_OK); videoinfo = sc->info_video; - /*_mmcam_dbg_log("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/ if (sc->ferror_send) { - _mmcam_dbg_warn("file write error, drop frames"); + MMCAM_LOG_WARNING("file write error, drop frames"); return GST_PAD_PROBE_DROP; } @@ -1489,8 +1485,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP videoinfo->video_frame_count++; if (videoinfo->video_frame_count <= (guint64)_MMCAMCORDER_MINIMUM_FRAME) { - /* _mmcam_dbg_log("Pass minimum frame: info->video_frame_count: %" G_GUINT64_FORMAT " ", - info->video_frame_count); */ + MMCAM_LOG_DEBUG("Pass minimum frame[%"G_GUINT64_FORMAT"]", videoinfo->video_frame_count); g_mutex_lock(&videoinfo->size_check_lock); videoinfo->filesize += buffer_size; g_mutex_unlock(&videoinfo->size_check_lock); @@ -1506,7 +1501,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP /* check free space */ ret = _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space); if (ret != 0) { - _mmcam_dbg_err("Error occurred. [%d]", ret); + MMCAM_LOG_ERROR("Error occurred. [%d]", ret); if (sc->ferror_count == 2 && sc->ferror_send == FALSE) { sc->ferror_send = TRUE; @@ -1525,16 +1520,16 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP /* check storage state */ storage_get_state(hcamcorder->storage_info.id, &storage_state); - _mmcam_dbg_warn("storage state %d", storage_state); + MMCAM_LOG_WARNING("storage state %d", storage_state); if (storage_state == STORAGE_STATE_REMOVED || storage_state == STORAGE_STATE_UNMOUNTABLE) { - _mmcam_dbg_err("storage was removed!"); + MMCAM_LOG_ERROR("storage was removed!"); _MMCAMCORDER_LOCK(hcamcorder); if (sc->ferror_send == FALSE) { - _mmcam_dbg_err("OUT_OF_STORAGE error"); + MMCAM_LOG_ERROR("OUT_OF_STORAGE error"); sc->ferror_send = TRUE; @@ -1546,7 +1541,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); } else { _MMCAMCORDER_UNLOCK(hcamcorder); - _mmcam_dbg_warn("error was already sent"); + MMCAM_LOG_WARNING("error was already sent"); } return GST_PAD_PROBE_DROP; @@ -1563,8 +1558,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP queued_buffer = aq_size + vq_size; if (free_space < (_MMCAMCORDER_MINIMUM_SPACE + buffer_size + trailer_size + queued_buffer)) { - _mmcam_dbg_warn("No more space for recording!!! Recording is paused."); - _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \ + MMCAM_LOG_WARNING("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \ " buffer size : [%" G_GUINT64_FORMAT "], queued buffer size : [%" G_GUINT64_FORMAT "]", \ free_space, trailer_size, buffer_size, queued_buffer); @@ -1586,8 +1580,8 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP if (videoinfo->max_size > 0 && videoinfo->max_size < max_size) { GstState pipeline_state = GST_STATE_VOID_PENDING; GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst; - _mmcam_dbg_warn("Max size!!! Recording is paused."); - _mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \ + + MMCAM_LOG_WARNING("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \ " buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]", videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size); @@ -1608,9 +1602,8 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_encoded(GstPad *pad, GstP videoinfo->filesize += (guint64)buffer_size; - /* - _mmcam_dbg_log("filesize %lld Byte, ", videoinfo->filesize); - */ + MMCAM_LOG_DEBUG("video rec[%"GST_TIME_FORMAT"], size[%"G_GUINT64_FORMAT"(trailer:%"G_GUINT64_FORMAT")]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), videoinfo->filesize + trailer_size, trailer_size); g_mutex_unlock(&videoinfo->size_check_lock); @@ -1653,7 +1646,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad /* check max time */ if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) { - _mmcam_dbg_warn("Time current [%" G_GUINT64_FORMAT "], Max [%" G_GUINT64_FORMAT "], motion rate [%lf]", \ + MMCAM_LOG_WARNING("Time current [%" G_GUINT64_FORMAT "], Max [%" G_GUINT64_FORMAT "], motion rate [%lf]", \ rec_pipe_time, videoinfo->max_time, videoinfo->record_motion_rate); if (!sc->isMaxtimePausing) { @@ -1690,32 +1683,21 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad msg.param.recording_status.remained_time = remained_time; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - /* - _mmcam_dbg_log("time [%" GST_TIME_FORMAT "], size [%d]", - GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize); - */ - if (videoinfo->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { guint record_motion_rate = (guint)videoinfo->record_motion_rate; - /* - _mmcam_dbg_log("record_motion_rate %d, videoinfo->record_drop_count %d", + MMCAM_LOG_VERBOSE("record_motion_rate[%u], videoinfo->record_drop_count[%u]", record_motion_rate, videoinfo->record_drop_count); - */ /* drop some frame if fast motion */ if (videoinfo->record_motion_rate > _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { if (record_motion_rate != (videoinfo->record_drop_count++)) { - /* - _mmcam_dbg_warn("drop frame"); - */ + MMCAM_LOG_VERBOSE("drop frame"); return GST_PAD_PROBE_DROP; } videoinfo->record_drop_count = 1; - /* - _mmcam_dbg_warn("pass frame"); - */ + MMCAM_LOG_VERBOSE("pass frame"); } GST_BUFFER_PTS(buffer) = b_time * (videoinfo->record_timestamp_ratio); @@ -1748,7 +1730,7 @@ static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadPro videoinfo = sc->info_video; if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) { - _mmcam_dbg_err("Buffer timestamp is invalid, check it"); + MMCAM_LOG_ERROR("Buffer timestamp is invalid, check it"); return GST_PAD_PROBE_OK; } @@ -1770,7 +1752,7 @@ static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadPro } if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) { - _mmcam_dbg_warn("Time current [%" G_GUINT64_FORMAT "], Max [%" G_GUINT64_FORMAT "], motion rate [%lf]", \ + MMCAM_LOG_WARNING("Time current [%" G_GUINT64_FORMAT "], Max [%" G_GUINT64_FORMAT "], motion rate [%lf]", \ rec_pipe_time, videoinfo->max_time, videoinfo->record_motion_rate); if (!sc->isMaxtimePausing) { @@ -1797,10 +1779,8 @@ static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadPro msg.param.recording_status.remained_time = remained_time; _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - /* - _mmcam_dbg_log("audio data probe :: time [%" GST_TIME_FORMAT "], size [%lld KB]", - GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize); - */ + MMCAM_LOG_DEBUG("audio data probe[%" GST_TIME_FORMAT "], size[%"G_GUINT64_FORMAT"]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), videoinfo->filesize + trailer_size); return GST_PAD_PROBE_OK; } @@ -1820,14 +1800,13 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP); mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP); - /*_mmcam_dbg_log("AUDIO SRC time stamp : [%" GST_TIME_FORMAT "] \n", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/ err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_name, MMCAM_AUDIO_VOLUME, &volume, MMCAM_AUDIO_FORMAT, &format, MMCAM_AUDIO_CHANNEL, &channel, NULL); if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); return err; } @@ -1840,24 +1819,24 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G if (volume == 0.0) memset(mapinfo.data, 0, mapinfo.size); + MMCAM_LOG_DEBUG("audio stream[%"GST_TIME_FORMAT"] - cb[%p], fmt[%d], ch[%d], size[%"G_GSIZE_FORMAT"]", + GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), hcamcorder->astream_cb, format, channel, mapinfo.size); + /* CALL audio stream callback */ if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) { MMCamcorderAudioStreamDataType stream; if (_mmcamcorder_get_state((MMHandleType)hcamcorder) < MM_CAMCORDER_STATE_PREPARE) { - _mmcam_dbg_warn("Not ready for stream callback"); + MMCAM_LOG_WARNING("Not ready for stream callback"); gst_buffer_unmap(buffer, &mapinfo); return GST_PAD_PROBE_OK; } - /*_mmcam_dbg_log("Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]", - GST_BUFFER_DATA(buffer), width, height, format);*/ - stream.data = (void *)mapinfo.data; stream.format = format; stream.channel = channel; stream.length = mapinfo.size; - stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano -> milli second */ + stream.timestamp = (unsigned int)(GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer))); _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(hcamcorder); @@ -1868,6 +1847,7 @@ static GstPadProbeReturn __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, G } gst_buffer_unmap(buffer, &mapinfo); + return GST_PAD_PROBE_OK; } @@ -1882,7 +1862,7 @@ static gboolean __mmcamcorder_add_metadata(MMHandleType handle, int fileformat) bret = __mmcamcorder_add_metadata_mp4(handle); break; default: - _mmcam_dbg_warn("Unsupported fileformat to insert location info (%d)", fileformat); + MMCAM_LOG_WARNING("Unsupported fileformat to insert location info (%d)", fileformat); break; } @@ -1919,14 +1899,14 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED); mmf_return_val_if_fail(sc->info_video, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - _mmcam_dbg_log(""); + MMCAM_LOG_INFO(""); info = sc->info_video; f = fopen64(info->filename, "rb+"); if (f == NULL) { strerror_r(errno, err_msg, MAX_ERROR_MESSAGE_LEN); - _mmcam_dbg_err("file open failed [%s]", err_msg); + MMCAM_LOG_ERROR("file open failed [%s]", err_msg); return FALSE; } @@ -1938,7 +1918,7 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) MMCAM_TAG_GPS_ENABLE, &gps_enable, NULL); if (err_name) { - _mmcam_dbg_warn("Get tag attrs fail. (%s:%x)", err_name, err); + MMCAM_LOG_WARNING("Get tag attrs fail. (%s:%x)", err_name, err); SAFE_FREE(err_name); } @@ -1954,7 +1934,7 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) if (_mmcamcorder_find_fourcc(f, MMCAM_FOURCC('u', 'd', 't', 'a'), TRUE)) { size_t nread = 0; - _mmcam_dbg_log("find udta container"); + MMCAM_LOG_INFO("find udta container"); /* read size */ if (fseek(f, -8L, SEEK_CUR) != 0) @@ -1966,7 +1946,7 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) nread = fread(&buf, sizeof(char), sizeof(buf), f); - _mmcam_dbg_log("recorded file fread %zu", nread); + MMCAM_LOG_INFO("recorded file fread %zu", nread); udta_size = _mmcamcorder_get_container_size(buf); @@ -1976,12 +1956,12 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) if (gps_enable) { if (!_mmcamcorder_write_loci(f, location_info)) { - _mmcam_dbg_err("failed to write loci"); + MMCAM_LOG_ERROR("failed to write loci"); goto fail; } if (!_mmcamcorder_write_geodata(f, geo_info)) { - _mmcam_dbg_err("failed to write geodata"); + MMCAM_LOG_ERROR("failed to write geodata"); goto fail; } } @@ -1993,12 +1973,12 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) if (!_mmcamcorder_update_size(f, udta_pos, current_pos)) goto fail; } else { - _mmcam_dbg_log("No udta container"); + MMCAM_LOG_INFO("No udta container"); if (fseek(f, 0, SEEK_END) != 0) goto fail; if (!_mmcamcorder_write_udta(f, gps_enable, location_info, geo_info)) { - _mmcam_dbg_err("failed to write udta"); + MMCAM_LOG_ERROR("failed to write udta"); goto fail; } } @@ -2011,7 +1991,7 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) if (_mmcamcorder_find_tag(f, MMCAM_FOURCC('m', 'o', 'o', 'v'), TRUE)) { gint64 internal_pos = ftello(f); - _mmcam_dbg_log("found moov container"); + MMCAM_LOG_INFO("found moov container"); if (fseek(f, -8L, SEEK_CUR) != 0) goto fail; @@ -2024,32 +2004,32 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle) /* add orientation info */ if (fseeko(f, internal_pos, SEEK_SET) < 0) { - _mmcam_dbg_err("fseeko failed : errno %d", errno); + MMCAM_LOG_ERROR("fseeko failed : errno %d", errno); goto fail; } if (!_mmcamcorder_find_tag(f, MMCAM_FOURCC('t', 'r', 'a', 'k'), FALSE)) { - _mmcam_dbg_err("failed to find [trak] tag"); + MMCAM_LOG_ERROR("failed to find [trak] tag"); goto fail; } if (!_mmcamcorder_find_tag(f, MMCAM_FOURCC('t', 'k', 'h', 'd'), FALSE)) { - _mmcam_dbg_err("failed to find [tkhd] tag"); + MMCAM_LOG_ERROR("failed to find [tkhd] tag"); goto fail; } - _mmcam_dbg_log("found [tkhd] tag"); + MMCAM_LOG_INFO("found [tkhd] tag"); /* seek to start position of composition matrix */ if (fseek(f, OFFSET_COMPOSITION_MATRIX, SEEK_CUR) == 0) { /* update composition matrix for orientation */ _mmcamcorder_update_composition_matrix(f, orientation); } else { - _mmcam_dbg_err("fseek failed : errno %d", errno); + MMCAM_LOG_ERROR("fseek failed : errno %d", errno); goto fail; } } else { - _mmcam_dbg_err("No 'moov' container"); + MMCAM_LOG_ERROR("No 'moov' container"); goto fail; } @@ -2061,7 +2041,7 @@ fail: return FALSE; ftell_fail: - _mmcam_dbg_err("ftell() returns negative value."); + MMCAM_LOG_ERROR("ftell() returns negative value."); fclose(f); return FALSE; } @@ -2079,14 +2059,14 @@ int _mmcamcorder_connect_video_stream_cb_signal(MMHandleType handle) /* check video source element */ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { - _mmcam_dbg_warn("connect video stream cb signal to _MMCAMCORDER_VIDEOSRC_SRC"); + MMCAM_LOG_WARNING("connect video stream cb signal to _MMCAMCORDER_VIDEOSRC_SRC"); MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, _MMCAMCORDER_HANDLER_VIDEOREC, "video-stream-cb", G_CALLBACK(__mmcamcorder_video_stream_cb), hcamcorder); return MM_ERROR_NONE; } else { - _mmcam_dbg_err("videosrc element is not created yet"); + MMCAM_LOG_ERROR("videosrc element is not created yet"); return MM_ERROR_CAMCORDER_NOT_INITIALIZED; } } @@ -2110,7 +2090,7 @@ int _mmcamcorder_video_prepare_record(MMHandleType handle) info = sc->info_video; - _mmcam_dbg_warn("start"); + MMCAM_LOG_WARNING("start"); /* create encoding pipeline */ ret = _mmcamcorder_create_recorder_pipeline((MMHandleType)hcamcorder); @@ -2125,14 +2105,14 @@ int _mmcamcorder_video_prepare_record(MMHandleType handle) if (temp_filename) { info->filename = g_strdup(temp_filename); if (!info->filename) { - _mmcam_dbg_err("strdup[src:%p] was failed", temp_filename); + MMCAM_LOG_ERROR("strdup[src:%p] was failed", temp_filename); goto _ERR_PREPARE_RECORD; } - _mmcam_dbg_log("Record file name [%s]", info->filename); + MMCAM_LOG_INFO("Record file name [%s]", info->filename); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename); } else { - _mmcam_dbg_log("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL); + MMCAM_LOG_INFO("Recorded data will be written in [%s]", _MMCamcorder_FILENAME_NULL); MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", _MMCamcorder_FILENAME_NULL); } @@ -2146,7 +2126,7 @@ int _mmcamcorder_video_prepare_record(MMHandleType handle) if (ret != MM_ERROR_NONE) goto _ERR_PREPARE_RECORD; - _mmcam_dbg_warn("done"); + MMCAM_LOG_WARNING("done"); return ret; @@ -2154,7 +2134,7 @@ _ERR_PREPARE_RECORD: /* Remove recorder pipeline and recording file which size maybe zero */ _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder); if (info && info->filename) { - _mmcam_dbg_log("file delete(%s)", info->filename); + MMCAM_LOG_INFO("file delete(%s)", info->filename); unlink(info->filename); }