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.
} 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.
/**
* @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
* @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.
#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>
#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;
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;
}
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,
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;
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 */
_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)
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;
/* 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)
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);
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