[0.6.280] remove unused caps ref 02/294502/2
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 20 Jun 2023 08:27:39 +0000 (17:27 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Tue, 20 Jun 2023 08:28:35 +0000 (17:28 +0900)
- remove type_caps
- rename type to type_caps_str

Change-Id: I30b3330c152f01ff3254b5f45945d8a7197ce11c

src/include/mm_player_priv.h
src/mm_player_priv.c

index 53fb954..1861ffc 100644 (file)
@@ -639,8 +639,7 @@ typedef struct {
        mmplayer_sound_info_t   sound;
 
        /* type string */
-       gchar *type;
-       GstCaps *type_caps;
+       gchar *type_caps_str;
 
        /* video stream caps parsed by demuxer */
        GstCaps *v_stream_caps;
index 64aa9b9..71c03d7 100644 (file)
@@ -4418,7 +4418,7 @@ __mmplayer_gst_destroy_pipeline(mmplayer_t *player)
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_INVALID_HANDLE);
 
        /* cleanup stuffs */
-       MMPLAYER_FREEIF(player->type);
+       MMPLAYER_FREEIF(player->type_caps_str);
        player->no_more_pad = FALSE;
        player->num_dynamic_pad = 0;
 
@@ -4485,11 +4485,6 @@ __mmplayer_gst_destroy_pipeline(mmplayer_t *player)
        }
        MMPLAYER_FREEIF(player->album_art);
 
-       if (player->type_caps) {
-               gst_caps_unref(player->type_caps);
-               player->type_caps = NULL;
-       }
-
        if (player->v_stream_caps) {
                gst_caps_unref(player->v_stream_caps);
                player->v_stream_caps = NULL;
@@ -5919,7 +5914,7 @@ _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration)
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(duration, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
-       if (g_strrstr(player->type, "video/mpegts"))
+       if (g_strrstr(player->type_caps_str, "video/mpegts"))
                __mmplayer_update_duration_value(player);
 
        *duration = player->duration;
@@ -6009,9 +6004,9 @@ static void
 __mmplayer_update_content_type_info(mmplayer_t *player)
 {
        MMPLAYER_FENTER();
-       MMPLAYER_RETURN_IF_FAIL(player && player->type);
+       MMPLAYER_RETURN_IF_FAIL(player && player->type_caps_str);
 
-       if (__mmplayer_is_midi_type(player->type)) {
+       if (__mmplayer_is_midi_type(player->type_caps_str)) {
                player->bypass_audio_effect = TRUE;
                return;
        }
@@ -6021,19 +6016,19 @@ __mmplayer_update_content_type_info(mmplayer_t *player)
                return;
        }
 
-       if (g_strrstr(player->type, "application/x-hls")) {
+       if (g_strrstr(player->type_caps_str, "application/x-hls")) {
                /* If it can't know exact type when it parses uri because of redirection case,
                 * it will be fixed by typefinder or when doing autoplugging.
                 */
                player->profile.uri_type = MM_PLAYER_URI_TYPE_HLS;
                player->streamer->is_adaptive_streaming = TRUE;
-       } else if (g_strrstr(player->type, "application/dash+xml")) {
+       } else if (g_strrstr(player->type_caps_str, "application/dash+xml")) {
                player->profile.uri_type = MM_PLAYER_URI_TYPE_DASH;
                player->streamer->is_adaptive_streaming = TRUE;
        }
 
        /* in case of TS, fixed buffering mode should be used because player can not get exact duration time */
-       if ((player->streamer->is_adaptive_streaming) || (g_strrstr(player->type, "video/mpegts"))) {
+       if ((player->streamer->is_adaptive_streaming) || (g_strrstr(player->type_caps_str, "video/mpegts"))) {
                player->streamer->buffering_req.mode = MM_PLAYER_BUFFERING_MODE_FIXED;
 
                if (player->streamer->buffering_req.rebuffer_time <= MIN_BUFFERING_TIME) { /* if user did not set the rebuffer value */
@@ -6058,23 +6053,15 @@ _mmplayer_typefind_have_type(GstElement *tf, guint probability,
 
        MMPLAYER_RETURN_IF_FAIL(player && tf && caps);
 
-       /* store type string */
-       if (player->type_caps) {
-               gst_caps_unref(player->type_caps);
-               player->type_caps = NULL;
-       }
-
-       player->type_caps = gst_caps_copy(caps);
-       MMPLAYER_LOG_GST_CAPS_TYPE(player->type_caps);
-
-       MMPLAYER_FREEIF(player->type);
-       player->type = gst_caps_to_string(caps);
-       if (player->type)
+       MMPLAYER_LOG_GST_CAPS_TYPE(caps);
+       MMPLAYER_FREEIF(player->type_caps_str);
+       player->type_caps_str = gst_caps_to_string(caps);
+       if (player->type_caps_str)
                LOGD("[handle: %p] media type %s found, probability %d%% / %d",
-                               player, player->type, probability, gst_caps_get_size(caps));
+                               player, player->type_caps_str, probability, gst_caps_get_size(caps));
 
        if ((!MMPLAYER_IS_RTSP_STREAMING(player)) &&
-               (g_strrstr(player->type, "audio/x-raw-int"))) {
+               (g_strrstr(player->type_caps_str, "audio/x-raw-int"))) {
                LOGE("not support media format");
 
                if (player->msg_posted == FALSE) {
@@ -6103,7 +6090,7 @@ _mmplayer_typefind_have_type(GstElement *tf, guint probability,
 
                if (!_mmplayer_gst_create_decoder(player, pad, caps)) {
                        gboolean async = FALSE;
-                       LOGE("failed to autoplug %s", player->type);
+                       LOGE("failed to autoplug %s", player->type_caps_str);
 
                        mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
 
@@ -6200,7 +6187,7 @@ __mmplayer_gst_make_queue2(mmplayer_t *player)
        /* NOTE : in case of ts streaming, player could not get the correct duration info *
         *                skip the pull mode(file or ring buffering) setting. */
        if (dur_bytes > 0) {
-               if (!g_strrstr(player->type, "video/mpegts")) {
+               if (!g_strrstr(player->type_caps_str, "video/mpegts")) {
                        type = MUXED_BUFFER_TYPE_MEM_RING_BUFFER;
                        player->streamer->ring_buffer_size = player->ini.http_ring_buffer_size;
                }
@@ -7202,7 +7189,7 @@ __mmplayer_is_offload_supported_type(mmplayer_t *player)
           this function need to be updated according to the supported media format
           @see player->ini.audio_offload_media_format */
 
-       if (__mmplayer_is_only_mp3_type(player->type)) {
+       if (__mmplayer_is_only_mp3_type(player->type_caps_str)) {
                LOGD("offload supportable media format type");
                return TRUE;
        }
@@ -7219,7 +7206,7 @@ __mmplayer_can_build_audio_offload_path(mmplayer_t *player)
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->attrs, FALSE);
 
-       LOGD("current stream : %s, sink: %s", player->type, player->ini.audio_offload_sink_element);
+       LOGD("current stream : %s, sink: %s", player->type_caps_str, player->ini.audio_offload_sink_element);
        if (!__mmplayer_is_offload_supported_type(player))
                goto DONE;
 
@@ -7470,8 +7457,8 @@ _mmplayer_gst_decode_autoplug_select(GstElement *bin,  GstPad *pad,
        LOGD("[handle: %p] found new element [%s] to link", player, factory_name);
 
        /* store type string */
-       if (player->type == NULL) {
-               player->type = gst_caps_to_string(caps);
+       if (player->type_caps_str == NULL) {
+               player->type_caps_str = gst_caps_to_string(caps);
                __mmplayer_update_content_type_info(player);
        }
 
@@ -7805,13 +7792,13 @@ _mmplayer_gst_element_added(GstBin *bin, GstElement *element, gpointer data)
                        player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].id = MMPLAYER_M_ADAPTIVE_DEMUX;
                        player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst = element;
 
-                       MMPLAYER_FREEIF(player->type);
+                       MMPLAYER_FREEIF(player->type_caps_str);
 
                        if (g_strrstr(factory_name, "hlsdemux")) {
-                               player->type = g_strdup("application/x-hls");
+                               player->type_caps_str = g_strdup("application/x-hls");
                                player->profile.uri_type = MM_PLAYER_URI_TYPE_HLS;
                        } else if (g_strrstr(factory_name, "dashdemux")) {
-                               player->type = g_strdup("application/dash+xml");
+                               player->type_caps_str = g_strdup("application/dash+xml");
                                player->profile.uri_type = MM_PLAYER_URI_TYPE_DASH;
                        } else {
                                LOGE("not supported type");
@@ -7848,7 +7835,7 @@ _mmplayer_gst_element_added(GstBin *bin, GstElement *element, gpointer data)
 
        if (g_strrstr(factory_name, "mpegaudioparse")) {
                if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
-                       (__mmplayer_is_only_mp3_type(player->type))) {
+                       (__mmplayer_is_only_mp3_type(player->type_caps_str))) {
                        LOGD("[mpegaudioparse] set streaming pull mode.");
                        g_object_set(G_OBJECT(element), "http-pull-mp3dec", TRUE, NULL);
                }
@@ -9943,12 +9930,12 @@ __mmplayer_set_playing_state(mmplayer_t *player)
         * So, if it's not set yet, fill it with found data.
         */
        if (!audio_codec) {
-               if (g_strrstr(player->type, "audio/midi"))
+               if (g_strrstr(player->type_caps_str, "audio/midi"))
                        audio_codec = "MIDI";
-               else if (g_strrstr(player->type, "audio/x-amr"))
+               else if (g_strrstr(player->type_caps_str, "audio/x-amr"))
                        audio_codec = "AMR";
-               else if (g_strrstr(player->type, "audio/mpeg")
-                               && !g_strrstr(player->type, "mpegversion=(int)1"))
+               else if (g_strrstr(player->type_caps_str, "audio/mpeg")
+                               && !g_strrstr(player->type_caps_str, "mpegversion=(int)1"))
                        audio_codec = "AAC";
                else
                        audio_codec = "unknown";