[0.6.190] use msg to notify the push buffer info 24/205824/2
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 9 May 2019 09:55:00 +0000 (18:55 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Thu, 9 May 2019 11:05:21 +0000 (20:05 +0900)
- send msg about push buffer status,
  seek data request and chagned video stream info
  to invoke related callback
- remove additional internal callback path

Change-Id: I01ab88ccdf5e1588d057f7681bbdc39f259f38a0

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_es.h
src/include/mm_player_priv.h
src/include/mm_player_utils.h
src/mm_player.c
src/mm_player_es.c
src/mm_player_gst.c
src/mm_player_priv.c

index cbf3ffe..4746670 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.189
+Version:    0.6.190
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index cda397a..a0d8f91 100644 (file)
  *
  */
 #define MM_PLAYER_VIDEO_HEIGHT              "content_video_height"
+
+/**
+ * MM_PLAYER_VIDEO_FPS:
+ */
+#define MM_PLAYER_VIDEO_FPS                 "content_video_fps"
+
+/**
+ * MM_PLAYER_VIDEO_BITRATE:
+ */
+#define MM_PLAYER_VIDEO_BITRATE             "content_video_bitrate"
+
 /**
  * MM_PLAYER_VIDEO_EVAS_SURFACE_SINK:
  *
@@ -538,28 +549,6 @@ typedef struct _SubtitleStreamInfo {
 typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
 
 /**
- * Buffer underrun / overflow data callback function type.
- *
- * @param      status     [in] buffer status
- * @param      user_param [in] User defined parameter which is passed when set
- *                          to enough data callback or need data callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_media_stream_buffer_status_callback)(mmplayer_stream_type_e type, mmplayer_media_stream_buffer_status_e status, unsigned long long bytes, void *user_param);
-
-/**
- * Buffer seek data callback function type.
- *
- * @param      offset     [in] offset for the buffer playback
- * @param      user_param [in] User defined parameter which is passed when set
- *                          to seek data callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_media_stream_seek_data_callback)(mmplayer_stream_type_e type, unsigned long long offset, void *user_param);
-
-/**
  * Called to notify the stream changed.
  *
  * @param user_data [in] The user data passed from the callback registration function
@@ -1273,32 +1262,6 @@ int mm_player_set_audio_info(MMHandleType player, media_format_h format);
 int mm_player_set_subtitle_info(MMHandleType player, mmplayer_subtitle_stream_info_t *info);
 
 /**
- * This function set callback function for receiving need or enough data message from player.
- *
- * @param   player     [in] Handle of player.
- * @param   type       [in] stream type
- * @param   callback   [in] data callback function for stream type.
- * @param   user_param [in] User parameter.
- *
- * @return  This function returns zero on success, or negative value with error
- *          code.
- */
-int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_buffer_status_callback callback, void *user_param);
-
-/**
- * This function set callback function for receiving seek data message from player.
- *
- * @param       player          [in]    Handle of player.
- * @param       type            [in]    stream type
- * @param       callback        [in]    Seek data callback function for stream type.
- * @param       user_param      [in]    User parameter.
- *
- * @return      This function returns zero on success, or negative value with error
- *                      code.
- */
-int mm_player_set_media_stream_seek_data_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_seek_data_callback callback, void *user_param);
-
-/**
  * This function is to set max size of buffer(appsrc).
  *
  * @param       player          [in]    Handle of player.
@@ -1362,20 +1325,6 @@ int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, mmplayer_
 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
 
 /**
- * This function set callback function for changing video stream from player. \n
- * It's only supported when video stream is included in file. \n
- *
- * @param      player   [in] Handle of player.
- * @param      callback [in] Video stream changed callback function.
- * @param      user_param [in] User parameter.
- *
- * @return     This function returns zero on success, or negative value with error
- *                     code.
- * @see                mm_player_stream_changed_callback
- */
-int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
-
-/**
  * This function is to get timeout value according to the content type for muse. \n
  * It's only supported when video stream is included in file. \n
  *
index c0c3315..25df7ad 100644 (file)
@@ -45,16 +45,6 @@ int _mmplayer_set_subtitle_info(MMHandleType player, mmplayer_subtitle_stream_in
 
 int _mmplayer_submit_packet(MMHandleType player, media_packet_h packet);
 
-int _mmplayer_set_media_stream_buffer_status_cb(MMHandleType player,
-                                                                                       mmplayer_stream_type_e type,
-                                                                                       mm_player_media_stream_buffer_status_callback callback,
-                                                                                       void *user_param);
-
-int _mmplayer_set_media_stream_seek_data_cb(MMHandleType player,
-                                                                                       mmplayer_stream_type_e type,
-                                                                                       mm_player_media_stream_seek_data_callback callback,
-                                                                                       void *user_param);
-
 int _mmplayer_set_media_stream_max_size(MMHandleType hplayer,
                                                                                        mmplayer_stream_type_e type,
                                                                                        guint64 max_size);
index 78cc1f8..2ff24d9 100644 (file)
@@ -586,16 +586,6 @@ typedef struct {
 
        guint64 media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_MAX];
        guint media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_MAX];
-       mm_player_media_stream_buffer_status_callback media_stream_buffer_status_cb[MM_PLAYER_STREAM_TYPE_MAX];
-       mm_player_media_stream_seek_data_callback media_stream_seek_data_cb[MM_PLAYER_STREAM_TYPE_MAX];
-       GMutex media_stream_cb_lock;
-
-       void *buffer_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
-       void *seek_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
-
-       /* video stream changed callback */
-       mm_player_stream_changed_callback video_stream_changed_cb;
-       void *video_stream_changed_cb_user_param;
 
        /* audio stream changed callback */
        mm_player_stream_changed_callback audio_stream_changed_cb;
@@ -848,7 +838,6 @@ int _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration);
 int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int pos);
 int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming);
 int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, void *user_param);
-int _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
 int _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
 int _mmplayer_set_video_decoded_cb(MMHandleType hplayer, mm_player_video_decoded_callback callback, void *user_param);
 int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent);
index af605f0..e0ffbc5 100644 (file)
 #define MMPLAYER_VIDEO_BO_WAIT_UNTIL(x_player, end_time)     g_cond_wait_until(&((mmplayer_t *)x_player)->video_bo_cond, &((mmplayer_t *)x_player)->video_bo_mutex, end_time)
 #define MMPLAYER_VIDEO_BO_SIGNAL(x_player)                   g_cond_signal(&((mmplayer_t *)x_player)->video_bo_cond);
 
-/* media stream lock */
-#define MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(x_player)        g_mutex_lock(&((mmplayer_t *)x_player)->media_stream_cb_lock)
-#define MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(x_player)      g_mutex_unlock(&((mmplayer_t *)x_player)->media_stream_cb_lock)
-
 /* subtitle info */
 #define MMPLAYER_SUBTITLE_INFO_LOCK(x_player)                     g_mutex_lock(&((mmplayer_t *)x_player)->subtitle_info_mutex)
 #define MMPLAYER_SUBTITLE_INFO_UNLOCK(x_player)                   g_mutex_unlock(&((mmplayer_t *)x_player)->subtitle_info_mutex)
index 566c1d4..e5ca355 100644 (file)
@@ -835,40 +835,6 @@ int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, mmplayer_
        return result;
 }
 
-int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_buffer_status_callback callback, void *user_param)
-{
-       int result = MM_ERROR_NONE;
-
-       LOGD("\n");
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       MMPLAYER_CMD_LOCK(player);
-
-       result = _mmplayer_set_media_stream_buffer_status_cb(player, type, callback, user_param);
-
-       MMPLAYER_CMD_UNLOCK(player);
-
-       return result;
-}
-
-int mm_player_set_media_stream_seek_data_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_seek_data_callback callback, void *user_param)
-{
-       int result = MM_ERROR_NONE;
-
-       LOGD("\n");
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       MMPLAYER_CMD_LOCK(player);
-
-       result = _mmplayer_set_media_stream_seek_data_cb(player, type, callback, user_param);
-
-       MMPLAYER_CMD_UNLOCK(player);
-
-       return result;
-}
-
 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
 {
        int result = MM_ERROR_NONE;
@@ -884,21 +850,6 @@ int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_s
        return result;
 }
 
-int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
-{
-       int result = MM_ERROR_NONE;
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       MMPLAYER_CMD_LOCK(player);
-
-       result = _mmplayer_set_videostream_changed_cb(player, callback, user_param);
-
-       MMPLAYER_CMD_UNLOCK(player);
-
-       return result;
-}
-
 int mm_player_get_timeout(MMHandleType player, int *timeout)
 {
        int result = MM_ERROR_NONE;
index 1ae5921..002e801 100644 (file)
@@ -190,72 +190,6 @@ __mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
        return ret;
 }
 
-int
-_mmplayer_set_media_stream_buffer_status_cb(MMHandleType hplayer,
-                                                                                       mmplayer_stream_type_e type,
-                                                                                       mm_player_media_stream_buffer_status_callback callback,
-                                                                                       void *user_param)
-{
-       mmplayer_t *player = (mmplayer_t *)hplayer;
-
-       MMPLAYER_FENTER();
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
-
-       if (player->media_stream_buffer_status_cb[type]) {
-               if (!callback)
-                       LOGD("[type:%s] will be clear", MMPLAYER_STREAM_TYPE_GET_NAME(type));
-               else
-                       LOGD("[type:%s] will be overwritten", MMPLAYER_STREAM_TYPE_GET_NAME(type));
-       }
-
-       player->media_stream_buffer_status_cb[type] = callback;
-       player->buffer_cb_user_param[type] = user_param;
-
-       LOGD("player handle %p, type %s, callback %p",
-                       player, MMPLAYER_STREAM_TYPE_GET_NAME(type), player->media_stream_buffer_status_cb[type]);
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
-
-       MMPLAYER_FLEAVE();
-
-       return MM_ERROR_NONE;
-}
-
-int
-_mmplayer_set_media_stream_seek_data_cb(MMHandleType hplayer,
-                                                                               mmplayer_stream_type_e type,
-                                                                               mm_player_media_stream_seek_data_callback callback,
-                                                                               void *user_param)
-{
-       mmplayer_t *player = (mmplayer_t *)hplayer;
-
-       MMPLAYER_FENTER();
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
-
-       if (player->media_stream_seek_data_cb[type]) {
-               if (!callback)
-                       LOGD("[type:%s] will be clear", MMPLAYER_STREAM_TYPE_GET_NAME(type));
-               else
-                       LOGD("[type:%s] will be overwritten", MMPLAYER_STREAM_TYPE_GET_NAME(type));
-       }
-
-       player->media_stream_seek_data_cb[type] = callback;
-       player->seek_cb_user_param[type] = user_param;
-
-       LOGD("player handle %p, type %s, callback %p",
-                       player, MMPLAYER_STREAM_TYPE_GET_NAME(type), player->media_stream_seek_data_cb[type]);
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
-
-       MMPLAYER_FLEAVE();
-
-       return MM_ERROR_NONE;
-}
-
 static GstElement *
 __mmplayer_get_source_element(mmplayer_t *player, mmplayer_stream_type_e type)
 {
@@ -381,6 +315,7 @@ __mmplayer_check_buffer_level(mmplayer_t *player, GstElement *element, mmplayer_
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && element, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(((type == MM_PLAYER_STREAM_TYPE_AUDIO) || (type == MM_PLAYER_STREAM_TYPE_VIDEO)), MM_ERROR_INVALID_ARGUMENT);
 
        if (player->media_stream_buffer_max_size[type] > 0)
                max_bytes = player->media_stream_buffer_max_size[type];
@@ -401,12 +336,6 @@ __mmplayer_check_buffer_level(mmplayer_t *player, GstElement *element, mmplayer_
        }
 
        if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) {
-               MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
-               if (!player->media_stream_buffer_status_cb[type]) {
-                       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
-                       return MM_ERROR_NONE;
-               }
-
                current_level_per = (guint)(gst_util_guint64_to_gdouble(current_level_bytes) / gst_util_guint64_to_gdouble(max_bytes) * 100);
 
                LOGD("type: %s, min_per %u, curr_per %u max %"G_GUINT64_FORMAT" cur %"G_GUINT64_FORMAT,
@@ -415,10 +344,16 @@ __mmplayer_check_buffer_level(mmplayer_t *player, GstElement *element, mmplayer_
                                        player->media_stream_buffer_max_size[type],
                                        current_level_bytes);
 
-               if (current_level_per < player->media_stream_buffer_min_percent[type])
-                       player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param[type]);
+               if (current_level_per < player->media_stream_buffer_min_percent[type]) {
+                       MMMessageParamType msg_param = {0,};
+
+                       msg_param.union_type = MM_MSG_UNION_BUFFER_STATUS;
+                       msg_param.buffer_status.stream_type = type;
+                       msg_param.buffer_status.status = MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN;
+                       msg_param.buffer_status.bytes = current_level_bytes;
 
-               MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
+                       MMPLAYER_POST_MSG(player, MM_MESSAGE_PUSH_BUFFER_STATUS, &msg_param);
+               }
        }
 
        MMPLAYER_FLEAVE();
@@ -968,4 +903,4 @@ __mm_player_is_codec_data_changed(mmplayer_t *player, media_packet_h packet,
 
        LOGD("need to update caps due to codec data is changed");
        return TRUE;
-}
\ No newline at end of file
+}
index 500de92..4ec53c7 100644 (file)
@@ -1851,10 +1851,10 @@ __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, "content_video_width", atoi(video_width));
+                               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_WIDTH, atoi(video_width));
 
                                seperator++;
-                               mm_attrs_set_int_by_name(attrs, "content_video_height", atoi(seperator));
+                               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_HEIGHT, atoi(seperator));
                        }
                }
 
@@ -2170,89 +2170,89 @@ void
 __mmplayer_gst_appsrc_feed_data(GstElement *element, guint size, gpointer user_data)
 {
        mmplayer_t *player  = (mmplayer_t *)user_data;
-       mmplayer_stream_type_e type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       mmplayer_stream_type_e stream_type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       MMMessageParamType msg_param = {0,};
        guint64 current_level_bytes = 0;
 
        MMPLAYER_RETURN_IF_FAIL(player);
 
        if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
-               type = MM_PLAYER_STREAM_TYPE_AUDIO;
+               stream_type = MM_PLAYER_STREAM_TYPE_AUDIO;
        } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
-               type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
-               type = MM_PLAYER_STREAM_TYPE_TEXT;
+               stream_type = MM_PLAYER_STREAM_TYPE_VIDEO;
        } else {
-               LOGE("can not enter here");
+               LOGW("invalid feed-data signal from %s", GST_ELEMENT_NAME(element));
                return;
        }
 
        g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
 
-       LOGI("type: %d, level: %"G_GUINT64_FORMAT, type, current_level_bytes);
+       LOGI("stream type: %d, level: %"G_GUINT64_FORMAT, stream_type, current_level_bytes);
+
+       msg_param.union_type = MM_MSG_UNION_BUFFER_STATUS;
+       msg_param.buffer_status.stream_type = stream_type;
+       msg_param.buffer_status.status = MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN;
+       msg_param.buffer_status.bytes = current_level_bytes;
 
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
-       if (player->media_stream_buffer_status_cb[type])
-               player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param[type]);
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
+       MMPLAYER_POST_MSG(player, MM_MESSAGE_PUSH_BUFFER_STATUS, &msg_param);
 }
 
 void
 __mmplayer_gst_appsrc_enough_data(GstElement *element, gpointer user_data)
 {
        mmplayer_t *player  = (mmplayer_t *)user_data;
-       mmplayer_stream_type_e type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       mmplayer_stream_type_e stream_type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       MMMessageParamType msg_param = {0,};
        guint64 current_level_bytes = 0;
 
        MMPLAYER_RETURN_IF_FAIL(player);
 
        if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
-               type = MM_PLAYER_STREAM_TYPE_AUDIO;
+               stream_type = MM_PLAYER_STREAM_TYPE_AUDIO;
        } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
-               type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
-               type = MM_PLAYER_STREAM_TYPE_TEXT;
+               stream_type = MM_PLAYER_STREAM_TYPE_VIDEO;
        } else {
-               LOGE("can not enter here");
+               LOGW("invalid enough-data signal from %s", GST_ELEMENT_NAME(element));
                return;
        }
 
-       LOGI("type: %d, buffer is full", type);
-
        g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
 
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
+       LOGI("stream type: %d, level: %"G_GUINT64_FORMAT, stream_type, current_level_bytes);
 
-       if (player->media_stream_buffer_status_cb[type])
-               player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW, current_level_bytes, player->buffer_cb_user_param[type]);
+       msg_param.union_type = MM_MSG_UNION_BUFFER_STATUS;
+       msg_param.buffer_status.stream_type = stream_type;
+       msg_param.buffer_status.status = MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW;
+       msg_param.buffer_status.bytes = current_level_bytes;
 
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
+       MMPLAYER_POST_MSG(player, MM_MESSAGE_PUSH_BUFFER_STATUS, &msg_param);
 }
 
 gboolean
 __mmplayer_gst_appsrc_seek_data(GstElement *element, guint64 position, gpointer user_data)
 {
        mmplayer_t *player  = (mmplayer_t *)user_data;
-       mmplayer_stream_type_e type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       mmplayer_stream_type_e stream_type = MM_PLAYER_STREAM_TYPE_DEFAULT;
+       MMMessageParamType msg_param = {0,};
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
        if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
-               type = MM_PLAYER_STREAM_TYPE_AUDIO;
+               stream_type = MM_PLAYER_STREAM_TYPE_AUDIO;
        } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
-               type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
-               type = MM_PLAYER_STREAM_TYPE_TEXT;
+               stream_type = MM_PLAYER_STREAM_TYPE_VIDEO;
        } else {
-               LOGE("can not enter here");
+               LOGW("invalid seek-data signal from %s", GST_ELEMENT_NAME(element));
                return TRUE;
        }
 
-       LOGD("type: %d, pos: %"G_GUINT64_FORMAT, type, position);
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
+       LOGD("stream type: %d, pos: %"G_GUINT64_FORMAT, stream_type, position);
+
+       msg_param.union_type = MM_MSG_UNION_SEEK_DATA;
+       msg_param.seek_data.stream_type = stream_type;
+       msg_param.seek_data.offset = position;
 
-       if (player->media_stream_seek_data_cb[type])
-               player->media_stream_seek_data_cb[type](type, position, player->seek_cb_user_param[type]);
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
+       MMPLAYER_POST_MSG(player, MM_MESSAGE_PUSH_BUFFER_SEEK_DATA, &msg_param);
 
        return TRUE;
 }
index be48238..72a476b 100644 (file)
@@ -2317,11 +2317,7 @@ __mmplayer_gst_caps_notify_cb(GstPad *pad, GParamSpec *unused, gpointer data)
                        player->set_mode.video_zc = name[0] == 'S';
 
                _mmplayer_update_content_attrs(player, ATTR_VIDEO);
-
-               if (player->video_stream_changed_cb) {
-                       LOGE("call the video stream changed cb");
-                       player->video_stream_changed_cb(player->video_stream_changed_cb_user_param);
-               }
+               MMPLAYER_POST_MSG(player, MM_MESSAGE_VIDEO_STREAM_CHANGED, NULL);
        } else {
                LOGW("invalid caps info");
        }
@@ -4706,9 +4702,6 @@ _mmplayer_create_player(MMHandleType handle)
        g_mutex_init(&player->video_bo_mutex);
        g_cond_init(&player->video_bo_cond);
 
-       /* create media stream callback mutex */
-       g_mutex_init(&player->media_stream_cb_lock);
-
        /* create subtitle info lock and cond */
        g_mutex_init(&player->subtitle_info_mutex);
        g_cond_init(&player->subtitle_info_cond);
@@ -5013,9 +5006,6 @@ _mmplayer_destroy(MMHandleType handle)
        g_mutex_clear(&player->video_bo_mutex);
        g_cond_clear(&player->video_bo_cond);
 
-       /* release media stream callback lock */
-       g_mutex_clear(&player->media_stream_cb_lock);
-
        MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
@@ -5314,24 +5304,6 @@ _mmplayer_get_mute(MMHandleType hplayer, bool *mute)
 }
 
 int
-_mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param)
-{
-       mmplayer_t *player = (mmplayer_t *)hplayer;
-
-       MMPLAYER_FENTER();
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       player->video_stream_changed_cb = callback;
-       player->video_stream_changed_cb_user_param = user_param;
-       LOGD("Handle value is %p : %p", player, player->video_stream_changed_cb);
-
-       MMPLAYER_FLEAVE();
-
-       return MM_ERROR_NONE;
-}
-
-int
 _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param)
 {
        mmplayer_t *player = (mmplayer_t *)hplayer;
@@ -7434,9 +7406,6 @@ __mmplayer_release_misc(mmplayer_t *player)
        player->audio_decoded_cb_user_param = NULL;
        player->audio_extract_opt = MM_PLAYER_AUDIO_EXTRACT_DEFAULT;
 
-       player->video_stream_changed_cb = NULL;
-       player->video_stream_changed_cb_user_param = NULL;
-
        player->audio_stream_changed_cb = NULL;
        player->audio_stream_changed_cb_user_param = NULL;
 
@@ -7479,17 +7448,6 @@ __mmplayer_release_misc(mmplayer_t *player)
                player->maximum_bitrate[i] = 0;
        }
 
-       MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
-
-       /* remove media stream cb(appsrc cb) */
-       for (i = 0; i < MM_PLAYER_STREAM_TYPE_MAX; i++) {
-               player->media_stream_buffer_status_cb[i] = NULL;
-               player->media_stream_seek_data_cb[i] = NULL;
-               player->buffer_cb_user_param[i] = NULL;
-               player->seek_cb_user_param[i] = NULL;
-       }
-       MMPLAYER_MEDIA_STREAM_CALLBACK_UNLOCK(player);
-
        /* free memory related to audio effect */
        MMPLAYER_FREEIF(player->audio_effect_info.custom_ext_level_for_plugin);
 
@@ -8907,10 +8865,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, "content_video_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, "content_video_height", height);
+       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_HEIGHT, height);
 
        gst_structure_get_fraction(p, "framerate", &tmpNu, &tmpDe);
 
@@ -8920,7 +8878,7 @@ __mmplayer_update_video_attrs(mmplayer_t *player, MMHandleType attrs)
        gst_object_unref(pad);
 
        if (tmpDe > 0) {
-               mm_attrs_set_int_by_name(attrs, "content_video_fps", tmpNu / tmpDe);
+               mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_FPS, tmpNu / tmpDe);
                SECURE_LOGD("fps : %d", tmpNu / tmpDe);
        }
 
@@ -8958,7 +8916,7 @@ __mmplayer_update_bitrate_attrs(mmplayer_t *player, MMHandleType attrs)
                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, "content_video_bitrate", bitrate);
+                       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_BITRATE, bitrate);
 
                        ret = TRUE;
                } else {
@@ -8968,7 +8926,7 @@ __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, "content_video_bitrate", player->total_bitrate);
+                       mm_attrs_set_int_by_name(attrs, MM_PLAYER_VIDEO_BITRATE, player->total_bitrate);
                        ret = TRUE;
                }
        }