[0.6.196] Use __DEBUG__ macro for debug 96/208496/5 accepted/tizen/unified/20190705.041516 submit/tizen/20190703.051818
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 25 Jun 2019 07:38:54 +0000 (16:38 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 26 Jun 2019 08:11:38 +0000 (17:11 +0900)
Change-Id: I7ad36371fccd42de3f5598c390ee32bf94855e0a

src/mm_player_gst.c
src/mm_player_ini.c
src/mm_player_priv.c
src/mm_player_utils.c

index 4ec53c7..9b1d4ca 100644 (file)
 |  FUNCTION DEFINITIONS                                                                                                                                                |
 |                                                                                                                                                                                      |
 ========================================================================================== */
+#ifdef __DEBUG__
+static void
+print_tag(const GstTagList *list, const gchar *tag, gpointer unused)
+{
+       gint i, count;
+
+       count = gst_tag_list_get_tag_size(list, tag);
+
+       LOGD("count = %d", count);
+
+       for (i = 0; i < count; i++) {
+               gchar *str;
+
+               if (gst_tag_get_type(tag) == G_TYPE_STRING) {
+                       if (!gst_tag_list_get_string_index(list, tag, i, &str))
+                               g_assert_not_reached();
+               } else {
+                       str = g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
+               }
+
+               if (i == 0)
+                       g_print("  %15s: %s", gst_tag_get_nick(tag), str);
+               else
+                       g_print("                 : %s", str);
+
+               g_free(str);
+       }
+}
+#endif
 
 static gboolean
 __mmplayer_check_error_posted_from_activated_track(mmplayer_t *player, gchar *src_element_name)
@@ -2034,7 +2063,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                __mmplayer_gst_handle_async_done_message(player, msg);
                break;
 
-       #if 0 /* delete unnecessary logs */
+#ifdef __DEBUG__
        case GST_MESSAGE_REQUEST_STATE:         LOGD("GST_MESSAGE_REQUEST_STATE"); break;
        case GST_MESSAGE_STEP_START:            LOGD("GST_MESSAGE_STEP_START"); break;
        case GST_MESSAGE_QOS:                           LOGD("GST_MESSAGE_QOS"); break;
@@ -2050,7 +2079,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
        case GST_MESSAGE_SEGMENT_START:         LOGD("GST_MESSAGE_SEGMENT_START"); break;
        case GST_MESSAGE_SEGMENT_DONE:          LOGD("GST_MESSAGE_SEGMENT_DONE"); break;
        case GST_MESSAGE_LATENCY:                       LOGD("GST_MESSAGE_LATENCY"); break;
-       #endif
+#endif
 
        default:
                break;
@@ -2080,7 +2109,7 @@ __mmplayer_gst_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data
        case GST_MESSAGE_TAG:
                __mmplayer_gst_extract_tag_from_msg(player, message);
 
-               #if 0 // debug
+#ifdef __DEBUG__
                {
                        GstTagList *tags = NULL;
 
@@ -2095,7 +2124,7 @@ __mmplayer_gst_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data
                        }
                        break;
                }
-               #endif
+#endif
                break;
 
        case GST_MESSAGE_DURATION_CHANGED:
@@ -2148,7 +2177,9 @@ __mmplayer_gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer us
        GST_BUFFER_OFFSET(buffer) = (guint64)buf->offset;
        GST_BUFFER_OFFSET_END(buffer) = (guint64)(buf->offset + len);
 
-       //LOGD("feed buffer %p, offset %u-%u length %u", buffer, buf->offset, (buf->offset+len), len);
+#ifdef __DEBUG__
+       LOGD("feed buffer %p, offset %u-%u length %u", buffer, buf->offset, (buf->offset+len), len);
+#endif
        g_signal_emit_by_name(appsrc, "push-buffer", buffer, &ret);
 
        buf->offset += len;
@@ -2331,7 +2362,9 @@ __mmplayer_gst_create_es_decoder(mmplayer_t *player, mmplayer_stream_type_e type
 
        dec_caps = gst_pad_query_caps(srcpad, NULL);
        if (dec_caps) {
-               //LOGD("got pad %s:%s , dec_caps %" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME(srcpad), dec_caps);
+#ifdef __DEBUG__
+               LOGD("got pad %s:%s , dec_caps %" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME(srcpad), dec_caps);
+#endif
                g_object_set(G_OBJECT(decodebin), "sink-caps", dec_caps, NULL);
                gst_caps_unref(dec_caps);
        }
index 34a9dd6..efad473 100644 (file)
@@ -384,7 +384,7 @@ mm_player_audio_effect_ini_load(mmplayer_ini_t *ini)
        LOGD("audioeffect element : %s", ini->audioeffect_element);
        LOGD("audio effect preset mode : %d", ini->use_audio_effect_preset);
        LOGD("audio effect custom mode : %d", ini->use_audio_effect_custom);
-#if 0 // debug
+#ifdef __DEBUG__
        int i;
        for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
                LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
index d495e7a..bee6733 100644 (file)
@@ -209,36 +209,6 @@ static void __mmplayer_set_playing_state(mmplayer_t *player);
 |                                                                                                                                                                                      |
 ========================================================================================== */
 
-#if 0 //debug
-static void
-print_tag(const GstTagList *list, const gchar *tag, gpointer unused)
-{
-       gint i, count;
-
-       count = gst_tag_list_get_tag_size(list, tag);
-
-       LOGD("count = %d", count);
-
-       for (i = 0; i < count; i++) {
-               gchar *str;
-
-               if (gst_tag_get_type(tag) == G_TYPE_STRING) {
-                       if (!gst_tag_list_get_string_index(list, tag, i, &str))
-                               g_assert_not_reached();
-               } else {
-                       str = g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
-               }
-
-               if (i == 0)
-                       g_print("  %15s: %s", gst_tag_get_nick(tag), str);
-               else
-                       g_print("                 : %s", str);
-
-               g_free(str);
-       }
-}
-#endif
-
 /* This function should be called after the pipeline goes PAUSED or higher
 state. */
 gboolean
@@ -432,9 +402,9 @@ _mmplayer_check_state(mmplayer_t *player, mmplayer_command_state_e command)
        mmplayer_state_e pending_state = MM_PLAYER_STATE_NUM;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       //LOGD("incomming command : %d ", command);
-
+#ifdef __DEBUG__
+       LOGD("incomming command : %d ", command);
+#endif
        current_state = MMPLAYER_CURRENT_STATE(player);
        pending_state = MMPLAYER_PENDING_STATE(player);
 
@@ -903,7 +873,9 @@ __mmplayer_gst_selector_update_start_time(mmplayer_t *player, mmplayer_track_typ
        for (idx = MM_PLAYER_TRACK_TYPE_AUDIO; idx < MM_PLAYER_TRACK_TYPE_TEXT; idx++) {
                if ((player->gapless.update_segment[idx] == TRUE) ||
                        !(player->selector[idx].event_probe_id)) {
-                       /* LOGW("[%d] skip", idx); */
+#ifdef __DEBUG__
+                       LOGW("[%d] skip", idx);
+#endif
                        continue;
                }
 
@@ -1066,11 +1038,13 @@ __mmplayer_gst_selector_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer
                                break;
                        }
 
+#ifdef __DEBUG__
                        LOGD("[%d] Adjusting QOS event: %" GST_TIME_FORMAT
                                 " - %" GST_TIME_FORMAT " = %" GST_TIME_FORMAT,
                                                stream_type, GST_TIME_ARGS(timestamp),
                                                GST_TIME_ARGS(running_time_diff),
                                                GST_TIME_ARGS(timestamp - running_time_diff));
+#endif
 
                        timestamp -= running_time_diff;
 
@@ -1220,7 +1194,9 @@ _mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
                goto ERROR;
 
        MMPLAYER_LOG_GST_CAPS_TYPE(caps);
-       /* LOGD("detected mimetype : %s", name); */
+#ifdef __DEBUG__
+       LOGD("detected mimetype : %s", name);
+#endif
 
        if (strstr(name, "video")) {
                gint stype = 0;
@@ -1647,8 +1623,9 @@ __mmplayer_gst_create_sinkbin(GstElement *elem, GstPad *pad, gpointer data)
                goto ERROR;
 
        caps_str = gst_caps_to_string(caps);
-
-       /* LOGD("detected mimetype : %s", name); */
+#ifdef __DEBUG__
+       LOGD("detected mimetype : %s", name);
+#endif
        if (strstr(name, "audio")) {
                if (player->pipeline->audiobin == NULL) {
                        const gchar *audio_format = gst_structure_get_string(str, "format");
@@ -2373,8 +2350,9 @@ __mmplayer_audio_stream_send_data(mmplayer_t *player, mmplayer_audio_stream_buff
        audio_stream.data_size = a_buffer->data_size;
        audio_stream.data = a_buffer->pcm_data;
        audio_stream.pcm_format = a_buffer->pcm_format;
-
-       /* LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_decoded_cb_user_param); */
+#ifdef __DEBUG__
+       LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_decoded_cb_user_param);
+#endif
        player->audio_decoded_cb(&audio_stream, player->audio_decoded_cb_user_param);
 
        MMPLAYER_FLEAVE();
@@ -2405,8 +2383,9 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer,
 
        GstCaps *caps = gst_pad_get_current_caps(pad);
        GstStructure *structure = gst_caps_get_structure(caps, 0);
-
-       /* MMPLAYER_LOG_GST_CAPS_TYPE(caps); */
+#ifdef __DEBUG__
+       MMPLAYER_LOG_GST_CAPS_TYPE(caps);
+#endif
        pcm_format = gst_structure_get_string(structure, "format");
        gst_structure_get_int(structure, "rate", &rate);
        gst_structure_get_int(structure, "channels", &channel);
@@ -2422,7 +2401,9 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer,
                        mmplayer_audio_stream_buff_t *tmp = (mmplayer_audio_stream_buff_t *)l->data;
                        if (tmp) {
                                if (channel_mask == tmp->channel_mask) {
-                                       /* LOGD("[%"G_GUINT64_FORMAT"] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size); */
+#ifdef __DEBUG__
+                                       LOGD("[%"G_GUINT64_FORMAT"] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size);
+#endif
                                        if (tmp->data_size + a_size < tmp->buff_size) {
                                                memcpy(tmp->pcm_data + tmp->data_size, a_data, a_size);
                                                tmp->data_size += a_size;
@@ -2476,7 +2457,9 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer,
                        goto DONE;
                }
                memcpy(a_buffer->pcm_data, a_data, a_size);
-               /* LOGD("new [%"G_GUINT64_FORMAT"] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size); */
+#ifdef __DEBUG__
+               LOGD("new [%"G_GUINT64_FORMAT"] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size);
+#endif
                player->audio_stream_buff_list = g_list_append(player->audio_stream_buff_list, a_buffer);
        } else {
                /* If sync is TRUE, send data directly. */
@@ -4870,7 +4853,9 @@ __mmplayer_init_gstreamer(mmplayer_t *player)
        }
        /* release */
        for (i = 0; i < arg_count; i++) {
-               //LOGD("release - argv[%d] : %s", i, argv2[i]);
+#ifdef __DEBUG__
+               LOGD("release - argv[%d] : %s", i, argv2[i]);
+#endif
                MMPLAYER_FREEIF(argv2[i]);
        }
 
@@ -7366,7 +7351,9 @@ _mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data)
                                                "max-video-height", player->adaptive_info.limit.height, NULL);
 
        } else if (g_strrstr(klass, "Demuxer")) {
-               //LOGD("plugged element is demuxer. take it");
+#ifdef __DEBUG__
+               LOGD("plugged element is demuxer. take it");
+#endif
                player->pipeline->mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX;
                player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
        }
@@ -8312,9 +8299,9 @@ __mmplayer_dump_buffer_probe_cb(GstPad *pad,  GstPadProbeInfo *info, gpointer u_
        MMPLAYER_RETURN_VAL_IF_FAIL(dump_data, GST_PAD_PROBE_PASS);
 
        gst_buffer_map(buffer, &probe_info, GST_MAP_READ);
-
-//     LOGD("buffer timestamp = %" GST_TIME_FORMAT, GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));
-
+#ifdef __DEBUG__
+       LOGD("buffer timestamp = %" GST_TIME_FORMAT, GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));
+#endif
        fwrite(probe_info.data, 1, probe_info.size , dump_data);
 
        gst_buffer_unmap(buffer, &probe_info);
@@ -8369,7 +8356,9 @@ _mm_player_video_stream_internal_buffer_unref(void *buffer)
 {
        MMPLAYER_FENTER();
        if (buffer) {
-               // LOGD("unref internal gst buffer %p", buffer);
+#ifdef __DEBUG__
+               LOGD("unref internal gst buffer %p", buffer);
+#endif
                gst_buffer_unref((GstBuffer *)buffer);
                buffer = NULL;
        }
@@ -9116,7 +9105,9 @@ __mmplayer_create_stream_from_pad(GstPad *pad)
                return NULL;
        }
 
-       /* MMPLAYER_LOG_GST_CAPS_TYPE(caps); */
+#ifdef __DEBUG__
+       MMPLAYER_LOG_GST_CAPS_TYPE(caps);
+#endif
        structure = gst_caps_get_structure(caps, 0);
        gst_structure_get_int(structure, "width", &width);
        gst_structure_get_int(structure, "height", &height);
index a88ca2d..20cdf4d 100644 (file)
@@ -168,8 +168,9 @@ _mmplayer_post_message(mmplayer_t *player, enum MMMessageType msgtype, MMMessage
 
        if (!player->msg_cb)
                return FALSE;
-
-       //LOGD("Message (type : %d)  will be posted using msg-cb(%p).", msgtype, player->msg_cb);
+#ifdef __DEBUG__
+       LOGD("Message (type : %d)  will be posted using msg-cb(%p).", msgtype, player->msg_cb);
+#endif
 
        player->msg_cb(msgtype, param, player->msg_cb_param);
 
@@ -445,12 +446,12 @@ _mmplayer_get_pixtype(unsigned int fourcc)
 {
        int pixtype = MM_PIXEL_FORMAT_INVALID;
 
-    /*
+#ifdef __DEBUG__
        char *pfourcc = (char *)&fourcc;
 
        LOGD("fourcc(%c%c%c%c)",
                pfourcc[0], pfourcc[1], pfourcc[2], pfourcc[3]);
-    */
+#endif
 
        switch (fourcc) {
        case GST_MAKE_FOURCC('S', 'N', '1', '2'):