[0.6.199] use player attr function for setting 33/209633/3
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 9 Jul 2019 11:08:15 +0000 (20:08 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Wed, 10 Jul 2019 02:19:31 +0000 (11:19 +0900)
- use player attr function which includes
  the attr commit function.

Change-Id: Ib8d48c142228953a51bd23549a1ebbb6ddadb2fe

packaging/libmm-player.spec
src/mm_player_attrs.c
src/mm_player_es.c
src/mm_player_gst.c
src/mm_player_priv.c
src/mm_player_tracks.c

index bc0cc88..bfbe599 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.198
+Version:    0.6.199
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index d46ea14..e15b676 100644 (file)
@@ -914,7 +914,6 @@ int _mmplayer_set_attribute(MMHandleType handle, char **err_attr_name, const cha
 
        /* set attributes and commit them */
        result = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, args_list);
-
        if (result != MM_ERROR_NONE) {
                LOGE("failed to set %s attribute", attribute_name);
                return result;
index 002e801..8c56a1d 100644 (file)
@@ -800,7 +800,7 @@ _mmplayer_set_media_stream_dynamic_resolution(MMHandleType hplayer, bool drc)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_DRC_MODE, (int)drc);
+       mm_player_set_attribute(hplayer, NULL, MM_PLAYER_DRC_MODE, (int)drc, NULL);
        if (player->v_stream_caps) {
                gst_caps_set_simple(player->v_stream_caps,
                        "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
index 03411a7..03f77ea 100644 (file)
@@ -746,7 +746,7 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
 {
 
 /* macro for better code readability */
-#define MMPLAYER_UPDATE_TAG_STRING(gsttag, attribute, playertag) \
+#define MMPLAYER_UPDATE_TAG_STRING(gsttag, player, playertag) \
        do { \
                if (gst_tag_list_get_string(tag_list, gsttag, &string)) {\
                        if (string != NULL) { \
@@ -755,17 +755,19 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                                        char *new_string = g_malloc(MM_MAX_STRING_LENGTH); \
                                        strncpy(new_string, string, MM_MAX_STRING_LENGTH - 1); \
                                        new_string[MM_MAX_STRING_LENGTH - 1] = '\0'; \
-                                       mm_attrs_set_string_by_name(attribute, playertag, new_string); \
+                                       mm_player_set_attribute((MMHandleType)player, NULL,\
+                                                       playertag, new_string, strlen(new_string), NULL); \
                                        MMPLAYER_FREEIF(new_string); \
                                } else { \
-                                       mm_attrs_set_string_by_name(attribute, playertag, string); \
+                                       mm_player_set_attribute((MMHandleType)player, NULL,\
+                                                       playertag, string, strlen(string), NULL); \
                                } \
                                MMPLAYER_FREEIF(string); \
                        } \
                } \
        } while (0)
 
-#define MMPLAYER_UPDATE_TAG_IMAGE(gsttag, attribute, playertag) \
+#define MMPLAYER_UPDATE_TAG_IMAGE(gsttag, player, playertag) \
        do {    \
                GstSample *sample = NULL;\
                if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample)) {\
@@ -781,7 +783,8 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                        player->album_art = (gchar *)g_malloc(info.size);\
                        if (player->album_art) {\
                                memcpy(player->album_art, info.data, info.size);\
-                               mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
+                               mm_player_set_attribute((MMHandleType)player, NULL,\
+                                               playertag, (void *)player->album_art, info.size, NULL); \
                                if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
                                        msg_param.data = (void *)player->album_art;\
                                        msg_param.size = info.size;\
@@ -794,7 +797,7 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                }       \
        } while (0)
 
-#define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
+#define MMPLAYER_UPDATE_TAG_UINT(gsttag, player, playertag) \
        do {    \
                if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint)) { \
                        if (v_uint) { \
@@ -808,34 +811,38 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                                        track_type = MM_PLAYER_TRACK_TYPE_TEXT; \
                                if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) { \
                                        if (track_type == MM_PLAYER_TRACK_TYPE_AUDIO) \
-                                               mm_attrs_set_int_by_name(attribute, "content_audio_bitrate", v_uint); \
+                                               mm_player_set_attribute((MMHandleType)player, NULL,\
+                                                               "content_audio_bitrate", v_uint, NULL); \
                                        player->bitrate[track_type] = v_uint; \
                                        player->total_bitrate = 0; \
                                        for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
                                                player->total_bitrate += player->bitrate[i]; \
-                                       mm_attrs_set_int_by_name(attribute, playertag, player->total_bitrate); \
+                                       mm_player_set_attribute((MMHandleType)player, NULL,\
+                                                       playertag, player->total_bitrate, NULL); \
                                        SECURE_LOGD("update bitrate %d[bps] of stream #%d.", v_uint, (int)track_type); \
                                } else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) { \
                                        player->maximum_bitrate[track_type] = v_uint; \
                                        player->total_maximum_bitrate = 0; \
                                        for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
                                                player->total_maximum_bitrate += player->maximum_bitrate[i]; \
-                                       mm_attrs_set_int_by_name(attribute, playertag, player->total_maximum_bitrate);\
+                                       mm_player_set_attribute((MMHandleType)player, NULL,\
+                                                       playertag, player->total_maximum_bitrate, NULL); \
                                        SECURE_LOGD("update maximum bitrate %d[bps] of stream #%d", v_uint, (int)track_type);\
                                } else { \
-                                       mm_attrs_set_int_by_name(attribute, playertag, v_uint); \
+                                       mm_player_set_attribute((MMHandleType)player, NULL, playertag, v_uint, NULL); \
                                } \
                                v_uint = 0;\
                        } \
                } \
        } while (0)
 
-#define MMPLAYER_UPDATE_TAG_DATE(gsttag, attribute, playertag) \
+#define MMPLAYER_UPDATE_TAG_DATE(gsttag, player, playertag) \
        do { \
                if (gst_tag_list_get_date(tag_list, gsttag, &date)) {\
                        if (date != NULL) {\
                                string = g_strdup_printf("%d", g_date_get_year(date));\
-                               mm_attrs_set_string_by_name(attribute, playertag, string);\
+                               mm_player_set_attribute((MMHandleType)player, NULL,\
+                                               playertag, string, strlen(string), NULL); \
                                SECURE_LOGD("metainfo year : %s", string);\
                                MMPLAYER_FREEIF(string);\
                                g_date_free(date);\
@@ -843,12 +850,13 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                } \
        } while (0)
 
-#define MMPLAYER_UPDATE_TAG_DATE_TIME(gsttag, attribute, playertag) \
+#define MMPLAYER_UPDATE_TAG_DATE_TIME(gsttag, player, playertag) \
        do { \
                if (gst_tag_list_get_date_time(tag_list, gsttag, &datetime)) {\
                        if (datetime != NULL) {\
                                string = g_strdup_printf("%d", gst_date_time_get_year(datetime));\
-                               mm_attrs_set_string_by_name(attribute, playertag, string);\
+                               mm_player_set_attribute((MMHandleType)player, NULL,\
+                                               playertag, string, strlen(string), NULL); \
                                SECURE_LOGD("metainfo year : %s", string);\
                                MMPLAYER_FREEIF(string);\
                                gst_date_time_unref(datetime);\
@@ -856,33 +864,9 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                } \
        } while (0)
 
-#define MMPLAYER_UPDATE_TAG_UINT64(gsttag, attribute, playertag) \
-       do { \
-               if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64)) {\
-                       if (v_uint64) {\
-                               /* FIXIT : don't know how to store date */\
-                               g_assert(1);\
-                               v_uint64 = 0;\
-                       } \
-               } \
-       } while (0)
-
-#define MMPLAYER_UPDATE_TAG_DOUBLE(gsttag, attribute, playertag) \
-       do { \
-               if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
-                       if (v_double) {\
-                               /* FIXIT : don't know how to store date */\
-                               g_assert(1);\
-                               v_double = 0;\
-                       } \
-               } \
-       } while (0)
-
        /* function start */
        GstTagList *tag_list = NULL;
 
-       MMHandleType attrs = 0;
-
        char *string = NULL;
        guint v_uint = 0;
        GDate *date = NULL;
@@ -898,69 +882,34 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player && msg, FALSE);
 
-       attrs = MMPLAYER_GET_ATTRS(player);
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(attrs, FALSE);
-
        /* get tag list from gst message */
        gst_message_parse_tag(msg, &tag_list);
 
        /* store tags to player attributes */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_TITLE, attrs, "tag_title");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_TITLE_SORTNAME, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ARTIST, attrs, "tag_artist");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ARTIST_SORTNAME, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ALBUM, attrs, "tag_album");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ALBUM_SORTNAME, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COMPOSER, attrs, "tag_author");
-       MMPLAYER_UPDATE_TAG_DATE(GST_TAG_DATE, attrs, "tag_date");
-       MMPLAYER_UPDATE_TAG_DATE_TIME(GST_TAG_DATE_TIME, attrs, "tag_date");
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_GENRE, attrs, "tag_genre");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COMMENT, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_EXTENDED_COMMENT, ?, ?); */
-       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_TRACK_NUMBER, attrs, "tag_track_num");
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_TRACK_COUNT, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_ALBUM_VOLUME_NUMBER, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_ALBUM_VOLUME_COUNT, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_LOCATION, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_DESCRIPTION, attrs, "tag_description");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_VERSION, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ISRC, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ORGANIZATION, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COPYRIGHT, attrs, "tag_copyright");
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COPYRIGHT_URI, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_CONTACT, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_LICENSE, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_LICENSE_URI, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_PERFORMER, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT64(GST_TAG_DURATION, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_CODEC, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_VIDEO_CODEC, attrs, "content_video_codec");
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_AUDIO_CODEC, attrs, "content_audio_codec");
-       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_BITRATE, attrs, "content_bitrate");
-       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_MAXIMUM_BITRATE, attrs, "content_max_bitrate");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_TITLE, player, "tag_title");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ARTIST, player, "tag_artist");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ALBUM, player, "tag_album");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COMPOSER, player, "tag_author");
+       MMPLAYER_UPDATE_TAG_DATE(GST_TAG_DATE, player, "tag_date");
+       MMPLAYER_UPDATE_TAG_DATE_TIME(GST_TAG_DATE_TIME, player, "tag_date");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_GENRE, player, "tag_genre");
+       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_TRACK_NUMBER, player, "tag_track_num");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_DESCRIPTION, player, "tag_description");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_COPYRIGHT, player, "tag_copyright");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_VIDEO_CODEC, player, "content_video_codec");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_AUDIO_CODEC, player, "content_audio_codec");
+       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_BITRATE, player, "content_bitrate");
+       MMPLAYER_UPDATE_TAG_UINT(GST_TAG_MAXIMUM_BITRATE, player, "content_max_bitrate");
        MMPLAYER_UPDATE_TAG_LOCK(player);
-       MMPLAYER_UPDATE_TAG_IMAGE(GST_TAG_IMAGE, attrs, "tag_album_cover");
+       MMPLAYER_UPDATE_TAG_IMAGE(GST_TAG_IMAGE, player, "tag_album_cover");
        MMPLAYER_UPDATE_TAG_UNLOCK(player);
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_NOMINAL_BITRATE, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_MINIMUM_BITRATE, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_SERIAL, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_ENCODER, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_UINT(GST_TAG_ENCODER_VERSION, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_TRACK_GAIN, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_TRACK_PEAK, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_ALBUM_GAIN, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_ALBUM_PEAK, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_REFERENCE_LEVEL, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_STRING(GST_TAG_LANGUAGE_CODE, ?, ?); */
-       /* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_BEATS_PER_MINUTE, ?, ?); */
-       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_IMAGE_ORIENTATION, attrs, "content_video_orientation");
+       MMPLAYER_UPDATE_TAG_STRING(GST_TAG_IMAGE_ORIENTATION, player, "content_video_orientation");
 
        if (strstr(GST_OBJECT_NAME(msg->src), "demux")) {
                if (player->video360_metadata.is_spherical == -1) {
                        __mmplayer_get_metadata_360_from_tags(tag_list, &player->video360_metadata);
-                       mm_attrs_set_int_by_name(attrs, "content_video_is_spherical",
-                                       player->video360_metadata.is_spherical);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       "content_video_is_spherical", player->video360_metadata.is_spherical, NULL);
                        if (player->video360_metadata.is_spherical == 1) {
                                LOGD("This is spherical content for 360 playback.");
                                player->is_content_spherical = TRUE;
@@ -993,9 +942,6 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                }
        }
 
-       if (mm_attrs_commit_all(attrs))
-               LOGE("failed to commit.");
-
        gst_tag_list_unref(tag_list);
 
        return TRUE;
@@ -1774,17 +1720,10 @@ __mmplayer_gst_handle_element_message(mmplayer_t *player, GstMessage *msg)
 {
        const gchar *structure_name;
        gint count = 0, idx = 0;
-       MMHandleType attrs = 0;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
 
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (!attrs) {
-               LOGE("Failed to get content attribute");
-               return;
-       }
-
        if (gst_message_get_structure(msg) == NULL)
                return;
 
@@ -1827,12 +1766,14 @@ __mmplayer_gst_handle_element_message(mmplayer_t *player, GstMessage *msg)
 
                if (gst_structure_get_int(gst_message_get_structure(msg), "num_buffers", &num_buffers)) {
                        LOGD("video_num_buffers : %d", num_buffers);
-                       mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_VIDEO_BUFFER_TOTAL_SIZE, num_buffers);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       MM_PLAYER_VIDEO_BUFFER_TOTAL_SIZE, num_buffers, NULL);
                }
 
                if (gst_structure_get_int(gst_message_get_structure(msg), "extra_num_buffers", &extra_num_buffers)) {
                        LOGD("num_of_vout_extra num buffers : %d", extra_num_buffers);
-                       mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_VIDEO_BUFFER_EXTRA_SIZE, extra_num_buffers);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       MM_PLAYER_VIDEO_BUFFER_EXTRA_SIZE, extra_num_buffers, NULL);
                }
                return;
        }
@@ -1856,21 +1797,27 @@ __mmplayer_gst_handle_element_message(mmplayer_t *player, GstMessage *msg)
                gchar *video_codec = NULL;
                gchar *video_frame_size = NULL;
 
-               gst_structure_get(gst_message_get_structure(msg), "rtsp_duration", G_TYPE_UINT64, &player->duration, NULL);
+               gst_structure_get(gst_message_get_structure(msg),
+                                       "rtsp_duration", G_TYPE_UINT64, &player->duration, NULL);
                LOGD("rtsp duration : %"G_GINT64_FORMAT" msec", GST_TIME_AS_MSECONDS(player->duration));
                player->streaming_type = _mmplayer_get_stream_service_type(player);
 
-               gst_structure_get(gst_message_get_structure(msg), "rtsp_audio_codec", G_TYPE_STRING, &audio_codec, NULL);
+               gst_structure_get(gst_message_get_structure(msg),
+                                       "rtsp_audio_codec", G_TYPE_STRING, &audio_codec, NULL);
                LOGD("rtsp_audio_codec : %s", audio_codec);
                if (audio_codec)
-                       mm_attrs_set_string_by_name(attrs, "content_audio_codec", audio_codec);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       "content_audio_codec", audio_codec, strlen(audio_codec), NULL);
 
-               gst_structure_get(gst_message_get_structure(msg), "rtsp_video_codec", G_TYPE_STRING, &video_codec, NULL);
+               gst_structure_get(gst_message_get_structure(msg),
+                                       "rtsp_video_codec", G_TYPE_STRING, &video_codec, NULL);
                LOGD("rtsp_video_codec : %s", video_codec);
                if (video_codec)
-                       mm_attrs_set_string_by_name(attrs, "content_video_codec", video_codec);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       "content_video_codec", video_codec, strlen(video_codec), NULL);
 
-               gst_structure_get(gst_message_get_structure(msg), "rtsp_video_frame_size", G_TYPE_STRING, &video_frame_size, NULL);
+               gst_structure_get(gst_message_get_structure(msg),
+                                       "rtsp_video_frame_size", G_TYPE_STRING, &video_frame_size, NULL);
                LOGD("rtsp_video_frame_size : %s", video_frame_size);
                if (video_frame_size) {
                        char *seperator = strchr(video_frame_size, '-');
@@ -1880,15 +1827,12 @@ __mmplayer_gst_handle_element_message(mmplayer_t *player, GstMessage *msg)
                                int separtor_len = strlen(seperator);
 
                                strncpy(video_width, video_frame_size, (frame_size_len - separtor_len));
-                               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_WIDTH, atoi(video_width));
-
                                seperator++;
-                               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_HEIGHT, atoi(seperator));
+
+                               mm_player_set_attribute((MMHandleType)player, NULL, MM_PLAYER_VIDEO_WIDTH,
+                                               atoi(video_width), MM_PLAYER_VIDEO_HEIGHT, atoi(seperator), NULL);
                        }
                }
-
-               if (mm_attrs_commit_all(attrs))
-                       LOGE("failed to commit.");
        }
 
        MMPLAYER_FLEAVE();
@@ -2744,6 +2688,7 @@ __mmplayer_gst_make_http_src(mmplayer_t *player)
        MMHandleType attrs = 0;
        gchar *user_agent, *cookies, **cookie_list;
        gint http_timeout = DEFAULT_HTTP_TIMEOUT;
+
        user_agent = cookies = NULL;
        cookie_list = NULL;
 
@@ -3730,32 +3675,24 @@ _mmplayer_gst_create_source(mmplayer_t *player)
 int
 _mmplayer_gst_build_es_pipeline(mmplayer_t *player)
 {
-       MMHandleType attrs = 0;
-
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
                                player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       /* get profile attribute */
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (!attrs) {
-               LOGE("failed to get content attribute");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-
        SECURE_LOGD("uri : %s", player->profile.uri);
 
-       mm_attrs_set_int_by_name(attrs, "profile_prepare_async", TRUE);
-       if (mm_attrs_commit_all(attrs)) /* return -1 if error */
-               LOGE("failed to commit");
+       mm_player_set_attribute((MMHandleType)player, NULL, "profile_prepare_async", TRUE, NULL);
 
-       if (player->v_stream_caps && !__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_VIDEO, player->v_stream_caps))
+       if ((player->v_stream_caps) &&
+               !(__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_VIDEO, player->v_stream_caps)))
                return MM_ERROR_PLAYER_INTERNAL;
 
-       if (player->a_stream_caps && !__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_AUDIO, player->a_stream_caps))
+       if ((player->a_stream_caps) &&
+               !(__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_AUDIO, player->a_stream_caps)))
                return MM_ERROR_PLAYER_INTERNAL;
 
-       if (player->s_stream_caps && !__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_TEXT, player->s_stream_caps))
+       if ((player->s_stream_caps) &&
+               !(__mmplayer_gst_create_es_path(player, MM_PLAYER_STREAM_TYPE_TEXT, player->s_stream_caps)))
                return MM_ERROR_PLAYER_INTERNAL;
 
        MMPLAYER_FLEAVE();
@@ -3769,20 +3706,12 @@ _mmplayer_gst_build_pipeline(mmplayer_t *player)
        GstElement *src_elem = NULL;
        GstElement *autoplug_elem = NULL;
        GList *element_bucket = NULL;
-       MMHandleType attrs = 0;
        main_element_id_e autoplug_elem_id = MMPLAYER_M_NUM;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
                                player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       /* get profile attribute */
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (!attrs) {
-               LOGE("failed to get content attribute");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-
        LOGD("uri type %d", player->profile.uri_type);
 
        /* create source element */
index b45b7d3..a925cef 100644 (file)
@@ -274,12 +274,6 @@ _mmplayer_update_content_attrs(mmplayer_t *player, enum content_attr_flag flag)
        if ((flag & ATTR_BITRATE) || (!has_bitrate && missing_only) || all)
                has_bitrate = __mmplayer_update_bitrate_attrs(player, attrs);
 
-       /* validate all */
-       if (mm_attrs_commit_all(attrs)) {
-               LOGE("failed to update attributes");
-               return FALSE;
-       }
-
        MMPLAYER_FLEAVE();
 
        return TRUE;
@@ -679,7 +673,7 @@ __mmplayer_initialize_gapless_play(mmplayer_t *player)
                player->v_stream_caps = NULL;
        }
 
-       mm_attrs_set_int_by_name(player->attrs, "content_video_found", 0);
+       mm_player_set_attribute((MMHandleType)player, NULL, "content_video_found", 0, NULL);
 
        /* clean found audio decoders */
        if (player->audio_decoders) {
@@ -1209,7 +1203,7 @@ _mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
 
                MMPLAYER_FREEIF(caps_str);
 
-               mm_attrs_set_int_by_name(player->attrs, "content_video_found", TRUE);
+               mm_player_set_attribute((MMHandleType)player, NULL, "content_video_found", TRUE, NULL);
                mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
 
                LOGD("surface type : %d", stype);
@@ -1346,7 +1340,6 @@ __mmplayer_create_sink_path(mmplayer_t *player, GstElement *selector, mmplayer_t
 static void
 __mmplayer_set_decode_track_info(mmplayer_t *player, mmplayer_track_type_e type)
 {
-       MMHandleType attrs = 0;
        gint active_index = 0;
 
        MMPLAYER_FENTER();
@@ -1363,18 +1356,10 @@ __mmplayer_set_decode_track_info(mmplayer_t *player, mmplayer_track_type_e type)
                return;
        }
 
-       if (type == MM_PLAYER_TRACK_TYPE_TEXT) {
-               attrs = MMPLAYER_GET_ATTRS(player);
-               if (attrs) {
-                       mm_attrs_set_int_by_name(attrs, "content_text_track_num", player->selector[type].total_track_num);
-                       mm_attrs_set_int_by_name(attrs, "current_text_track_index", player->selector[type].active_pad_index);
-
-                       if (mm_attrs_commit_all(attrs))
-                               LOGW("failed to commit attrs.");
-               } else {
-                       LOGW("cannot get content attribute");
-               }
-       }
+       if (type == MM_PLAYER_TRACK_TYPE_TEXT)
+               mm_player_set_attribute((MMHandleType)player, NULL,
+                               "content_text_track_num", player->selector[type].total_track_num,
+                               "current_text_track_index", player->selector[type].active_pad_index, NULL);
 
        MMPLAYER_FLEAVE();
        return;
@@ -1631,7 +1616,8 @@ __mmplayer_gst_create_sinkbin(GstElement *elem, GstPad *pad, gpointer data)
                        const gchar *audio_format = gst_structure_get_string(str, "format");
                        if (audio_format) {
                                LOGD("original audio format %s", audio_format);
-                               mm_attrs_set_string_by_name(player->attrs, "content_audio_format", audio_format);
+                               mm_player_set_attribute((MMHandleType)player, NULL,
+                                               "content_audio_format", audio_format, strlen(audio_format), NULL);
                        }
 
                        if (__mmplayer_gst_create_audio_sink_bin(player) != MM_ERROR_NONE) {
@@ -1946,10 +1932,11 @@ static void __mmplayer_video_param_set_roi_area(mmplayer_t *player)
 
        if (handle) {
                /* It should be set after setting window */
-               mm_attrs_get_int_by_name(attrs, "display_win_roi_x", &win_roi_x);
-               mm_attrs_get_int_by_name(attrs, "display_win_roi_y", &win_roi_y);
-               mm_attrs_get_int_by_name(attrs, "display_win_roi_width", &win_roi_width);
-               mm_attrs_get_int_by_name(attrs, "display_win_roi_height", &win_roi_height);
+               mm_attrs_multiple_get(attrs, NULL,
+                                       "display_win_roi_x", &win_roi_x,
+                                       "display_win_roi_y", &win_roi_y,
+                                       "display_win_roi_width", &win_roi_width,
+                                       "display_win_roi_height", &win_roi_height, NULL);
 
                /* After setting window handle, set display roi area */
                gst_video_overlay_set_display_roi_area(
@@ -2550,9 +2537,11 @@ __mmplayer_gst_set_pulsesink_property(mmplayer_t *player)
        mm_attrs_get_string_by_name(player->attrs, "sound_stream_type", &stream_type);
 
        if (!stream_type)
-               snprintf(stream_props, sizeof(stream_props) - 1, "props,application.process.id.origin=%d", player->client_pid);
+               snprintf(stream_props, sizeof(stream_props) - 1,
+                               "props,application.process.id.origin=%d", player->client_pid);
        else
-               snprintf(stream_props, sizeof(stream_props) - 1, "props,media.role=%s, media.parent_id=%d, application.process.id.origin=%d",
+               snprintf(stream_props, sizeof(stream_props) - 1,
+                               "props,media.role=%s, media.parent_id=%d, application.process.id.origin=%d",
                                stream_type, stream_id, player->client_pid);
 
        props = gst_structure_from_string(stream_props, NULL);
@@ -3205,8 +3194,10 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size)
 
                /* update video num buffers */
                LOGD("video_num_buffers : %d", idx);
-               mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_VIDEO_BUFFER_TOTAL_SIZE, idx);
-               mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_VIDEO_BUFFER_EXTRA_SIZE, MAX(DEFAULT_NUM_OF_V_OUT_BUFFER, (idx/2)));
+               mm_player_set_attribute((MMHandleType)player, NULL,
+                               MM_PLAYER_VIDEO_BUFFER_TOTAL_SIZE, idx,
+                               MM_PLAYER_VIDEO_BUFFER_EXTRA_SIZE, MAX(DEFAULT_NUM_OF_V_OUT_BUFFER, (idx / 2)),
+                               NULL);
 
                if (idx == 0) {
                        MMPLAYER_VIDEO_BO_UNLOCK(player);
@@ -5043,8 +5034,9 @@ _mmplayer_realize(MMHandleType hplayer)
                player->streamer = _mm_player_streaming_create();
                _mm_player_streaming_initialize(player->streamer, TRUE);
 
-               mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_PREBUFFER_MS, &prebuffer_ms);
-               mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_REBUFFER_MS, &rebuffer_ms);
+               mm_attrs_multiple_get(player->attrs, NULL,
+                               MM_PLAYER_PREBUFFER_MS, &prebuffer_ms,
+                               MM_PLAYER_REBUFFER_MS, &rebuffer_ms, NULL);
 
                if (prebuffer_ms > 0) {
                        prebuffer_ms = MAX(prebuffer_ms, 1000);
@@ -5814,10 +5806,11 @@ __mmplayer_set_audio_attrs(mmplayer_t *player, GstCaps *caps)
 
        /* set stream information */
        gst_structure_get_int(caps_structure, "rate", &samplerate);
-       mm_attrs_set_int_by_name(player->attrs, "content_audio_samplerate", samplerate);
-
        gst_structure_get_int(caps_structure, "channels", &channels);
-       mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels);
+
+       mm_player_set_attribute((MMHandleType)player, NULL,
+                       "content_audio_samplerate", samplerate,
+                       "content_audio_channels", channels, NULL);
 
        LOGD("audio samplerate : %d     channels : %d", samplerate, channels);
 }
@@ -6325,16 +6318,15 @@ __mmplayer_get_next_uri(mmplayer_t *player)
                break;
        }
 
-       if (uri_idx == num_of_list) {
+       if (!uri || uri_idx == num_of_list) {
                LOGE("failed to find next uri");
                return FALSE;
        }
 
        player->uri_info.uri_idx = uri_idx;
-       mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
-
-       if (mm_attrs_commit_all(player->attrs)) {
-               LOGE("failed to commit");
+       if (mm_player_set_attribute((MMHandleType)player, NULL,
+                       "profile_uri", uri, strlen(uri), NULL) != MM_ERROR_NONE) {
+               LOGE("failed to set attribute");
                return FALSE;
        }
 
@@ -6376,7 +6368,10 @@ __mmplayer_verify_gapless_play_path(mmplayer_t *player)
                goto ERROR;
        }
 
-       mm_attrs_get_int_by_name(attrs, "content_video_found", &video);
+       mm_attrs_multiple_get(player->attrs, NULL,
+                       "content_video_found", &video,
+                       "profile_play_count", &count,
+                       MM_PLAYER_GAPLESS_MODE, &gapless, NULL);
 
        /* gapless playback is not supported in case of video at TV profile. */
        profile_tv = __mmplayer_check_profile();
@@ -6385,12 +6380,6 @@ __mmplayer_verify_gapless_play_path(mmplayer_t *player)
                goto ERROR;
        }
 
-       if (mm_attrs_get_int_by_name(attrs, "profile_play_count", &count) != MM_ERROR_NONE)
-               LOGE("failed to get play count");
-
-       if (mm_attrs_get_int_by_name(attrs, MM_PLAYER_GAPLESS_MODE, &gapless) != MM_ERROR_NONE)
-               LOGE("failed to get gapless mode");
-
        /* check repeat count in case of audio */
        if (!gapless &&
                (video || (count != REPEAT_COUNT_INFINITE && count < REPEAT_COUNT_MIN))) {
@@ -6408,11 +6397,7 @@ __mmplayer_verify_gapless_play_path(mmplayer_t *player)
                        /* decrease play count */
                        /* we succeeded to rewind. update play count and then wait for next EOS */
                        count--;
-                       mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
-                       /* commit attribute */
-                       if (mm_attrs_commit_all(attrs))
-                               LOGE("failed to commit attribute");
-
+                       mm_player_set_attribute((MMHandleType)player, NULL, "profile_play_count", count, NULL);
                } else if (count != REPEAT_COUNT_INFINITE) {
                        LOGD("there is no next uri and no repeat");
                        goto ERROR;
@@ -6573,10 +6558,11 @@ _mmplayer_set_uri(MMHandleType hplayer, const char *uri)
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(uri, MM_ERROR_INVALID_ARGUMENT);
 
-       mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
-       if (mm_attrs_commit_all(player->attrs)) {
-               LOGE("failed to commit the original uri.");
+       if (mm_player_set_attribute(hplayer, NULL,
+                       "profile_uri", uri, strlen(uri), NULL) != MM_ERROR_NONE) {
+               LOGE("failed to set attribute");
                result = MM_ERROR_PLAYER_INTERNAL;
        } else {
                if (_mmplayer_set_next_uri(hplayer, uri, TRUE) != MM_ERROR_NONE)
@@ -6726,7 +6712,9 @@ __mmplayer_gst_decode_autoplug_continue(GstElement *bin,  GstPad *pad,
                caps_str = gst_caps_to_string(caps);
                /* set it directly because not sent by TAG */
                if (g_strrstr(caps_str, "mobile-xmf"))
-                       mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", "mobile-xmf");
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       "content_audio_codec", "mobile-xmf", strlen("mobile-xmf"), NULL);
+
                MMPLAYER_FREEIF(caps_str);
        } else if (g_str_has_prefix(mime, "video") && !player->ini.video_playback_supported) {
                MMMessageParamType msg_param;
@@ -6830,9 +6818,7 @@ static void __mmplayer_rebuild_audio_pipeline(mmplayer_t *player)
        _mmplayer_set_position((MMHandleType)player, position);
 
        /* async not to be blocked in streaming case */
-       mm_attrs_set_int_by_name(player->attrs, "profile_prepare_async", TRUE);
-       if (mm_attrs_commit_all(player->attrs))
-               LOGE("failed to commit");
+       mm_player_set_attribute((MMHandleType)player, NULL, "profile_prepare_async", TRUE, NULL);
 
        _mmplayer_pause((MMHandleType)player);
 
@@ -7470,7 +7456,7 @@ __mmplayer_release_misc_post(mmplayer_t *player)
 
        MMPLAYER_RETURN_IF_FAIL(player);
 
-       mm_attrs_set_int_by_name(player->attrs, "content_video_found", 0);
+       mm_player_set_attribute((MMHandleType)player, NULL, "content_video_found", 0, NULL);
 
        /* clean found audio decoders */
        if (player->audio_decoders) {
@@ -7487,13 +7473,11 @@ __mmplayer_release_misc_post(mmplayer_t *player)
        if (player->uri_info.uri_list) {
                original_uri = g_list_nth_data(player->uri_info.uri_list, 0);
 
-               if (player->attrs) {
-                       mm_attrs_set_string_by_name(player->attrs, "profile_uri", original_uri);
-                       LOGD("restore original uri = %s", original_uri);
+               if (!original_uri)
+                       LOGW("failed to get original uri info");
 
-                       if (mm_attrs_commit_all(player->attrs))
-                               LOGE("failed to commit the original uri.");
-               }
+               mm_player_set_attribute((MMHandleType)player, NULL, "profile_uri",
+                               original_uri, (original_uri) ? strlen(original_uri) : (0), NULL);
 
                GList *uri_list = player->uri_info.uri_list;
                for (; uri_list; uri_list = g_list_next(uri_list)) {
@@ -7722,13 +7706,8 @@ _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_typ
 
        /* videobin is not created yet, so we just set attributes related to display surface */
        LOGD("store display attribute for given surface type(%d)", surface_type);
-       mm_attrs_set_int_by_name(player->attrs, "display_surface_type", surface_type);
-       mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
-       if (mm_attrs_commit_all(player->attrs)) {
-               LOGE("failed to commit attribute");
-               MMPLAYER_FLEAVE();
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
+       mm_player_set_attribute(handle, NULL, "display_surface_type", surface_type,
+                       "display_overlay", display_overlay, sizeof(display_overlay), NULL);
 
        MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
@@ -7911,16 +7890,16 @@ __mmplayer_change_external_subtitle_language(mmplayer_t *player, const char *fil
                goto EXIT;
        }
 
-       LOGD("old subtitle file path is [%s]", subtitle_uri);
-       LOGD("new subtitle file path is [%s]", filepath);
+       SECURE_LOGD("old subtitle file path is [%s]", subtitle_uri);
+       SECURE_LOGD("new subtitle file path is [%s]", filepath);
 
        if (!strcmp(filepath, subtitle_uri)) {
-               LOGD("No need to swtich subtitle, as input filepath is same as current filepath");
+               LOGD("subtitle path is not changed");
                goto EXIT;
        } else {
-               mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
-               if (mm_attrs_commit_all(player->attrs)) {
-                       LOGE("failed to commit.");
+               if (mm_player_set_attribute((MMHandleType)player, NULL,
+                               "subtitle_uri", filepath, strlen(filepath), NULL) != MM_ERROR_NONE) {
+                       LOGE("failed to set attribute");
                        goto EXIT;
                }
        }
@@ -7997,9 +7976,9 @@ _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char *filepath)
 
        if (!player->pipeline) {
                /* IDLE state */
-               mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
-               if (mm_attrs_commit_all(player->attrs)) {
-                       LOGE("failed to commit");       /* subtitle path will not be created */
+               if (mm_player_set_attribute(hplayer, NULL, "subtitle_uri", filepath,
+                               (filepath)?(strlen(filepath)):(0), NULL) != MM_ERROR_NONE) {
+                       LOGE("failed to set attribute");
                        return MM_ERROR_PLAYER_INTERNAL;
                }
        } else {
@@ -8008,13 +7987,13 @@ _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char *filepath)
                MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
                if (!__mmplayer_check_subtitle(player)) {
-                       mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
-                       if (mm_attrs_commit_all(player->attrs)) {
-                               LOGE("failed to commit");
+                       if (mm_player_set_attribute(hplayer, NULL, "subtitle_uri",
+                                       filepath, strlen(filepath), NULL) != MM_ERROR_NONE) {
+                               LOGE("failed to set attribute");
                                return MM_ERROR_PLAYER_INTERNAL;
                        }
 
-                       if (MM_ERROR_NONE != __mmplayer_gst_create_text_pipeline(player)) {
+                       if (__mmplayer_gst_create_text_pipeline(player) != MM_ERROR_NONE) {
                                LOGE("fail to create text pipeline");
                                return MM_ERROR_PLAYER_INTERNAL;
                        }
@@ -8535,7 +8514,6 @@ _mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_typ
 #define IDX_FIRST_SW_CODEC 0
        mmplayer_t *player = (mmplayer_t *)hplayer;
        const char *attr_name = (stream_type == MM_PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
-       MMHandleType attrs = 0;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -8576,14 +8554,7 @@ _mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_typ
        }
 
        LOGD("update %s codec_type to %d", attr_name, codec_type);
-
-       attrs = MMPLAYER_GET_ATTRS(player);
-       mm_attrs_set_int_by_name(attrs, attr_name, codec_type);
-
-       if (mm_attrs_commit_all(player->attrs)) {
-               LOGE("failed to commit codec_type attributes");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
+       mm_player_set_attribute(hplayer, NULL, attr_name, codec_type, NULL);
 
        MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
@@ -8815,10 +8786,11 @@ __mmplayer_update_audio_attrs(mmplayer_t *player, MMHandleType attrs)
        mm_attrs_get_int_by_name(attrs, "content_audio_samplerate", &samplerate);
 
        gst_structure_get_int(p, "rate", &samplerate);
-       mm_attrs_set_int_by_name(attrs, "content_audio_samplerate", samplerate);
-
        gst_structure_get_int(p, "channels", &channels);
-       mm_attrs_set_int_by_name(attrs, "content_audio_channels", channels);
+
+       mm_player_set_attribute((MMHandleType)player, NULL,
+                       "content_audio_samplerate", samplerate,
+                       "content_audio_channels", channels, NULL);
 
        SECURE_LOGD("samplerate : %d    channels : %d", samplerate, channels);
 
@@ -8863,10 +8835,10 @@ __mmplayer_update_video_attrs(mmplayer_t *player, MMHandleType attrs)
 
        p = gst_caps_get_structure(caps_v, 0);
        gst_structure_get_int(p, "width", &width);
-       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_WIDTH, width);
-
        gst_structure_get_int(p, "height", &height);
-       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_HEIGHT, height);
+
+       mm_player_set_attribute((MMHandleType)player, NULL,
+                       MM_PLAYER_VIDEO_WIDTH, width, MM_PLAYER_VIDEO_HEIGHT, height, NULL);
 
        gst_structure_get_fraction(p, "framerate", &tmpNu, &tmpDe);
 
@@ -8876,7 +8848,8 @@ __mmplayer_update_video_attrs(mmplayer_t *player, MMHandleType attrs)
        gst_object_unref(pad);
 
        if (tmpDe > 0) {
-               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_FPS, tmpNu / tmpDe);
+               mm_player_set_attribute((MMHandleType)player, NULL,
+                               MM_PLAYER_VIDEO_FPS, (tmpNu/tmpDe), NULL);
                SECURE_LOGD("fps : %d", tmpNu / tmpDe);
        }
 
@@ -8913,9 +8886,10 @@ __mmplayer_update_bitrate_attrs(mmplayer_t *player, MMHandleType attrs)
                msec_dur = GST_TIME_AS_MSECONDS(player->duration);
                if (msec_dur > 0) {
                        bitrate = data_size * 8 * 1000 / msec_dur;
-                       SECURE_LOGD("file size : %"G_GUINT64_FORMAT", video bitrate = %"G_GUINT64_FORMAT, data_size, bitrate);
-                       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_BITRATE, bitrate);
-
+                       SECURE_LOGD("file size : %"G_GUINT64_FORMAT
+                                       ", video bitrate = %"G_GUINT64_FORMAT, data_size, bitrate);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       MM_PLAYER_VIDEO_BITRATE, (int)bitrate, NULL);
                        ret = TRUE;
                } else {
                        LOGD("player duration is less than 0");
@@ -8924,7 +8898,8 @@ __mmplayer_update_bitrate_attrs(mmplayer_t *player, MMHandleType attrs)
 
        if (MMPLAYER_IS_RTSP_STREAMING(player)) {
                if (player->total_bitrate) {
-                       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_BITRATE, player->total_bitrate);
+                       mm_player_set_attribute((MMHandleType)player, NULL,
+                                       MM_PLAYER_VIDEO_BITRATE, player->total_bitrate, NULL);
                        ret = TRUE;
                }
        }
@@ -9312,10 +9287,9 @@ __mmplayer_set_playing_state(mmplayer_t *player)
                else
                        audio_codec = "unknown";
 
-               mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", audio_codec);
-
-               if (mm_attrs_commit_all(player->attrs))
-                       LOGE("failed to update attributes");
+               if (mm_player_set_attribute((MMHandleType)player, NULL,
+                               "content_audio_codec", audio_codec, strlen(audio_codec), NULL) != MM_ERROR_NONE)
+                       LOGE("failed to set attribute");
 
                LOGD("set audio codec type with caps");
        }
index 317d2f5..e76b8a4 100644 (file)
@@ -23,6 +23,7 @@
 #include <mm_error.h>
 #include "mm_player_utils.h"
 #include "mm_player_tracks.h"
+#include "mm_player_attrs.h"
 
 #define INVALID_TRACK_INDEX -1
 #define LANGUAGE_CODE_SIZE (3 + 1) /* Size of ISO-639-1, and considering the nul-terminator */
@@ -131,17 +132,9 @@ _mmplayer_select_track(MMHandleType hplayer, mmplayer_track_type_e type, int ind
        }
 
        if (type == MM_PLAYER_TRACK_TYPE_TEXT) {
-               MMHandleType attrs = MMPLAYER_GET_ATTRS(player);
-               if (!attrs) {
-                       LOGE("cannot get content attribute");
-                       ret = MM_ERROR_PLAYER_INTERNAL;
-                       goto EXIT;
-               }
-
-               mm_attrs_set_int_by_name(attrs, "current_text_track_index", index);
-
-               if (mm_attrs_commit_all(attrs)) {
-                       LOGE("failed to commit");
+               if (mm_player_set_attribute(hplayer, NULL,
+                               "current_text_track_index", index, NULL) != MM_ERROR_NONE) {
+                       LOGE("failed to set text track index");
                        ret = MM_ERROR_PLAYER_INTERNAL;
                        goto EXIT;
                }
@@ -287,17 +280,11 @@ void
 _mmplayer_track_destroy(mmplayer_t *player)
 {
        mmplayer_track_type_e type = MM_PLAYER_TRACK_TYPE_AUDIO;
-       MMHandleType attrs = 0;
        MMPLAYER_FENTER();
 
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (attrs) {
-               mm_attrs_set_int_by_name(attrs, "content_text_track_num", 0);
-               mm_attrs_set_int_by_name(attrs, "current_text_track_index", INVALID_TRACK_INDEX);
-
-               if (mm_attrs_commit_all(attrs))
-                       LOGE("failed to commit");
-       }
+       if (mm_player_set_attribute((MMHandleType)player, NULL, "content_text_track_num", 0,
+                       "current_text_track_index", INVALID_TRACK_INDEX, NULL) != MM_ERROR_NONE)
+               LOGE("failed to reset track attr");
 
        for (; type < MM_PLAYER_TRACK_TYPE_MAX ; type++) {
                player->selector[type].active_pad_index = 0;
@@ -323,7 +310,6 @@ _mmplayer_track_update_selector_info(mmplayer_t *player, mmplayer_track_type_e t
 void
 _mmplayer_track_update_text_attr_info(mmplayer_t *player, GstMessage *msg)
 {
-        MMHandleType attrs = 0;
         const GValue *lang_list = NULL;
         mmplayer_lang_info_t *temp = NULL;
         gchar *current_lang = NULL;
@@ -333,12 +319,6 @@ _mmplayer_track_update_text_attr_info(mmplayer_t *player, GstMessage *msg)
         MMPLAYER_FENTER();
         MMPLAYER_RETURN_IF_FAIL(player && msg);
 
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (!attrs) {
-               LOGE("failed to get content attribute");
-               return;
-       }
-
        if (!gst_message_get_structure(msg)) {
                LOGE("failed to get msg structure");
                return;
@@ -358,7 +338,8 @@ _mmplayer_track_update_text_attr_info(mmplayer_t *player, GstMessage *msg)
 
        MMPLAYER_SUBTITLE_INFO_LOCK(player);
        player->subtitle_language_list = (GList *)g_value_get_pointer(lang_list);
-       mm_attrs_set_int_by_name(attrs, "content_text_track_num", (gint)track_count);
+       mm_player_set_attribute((MMHandleType)player, NULL,
+                       "content_text_track_num", (gint)track_count, NULL);
        g_object_get(G_OBJECT(msg->src), "current-language", &current_lang, NULL);
 
        LOGI("track count: %d, current track lang: %s", track_count, current_lang);
@@ -380,13 +361,11 @@ _mmplayer_track_update_text_attr_info(mmplayer_t *player, GstMessage *msg)
        }
 
        if (track_index > INVALID_TRACK_INDEX)
-               mm_attrs_set_int_by_name(attrs, "current_text_track_index", track_index);
+               mm_player_set_attribute((MMHandleType)player, NULL,
+                               "current_text_track_index", track_index, NULL);
        else
                LOGE("failed to find current track index");
 
-       if (mm_attrs_commit_all(attrs))
-               LOGE("failed to commit");
-
 EXIT:
        MMPLAYER_SUBTITLE_INFO_SIGNAL(player);
        MMPLAYER_SUBTITLE_INFO_UNLOCK(player);