Send media packet pts when use media_packet_video_frame_cb 03/55203/1 accepted/tizen/mobile/20151223.105716 accepted/tizen/tv/20151223.105656 accepted/tizen/wearable/20151223.111426 submit/tizen/20151223.055742 submit/tizen/20160104.022701 submit/tizen_common/20151229.142028 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 22 Dec 2015 10:55:42 +0000 (19:55 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 22 Dec 2015 10:55:42 +0000 (19:55 +0900)
Change-Id: I607fb78577a9bbf63c30ba2671f4caed8b7f2b62
Signed-off-by: Gilbok Lee <gilbok.lee@samsung.com>
client/src/player2.c
client/test/player_test.c
include/player_msg_private.h
packaging/capi-media-player.spec
src/player_msg_dispatcher.c

index c85e0e1..5b2003d 100644 (file)
@@ -460,6 +460,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c
        int ret;
        _media_pkt_fin_data *fin_data;
        intptr_t packet;
+       uint64_t pts = 0;
        int i;
 
        player_msg_get(key[0], recvMsg);
@@ -468,6 +469,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c
        player_msg_get(key[3], recvMsg);
        player_msg_get_type(packet, recvMsg, POINTER);
        player_msg_get(mimetype, recvMsg);
+       player_msg_get(pts, recvMsg);
        player_msg_get_array(surface_info, recvMsg);
 
        LOGD("width %d, height %d", sinfo.width, sinfo.height);
@@ -522,6 +524,11 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c
                }
        }
        if (pkt) {
+               if (pts != 0) {
+                       ret = media_packet_set_pts(pkt, (uint64_t)pts);
+                       if (ret != MEDIA_PACKET_ERROR_NONE)
+                               LOGE("media_packet_set_pts failed");
+               }
                /* call media packet callback */
                ((player_media_packet_video_decoded_cb)cb_info->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])(pkt, cb_info->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]);
        }
index 40e3dc1..ce83de6 100644 (file)
@@ -956,12 +956,11 @@ static void _player_prepare(bool async)
                        set_content_info(TRUE);
                        async = TRUE;
                        is_es_push_mode = TRUE;
-               }
 #ifdef _ES_PULL_
-               else {
+               else {
                        set_content_info(FALSE);
-               }
 #endif
+               }
        }
 
        if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
index 3e94fc7..931ebb5 100644 (file)
@@ -759,6 +759,47 @@ typedef struct {
                muse_core_msg_json_factory_free(__sndMsg__); \
        }while(0)
 
+/**
+ * @brief Create and send return message.
+ * @remarks Does NOT guarantee thread safe.
+ * @param[in] api The enum of module API.
+ * @param[in] event The event number.
+ * @param[in] module mused module information
+ * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
+ * @param[in] param# the name of param is key, must be local variable. never be pointer.
+ * @param[in] arr_param the name of param is key, must be local array/pointer variable.
+ * @param[in] length The size of array.
+ * @param[in] datum_size The size of a array's datum.
+ */
+#define player_msg_event7_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7, arr_param, length, datum_size) \
+       do{     \
+               char *__sndMsg__; \
+               type1 __value1__ = (type1)param1; \
+               type2 __value2__ = (type2)param2; \
+               type3 __value3__ = (type3)param3; \
+               type4 __value4__ = (type4)param4; \
+               type5 __value5__ = (type5)param5; \
+               type6 __value6__ = (type6)param6; \
+               type7 __value7__ = (type7)param7; \
+               int *__arr_value__ = (int *)arr_param; \
+               __sndMsg__ = muse_core_msg_json_factory_new(api, \
+                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+                               MUSE_TYPE_##type1, #param1, __value1__, \
+                               MUSE_TYPE_##type2, #param2, __value2__, \
+                               MUSE_TYPE_##type3, #param3, __value3__, \
+                               MUSE_TYPE_##type4, #param4, __value4__, \
+                               MUSE_TYPE_##type5, #param5, __value5__, \
+                               MUSE_TYPE_##type6, #param6, __value6__, \
+                               MUSE_TYPE_##type7, #param7, __value7__, \
+                               MUSE_TYPE_INT, #length, length, \
+                               MUSE_TYPE_ARRAY, #arr_param, \
+                                       datum_size == sizeof(int)? length :  \
+                                       length / sizeof(int) + (length % sizeof(int)?1:0), \
+                                       __arr_value__, \
+                               0); \
+               muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+               muse_core_msg_json_factory_free(__sndMsg__); \
+       }while(0)
 
 
 #ifdef __cplusplus
index 3c79f1d..7c3bcdd 100644 (file)
@@ -4,7 +4,7 @@
 Name:       capi-media-player
 Summary:    A Media Daemon player library in Tizen Native API
 Version:    0.3.3
-Release:    0
+Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 9ab226f..c6f7e14 100644 (file)
@@ -253,6 +253,7 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data)
        intptr_t packet = (intptr_t)pkt;
        media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
        media_format_h fmt;
+       uint64_t pts = 0;
 
        memset(&sinfo, 0, sizeof(tbm_surface_info_s));
 
@@ -278,7 +279,8 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data)
        }
        media_packet_get_format(pkt, &fmt);
        media_format_get_video_info(fmt, &mimetype, NULL, NULL, NULL, NULL);
-       player_msg_event6_array(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, packet, INT, mimetype, surface_info, surface_info_size, sizeof(char));
+       media_packet_get_pts(pkt, &pts);
+       player_msg_event7_array(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, packet, INT, mimetype, INT64, pts, surface_info, surface_info_size, sizeof(char));
 }
 
 static void _audio_frame_decoded_cb(player_audio_raw_data_s * audio_frame, void *user_data)