From: Gilbok Lee Date: Wed, 13 Sep 2017 09:57:40 +0000 (+0900) Subject: Remove libmm-log build dependency X-Git-Tag: submit/tizen_3.0/20200709.013215^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_3.0;p=platform%2Fcore%2Fmultimedia%2Flibmm-transcode.git Remove libmm-log build dependency [Version] 0.10.4 [Profile] Mobile, TV [Issue Type] build dependency Change-Id: I1e48162bca6d5e1d1e14bf4eeff0a4c1cd13b010 --- diff --git a/AUTHORS b/AUTHORS old mode 100755 new mode 100644 diff --git a/LICENSE.APLv2.0 b/LICENSE.APLv2.0 old mode 100755 new mode 100644 diff --git a/Makefile.am b/Makefile.am old mode 100755 new mode 100644 diff --git a/configure.ac b/configure.ac index 1d082d6..1860e16 100755 --- a/configure.ac +++ b/configure.ac @@ -36,9 +36,9 @@ PKG_CHECK_MODULES(MMCOMMON, mm-common) AC_SUBST(MMCOMMON_CFLAGS) AC_SUBST(MMCOMMON_LIBS) -PKG_CHECK_MODULES(MMLOG, mm-log) -AC_SUBST(MMLOG_CFLAGS) -AC_SUBST(MMLOG_LIBS) +PKG_CHECK_MODULES(DLOG, dlog) +AC_SUBST(DLOG_CFLAGS) +AC_SUBST(DLOG_LIBS) PKG_CHECK_MODULES(MMFILEINFO, mm-fileinfo) AC_SUBST(MMFILEINFO_CFLAGS) diff --git a/packaging/libmm-transcode.spec b/packaging/libmm-transcode.spec index 8a41b69..bdb6d71 100644 --- a/packaging/libmm-transcode.spec +++ b/packaging/libmm-transcode.spec @@ -1,13 +1,13 @@ Name: libmm-transcode Summary: Multimedia Framework Video Transcode Library -Version: 0.10.3 +Version: 0.10.4 Release: 0 Group: System/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1001: libmm-transcode.manifest BuildRequires: pkgconfig(mm-common) -BuildRequires: pkgconfig(mm-log) +BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(mm-fileinfo) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gstreamer-1.0) diff --git a/transcode/Makefile.am b/transcode/Makefile.am old mode 100755 new mode 100644 index 9fb8a2a..0370bf2 --- a/transcode/Makefile.am +++ b/transcode/Makefile.am @@ -20,8 +20,8 @@ libmm_transcode_la_CFLAGS = -I$(srcdir)/include \ $(GST_PLUGIN_BASE_CFLAGS) \ $(GST_INTERFACE_CFLAGS) \ $(GSTPBUTILS_CFLAGS) \ - $(GST_VIDEO_LIBS) \ - $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x300000 -DMMF_DEBUG_PREFIX=\"MMF-VIDEOEDIT\" + $(GST_VIDEO_CFLAGS) \ + $(DLOG_CFLAGS) libmm_transcode_la_LIBADD = $(MMCOMMON_LIBS) \ $(MMFILEINFO_LIBS) \ @@ -32,7 +32,7 @@ libmm_transcode_la_LIBADD = $(MMCOMMON_LIBS) \ $(GST_PLUGIN_BASE_LIBS) \ $(GST_INTERFACE_LIBS) \ $(GSTPBUTILS_LIBS) \ - $(MMLOG_LIBS) + $(DLOG_LIBS) pcfiles = mm-transcode.pc pkgconfigdir = $(libdir)/pkgconfig diff --git a/transcode/include/mm_transcode_internal.h b/transcode/include/mm_transcode_internal.h index e5b4ba1..ccf5f8e 100644 --- a/transcode/include/mm_transcode_internal.h +++ b/transcode/include/mm_transcode_internal.h @@ -31,10 +31,8 @@ extern "C" { #include #include #include -#include -#include +#include #include -#include #include #include #include @@ -56,7 +54,12 @@ extern "C" { #define BUFFER_SIZE 4096 #define ENC_BUFFER_SIZE 25 -#define TRANSCODE_FREE(src) { if(src) {g_free(src); src = NULL;} } +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "MM_TRANSCODE" + +#define TRANSCODE_FREE(src) { if (src) { g_free(src); src = NULL; } } #define AAC "aac" #define ACON "auto-audio-convert" #define ACS "auto-colorspace" diff --git a/transcode/mm-transcode.pc.in b/transcode/mm-transcode.pc.in old mode 100755 new mode 100644 diff --git a/transcode/mm_transcode.c b/transcode/mm_transcode.c old mode 100755 new mode 100644 index f09caaf..c886fc4 --- a/transcode/mm_transcode.c +++ b/transcode/mm_transcode.c @@ -28,7 +28,7 @@ int mm_transcode_create(MMHandleType *MMHandle) /* Check argument here */ if (MMHandle == NULL) { - debug_error("Invalid arguments [tag null]\n"); + LOGE("Invalid arguments [tag null]"); return MM_ERROR_INVALID_ARGUMENT; } @@ -37,37 +37,38 @@ int mm_transcode_create(MMHandleType *MMHandle) /*handle = g_malloc(sizeof(handle_s)); */ handle = g_new0(handle_s, 1); if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_vidp = g_new0(handle_vidp_plugin_s, 1); if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); goto ERROR4; } handle->decoder_audp = g_new0(handle_audp_plugin_s, 1); if (!handle->decoder_audp) { - debug_error("[ERROR] - handle decoder audio process bin"); + LOGE("[ERROR] - handle decoder audio process bin"); goto ERROR3; } handle->encodebin = g_new0(handle_encode_s, 1); if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); goto ERROR2; } handle->property = g_new0(handle_property_s, 1); if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); goto ERROR1; } *MMHandle = (MMHandleType)handle; - debug_log("MMHandle: 0x%2x", handle); + LOGD("MMHandle: %p", handle); + handle->property->_MMHandle = 0; return ret; @@ -90,91 +91,91 @@ int mm_transcode_prepare(MMHandleType MMHandle, const char *in_Filename, mm_cont handle_s *handle = (handle_s *) MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if ((in_Filename == NULL) || (strlen(in_Filename) == 0)) { - debug_error("Invalid Input file"); + LOGE("Invalid Input file"); return MM_ERROR_INVALID_ARGUMENT; } if (videoencoder == MM_VIDEOENCODER_NO_USE && audioencoder == MM_AUDIOENCODER_NO_USE) { - debug_error("No encoder resource"); + LOGE("No encoder resource"); return MM_ERROR_INVALID_ARGUMENT; } if (videoencoder == MM_VIDEOENCODER_H264) { - debug_error("Can't support encoding to H264"); + LOGE("Can't support encoding to H264"); return MM_ERROR_INVALID_ARGUMENT; } /* set element */ ret = _mm_transcode_set_handle_element(handle, in_Filename, containerformat, videoencoder, audioencoder); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Set element"); + LOGE("ERROR -Set element"); return ret; } - debug_log("%s == %s", handle->property->sourcefile, in_Filename); + LOGD("%s == %s", handle->property->sourcefile, in_Filename); /* protect the case of changing input file during transcoding */ if (0 == strlen(handle->property->sourcefile) || 0 == strcmp(handle->property->sourcefile, in_Filename)) { /* setup */ ret = _mm_setup_pipeline(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Setup Pipeline"); + LOGD("Success - Setup Pipeline"); } else { - debug_error("ERROR - Setup Pipeline"); + LOGE("ERROR - Setup Pipeline"); return ret; } /* video / auido stream */ ret = _mm_transcode_get_stream_info(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Get stream info"); + LOGD("Success - Get stream info"); } else { - debug_error("ERROR - Get stream info"); + LOGE("ERROR - Get stream info"); return ret; } /* create pipeline */ ret = _mm_transcode_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create Pipeline"); + LOGD("Success - Create Pipeline"); } else { - debug_error("ERROR -Create Pipeline"); + LOGE("ERROR -Create Pipeline"); return ret; } /*link pipeline */ ret = _mm_transcode_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Link pipeline"); + LOGD("Success - Link pipeline"); } else { - debug_error("ERROR - Link pipeline"); + LOGE("ERROR - Link pipeline"); return ret; } /* flush param */ ret = _mm_transcode_param_flush(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Init parameter"); + LOGD("Success - Init parameter"); } else { - debug_error("ERROR - Init parameter"); + LOGE("ERROR - Init parameter"); return ret; } /* create thread */ ret = _mm_transcode_thread(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Link pipeline"); + LOGD("Success - Link pipeline"); } else { - debug_error("ERROR - Link pipeline"); + LOGE("ERROR - Link pipeline"); return ret; } @@ -182,7 +183,7 @@ int mm_transcode_prepare(MMHandleType MMHandle, const char *in_Filename, mm_cont GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(handle->pipeline)); handle->property->bus_watcher = gst_bus_add_watch(bus, (GstBusFunc)_mm_cb_transcode_bus, handle); gst_object_unref(GST_OBJECT(bus)); - debug_log("Success - gst_object_unref (bus)"); + LOGD("Success - gst_object_unref (bus)"); } handle->property->_MMHandle++; @@ -196,40 +197,42 @@ int mm_transcode(MMHandleType MMHandle, unsigned int resolution_width, unsigned handle_s *handle = (handle_s *)MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!completed_callback) { - debug_error("[ERROR] - completed_callback"); + LOGE("[ERROR] - completed_callback"); return MM_ERROR_INVALID_ARGUMENT; } if (!out_Filename) { - debug_error("[ERROR] - out_Filename"); + LOGE("[ERROR] - out_Filename"); return MM_ERROR_INVALID_ARGUMENT; } if (duration < MIN_DURATION && duration != 0) { - debug_error("The minimum seek duration is 1000 msec "); + LOGE("The minimum seek duration is 1000 msec "); return MM_ERROR_INVALID_ARGUMENT; } handle->property->progress_cb = progress_callback; handle->property->progress_cb_param = user_param; - debug_log("[MMHandle] 0x%2x [progress_cb] 0x%2x [progress_cb_param] 0x%2x", MMHandle, handle->property->progress_cb, handle->property->progress_cb_param); + LOGD("[MMHandle] %p [progress_cb] %p [progress_cb_param] %p", + MMHandle, handle->property->progress_cb, handle->property->progress_cb_param); handle->property->completed_cb = completed_callback; handle->property->completed_cb_param = user_param; - debug_log("[MMHandle] 0x%2x [completed_cb] 0x%2x [completed_cb_param] 0x%2x", MMHandle, handle->property->completed_cb, handle->property->completed_cb_param); + LOGD("[MMHandle] %p [completed_cb] %p [completed_cb_param] %p", + MMHandle, handle->property->completed_cb, handle->property->completed_cb_param); if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } /* check if prepare is called during transcoding */ @@ -237,21 +240,21 @@ int mm_transcode(MMHandleType MMHandle, unsigned int resolution_width, unsigned handle_param_s *param = g_new0(handle_param_s, 1); if (param) { /*g_value_init (param, G_TYPE_INT); */ - debug_log("[param] 0x%2x", param); + LOGD("[param] %p", param); } /* set parameter */ ret = _mm_transcode_set_handle_parameter(param, resolution_width, resolution_height, fps_value, start_position, duration, seek_mode, out_Filename); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Set parameter"); + LOGE("ERROR -Set parameter"); return ret; } ret = _mm_transcode_preset_capsfilter(handle, resolution_width, resolution_height); if (ret == MM_ERROR_NONE) { - debug_log("Success - Preset Capsfilter"); + LOGD("Success - Preset Capsfilter"); } else { - debug_error("ERROR - Preset Capsfilter"); + LOGE("ERROR - Preset Capsfilter"); return ret; } @@ -271,22 +274,22 @@ int mm_transcode_is_busy(MMHandleType MMHandle, bool *is_busy) handle_s *handle = (handle_s *)MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!is_busy) { - debug_error("[ERROR] - is_busy"); + LOGE("[ERROR] - is_busy"); return MM_ERROR_INVALID_ARGUMENT; } *is_busy = handle->property->is_busy; - debug_log("[Transcoding....] %d", *is_busy); + LOGD("[Transcoding....] %d", *is_busy); return ret; } @@ -297,33 +300,33 @@ int mm_transcode_cancel(MMHandleType MMHandle) handle_s *handle = (handle_s *)MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->property->is_busy) { - debug_log("Cancel - [IS BUSY]"); + LOGD("Cancel - [IS BUSY]"); ret = _mm_transcode_state_change(handle, GST_STATE_NULL); if (ret != MM_ERROR_NONE) { - debug_error("ERROR - Null Pipeline"); + LOGE("ERROR - Null Pipeline"); return ret; } if ((handle->param) && (strlen(handle->param->outputfile) > 0)) { unlink(handle->param->outputfile); - debug_log("[Cancel] unlink %s", handle->param->outputfile); + LOGD("[Cancel] unlink %s", handle->param->outputfile); } else { - debug_error("unlink error"); + LOGE("unlink error"); return MM_ERROR_TRANSCODE_INTERNAL; } g_mutex_lock(handle->property->thread_mutex); g_cond_signal(handle->property->thread_cond); - debug_log("===> send completed signal <-cancel"); + LOGD("===> send completed signal <-cancel"); g_mutex_unlock(handle->property->thread_mutex); } @@ -339,12 +342,12 @@ int mm_transcode_destroy(MMHandleType MMHandle) handle_s *handle = (handle_s *)MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -353,9 +356,9 @@ int mm_transcode_destroy(MMHandleType MMHandle) if (handle->property->is_busy) { ret = mm_transcode_cancel(MMHandle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Cancel Transcode"); + LOGD("Success - Cancel Transcode"); } else { - debug_error("ERROR - Cancel Transcode"); + LOGE("ERROR - Cancel Transcode"); return FALSE; } } @@ -364,48 +367,48 @@ int mm_transcode_destroy(MMHandleType MMHandle) handle_param_s *param = g_new0(handle_param_s, 1); if (param) { - debug_log("[Try to Push Last Queue]"); + LOGD("[Try to Push Last Queue]"); g_async_queue_push(handle->property->queue, GINT_TO_POINTER(param)); } else { - debug_error("Fail to create Last Queue"); + LOGE("Fail to create Last Queue"); return MM_ERROR_INVALID_ARGUMENT; } ret = _mm_cleanup_signal(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - CleanUp Signal"); + LOGD("Success - CleanUp Signal"); } else { - debug_error("ERROR - CleanUp Signal"); + LOGE("ERROR - CleanUp Signal"); return ret; } ret = _mm_transcode_state_change(handle, GST_STATE_NULL); if (ret != MM_ERROR_NONE) { - debug_error("ERROR - Null Pipeline"); + LOGE("ERROR - Null Pipeline"); return ret; } else { - debug_log("SUCCESS - Null Pipeline"); + LOGD("SUCCESS - Null Pipeline"); } if ((handle->param) && (!handle->param->completed)) { g_cond_signal(handle->property->thread_cond); - debug_log("===> send completed signal <-destroy"); + LOGD("===> send completed signal <-destroy"); g_mutex_unlock(handle->property->thread_mutex); - debug_log("unlock destory"); + LOGD("unlock destory"); if (strlen(handle->param->outputfile) > 0) { unlink(handle->param->outputfile); - debug_log("[Cancel] unlink %s", handle->param->outputfile); + LOGD("[Cancel] unlink %s", handle->param->outputfile); } } ret = _mm_cleanup_pipeline(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - CleanUp Pipeline"); + LOGD("Success - CleanUp Pipeline"); } else { - debug_error("ERROR - CleanUp Pipeline"); + LOGE("ERROR - CleanUp Pipeline"); return ret; } TRANSCODE_FREE(param); - debug_log("[param] free"); + LOGD("[param] free"); return ret; } @@ -417,17 +420,17 @@ int mm_transcode_get_attrs(MMHandleType MMHandle, mm_containerformat_e * contain handle_s *handle = (handle_s *)MMHandle; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!containerformat || !videoencoder || !audioencoder || !current_pos || !duration || !resolution_width || !resolution_height) { - debug_error("[ERROR] - Invalid argument pointer"); + LOGE("[ERROR] - Invalid argument pointer"); return MM_ERROR_INVALID_ARGUMENT; } @@ -436,7 +439,7 @@ int mm_transcode_get_attrs(MMHandleType MMHandle, mm_containerformat_e * contain *audioencoder = handle->property->audioencoder; if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -448,7 +451,9 @@ int mm_transcode_get_attrs(MMHandleType MMHandle, mm_containerformat_e * contain *resolution_width = handle->param->resolution_width; *resolution_height = handle->param->resolution_height; - debug_log("containerformat : %d, videoencoder : %d, audioencoder : %d, current_pos : %d, duration : %d, resolution_width : %d, resolution_height : %d", *containerformat, *videoencoder, *audioencoder, *current_pos, *duration, *resolution_width, *resolution_height); + LOGD("containerformat : %d, videoencoder : %d, audioencoder : %d, current_pos : %lu, duration : %lu, resolution_width : %d, resolution_height : %d", + *containerformat, *videoencoder, *audioencoder, *current_pos, + *duration, *resolution_width, *resolution_height); return ret; } @@ -459,7 +464,7 @@ int mm_transcode_get_supported_container_format(mm_transcode_support_type_callba for (idx = 0; idx < MM_CONTAINER_NUM; idx++) { if (type_callback(idx, user_param) == false) { - debug_error("error occured. idx[%d]", idx); + LOGE("error occured. idx[%d]", idx); break; } } @@ -473,7 +478,7 @@ int mm_transcode_get_supported_video_encoder(mm_transcode_support_type_callback for (idx = 0; idx < MM_VIDEOENCODER_H264; idx++) { if (type_callback(idx, user_param) == false) { - debug_error("error occured. idx[%d]", idx); + LOGE("error occured. idx[%d]", idx); break; } } @@ -487,7 +492,7 @@ int mm_transcode_get_supported_audio_encoder(mm_transcode_support_type_callback for (idx = 0; idx < MM_AUDIOENCODER_NO_USE; idx++) { if (type_callback(idx, user_param) == false) { - debug_error("error occured. idx[%d]", idx); + LOGE("error occured. idx[%d]", idx); break; } } diff --git a/transcode/mm_transcode_codec.c b/transcode/mm_transcode_codec.c old mode 100755 new mode 100644 index 0aae807..a3bebcf --- a/transcode/mm_transcode_codec.c +++ b/transcode/mm_transcode_codec.c @@ -26,29 +26,29 @@ int _mm_encodebin_set_venc_aenc(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->property->mux = malloc(sizeof(gchar) * ENC_BUFFER_SIZE); if (handle->property->mux == NULL) { - debug_error("[NULL] mux"); + LOGE("[NULL] mux"); return MM_ERROR_INVALID_ARGUMENT; } handle->property->venc = malloc(sizeof(gchar) * ENC_BUFFER_SIZE); if (handle->property->venc == NULL) { - debug_error("[NULL] venc"); + LOGE("[NULL] venc"); TRANSCODE_FREE(handle->property->mux); return MM_ERROR_INVALID_ARGUMENT; } handle->property->aenc = malloc(sizeof(gchar) * ENC_BUFFER_SIZE); if (handle->property->aenc == NULL) { - debug_error("[NULL] aenc"); + LOGE("[NULL] aenc"); TRANSCODE_FREE(handle->property->mux); TRANSCODE_FREE(handle->property->venc); return MM_ERROR_INVALID_ARGUMENT; @@ -67,41 +67,41 @@ int _mm_encodebin_set_venc_aenc(handle_s *handle) strncpy(handle->property->mux, MUX3GP, ENC_BUFFER_SIZE - 1); break; default: - debug_error("error container value"); + LOGE("error container value"); break; } switch (handle->property->videoencoder) { case MM_VIDEOENCODER_MPEG4: strncpy(handle->property->venc, AVENCMPEG4, ENC_BUFFER_SIZE - 1); - debug_log("[FFMPEG] %s", handle->property->venc); + LOGD("[FFMPEG] %s", handle->property->venc); break; case MM_VIDEOENCODER_H263: strncpy(handle->property->venc, AVENCH263, ENC_BUFFER_SIZE - 1); - debug_log("[FFMPEG] %s", handle->property->venc); + LOGD("[FFMPEG] %s", handle->property->venc); break; case MM_VIDEOENCODER_NO_USE: - debug_log("No VIDEO"); + LOGD("No VIDEO"); break; default: - debug_error("error videoencoder value"); + LOGE("error videoencoder value"); break; } switch (handle->property->audioencoder) { case MM_AUDIOENCODER_AAC: strncpy(handle->property->aenc, AACENC, ENC_BUFFER_SIZE - 1); - debug_log("[FFMPEG] %s", handle->property->aenc); + LOGD("[FFMPEG] %s", handle->property->aenc); break; case MM_AUDIOENCODER_AMR: strncpy(handle->property->aenc, AMRENC, ENC_BUFFER_SIZE - 1); - debug_log("[FFMPEG] %s", handle->property->aenc); + LOGD("[FFMPEG] %s", handle->property->aenc); break; case MM_AUDIOENCODER_NO_USE: - debug_log("No AUDIO"); + LOGD("No AUDIO"); break; default: - debug_error("error audioencoder value"); + LOGE("error audioencoder value"); break; } return ret; diff --git a/transcode/mm_transcode_pipeline.c b/transcode/mm_transcode_pipeline.c old mode 100755 new mode 100644 index a6ece61..0db068a --- a/transcode/mm_transcode_pipeline.c +++ b/transcode/mm_transcode_pipeline.c @@ -46,36 +46,36 @@ int _mm_cleanup_encodebin(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->encodebin->encvideopad) { gst_object_unref(GST_OBJECT(handle->encodebin->encvideopad)); handle->encodebin->encvideopad = NULL; - debug_log("Success - gst_object_unref (encvideopad)"); + LOGD("Success - gst_object_unref (encvideopad)"); } if (handle->encodebin->encaudiopad) { gst_object_unref(GST_OBJECT(handle->encodebin->encaudiopad)); handle->encodebin->encaudiopad = NULL; - debug_log("Success - gst_object_unref (encaudiopad)"); + LOGD("Success - gst_object_unref (encaudiopad)"); } if (handle->property->caps) { gst_caps_unref(handle->property->caps); handle->property->caps = NULL; - debug_log("gst_caps_unref"); + LOGD("gst_caps_unref"); } return ret; @@ -86,12 +86,12 @@ int _mm_cleanup_signal(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -108,31 +108,31 @@ int _mm_cleanup_signal(handle_s *handle) if (handle->property->audio_cb_probe_id) { g_source_remove(handle->property->audio_cb_probe_id); handle->property->audio_cb_probe_id = 0; - debug_log("g_source_remove (audio_cb_probe_id)"); + LOGD("g_source_remove (audio_cb_probe_id)"); } if (handle->property->video_cb_probe_id) { g_source_remove(handle->property->video_cb_probe_id); handle->property->video_cb_probe_id = 0; - debug_log("g_source_remove (video_cb_probe_id)"); + LOGD("g_source_remove (video_cb_probe_id)"); } if (handle->property->progrss_event_id) { g_source_remove(handle->property->progrss_event_id); handle->property->progrss_event_id = 0; - debug_log("g_source_remove (progrss_event_id)"); + LOGD("g_source_remove (progrss_event_id)"); } if (handle->encodebin->audio_event_probe_id) { g_source_remove(handle->encodebin->audio_event_probe_id); handle->encodebin->audio_event_probe_id = 0; - debug_log("g_source_remove (audio_event_probe_id)"); + LOGD("g_source_remove (audio_event_probe_id)"); } if (handle->encodebin->video_event_probe_id) { g_source_remove(handle->encodebin->video_event_probe_id); handle->encodebin->video_event_probe_id = 0; - debug_log("g_source_remove (video_event_probe_id)"); + LOGD("g_source_remove (video_event_probe_id)"); } return ret; @@ -144,56 +144,56 @@ int _mm_cleanup_pipeline(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->property->_MMHandle = 0; /* g_thread_exit(handle->thread); */ - debug_log("g_thread_exit"); + LOGD("g_thread_exit"); if (handle->property->thread) { g_thread_join(handle->property->thread); - debug_log("Success - join (thread)"); + LOGD("Success - join (thread)"); } /* disconnecting bus watch */ if (handle->property->bus_watcher) { g_source_remove(handle->property->bus_watcher); - debug_log("g_source_remove"); + LOGD("g_source_remove"); handle->property->bus_watcher = 0; } if (handle->property->queue) { g_async_queue_unref(handle->property->queue); handle->property->queue = NULL; - debug_log("Success - g_async_queue_unref(queue)"); + LOGD("Success - g_async_queue_unref(queue)"); } if (handle->property->thread_mutex) { g_mutex_clear(handle->property->thread_mutex); g_free(handle->property->thread_mutex); handle->property->thread_mutex = NULL; - debug_log("Success - free (thread_mutex)"); + LOGD("Success - free (thread_mutex)"); } if (handle->property->thread_cond) { g_cond_clear(handle->property->thread_cond); g_free(handle->property->thread_cond); handle->property->thread_cond = NULL; - debug_log("Success - free (thread_cond)"); + LOGD("Success - free (thread_cond)"); } if (handle->property->thread_exit_mutex) { g_mutex_clear(handle->property->thread_exit_mutex); g_free(handle->property->thread_exit_mutex); handle->property->thread_exit_mutex = NULL; - debug_log("Success - free (thread_exit_mutex)"); + LOGD("Success - free (thread_exit_mutex)"); } /* release videopad */ @@ -201,25 +201,25 @@ int _mm_cleanup_pipeline(handle_s *handle) if (handle->decoder_vidp->decvideosinkpad) { gst_object_unref(GST_OBJECT(handle->decoder_vidp->decvideosinkpad)); handle->decoder_vidp->decvideosinkpad = NULL; - debug_log("Success - gt_object_unref (decvideosinkpad)"); + LOGD("Success - gt_object_unref (decvideosinkpad)"); } if (handle->decoder_vidp->decvideosrcpad) { gst_object_unref(GST_OBJECT(handle->decoder_vidp->decvideosrcpad)); handle->decoder_vidp->decvideosrcpad = NULL; - debug_log("Success - gst_object_unref (decvideosrcpad)"); + LOGD("Success - gst_object_unref (decvideosrcpad)"); } if (handle->decoder_vidp->srcdecvideopad) { gst_object_unref(GST_OBJECT(handle->decoder_vidp->srcdecvideopad)); handle->decoder_vidp->srcdecvideopad = NULL; - debug_log("Success - gst_object_unref (srcdecvideopad)"); + LOGD("Success - gst_object_unref (srcdecvideopad)"); } if (handle->decoder_vidp->sinkdecvideopad) { gst_object_unref(GST_OBJECT(handle->decoder_vidp->sinkdecvideopad)); handle->decoder_vidp->sinkdecvideopad = NULL; - debug_log("Success - gst_object_unref (sinkdecvideopad)"); + LOGD("Success - gst_object_unref (sinkdecvideopad)"); } } @@ -228,45 +228,45 @@ int _mm_cleanup_pipeline(handle_s *handle) if (handle->decoder_audp->decaudiosinkpad) { gst_object_unref(GST_OBJECT(handle->decoder_audp->decaudiosinkpad)); handle->decoder_audp->decaudiosinkpad = NULL; - debug_log("Success - gst_object_unref (decaudiosinkpad)"); + LOGD("Success - gst_object_unref (decaudiosinkpad)"); } if (handle->decoder_audp->decaudiosrcpad) { gst_object_unref(GST_OBJECT(handle->decoder_audp->decaudiosrcpad)); handle->decoder_audp->decaudiosrcpad = NULL; - debug_log("Success - gst_object_unref (decaudiosrcpad)"); + LOGD("Success - gst_object_unref (decaudiosrcpad)"); } if (handle->decoder_audp->srcdecaudiopad) { gst_object_unref(GST_OBJECT(handle->decoder_audp->srcdecaudiopad)); handle->decoder_audp->srcdecaudiopad = NULL; - debug_log("Success - gst_object_unref (srcdecaudiopad)"); + LOGD("Success - gst_object_unref (srcdecaudiopad)"); } if (handle->decoder_audp->sinkdecaudiopad) { gst_object_unref(GST_OBJECT(handle->decoder_audp->sinkdecaudiopad)); handle->decoder_audp->sinkdecaudiopad = NULL; - debug_log("Success - gst_object_unref (sinkdecaudiopad)"); + LOGD("Success - gst_object_unref (sinkdecaudiopad)"); } } if (_mm_cleanup_encodebin(handle) != MM_ERROR_NONE) { - debug_error("ERROR -Play Pipeline"); + LOGE("ERROR -Play Pipeline"); return FALSE; } else { - debug_log("Success -clean encodebin"); + LOGD("Success -clean encodebin"); } if (handle->property->sink_elements) { g_list_free(handle->property->sink_elements); handle->property->sink_elements = NULL; - debug_log("Success - g_list_free (sink_elements)"); + LOGD("Success - g_list_free (sink_elements)"); } if (handle->pipeline) { gst_object_unref(handle->pipeline); handle->pipeline = NULL; - debug_log("Success - gst_object_unref (pipeline)"); + LOGD("Success - gst_object_unref (pipeline)"); } TRANSCODE_FREE(handle->property->mux); @@ -285,18 +285,18 @@ static void _mm_decode_add_sink(handle_s *handle, GstElement *sink_elements) { if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } if (sink_elements) { handle->property->sink_elements = g_list_append(handle->property->sink_elements, sink_elements); - debug_log("g_list_append"); + LOGD("g_list_append"); } } @@ -306,29 +306,29 @@ static int _mm_decode_audio_output_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->decoder_audp) { - debug_error("[ERROR] - handle decoder audio process bin"); + LOGE("[ERROR] - handle decoder audio process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_audp->decaudiobin = gst_bin_new("audiobin"); if (!handle->decoder_audp->decaudiobin) { - debug_error("decaudiobin could not be created"); + LOGE("decaudiobin could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_audp->decsinkaudioqueue = gst_element_factory_make("queue", "decsinkaudioqueue"); if (!handle->decoder_audp->decsinkaudioqueue) { - debug_error("decsinkaudioqueue could not be created"); + LOGE("decsinkaudioqueue could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -336,28 +336,28 @@ static int _mm_decode_audio_output_create(handle_s *handle) handle->decoder_audp->decaudiosinkpad = gst_element_get_static_pad(handle->decoder_audp->decsinkaudioqueue, "sink"); if (!handle->decoder_audp->decaudiosinkpad) { - debug_error("decaudiosinkpad could not be created"); + LOGE("decaudiosinkpad could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) { - debug_log("[MM_AUDIOENCODER_NO_USE] fakesink create"); + LOGD("[MM_AUDIOENCODER_NO_USE] fakesink create"); handle->decoder_audp->audiofakesink = gst_element_factory_make("fakesink", "audiofakesink"); if (!handle->decoder_audp->audiofakesink) { - debug_error("fakesink element could not be created"); + LOGE("fakesink element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } } else { handle->decoder_audp->aconv = gst_element_factory_make("audioconvert", "aconv"); if (!handle->decoder_audp->aconv) { - debug_error("decaudiobin element could not be created"); + LOGE("decaudiobin element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_audp->valve = gst_element_factory_make("valve", "valve"); if (!handle->decoder_audp->valve) { - debug_error("decaudiobin element could not be created"); + LOGE("decaudiobin element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -365,19 +365,19 @@ static int _mm_decode_audio_output_create(handle_s *handle) handle->decoder_audp->resample = gst_element_factory_make("audioresample", "audioresample"); if (!handle->decoder_audp->resample) { - debug_error("decaudiobin element could not be created"); + LOGE("decaudiobin element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_audp->audflt = gst_element_factory_make("capsfilter", "afilter"); if (!handle->decoder_audp->audflt) { - debug_error("audflt element could not be created"); + LOGE("audflt element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_audp->decaudiosrcpad = gst_element_get_static_pad(handle->decoder_audp->audflt, "src"); if (!handle->decoder_audp->decaudiosrcpad) { - debug_error("decaudiosrcpad element could not be created"); + LOGE("decaudiosrcpad element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } } @@ -390,26 +390,26 @@ static int _mm_decode_audio_output_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->decoder_audp) { - debug_error("[ERROR] - handle decoder audio process bin"); + LOGE("[ERROR] - handle decoder audio process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) { - debug_log("[MM_AUDIOENCODER_NO_USE] fakesink pad create"); + LOGD("[MM_AUDIOENCODER_NO_USE] fakesink pad create"); gst_bin_add_many(GST_BIN(handle->decoder_audp->decaudiobin), handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->audiofakesink, NULL); if (!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->audiofakesink, NULL)) { - debug_error("[Audio Output Bin] gst_element_link_many failed"); + LOGE("[Audio Output Bin] gst_element_link_many failed"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -419,7 +419,7 @@ static int _mm_decode_audio_output_link(handle_s *handle) } else { gst_bin_add_many(GST_BIN(handle->decoder_audp->decaudiobin), handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->valve, handle->decoder_audp->aconv, handle->decoder_audp->resample, handle->decoder_audp->audflt, NULL); if (!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->valve, handle->decoder_audp->aconv, handle->decoder_audp->resample, handle->decoder_audp->audflt, NULL)) { - debug_error("[Audio Output Bin] gst_element_link_many failed"); + LOGE("[Audio Output Bin] gst_element_link_many failed"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -433,7 +433,7 @@ static int _mm_decode_audio_output_link(handle_s *handle) handle->property->audio_cb_probe_id = gst_pad_add_probe(handle->decoder_audp->sinkdecaudiopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_audio_output_stream_probe, handle, NULL); /* must use sinkpad (sinkpad => srcpad) for normal resized video buffer */ - debug_log("audio_cb_probe_id: %d", handle->property->audio_cb_probe_id); + LOGD("audio_cb_probe_id: %lu", handle->property->audio_cb_probe_id); } gst_bin_add(GST_BIN(handle->pipeline), handle->decoder_audp->decaudiobin); @@ -445,29 +445,29 @@ static int _mm_decode_video_output_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_vidp->decvideobin = gst_bin_new("videobin"); if (!handle->decoder_vidp->decvideobin) { - debug_error("decvideobin could not be created. Exiting"); + LOGE("decvideobin could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_vidp->decsinkvideoqueue = gst_element_factory_make("queue", "decsinkvideoqueue"); if (!handle->decoder_vidp->decsinkvideoqueue) { - debug_error("decsinkvideoqueue element could not be created. Exiting"); + LOGE("decsinkvideoqueue element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -475,13 +475,13 @@ static int _mm_decode_video_output_create(handle_s *handle) handle->decoder_vidp->decvideosinkpad = gst_element_get_static_pad(handle->decoder_vidp->decsinkvideoqueue, "sink"); if (!handle->decoder_vidp->decvideosinkpad) { - debug_error("decvideosinkpad element could not be created. Exiting"); + LOGE("decvideosinkpad element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_vidp->videorate = gst_element_factory_make("videorate", "videorate"); if (!handle->decoder_vidp->videorate) { - debug_error("videorate element could not be created. Exiting"); + LOGE("videorate element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -490,7 +490,7 @@ static int _mm_decode_video_output_create(handle_s *handle) handle->decoder_vidp->videoscale = gst_element_factory_make("videoscale", "scaler"); if (!handle->decoder_vidp->videoscale) { - debug_error("videoscale element could not be created. Exiting"); + LOGE("videoscale element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } /* Configure videoscale to use 4-tap scaling for higher quality */ @@ -498,13 +498,13 @@ static int _mm_decode_video_output_create(handle_s *handle) handle->decoder_vidp->vidflt = gst_element_factory_make("capsfilter", "vfilter"); if (!handle->decoder_vidp->vidflt) { - debug_error("One element could not be created. Exiting"); + LOGE("One element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->decoder_vidp->decvideosrcpad = gst_element_get_static_pad(handle->decoder_vidp->vidflt, "src"); if (!handle->decoder_vidp->decvideosrcpad) { - debug_error("decvideosrcpad element could not be created. Exiting"); + LOGE("decvideosrcpad element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -516,18 +516,18 @@ static int _mm_decode_video_output_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } gst_bin_add_many(GST_BIN(handle->decoder_vidp->decvideobin), handle->decoder_vidp->decsinkvideoqueue, handle->decoder_vidp->videoscale, handle->decoder_vidp->videorate, handle->decoder_vidp->vidflt, NULL); if (!gst_element_link_many(handle->decoder_vidp->decsinkvideoqueue, handle->decoder_vidp->videoscale, handle->decoder_vidp->videorate, handle->decoder_vidp->vidflt, NULL)) { - debug_error("[Video Output Bin] gst_element_link_many failed"); + LOGE("[Video Output Bin] gst_element_link_many failed"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -539,7 +539,7 @@ static int _mm_decode_video_output_link(handle_s *handle) handle->property->video_cb_probe_id = gst_pad_add_probe(handle->decoder_vidp->sinkdecvideopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_video_output_stream_probe, handle, NULL); /* must use sinkpad (sinkpad => srcpad) */ - debug_log("video_cb_probe_sink_id: %d", handle->property->video_cb_probe_id); + LOGD("video_cb_probe_sink_id: %lu", handle->property->video_cb_probe_id); gst_bin_add(GST_BIN(handle->pipeline), handle->decoder_vidp->decvideobin); @@ -554,7 +554,7 @@ static int _mm_decodebin_pipeline_create(handle_s *handle) handle->decodebin = gst_element_factory_make("decodebin", "decoder"); if (!handle->decodebin) { - debug_error("decbin element could not be created. Exiting"); + LOGE("decbin element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -569,39 +569,39 @@ int _mm_decodesrcbin_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->decoder_audp) { - debug_error("[ERROR] - handle decoder audio process bin"); + LOGE("[ERROR] - handle decoder audio process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } ret = _mm_filesrc_pipeline_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create filesrc pipeline"); + LOGD("Success - Create filesrc pipeline"); } else { - debug_error("ERROR -Create filesrc pipeline"); + LOGE("ERROR -Create filesrc pipeline"); return ret; } if (handle->property->has_audio_stream) { ret = _mm_decode_audio_output_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create audiobin pipeline: 0x%2x", handle->decoder_audp->decaudiobin); + LOGD("Success - Create audiobin pipeline: %p", handle->decoder_audp->decaudiobin); } else { - debug_error("ERROR - Create audiobin pipeline"); + LOGE("ERROR - Create audiobin pipeline"); return ret; } } @@ -609,18 +609,18 @@ int _mm_decodesrcbin_create(handle_s *handle) if (handle->property->has_video_stream) { ret = _mm_decode_video_output_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create videobin pipeline: 0x%2x", handle->decoder_vidp->decvideobin); + LOGD("Success - Create videobin pipeline: %p", handle->decoder_vidp->decvideobin); } else { - debug_error("ERROR -Create videobin pipeline"); + LOGE("ERROR -Create videobin pipeline"); return ret; } } ret = _mm_decodebin_pipeline_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create decodebin pipeline"); + LOGD("Success - Create decodebin pipeline"); } else { - debug_error("ERROR - Create decodebin pipeline"); + LOGE("ERROR - Create decodebin pipeline"); return ret; } @@ -632,29 +632,29 @@ int _mm_decodesrcbin_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } ret = _mm_filesrc_decodebin_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - _mm_filesrc_decodebin_link"); + LOGD("Success - _mm_filesrc_decodebin_link"); } else { - debug_error("ERROR - _mm_filesrc_decodebin_link"); + LOGE("ERROR - _mm_filesrc_decodebin_link"); return ret; } if (handle->property->has_audio_stream) { ret = _mm_decode_audio_output_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - _mm_decode_audio_output_link"); + LOGD("Success - _mm_decode_audio_output_link"); } else { - debug_error("ERROR - _mm_decode_audio_output_link"); + LOGE("ERROR - _mm_decode_audio_output_link"); return ret; } } @@ -662,9 +662,9 @@ int _mm_decodesrcbin_link(handle_s *handle) if (handle->property->has_video_stream) { ret = _mm_decode_video_output_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - _mm_decode_video_output_link"); + LOGD("Success - _mm_decode_video_output_link"); } else { - debug_error("ERROR - _mm_decode_video_output_link"); + LOGE("ERROR - _mm_decode_video_output_link"); return ret; } } @@ -677,59 +677,59 @@ int _mm_encodebin_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } handle->encodebin->encbin = gst_element_factory_make("encodebin", "encodebin"); if (!handle->encodebin->encbin) { - debug_error("encbin element could not be created"); + LOGE("encbin element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE && handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) { ret = _mm_encodebin_set_video_property(handle); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Setup encodebin video property"); + LOGE("ERROR -Setup encodebin video property"); return ret; } ret = _mm_encodebin_set_audio_property(handle); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Setup encodebin audio property"); + LOGE("ERROR -Setup encodebin audio property"); return ret; } } else if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) { ret = _mm_encodebin_set_video_property(handle); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Setup encodebin video property"); + LOGE("ERROR -Setup encodebin video property"); return ret; } } else if (handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) { handle->encodebin->encodebin_profile = 1; - debug_log("[AUDIO ONLY ENCODE]"); + LOGD("[AUDIO ONLY ENCODE]"); ret = _mm_encodebin_set_audio_property(handle); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Setup encodebin video property"); + LOGE("ERROR -Setup encodebin video property"); return ret; } } - debug_log("[Encodebin Profile: %d]", handle->encodebin->encodebin_profile); + LOGD("[Encodebin Profile: %d]", handle->encodebin->encodebin_profile); ret = _mm_encodebin_set_property(handle); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Setup encodebin property"); + LOGE("ERROR -Setup encodebin property"); return ret; } @@ -741,17 +741,17 @@ int _mm_encodebin_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -762,11 +762,11 @@ int _mm_encodebin_link(handle_s *handle) if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) { handle->encodebin->encvideopad = gst_element_get_request_pad(handle->encodebin->encbin, "video"); if (handle->encodebin->encvideopad) { - debug_log("encvideopad: 0x%2x", handle->encodebin->encvideopad); + LOGD("encvideopad: %p", handle->encodebin->encvideopad); gst_pad_link(handle->decoder_vidp->srcdecvideopad, handle->encodebin->encvideopad); handle->encodebin->audio_event_probe_id = gst_pad_add_probe(handle->encodebin->encvideopad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, _mm_cb_encodebin_sinkpad_event_probe, handle, NULL); } else { - debug_error("error encvideopad"); + LOGE("error encvideopad"); return MM_ERROR_TRANSCODE_INTERNAL; } } @@ -776,11 +776,11 @@ int _mm_encodebin_link(handle_s *handle) if (handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) { handle->encodebin->encaudiopad = gst_element_get_request_pad(handle->encodebin->encbin, "audio"); if (handle->encodebin->encaudiopad) { - debug_log("encaudiopad: 0x%2x", handle->encodebin->encaudiopad); + LOGD("encaudiopad: %p", handle->encodebin->encaudiopad); gst_pad_link(handle->decoder_audp->srcdecaudiopad, handle->encodebin->encaudiopad); handle->encodebin->audio_event_probe_id = gst_pad_add_probe(handle->encodebin->encaudiopad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, _mm_cb_encodebin_sinkpad_event_probe, handle, NULL); } else { - debug_error("error encaudiopad"); + LOGE("error encaudiopad"); return MM_ERROR_TRANSCODE_INTERNAL; } } @@ -794,17 +794,17 @@ static int _mm_encodebin_set_audio_property(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -812,25 +812,25 @@ static int _mm_encodebin_set_audio_property(handle_s *handle) /* Audio */ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ARS)) { g_object_set(G_OBJECT(handle->encodebin->encbin), ARS, 0, NULL); - debug_log("[AUDIO RESAMPLE] encbin set auto-audio-resample"); + LOGD("[AUDIO RESAMPLE] encbin set auto-audio-resample"); } else { - debug_error("error [AUDIO RESAMPLE] encbin set auto-audio-resample"); + LOGE("error [AUDIO RESAMPLE] encbin set auto-audio-resample"); return MM_ERROR_TRANSCODE_INTERNAL; } if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACON)) { g_object_set(G_OBJECT(handle->encodebin->encbin), ACON, 1, NULL); - debug_log("encbin set auto-audio-convert"); + LOGD("encbin set auto-audio-convert"); } else { - debug_error("error encbin set auto-audio-convert"); + LOGE("error encbin set auto-audio-convert"); return MM_ERROR_TRANSCODE_INTERNAL; } if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), AENC)) { g_object_set(G_OBJECT(handle->encodebin->encbin), AENC, handle->property->aenc, NULL); - debug_log("[AUDIOENCODER] encbin set [%s: %s]", AENC, handle->property->aenc); + LOGD("[AUDIOENCODER] encbin set [%s: %s]", AENC, handle->property->aenc); } else { - debug_error("error [AUDIOENCODER] encbin set [%s: %s]", AENC, handle->property->aenc); + LOGE("error [AUDIOENCODER] encbin set [%s: %s]", AENC, handle->property->aenc); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -838,7 +838,7 @@ static int _mm_encodebin_set_audio_property(handle_s *handle) g_object_set(G_OBJECT(gst_bin_get_by_name(GST_BIN(handle->encodebin->encbin), "audio_encode")), AACCOMPLIANCE, AACCOMPLIANCELEVEL, NULL); g_object_get(G_OBJECT(handle->encodebin->encbin), "use-aenc-queue", &(handle->encodebin->aencqueue), NULL); - debug_log("aencqueue : %s", GST_ELEMENT_NAME(handle->encodebin->aencqueue)); + LOGD("aencqueue : %s", GST_ELEMENT_NAME(handle->encodebin->aencqueue)); } return ret; @@ -849,33 +849,33 @@ static int _mm_encodebin_set_property(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), PROFILE)) { g_object_set(G_OBJECT(handle->encodebin->encbin), PROFILE, handle->encodebin->encodebin_profile, NULL); - debug_log("encbin set profile"); + LOGD("encbin set profile"); } else { - debug_error("error handle->encbin set profile"); + LOGE("error handle->encbin set profile"); return MM_ERROR_TRANSCODE_INTERNAL; } if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), MUX)) { g_object_set(G_OBJECT(handle->encodebin->encbin), MUX, handle->property->mux, NULL); - debug_log("[MUX] encbin set [%s: %s]", MUX, handle->property->mux); + LOGD("[MUX] encbin set [%s: %s]", MUX, handle->property->mux); } else { - debug_error("error [MUX] set [%s: %s]", MUX, handle->property->mux); + LOGE("error [MUX] set [%s: %s]", MUX, handle->property->mux); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -887,17 +887,17 @@ static int _mm_encodebin_set_video_property(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -905,22 +905,22 @@ static int _mm_encodebin_set_video_property(handle_s *handle) /* Video */ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACS)) { g_object_set(G_OBJECT(handle->encodebin->encbin), ACS, 0, NULL); - debug_log("[AUTO COLORSPACE] encbin set auto-colorspace"); + LOGD("[AUTO COLORSPACE] encbin set auto-colorspace"); } else { - debug_error("error [AUTO COLORSPACE] encbin set auto-colorspace"); + LOGE("error [AUTO COLORSPACE] encbin set auto-colorspace"); return MM_ERROR_TRANSCODE_INTERNAL; } if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), VENC)) { g_object_set(G_OBJECT(handle->encodebin->encbin), VENC, handle->property->venc, NULL); - debug_log("[VIDEOENCODER] encbin set [%s: %s]", VENC, handle->property->venc); + LOGD("[VIDEOENCODER] encbin set [%s: %s]", VENC, handle->property->venc); } else { - debug_error("error [VIDEOENCODER] set [%s: %s]", VENC, handle->property->venc); + LOGE("error [VIDEOENCODER] set [%s: %s]", VENC, handle->property->venc); return MM_ERROR_TRANSCODE_INTERNAL; } g_object_get(G_OBJECT(handle->encodebin->encbin), "use-venc-queue", &(handle->encodebin->vencqueue), NULL); - debug_log("vencqueue : %s", GST_ELEMENT_NAME(handle->encodebin->vencqueue)); + LOGD("vencqueue : %s", GST_ELEMENT_NAME(handle->encodebin->vencqueue)); } return ret; @@ -931,18 +931,18 @@ int _mm_filesink_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } handle->filesink = gst_element_factory_make("filesink", "filesink"); if (!handle->filesink) { - debug_error("filesink element could not be created"); + LOGE("filesink element could not be created"); return MM_ERROR_TRANSCODE_INTERNAL; } - debug_log("[sync]"); + LOGD("[sync]"); g_object_set(G_OBJECT(handle->filesink), "sync", TRUE, NULL); g_object_set(G_OBJECT(handle->filesink), "async", FALSE, NULL); @@ -954,12 +954,12 @@ int _mm_filesink_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -968,10 +968,10 @@ int _mm_filesink_link(handle_s *handle) /* link encodebin and filesink */ if (!gst_element_link(handle->encodebin->encbin, handle->filesink)) { - debug_error("gst_element_link [encbin ! filesink] failed"); + LOGE("gst_element_link [encbin ! filesink] failed"); return MM_ERROR_TRANSCODE_INTERNAL; } else { - debug_log("gst_element_link [encbin ! filesink]"); + LOGD("gst_element_link [encbin ! filesink]"); } return ret; @@ -984,16 +984,16 @@ static int _mm_filesrc_pipeline_create(handle_s *handle) handle->filesrc = gst_element_factory_make("filesrc", "source"); if (!handle->filesrc) { - debug_error("filesrc element could not be created. Exiting"); + LOGE("filesrc element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } - debug_log("sourcefile: %s", handle->property->sourcefile); + LOGD("sourcefile: %s", handle->property->sourcefile); g_object_set(G_OBJECT(handle->filesrc), "location", handle->property->sourcefile, NULL); return ret; @@ -1004,7 +1004,7 @@ static int _mm_filesrc_decodebin_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } @@ -1012,7 +1012,7 @@ static int _mm_filesrc_decodebin_link(handle_s *handle) gst_bin_add_many(GST_BIN(handle->pipeline), handle->filesrc, handle->decodebin, NULL); if (!gst_element_link_many(handle->filesrc, handle->decodebin, NULL)) { - debug_error("gst_element_link_many src ! decbin failed"); + LOGE("gst_element_link_many src ! decbin failed"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -1024,22 +1024,22 @@ int _mm_transcode_preset_capsfilter(handle_s *handle, unsigned int resolution_wi int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (handle->decoder_vidp->vidflt) { - debug_log("[Resolution] Output Width: [%d], Output Height: [%d]", resolution_width, resolution_height); + LOGD("[Resolution] Output Width: [%d], Output Height: [%d]", resolution_width, resolution_height); if (resolution_width == 0 || resolution_height == 0) g_object_set(G_OBJECT(handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple("video/x-raw", "format", G_TYPE_STRING, "I420", NULL), NULL); @@ -1055,15 +1055,15 @@ int _mm_setup_pipeline(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } handle->pipeline = gst_pipeline_new("TransCode"); - debug_log("Success - pipeline"); + LOGD("Success - pipeline"); if (!handle->pipeline) { - debug_error("pipeline could not be created. Exiting"); + LOGE("pipeline could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } diff --git a/transcode/mm_transcode_seek.c b/transcode/mm_transcode_seek.c old mode 100755 new mode 100644 index 26d1788..9d1a099 --- a/transcode/mm_transcode_seek.c +++ b/transcode/mm_transcode_seek.c @@ -35,12 +35,12 @@ GstPadProbeReturn _mm_cb_audio_output_stream_probe(GstPad *pad, GstPadProbeInfo handle_s *handle = (handle_s *)user_data; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return GST_PAD_PROBE_REMOVE; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return GST_PAD_PROBE_REMOVE; } @@ -78,12 +78,12 @@ GstPadProbeReturn _mm_cb_video_output_stream_probe(GstPad *pad, GstPadProbeInfo handle_s *handle = (handle_s *)user_data; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return GST_PAD_PROBE_REMOVE; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return GST_PAD_PROBE_REMOVE; } @@ -121,17 +121,17 @@ GstPadProbeReturn _mm_cb_encodebin_sinkpad_event_probe(GstPad *pad, GstPadProbeI GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info); if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return GST_PAD_PROBE_REMOVE; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return GST_PAD_PROBE_REMOVE; } if (!event) { - debug_error("[ERROR] - event"); + LOGE("[ERROR] - event"); return GST_PAD_PROBE_REMOVE; } @@ -151,7 +151,7 @@ GstPadProbeReturn _mm_cb_encodebin_sinkpad_event_probe(GstPad *pad, GstPadProbeI gst_event_unref(event); if (!new_segment) { - debug_error("[ERROR] segment copy error"); + LOGE("[ERROR] segment copy error"); return GST_PAD_PROBE_REMOVE; } @@ -178,12 +178,12 @@ GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement *element, G const gchar *caps_str = NULL; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -191,30 +191,28 @@ GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement *element, G if (g_strrstr(caps_str, "audio")) { handle->property->audiodecodename = (char *)malloc(sizeof(char) * ENC_BUFFER_SIZE); if (handle->property->audiodecodename == NULL) { - debug_error("audiodecodename is NULL"); + LOGE("audiodecodename is NULL"); return GST_AUTOPLUG_SELECT_TRY; } memset(handle->property->audiodecodename, 0, ENC_BUFFER_SIZE); - strncpy(handle->property->audiodecodename, feature_name, ENC_BUFFER_SIZE - 1); - handle->property->audiodecodename[ENC_BUFFER_SIZE] = '\0'; - debug_log("[audio decode name %s : %s]", caps_str, handle->property->audiodecodename); + g_strlcpy(handle->property->audiodecodename, feature_name, ENC_BUFFER_SIZE); + LOGD("[audio decode name %s : %s]", caps_str, handle->property->audiodecodename); } if (g_strrstr(caps_str, "video")) { if (g_strrstr(feature_name, "omx") || g_strrstr(feature_name, "sprd") || g_strrstr(feature_name, "v4l2")) { /* emit autoplug-select to see what we should do with it. */ - debug_log("SKIP %s Codec", feature_name); + LOGD("SKIP %s Codec", feature_name); return GST_AUTOPLUG_SELECT_SKIP; } handle->property->videodecodename = (char *)malloc(sizeof(char) * ENC_BUFFER_SIZE); if (handle->property->videodecodename == NULL) { - debug_error("videodecodename is NULL"); + LOGE("videodecodename is NULL"); return GST_AUTOPLUG_SELECT_TRY; } memset(handle->property->videodecodename, 0, ENC_BUFFER_SIZE); - strncpy(handle->property->videodecodename, feature_name, ENC_BUFFER_SIZE - 1); - handle->property->videodecodename[ENC_BUFFER_SIZE] = '\0'; - debug_log("[video decode name %s : %s]", caps_str, handle->property->videodecodename); + g_strlcpy(handle->property->videodecodename, feature_name, ENC_BUFFER_SIZE); + LOGD("[video decode name %s : %s]", caps_str, handle->property->videodecodename); } /* Try factory. */ @@ -224,36 +222,36 @@ GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement *element, G void _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, handle_s *handle) { if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder_vidp"); + LOGE("[ERROR] - handle decoder_vidp"); return; } if (!handle->decoder_audp) { - debug_error("[ERROR] - handle decoder_audp"); + LOGE("[ERROR] - handle decoder_audp"); return; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } - debug_log("[============ new-decoded-pad ============]"); + LOGD("[============ new-decoded-pad ============]"); handle->property->caps = gst_pad_query_caps(pad, NULL); const gchar *mime = _mm_check_media_type(handle->property->caps); if (!mime) { - debug_error("[ERROR] - mime"); + LOGE("[ERROR] - mime"); return; } @@ -262,12 +260,12 @@ void _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, handle_s /* link videopad */ if (gst_pad_is_linked(pad)) { - debug_log("pad liked"); + LOGD("pad liked"); } else { if (gst_pad_link(pad, (GstPad *) handle->decoder_vidp->sinkdecvideopad) != GST_PAD_LINK_OK) - debug_error("Error [pad - sinkdecvideopad]"); + LOGE("Error [pad - sinkdecvideopad]"); else - debug_log("Success [pad - sinkdecvideopad]"); + LOGD("Success [pad - sinkdecvideopad]"); } } else if (g_strrstr(mime, "audio")) { @@ -275,16 +273,16 @@ void _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, handle_s /* link audiopad */ if (gst_pad_is_linked(pad)) { - debug_log("pad liked"); + LOGD("pad liked"); } else { if (gst_pad_link(pad, (GstPad *) handle->decoder_audp->sinkdecaudiopad) != GST_PAD_LINK_OK) - debug_error("Error [pad - sinkdecaudiopad]"); + LOGE("Error [pad - sinkdecaudiopad]"); else - debug_log("Success [pad - sinkdecaudiopad]"); + LOGD("Success [pad - sinkdecaudiopad]"); } } else { - debug_log("gst structure error"); + LOGD("gst structure error"); } } @@ -294,12 +292,12 @@ gboolean _mm_cb_print_position(handle_s *handle) gint64 pos; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return FALSE; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return FALSE; } @@ -348,12 +346,12 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return FALSE; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return FALSE; } @@ -369,17 +367,17 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat gst_message_parse_error(message, &err, &debug); if (!err) { - debug_warning("Fail to parse error message"); + LOGW("Fail to parse error message"); break; } - debug_error("[Source: %s] Error: %s", GST_OBJECT_NAME(GST_OBJECT_CAST(GST_ELEMENT(GST_MESSAGE_SRC(message)))), err->message); + LOGE("[Source: %s] Error: %s", GST_OBJECT_NAME(GST_OBJECT_CAST(GST_ELEMENT(GST_MESSAGE_SRC(message)))), err->message); ret = mm_transcode_cancel(MMHandle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Cancel Transcode"); + LOGD("Success - Cancel Transcode"); } else { - debug_error("ERROR - Cancel Transcode"); + LOGE("ERROR - Cancel Transcode"); return FALSE; } @@ -400,41 +398,41 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat GstState State_Old, State_New, State_Pending; gst_message_parse_state_changed(message, &State_Old, &State_New, &State_Pending); - debug_log("[Source: %s] [State: %d -> %d]", GST_OBJECT_NAME(GST_OBJECT_CAST(GST_ELEMENT(GST_MESSAGE_SRC(message)))), State_Old, State_New); + LOGD("[Source: %s] [State: %d -> %d]", GST_OBJECT_NAME(GST_OBJECT_CAST(GST_ELEMENT(GST_MESSAGE_SRC(message)))), State_Old, State_New); if (State_Old == GST_STATE_NULL && State_New == GST_STATE_READY) { - debug_log("[Set State: Pause]"); + LOGD("[Set State: Pause]"); /* Pause Transcode */ ret = _mm_transcode_state_change(handle, GST_STATE_PAUSED); if (ret == MM_ERROR_NONE) { - debug_log("Success - Pause pipeline"); + LOGD("Success - Pause pipeline"); } else { - debug_error("ERROR - Pause pipeline"); + LOGE("ERROR - Pause pipeline"); return FALSE; } } if (State_Old == GST_STATE_READY && State_New == GST_STATE_PAUSED) { /* Seek */ - debug_log("[%s] Start New Segment pipeline", handle->param->outputfile); + LOGD("[%s] Start New Segment pipeline", handle->param->outputfile); ret = _mm_transcode_seek(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Set New Segment pipeline"); + LOGD("Success - Set New Segment pipeline"); } else { - debug_log("[Null Trancode]"); + LOGD("[Null Trancode]"); if (_mm_transcode_state_change(handle, GST_STATE_NULL) != MM_ERROR_NONE) { - debug_error("ERROR -Null Pipeline"); + LOGE("ERROR -Null Pipeline"); return FALSE; } g_mutex_lock(handle->property->thread_mutex); - debug_log("[g_mutex_lock]"); + LOGD("[g_mutex_lock]"); TRANSCODE_FREE(handle->param); - debug_log("g_free(param)"); + LOGD("g_free(param)"); g_cond_signal(handle->property->thread_cond); - debug_log("[g_cond_signal]"); + LOGD("[g_cond_signal]"); g_mutex_unlock(handle->property->thread_mutex); - debug_log("[g_mutex_unlock]"); + LOGD("[g_mutex_unlock]"); } } @@ -447,18 +445,18 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat break; if (gst_element_query_duration(handle->pipeline, fmt, &total_length) && handle->property->total_length == 0) { - debug_log("[GST_MESSAGE_ASYNC_DONE] Total Duration: %" G_GUINT64_FORMAT " ", total_length); + LOGD("[GST_MESSAGE_ASYNC_DONE] Total Duration: %" G_GUINT64_FORMAT " ", total_length); handle->property->total_length = (unsigned long)(GST_TIME_AS_MSECONDS(total_length)); } handle->param->async_done = TRUE; - debug_log("GST_MESSAGE_ASYNC_DONE"); + LOGD("GST_MESSAGE_ASYNC_DONE"); /* Play Transcode */ - debug_log("[Play Trancode] [%d ~ %d]", handle->param->start_pos, handle->property->end_pos); + LOGD("[Play Trancode] [%lu ~ %lu]", handle->param->start_pos, handle->property->end_pos); if (_mm_transcode_play(handle) != MM_ERROR_NONE) { - debug_error("ERROR - Play Pipeline"); + LOGE("ERROR - Play Pipeline"); return FALSE; } break; @@ -470,38 +468,38 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat break; handle->param->segment_done = TRUE; - debug_log("GST_MESSAGE_SEGMENT_DONE"); + LOGD("GST_MESSAGE_SEGMENT_DONE"); break; } case GST_MESSAGE_EOS: { /* end-of-stream */ - debug_log("[GST_MESSAGE_EOS] end-of-stream"); + LOGD("[GST_MESSAGE_EOS] end-of-stream"); - debug_log("[completed] %s (Transcode ID: %d)", handle->param->outputfile, handle->property->seek_idx++); + LOGD("[completed] %s (Transcode ID: %d)", handle->param->outputfile, handle->property->seek_idx++); handle->property->AUDFLAG = 0; handle->property->VIDFLAG = 0; /* Null Transcode *//* Need to fresh filesink's property */ - debug_log("[Null Trancode]"); + LOGD("[Null Trancode]"); if (_mm_transcode_state_change(handle, GST_STATE_NULL) != MM_ERROR_NONE) { - debug_error("ERROR -Null Pipeline"); + LOGE("ERROR -Null Pipeline"); return FALSE; } /* checkpoint once more here (eos) and not unlink when Audio only */ if ((handle->param->start_pos > handle->property->total_length && handle->property->total_length != 0) && (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE)) { unlink(handle->param->outputfile); - debug_log("[unlink] %s %d > %d", handle->param->outputfile, handle->param->start_pos, handle->property->total_length); + LOGD("[unlink] %s %lu > %lu", handle->param->outputfile, handle->param->start_pos, handle->property->total_length); } g_mutex_lock(handle->property->thread_mutex); handle->param->completed = TRUE; handle->property->is_busy = FALSE; g_cond_signal(handle->property->thread_cond); - debug_log("===> send completed signal"); + LOGD("===> send completed signal"); g_mutex_unlock(handle->property->thread_mutex); - debug_log("[MMHandle] 0x%2x [msg_cb] 0x%2x [msg_cb_param] 0x%2x", MMHandle, handle->property->completed_cb, handle->property->completed_cb_param); + LOGD("[MMHandle] %p [msg_cb] %p [msg_cb_param] %p", MMHandle, handle->property->completed_cb, handle->property->completed_cb_param); if (handle->property->progress_cb) handle->property->progress_cb(handle->property->real_duration, handle->property->real_duration, handle->property->progress_cb_param); @@ -513,7 +511,7 @@ gboolean _mm_cb_transcode_bus(GstBus *bus, GstMessage *message, gpointer userdat } default: /* unhandle meage */ - /*debug_log("unhandle message"); */ + /*LOGD("unhandle message"); */ break; } return TRUE; @@ -524,22 +522,22 @@ static void _mm_transcode_audio_capsfilter(GstCaps *caps, handle_s *handle) gchar *str = NULL; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } if (!caps) { - debug_error("[ERROR] - caps"); + LOGE("[ERROR] - caps"); return; } @@ -554,7 +552,7 @@ static void _mm_transcode_audio_capsfilter(GstCaps *caps, handle_s *handle) str = gst_caps_to_string(caps); if (str) { - debug_log("audio decoder capsfilter audiocaps: %s", str); + LOGD("audio decoder capsfilter audiocaps: %s", str); g_free(str); } @@ -567,40 +565,40 @@ int _mm_transcode_create(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } ret = _mm_decodesrcbin_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create decodesrcbin"); + LOGD("Success - Create decodesrcbin"); } else { - debug_error("ERROR - Create decodesrcbin"); + LOGE("ERROR - Create decodesrcbin"); return ret; } ret = _mm_encodebin_set_venc_aenc(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Setup video and audio encoder of encodebin"); + LOGD("Success - Setup video and audio encoder of encodebin"); } else { - debug_error("ERROR -Setup video and audio encoder of encodebin "); + LOGE("ERROR -Setup video and audio encoder of encodebin "); return ret; } ret = _mm_encodebin_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create encodebin"); + LOGD("Success - Create encodebin"); } else { - debug_error("ERROR - Create encodebin"); + LOGE("ERROR - Create encodebin"); return ret; } /*create filesink */ ret = _mm_filesink_create(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Create Filesink"); + LOGD("Success - Create Filesink"); } else { - debug_error("ERROR - Create Filesink"); + LOGE("ERROR - Create Filesink"); return ret; } @@ -612,17 +610,17 @@ static int _mm_transcode_exec(handle_s *handle, handle_param_s *param) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!param || !param->outputfile) { - debug_error("[ERROR] - param"); + LOGE("[ERROR] - param"); return MM_ERROR_TRANSCODE_INVALID_VALUE; } @@ -630,14 +628,14 @@ static int _mm_transcode_exec(handle_s *handle, handle_param_s *param) if (handle->property->repeat_thread_exit) { g_mutex_unlock(handle->property->thread_mutex); - debug_log("unlock destory"); + LOGD("unlock destory"); } else { - debug_log("start_pos: %d, duration: %d, seek_mode: %d output file name: %s\n", param->start_pos, param->duration, param->seek_mode, param->outputfile); + LOGD("start_pos: %lu, duration: %lu, seek_mode: %d output file name: %s\n", param->start_pos, param->duration, param->seek_mode, param->outputfile); handle->param = g_new0(handle_param_s, 1); /*g_value_init (handle->param, G_TYPE_INT); */ if (!handle->param) { - debug_error("[ERROR] - handle param"); + LOGE("[ERROR] - handle param"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -662,44 +660,47 @@ static int _mm_transcode_exec(handle_s *handle, handle_param_s *param) handle->param->segment_done = FALSE; handle->param->completed = FALSE; handle->param->printed = 0; - debug_log("[SEEK: %d] width: %d height: %d fps_value: %d start_pos: %d duration: %d seek_mode: %d outputfile: %s", handle->param->seeking, handle->param->resolution_width, handle->param->resolution_height, handle->param->fps_value, handle->param->start_pos, handle->param->duration, handle->param->seek_mode, handle->param->outputfile); + LOGD("[SEEK: %d] width: %d height: %d fps_value: %d start_pos: %lu duration: %lu seek_mode: %d outputfile: %s", + handle->param->seeking, handle->param->resolution_width, handle->param->resolution_height, + handle->param->fps_value, handle->param->start_pos, handle->param->duration, + handle->param->seek_mode, handle->param->outputfile); if (handle->property->total_length != 0 && handle->param->start_pos > handle->property->total_length) { - debug_log("[SKIP] [%s] because out of duration [%d < %d ~ %d] ", handle->param->outputfile, handle->property->total_length, handle->param->start_pos, handle->param->duration); + LOGD("[SKIP] [%s] because out of duration [%lu < %lu ~ %lu] ", handle->param->outputfile, handle->property->total_length, handle->param->start_pos, handle->param->duration); g_mutex_unlock(handle->property->thread_mutex); - debug_log("[thread_mutex unlock]"); + LOGD("[thread_mutex unlock]"); } else { g_object_set(G_OBJECT(handle->filesink), "location", handle->param->outputfile, NULL); - debug_log("[%s] set filesink location", handle->param->outputfile); + LOGD("[%s] set filesink location", handle->param->outputfile); /* Ready Transcode */ if (strlen(handle->param->outputfile) != 0) { - debug_log("[Set State: Ready]"); + LOGD("[Set State: Ready]"); ret = _mm_transcode_state_change(handle, GST_STATE_READY); if (ret == MM_ERROR_NONE) { - debug_log("Success - Ready pipeline"); + LOGD("Success - Ready pipeline"); } else { - debug_error("ERROR - Reay pipeline"); + LOGE("ERROR - Reay pipeline"); g_mutex_unlock(handle->property->thread_mutex); return ret; } } if (0 == handle->property->seek_idx) { - debug_log("Link Filesink"); + LOGD("Link Filesink"); /* link filesink */ ret = _mm_filesink_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - Link Filesink"); + LOGD("Success - Link Filesink"); } else { - debug_error("ERROR - Link Filesink"); + LOGE("ERROR - Link Filesink"); g_mutex_unlock(handle->property->thread_mutex); return ret; } } g_cond_wait(handle->property->thread_cond, handle->property->thread_mutex); - debug_log("<=== get completed signal"); + LOGD("<=== get completed signal"); g_mutex_unlock(handle->property->thread_mutex); } } @@ -712,17 +713,17 @@ int _mm_transcode_get_stream_info(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (strlen(handle->property->sourcefile) == 0) { - debug_error("Invalid arguments [sourcefile size 0]\n"); + LOGE("Invalid arguments [sourcefile size 0]\n"); return MM_ERROR_INVALID_ARGUMENT; } @@ -731,9 +732,9 @@ int _mm_transcode_get_stream_info(handle_s *handle) ret = mm_file_get_stream_info(handle->property->sourcefile, &audio_track_num, &video_track_num); if (ret == MM_ERROR_NONE) { - debug_log("Success - mm_file_get_stream_info"); + LOGD("Success - mm_file_get_stream_info"); } else { - debug_error("ERROR - mm_file_get_stream_info"); + LOGE("ERROR - mm_file_get_stream_info"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -742,17 +743,17 @@ int _mm_transcode_get_stream_info(handle_s *handle) else handle->property->has_audio_stream = FALSE; - debug_log("has_audio_stream: %d", handle->property->has_audio_stream); + LOGD("has_audio_stream: %d", handle->property->has_audio_stream); if (video_track_num) handle->property->has_video_stream = TRUE; else handle->property->has_video_stream = FALSE; - debug_log("has_video_stream: %d", handle->property->has_video_stream); + LOGD("has_video_stream: %d", handle->property->has_video_stream); if ((handle->property->videoencoder != MM_VIDEOENCODER_NO_USE && !handle->property->has_video_stream) || (handle->property->audioencoder != MM_AUDIOENCODER_NO_USE && !handle->property->has_audio_stream)) { - debug_error("No video || audio stream"); + LOGE("No video || audio stream"); return MM_ERROR_INVALID_ARGUMENT; } @@ -764,23 +765,23 @@ int _mm_transcode_link(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } ret = _mm_decodesrcbin_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - decodesrcbin link"); + LOGD("Success - decodesrcbin link"); } else { - debug_error("ERROR - decodesrcbin link"); + LOGE("ERROR - decodesrcbin link"); return ret; } ret = _mm_encodebin_link(handle); if (ret == MM_ERROR_NONE) { - debug_log("Success - encodebin link"); + LOGD("Success - encodebin link"); } else { - debug_error("ERROR - encodebin link"); + LOGE("ERROR - encodebin link"); return ret; } @@ -790,51 +791,51 @@ int _mm_transcode_link(handle_s *handle) static void _mm_transcode_video_capsfilter(GstCaps *caps, handle_s *handle) { if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } if (!caps) { - debug_error("[ERROR] - caps"); + LOGE("[ERROR] - caps"); TRANSCODE_FREE(handle->property->videodecodename); return; } - debug_log("[First Video Buffer] Set CapsFilter Parameter"); + LOGD("[First Video Buffer] Set CapsFilter Parameter"); _mm_transcode_video_capsfilter_set_parameter(caps, handle); /* Not support enlarge video resolution */ - debug_log("Execute Resize"); + LOGD("Execute Resize"); #if 0 /* Not irrelevant to the ratio */ handle->param->resolution_height = handle->param->resolution_width * handle->in_height / handle->in_width; #endif - debug_log("[Resize] resolution_width: %d, resolution_height: %d", handle->param->resolution_width, handle->param->resolution_height); + LOGD("[Resize] resolution_width: %d, resolution_height: %d", handle->param->resolution_width, handle->param->resolution_height); if (0 == handle->param->resolution_width || 0 == handle->param->resolution_height) { - debug_log("[Origin Resolution] Two resolutoin value = 0"); + LOGD("[Origin Resolution] Two resolutoin value = 0"); handle->param->resolution_width = handle->property->in_width; handle->param->resolution_height = handle->property->in_height; } if (handle->param->resolution_width < VIDEO_RESOLUTION_WIDTH_SQCIF || handle->param->resolution_height < VIDEO_RESOLUTION_HEIGHT_SQCIF) { - debug_log("The Minimun resolution is SQCIF"); + LOGD("The Minimun resolution is SQCIF"); handle->param->resolution_width = VIDEO_RESOLUTION_WIDTH_SQCIF; handle->param->resolution_height = VIDEO_RESOLUTION_HEIGHT_SQCIF; } if (handle->property->in_width < handle->param->resolution_width || handle->property->in_height < handle->param->resolution_height) { - debug_log("[Origin Resolution] resolutoin value > origin resolution"); + LOGD("[Origin Resolution] resolutoin value > origin resolution"); handle->param->resolution_width = handle->property->in_width; handle->param->resolution_height = handle->property->in_height; } - debug_log("[Call CapsFilter] resolution_width: %d, resolution_height: %d", handle->param->resolution_width, handle->param->resolution_height); + LOGD("[Call CapsFilter] resolution_width: %d, resolution_height: %d", handle->param->resolution_width, handle->param->resolution_height); _mm_transcode_video_capsfilter_call(handle); TRANSCODE_FREE(handle->property->videodecodename); } @@ -842,22 +843,22 @@ static void _mm_transcode_video_capsfilter(GstCaps *caps, handle_s *handle) static void _mm_transcode_video_capsfilter_call(handle_s *handle) { if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->decoder_vidp) { - debug_error("[ERROR] - handle decoder video process bin"); + LOGE("[ERROR] - handle decoder video process bin"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } /* Configure videoscale to use 4-tap scaling for higher quality */ - debug_log("Input Width: [%d] Input Hieght: [%d] Output Width: [%d], Output Height: [%d]", handle->property->in_width, handle->property->in_height, handle->param->resolution_width, handle->param->resolution_height); + LOGD("Input Width: [%d] Input Hieght: [%d] Output Width: [%d], Output Height: [%d]", handle->property->in_width, handle->property->in_height, handle->param->resolution_width, handle->param->resolution_height); g_object_set(G_OBJECT(handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple(handle->property->mime, "format", G_TYPE_STRING, handle->property->format, "width", G_TYPE_INT, handle->param->resolution_width, "height", G_TYPE_INT, handle->param->resolution_height, "framerate", GST_TYPE_FRACTION, handle->property->fps_n, handle->property->fps_d, "pixel-aspect-ratio", GST_TYPE_FRACTION, handle->property->aspect_x, handle->property->aspect_y, NULL), NULL); } @@ -867,38 +868,37 @@ static void _mm_transcode_video_capsfilter_set_parameter(GstCaps *caps, handle_s const GValue *par, *fps; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return; } if (!caps) { - debug_error("[ERROR] - caps"); + LOGE("[ERROR] - caps"); return; } GstStructure *_str = gst_caps_get_structure(caps, 0); handle->property->mime = _mm_check_media_type(caps); - debug_log("mime: %s", handle->property->mime); + LOGD("mime: %s", handle->property->mime); const gchar *format = gst_structure_get_string(_str, "format"); - strncpy(handle->property->format, format, sizeof(handle->property->format)); - handle->property->format[sizeof(handle->property->format) - 1] = '\0'; + g_strlcpy(handle->property->format, format, sizeof(handle->property->format)); switch (gst_video_format_from_string(handle->property->format)) { case GST_VIDEO_FORMAT_I420: case GST_VIDEO_FORMAT_RGB: case GST_VIDEO_FORMAT_NV12: - debug_log("format: %s", handle->property->format); + LOGD("format: %s", handle->property->format); break; case GST_VIDEO_FORMAT_UNKNOWN: if (strcmp(handle->property->format, "SN12") == 0 || strcmp(handle->property->format, "ST12") == 0) - debug_log("format: %s", handle->property->format); + LOGD("format: %s", handle->property->format); break; @@ -907,23 +907,23 @@ static void _mm_transcode_video_capsfilter_set_parameter(GstCaps *caps, handle_s } if (!gst_structure_get_int(_str, "width", &handle->property->in_width) || !gst_structure_get_int(_str, "height", &handle->property->in_height)) - debug_error("error gst_structure_get_int [width] [height]"); + LOGE("error gst_structure_get_int [width] [height]"); else - debug_log("Origin File's Width: [%u] Origin File's Hieght: [%u]", handle->property->in_width, handle->property->in_height); + LOGD("Origin File's Width: [%u] Origin File's Hieght: [%u]", handle->property->in_width, handle->property->in_height); fps = gst_structure_get_value(_str, "framerate"); if (fps) { handle->property->fps_n = gst_value_get_fraction_numerator(fps); handle->property->fps_d = gst_value_get_fraction_denominator(fps); - debug_log("[Origin framerate] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->fps_n, handle->property->fps_d); + LOGD("[Origin framerate] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->fps_n, handle->property->fps_d); } if (handle->param->fps_value >= 5 && handle->param->fps_value <= 30 && handle->param->fps_value <= handle->property->fps_n) { handle->property->fps_n = (gint) handle->param->fps_value; handle->property->fps_d = 1; } - debug_log("[framerate] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->fps_n, handle->property->fps_d); + LOGD("[framerate] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->fps_n, handle->property->fps_d); par = gst_structure_get_value(_str, "pixel-aspect-ratio"); if (par) { @@ -932,7 +932,7 @@ static void _mm_transcode_video_capsfilter_set_parameter(GstCaps *caps, handle_s } else { handle->property->aspect_x = handle->property->aspect_y = 1; } - debug_log("[pixel-aspect-ratio] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->aspect_x, handle->property->aspect_y); + LOGD("[pixel-aspect-ratio] gst_value_get_fraction_numerator: %d, gst_value_get_fraction_denominator: %d", handle->property->aspect_x, handle->property->aspect_y); } @@ -941,32 +941,32 @@ int _mm_transcode_set_handle_element(handle_s *handle, const char *in_Filename, int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (in_Filename == NULL) { - debug_error("Invalid arguments [filename null]\n"); + LOGE("Invalid arguments [filename null]\n"); return MM_ERROR_INVALID_ARGUMENT; } if (strlen(in_Filename) == 0 || strlen(in_Filename) > BUFFER_SIZE) { - debug_error("Invalid arguments [filename size: %d]\n", strlen(in_Filename)); + LOGE("Invalid arguments [filename size: %d]\n", strlen(in_Filename)); return MM_ERROR_INVALID_ARGUMENT; } handle->property->sourcefile = malloc(sizeof(char) * BUFFER_SIZE); if (handle->property->sourcefile) { memset(handle->property->sourcefile, 0, BUFFER_SIZE); - strncpy(handle->property->sourcefile, in_Filename, strlen(in_Filename)); - debug_log("%s", handle->property->sourcefile); + g_strlcpy(handle->property->sourcefile, in_Filename, BUFFER_SIZE); + LOGD("%s", handle->property->sourcefile); } else { - debug_error("[ERROR] malloc fail of sourcefile"); + LOGE("[ERROR] malloc fail of sourcefile"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -974,7 +974,7 @@ int _mm_transcode_set_handle_element(handle_s *handle, const char *in_Filename, handle->property->videoencoder = videoencoder; handle->property->audioencoder = audioencoder; - debug_log("container format: %d videoencoder:%d, audioencoder: %d", handle->property->containerformat, handle->property->videoencoder, handle->property->audioencoder); + LOGD("container format: %d videoencoder:%d, audioencoder: %d", handle->property->containerformat, handle->property->videoencoder, handle->property->audioencoder); return ret; } @@ -984,7 +984,7 @@ int _mm_transcode_set_handle_parameter(handle_param_s *param, unsigned int resol int ret = MM_ERROR_NONE; if (!param) { - debug_error("param error"); + LOGE("param error"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -995,7 +995,8 @@ int _mm_transcode_set_handle_parameter(handle_param_s *param, unsigned int resol param->start_pos = start_pos; param->duration = duration; param->seek_mode = seek_mode; - debug_log("resolution_width: %d, resolution_height: %d, fps_value: %d, start_pos: %d, duration: %d, seek_mode: %d \n", param->resolution_width, param->resolution_height, fps_value, param->start_pos, param->duration, param->seek_mode); + LOGD("resolution_width: %d, resolution_height: %d, fps_value: %d, start_pos: %lu, duration: %lu, seek_mode: %d \n", + param->resolution_width, param->resolution_height, fps_value, param->start_pos, param->duration, param->seek_mode); if (start_pos == 0 && duration == 0) param->seeking = FALSE; @@ -1005,15 +1006,14 @@ int _mm_transcode_set_handle_parameter(handle_param_s *param, unsigned int resol if (out_Filename) { param->outputfile = malloc(sizeof(gchar) * BUFFER_SIZE); if (!param->outputfile) { - debug_error("[ERROR] outputfile"); + LOGE("[ERROR] outputfile"); return MM_ERROR_TRANSCODE_NO_FREE_SPACE; } memset(param->outputfile, 0, BUFFER_SIZE); - strncpy(param->outputfile, out_Filename, BUFFER_SIZE - 1); - param->outputfile[BUFFER_SIZE] = '\0'; - debug_log("%s(%d)", param->outputfile, strlen(out_Filename)); + g_strlcpy(param->outputfile, out_Filename, BUFFER_SIZE); + LOGD("%s(%d)", param->outputfile, strlen(out_Filename)); } else { - debug_error("out_Filename error"); + LOGE("out_Filename error"); return MM_ERROR_INVALID_ARGUMENT; } @@ -1026,58 +1026,58 @@ int _mm_transcode_state_change(handle_s *handle, GstState gst_state) GstStateChangeReturn ret_state; if (gst_state == GST_STATE_NULL) - debug_log("Before - GST_STATE_NULL"); + LOGD("Before - GST_STATE_NULL"); else if (gst_state == GST_STATE_READY) - debug_log("Before - GST_STATE_READY"); + LOGD("Before - GST_STATE_READY"); else if (gst_state == GST_STATE_PAUSED) - debug_log("Before - GST_STATE_PAUSED"); + LOGD("Before - GST_STATE_PAUSED"); else if (gst_state == GST_STATE_PLAYING) - debug_log("Before - GST_STATE_PLAYING"); + LOGD("Before - GST_STATE_PLAYING"); ret_state = gst_element_set_state(handle->pipeline, gst_state); if (ret_state == GST_STATE_CHANGE_FAILURE) { if (gst_state == GST_STATE_NULL) - debug_error("ERROR - SET GST_STATE_NULL"); + LOGE("ERROR - SET GST_STATE_NULL"); else if (gst_state == GST_STATE_READY) - debug_error("ERROR - SET GST_STATE_READY"); + LOGE("ERROR - SET GST_STATE_READY"); else if (gst_state == GST_STATE_PAUSED) - debug_error("ERROR - SET GST_STATE_PAUSED"); + LOGE("ERROR - SET GST_STATE_PAUSED"); else if (gst_state == GST_STATE_PLAYING) - debug_error("ERROR - SET GST_STATE_PLAYING"); + LOGE("ERROR - SET GST_STATE_PLAYING"); return MM_ERROR_TRANSCODE_INTERNAL; } else { if (gst_state == GST_STATE_NULL) - debug_log("Success - SET GST_STATE_NULL"); + LOGD("Success - SET GST_STATE_NULL"); else if (gst_state == GST_STATE_READY) - debug_log("Success - SET GST_STATE_READY"); + LOGD("Success - SET GST_STATE_READY"); else if (gst_state == GST_STATE_PAUSED) - debug_log("Success - SET GST_STATE_PAUSED"); + LOGD("Success - SET GST_STATE_PAUSED"); else if (gst_state == GST_STATE_PLAYING) - debug_log("Success - SET GST_STATE_PLAYING"); + LOGD("Success - SET GST_STATE_PLAYING"); } ret_state = gst_element_get_state(handle->pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); if (ret_state == GST_STATE_CHANGE_FAILURE) { if (gst_state == GST_STATE_NULL) - debug_error("ERROR - GET GST_STATE_NULL"); + LOGE("ERROR - GET GST_STATE_NULL"); else if (gst_state == GST_STATE_READY) - debug_error("ERROR - GET GST_STATE_READY"); + LOGE("ERROR - GET GST_STATE_READY"); else if (gst_state == GST_STATE_PAUSED) - debug_error("ERROR - GET GST_STATE_PAUSED"); + LOGE("ERROR - GET GST_STATE_PAUSED"); else if (gst_state == GST_STATE_PLAYING) - debug_error("ERROR - GET GST_STATE_PLAYING"); + LOGE("ERROR - GET GST_STATE_PLAYING"); return MM_ERROR_TRANSCODE_INTERNAL; } else { if (gst_state == GST_STATE_NULL) - debug_log("Success - GET GST_STATE_NULL"); + LOGD("Success - GET GST_STATE_NULL"); else if (gst_state == GST_STATE_READY) - debug_log("Success - GET GST_STATE_READY"); + LOGD("Success - GET GST_STATE_READY"); else if (gst_state == GST_STATE_PAUSED) - debug_log("Success - GET GST_STATE_PAUSED"); + LOGD("Success - GET GST_STATE_PAUSED"); else if (gst_state == GST_STATE_PLAYING) - debug_log("Success - GET GST_STATE_PLAYING"); + LOGD("Success - GET GST_STATE_PLAYING"); } return ret; @@ -1088,17 +1088,17 @@ int _mm_transcode_param_flush(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->encodebin) { - debug_error("[ERROR] - handle encodebin"); + LOGE("[ERROR] - handle encodebin"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -1126,25 +1126,30 @@ static int _mm_transcode_play(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } ret = _mm_transcode_state_change(handle, GST_STATE_PLAYING); if (ret != MM_ERROR_NONE) { - debug_error("ERROR -Playing Pipeline"); + LOGE("ERROR -Playing Pipeline"); return ret; } - debug_log("[SEEK: %d] width: %d height: %d start_pos: %d duration: %d (%d) seek_mode: %d outputfile: %s", handle->param->seeking, handle->param->resolution_width, handle->param->resolution_height, handle->param->start_pos, handle->param->duration, handle->property->end_pos, handle->param->seek_mode, handle->param->outputfile); + LOGD("[SEEK: %d] width: %d height: %d start_pos: %lu duration: %lu (%lu) seek_mode: %d outputfile: %s", + handle->param->seeking, handle->param->resolution_width, handle->param->resolution_height, + handle->param->start_pos, handle->param->duration, handle->property->end_pos, + handle->param->seek_mode, handle->param->outputfile); - handle->property->progrss_event_id = g_timeout_add(LAZY_PAUSE_TIMEOUT_MSEC, (GSourceFunc) _mm_cb_print_position, handle); - debug_log("Timer (id=[%d], timeout=[%d ms])\n", handle->property->progrss_event_id, LAZY_PAUSE_TIMEOUT_MSEC); + if (!handle->property->progrss_event_id) { + handle->property->progrss_event_id = g_timeout_add(LAZY_PAUSE_TIMEOUT_MSEC, (GSourceFunc) _mm_cb_print_position, handle); + LOGD("Timer (id=[%d], timeout=[%d ms])\n", handle->property->progrss_event_id, LAZY_PAUSE_TIMEOUT_MSEC); + } return ret; } @@ -1154,12 +1159,12 @@ static int _mm_transcode_seek(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -1172,7 +1177,8 @@ static int _mm_transcode_seek(handle_s *handle) handle->property->end_pos = handle->param->start_pos + handle->param->duration; if (handle->param->start_pos > handle->property->total_length && handle->property->seek_idx) { - debug_error("[%d ~ %d] out of %d", handle->param->start_pos, handle->property->end_pos, handle->property->total_length); + LOGE("[%lu ~ %lu] out of %lu", + handle->param->start_pos, handle->property->end_pos, handle->property->total_length); return MM_ERROR_TRANSCODE_SEEK_FAILED; } else { if (handle->param->duration != 0) { @@ -1182,13 +1188,14 @@ static int _mm_transcode_seek(handle_s *handle) end_pos = handle->property->total_length * G_GINT64_CONSTANT(1000000); } - debug_log("seek time : [ (%d msec) : (%d msec) ]\n", handle->param->start_pos, handle->property->end_pos); + LOGD("seek time : [ (%lu msec) : (%lu msec) ]\n", + handle->param->start_pos, handle->property->end_pos); while (walk_element) { GstElement *seekable_element = GST_ELEMENT(walk_element->data); if (!seekable_element) { - debug_error("ERROR - seekable"); + LOGE("ERROR - seekable"); return MM_ERROR_TRANSCODE_INTERNAL; } @@ -1198,7 +1205,7 @@ static int _mm_transcode_seek(handle_s *handle) _Flags = GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_FLUSH; if (!gst_element_seek(seekable_element, rate, GST_FORMAT_TIME, _Flags, GST_SEEK_TYPE_SET, start_pos, GST_SEEK_TYPE_SET, end_pos)) { - debug_error("ERROR - gst_element_seek (on) event : %s", GST_OBJECT_NAME(GST_OBJECT_CAST(seekable_element))); + LOGE("ERROR - gst_element_seek (on) event : %s", GST_OBJECT_NAME(GST_OBJECT_CAST(seekable_element))); return MM_ERROR_TRANSCODE_SEEK_FAILED; } @@ -1215,55 +1222,55 @@ int _mm_transcode_thread(handle_s *handle) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return MM_ERROR_INVALID_ARGUMENT; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return MM_ERROR_TRANSCODE_INTERNAL; } if (!handle->property->thread_mutex) { handle->property->thread_mutex = g_new(GMutex, 1); g_mutex_init(handle->property->thread_mutex); - debug_log("create thread_mutex: 0x%2x", handle->property->thread_mutex); + LOGD("create thread_mutex: %p", handle->property->thread_mutex); } else { - debug_error("ERROR - thread_mutex is already created"); + LOGE("ERROR - thread_mutex is already created"); } if (!handle->property->thread_exit_mutex) { handle->property->thread_exit_mutex = g_new(GMutex, 1); g_mutex_init(handle->property->thread_exit_mutex); - debug_log("create exit mutex: 0x%2x", handle->property->thread_exit_mutex); + LOGD("create exit mutex: %p", handle->property->thread_exit_mutex); } else { - debug_error("ERROR - thread_exit_mutex is already created"); + LOGE("ERROR - thread_exit_mutex is already created"); } /* These are a communicator for thread */ if (!handle->property->queue) { handle->property->queue = g_async_queue_new(); - debug_log("create async queue: 0x%2x", handle->property->queue); + LOGD("create async queue: %p", handle->property->queue); } else { - debug_error("ERROR - async queue is already created"); + LOGE("ERROR - async queue is already created"); } if (!handle->property->thread_cond) { handle->property->thread_cond = g_new(GCond, 1); g_cond_init(handle->property->thread_cond); - debug_log("create thread cond: 0x%2x", handle->property->thread_cond); + LOGD("create thread cond: %p", handle->property->thread_cond); } else { - debug_error("thread cond is already created"); + LOGE("thread cond is already created"); } /* create threads */ - debug_log("create thread"); + LOGD("create thread"); handle->property->thread = g_thread_new(NULL, (GThreadFunc)_mm_transcode_thread_repeate, (gpointer)handle); if (!handle->property->thread) { - debug_error("ERROR - create thread"); + LOGE("ERROR - create thread"); return MM_ERROR_TRANSCODE_INTERNAL; } else { - debug_log("create thread: 0x%2x", handle->property->thread); + LOGD("create thread: %p", handle->property->thread); } return ret; @@ -1275,12 +1282,12 @@ static gpointer _mm_transcode_thread_repeate(gpointer data) int ret = MM_ERROR_NONE; if (!handle) { - debug_error("[ERROR] - handle"); + LOGE("[ERROR] - handle"); return NULL; } if (!handle->property) { - debug_error("[ERROR] - handle property"); + LOGE("[ERROR] - handle property"); return NULL; } @@ -1288,30 +1295,32 @@ static gpointer _mm_transcode_thread_repeate(gpointer data) while (1) { int length = g_async_queue_length(handle->property->queue); if (length) { - debug_log("[QUEUE #] %d", length); + LOGD("[QUEUE #] %d", length); handle->property->is_busy = TRUE; } handle_param_s *pop_data = (handle_param_s *) g_async_queue_pop(handle->property->queue); if (handle->property->repeat_thread_exit || !handle->property->is_busy) { - debug_log("[Receive Last Queue]"); - debug_log("[Destroy]"); + LOGD("[Receive Last Queue]"); + LOGD("[Destroy]"); break; } else { - debug_log("[pop queue] resolution_width: %d, resolution_height: %d, start_pos: %d, duration: %d, seek_mode: %d outputfile: %s\n", pop_data->resolution_width, pop_data->resolution_height, pop_data->start_pos, pop_data->duration, pop_data->seek_mode, pop_data->outputfile); + LOGD("[pop queue] resolution_width: %d, resolution_height: %d, start_pos: %lu, duration: %lu, seek_mode: %d outputfile: %s\n", + pop_data->resolution_width, pop_data->resolution_height, pop_data->start_pos, + pop_data->duration, pop_data->seek_mode, pop_data->outputfile); /* Need to block */ ret = _mm_transcode_exec(handle, pop_data); if (ret == MM_ERROR_NONE) { - debug_log("Success - transcode_exec"); + LOGD("Success - transcode_exec"); } else { - debug_log("Destroy - transcode_exec"); - debug_log("<=== get exit (%d) signal", handle->property->repeat_thread_exit); + LOGD("Destroy - transcode_exec"); + LOGD("<=== get exit (%d) signal", handle->property->repeat_thread_exit); break; } } } - debug_log("exit thread"); + LOGD("exit thread"); return NULL; }