[0.2.110] cleanup pcm extraction path 64/204264/1 accepted/tizen/unified/20190425.111754 submit/tizen/20190425.024703
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 22 Apr 2019 11:24:04 +0000 (20:24 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 22 Apr 2019 11:24:10 +0000 (20:24 +0900)
- cleanup pcm extraction path to use it with public api
  which will be added soon.
- remove reference of mm_player_internal.h

Change-Id: I09eb7ea434e81fd6ccdc75c3265ab1bdbb834ffd

legacy/include/legacy_player.h
legacy/include/legacy_player_internal.h
legacy/src/legacy_player.c
legacy/src/legacy_player_internal.c
muse/include/muse_player.h
muse/src/muse_player.c
packaging/mmsvc-player.spec

index ef100f2..e3f8166 100644 (file)
@@ -272,13 +272,20 @@ typedef void (*player_buffering_cb)(int percent, void *user_data);
 typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
 
 /**
- * @brief Called to register for notifications about delivering video data when every video frame is decoded.
+ * @brief Called to register for notifications about delivering video data when each video frame is decoded.
  * @param[in] video_data video decoded data
  * @param[in] user_data The user data passed from the callback registration function
  */
 typedef bool (*legacy_player_media_packet_video_decoded_cb)(void *video_data, void *user_data);
 
 /**
+ * @brief Called to register for notifications about delivering audio data when audio frame is decoded.
+ * @param[in] audio_data audio decoded data
+ * @param[in] user_data The user data passed from the callback registration function
+ */
+typedef bool (*legacy_player_media_packet_audio_decoded_cb)(void *audio_data, void *user_data);
+
+/**
  * @brief Called when the buffer level drops below the threshold of max size or no free space in buffer.
  * @since_tizen 2.4
  * @remarks This API is used for media stream playback only.
index 5f83029..d805f26 100644 (file)
@@ -43,30 +43,6 @@ typedef enum
 } player_codec_type_e;
 
 /**
- * @brief This file contains the media player API for custom features.
- * @since_tizen 2.4
- */
-typedef struct {
-       void *data;          /**< PCM data */
-       int size;            /**< Data Size */
-       int channel;         /**< Channel */
-       int rate;            /**<  Samplerate */
-       int depth;           /**< Depth */
-       bool little_endian;  /**< Endianness */
-       guint64 channel_mask;   /**< channel_mask */
-} player_audio_raw_data_s;
-
-/**
- * @brief Called when the audio frame is decoded.
- * @since_tizen 2.4
- * @param[in] audio_raw_frame The decoded audio frame data type
- * @param[in] user_data          The user data passed from the callback registration function
- * @see player_set_audio_frame_decoded_cb()
- * @see player_unset_audio_frame_decoded_cb()
- */
-typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_raw_frame, void *user_data);
-
-/**
  * @brief Called when the buffer level drops below the min size or exceeds the max size.
  * @since_tizen 3.0
  * @remarks This API is used for media stream playback only.
@@ -82,7 +58,7 @@ typedef void (*player_media_stream_buffer_status_cb_ex)(player_media_stream_buff
 /**
  * @brief Registers a callback function to be invoked when audio frame is decoded. Audio only contents is possible. If included video, error happens.
  * @since_tizen 2.4
- * @param[in] player    The handle to the media player
+ * @param[in] player The handle to the media player
  * @param[in] sync Sync on the clock
  * @param[in] format Audio format of output pcm
  * @param[in] callback The callback function to register
@@ -95,9 +71,9 @@ typedef void (*player_media_stream_buffer_status_cb_ex)(player_media_stream_buff
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
  * @retval #PLAYER_ERROR_NOT_SUPPORTD Not supported
  * @pre The player state must be #PLAYER_STATE_IDLE by legacy_player_create() or legacy_player_unprepare().
- * @post player_audio_pcm_extraction_cb() will be invoked.
+ * @post legacy_player_media_packet_audio_decoded_cb() will be invoked.
  */
-int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data);
+int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, legacy_player_media_packet_audio_decoded_cb callback, void *user_data);
 
 /**
  * @brief Set pcm mode spec. Samplerate, channel is needed.
index d0c1059..3bca057 100644 (file)
@@ -21,7 +21,6 @@
 #include <mm.h>
 #include <mm_player.h>
 #include <mm_player_audioeffect.h>
-#include <mm_player_internal.h>
 #include <mm_types.h>
 #include <sound_manager.h>
 #include <sound_manager_internal.h>
index 83ec9d2..83de76d 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <mm.h>
 #include <mm_player.h>
-#include <mm_player_internal.h>
 #include <mm_types.h>
 #include "muse_player.h"
 #include "legacy_player.h"
 /*
  * Internal Macros
  */
-#define PLAYER_SET_CALLBACK(event_type, handle, callback, user_data) \
-do { \
-       PLAYER_INSTANCE_CHECK(handle); \
-       PLAYER_NULL_ARG_CHECK(callback); \
-       handle->user_cb[event_type] = callback; \
-       handle->user_data[event_type] = user_data; \
-       LOGI("Event type : %d ", event_type); \
-} while (0)
-
-bool __audio_stream_callback(mmplayer_audio_decoded_data_info_t *stream, void *user_data)
-{
-       legacy_player_t *handle = (legacy_player_t *)user_data;
-
-       if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
-               LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
-               return true;
-       }
-
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME])
-               ((player_audio_pcm_extraction_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME])((player_audio_raw_data_s *)stream, handle->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]);
-
-       return true;
-}
 
-int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data)
+int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, legacy_player_media_packet_audio_decoded_cb callback, void *user_data)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
        int ret = MM_ERROR_NONE;
@@ -68,11 +44,10 @@ int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, pla
        if (!sync)
                opt = MM_PLAYER_AUDIO_EXTRACT_NO_SYNC_WITH_CLOCK | MM_PLAYER_AUDIO_EXTRACT_DEINTERLEAVE;
 
-       ret = mm_player_set_audio_decoded_callback(handle->mm_handle, opt, __audio_stream_callback, (void *)handle);
+       ret = mm_player_set_audio_decoded_callback(handle->mm_handle, opt, (mm_player_audio_decoded_callback)callback, user_data);
        if (ret != MM_ERROR_NONE)
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
 
-       PLAYER_SET_CALLBACK(MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, handle, callback, user_data);
        return PLAYER_ERROR_NONE;
 }
 
index da83b16..3e383ab 100644 (file)
@@ -64,7 +64,7 @@ typedef enum {
        MUSE_PLAYER_EVENT_TYPE_CAPTURE,
        MUSE_PLAYER_EVENT_TYPE_SEEK,
        MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME,
-       MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME,
+       MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME,
        MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR,
        MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT,
        MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET,
@@ -85,6 +85,7 @@ typedef enum {
        MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER,
 #endif
        MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED,
+       MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, /* DEPRECATED_PLAYER_INTERNAL_API */
        MUSE_PLAYER_EVENT_TYPE_NUM
 } muse_player_event_e;
 
index f2b556b..0a6f05d 100644 (file)
@@ -1082,7 +1082,7 @@ static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(legacy_player_h pla
        NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_CAPTURE */
        NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_SEEK */
        _set_media_packet_video_frame_cb,       /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME */
-       NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME */
+       NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
        NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */
        NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT */
        NULL,                                   /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET */
@@ -1103,6 +1103,7 @@ static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(legacy_player_h pla
        _set_retrieve_buffer_cb,        /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
 #endif
        NULL,                           /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */
+       NULL,                           /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, DEPRECATED_PLAYER_INTERNAL_API */
 };
 
 static int _push_media_stream(muse_player_handle_t *muse_player, player_push_media_msg_type *push_media, char *buf)
@@ -1188,12 +1189,13 @@ static int _push_media_stream(muse_player_handle_t *muse_player, player_push_med
        return ret;
 }
 
-static void _audio_decoded_cb(player_audio_raw_data_s *audio_frame, void *user_data)
+static bool __audio_decoded_cb(void *audio_data, void *user_data)
 {
        muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
-       muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME;
+       muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME;
        muse_module_h module = (muse_module_h)user_data;
        muse_player_handle_t *muse_player = NULL;
+       mmplayer_audio_decoded_data_info_t *audio_info = (mmplayer_audio_decoded_data_info_t *)audio_data;
        void *data = NULL;
        int size = 0;
        bool ret = true;
@@ -1202,31 +1204,31 @@ static void _audio_decoded_cb(player_audio_raw_data_s *audio_frame, void *user_d
 
        /* LOGD("ENTER"); */
 
-       if (audio_frame) {
-               data = audio_frame->data;
-               size = audio_frame->size;
+       if (audio_info) {
+               data = audio_info->data;
+               size = audio_info->data_size;
        }
 
        if (data == NULL || size == 0) {
                LOGE("audio frame is NULL");
-               return;
+               return false;
        }
 
        muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
        if (muse_player == NULL) {
                LOGE("handle is NULL");
-               return;
+               return false;
        }
 
-       ret = _create_export_data(muse_player, data, size, audio_frame, sizeof(player_audio_raw_data_s), &tfd, &key);
+       ret = _create_export_data(muse_player, data, size, audio_info, sizeof(mmplayer_audio_decoded_data_info_t), &tfd, &key);
        if (!ret) {
                LOGE("failed to create export data");
-               return;
+               return false;
        }
 
        /* send message */
        PLAYER_SEND_EVENT_MSG_WITH_TFD(api, ev, module, tfd, MUSE_TYPE_INT, "key", key);
-       return;
+       return true;
 }
 
 int _player_disp_send_msg(int send_fd, char *msg, int *tfd)
@@ -2945,7 +2947,7 @@ int player_disp_set_pcm_extraction_mode(muse_module_h module)
        muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
        player_msg_get(sync, muse_server_module_get_msg(module));
 
-       ret = legacy_player_set_pcm_extraction_mode(muse_player->player_handle, sync, _audio_decoded_cb, module);
+       ret = legacy_player_set_pcm_extraction_mode(muse_player->player_handle, sync, __audio_decoded_cb, module);
 
        PLAYER_RETURN_MSG(api, ret, module);
 
index f87b5cb..8c235c5 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.109
+Version:    0.2.110
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0