* @since_tizen 2.3
*/
typedef enum {
- PLAYER_STATE_NONE, /**< Player is not created */
- PLAYER_STATE_IDLE, /**< Player is created, but not prepared */
- PLAYER_STATE_READY, /**< Player is ready to play media */
- PLAYER_STATE_PLAYING, /**< Player is playing media */
- PLAYER_STATE_PAUSED, /**< Player is paused while playing media */
+ PLAYER_STATE_NONE, /**< Player is not created */
+ PLAYER_STATE_IDLE, /**< Player is created, but not prepared */
+ PLAYER_STATE_READY, /**< Player is ready to play media */
+ PLAYER_STATE_PLAYING, /**< Player is playing media */
+ PLAYER_STATE_PAUSED, /**< Player is paused while playing media */
} player_state_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- PLAYER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- PLAYER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
- PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
- PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on the device */
- PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
- PLAYER_ERROR_SEEK_FAILED = PLAYER_ERROR_CLASS | 0x01, /**< Seek operation failure */
- PLAYER_ERROR_INVALID_STATE = PLAYER_ERROR_CLASS | 0x02, /**< Invalid state */
- PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03, /**< File format not supported */
- PLAYER_ERROR_INVALID_URI = PLAYER_ERROR_CLASS | 0x04, /**< Invalid URI */
- PLAYER_ERROR_SOUND_POLICY = PLAYER_ERROR_CLASS | 0x05, /**< Sound policy error */
- PLAYER_ERROR_CONNECTION_FAILED = PLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */
- PLAYER_ERROR_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07, /**< Video capture failed */
- PLAYER_ERROR_DRM_EXPIRED = PLAYER_ERROR_CLASS | 0x08, /**< Expired license */
- PLAYER_ERROR_DRM_NO_LICENSE = PLAYER_ERROR_CLASS | 0x09, /**< No license */
- PLAYER_ERROR_DRM_FUTURE_USE = PLAYER_ERROR_CLASS | 0x0a, /**< License for future use */
- PLAYER_ERROR_DRM_NOT_PERMITTED = PLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */
- PLAYER_ERROR_RESOURCE_LIMIT = PLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */
- PLAYER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
- PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */
- PLAYER_ERROR_BUFFER_SPACE = TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available (Since 3.0)*/
+ PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ PLAYER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ PLAYER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
+ PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+ PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on the device */
+ PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ PLAYER_ERROR_SEEK_FAILED = PLAYER_ERROR_CLASS | 0x01, /**< Seek operation failure */
+ PLAYER_ERROR_INVALID_STATE = PLAYER_ERROR_CLASS | 0x02, /**< Invalid state */
+ PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03, /**< File format not supported */
+ PLAYER_ERROR_INVALID_URI = PLAYER_ERROR_CLASS | 0x04, /**< Invalid URI */
+ PLAYER_ERROR_SOUND_POLICY = PLAYER_ERROR_CLASS | 0x05, /**< Sound policy error */
+ PLAYER_ERROR_CONNECTION_FAILED = PLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */
+ PLAYER_ERROR_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07, /**< Video capture failed */
+ PLAYER_ERROR_DRM_EXPIRED = PLAYER_ERROR_CLASS | 0x08, /**< Expired license */
+ PLAYER_ERROR_DRM_NO_LICENSE = PLAYER_ERROR_CLASS | 0x09, /**< No license */
+ PLAYER_ERROR_DRM_FUTURE_USE = PLAYER_ERROR_CLASS | 0x0a, /**< License for future use */
+ PLAYER_ERROR_DRM_NOT_PERMITTED = PLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */
+ PLAYER_ERROR_RESOURCE_LIMIT = PLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */
+ PLAYER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */
+ PLAYER_ERROR_BUFFER_SPACE = TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available (Since 3.0)*/
} player_error_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
- PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
+ PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
} player_interrupted_code_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_PD_STARTED = 0, /**< Progressive download is started */
- PLAYER_PD_COMPLETED, /**< Progressive download is completed */
+ PLAYER_PD_STARTED = 0, /**< Progressive download is started */
+ PLAYER_PD_COMPLETED, /**< Progressive download is completed */
} player_pd_message_type_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */
- PLAYER_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */
- PLAYER_DISPLAY_TYPE_NONE, /**< This disposes off buffers */
+ PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */
+ PLAYER_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */
+ PLAYER_DISPLAY_TYPE_NONE, /**< This disposes off buffers */
} player_display_type_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */
- AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */
- AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */
+ AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */
+ AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */
+ AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */
} audio_latency_mode_e;
/**
* @since_tizen 2.4
*/
typedef enum {
- PLAYER_STREAM_TYPE_DEFAULT, /**< Container type */
- PLAYER_STREAM_TYPE_AUDIO, /**< Audio element stream type */
- PLAYER_STREAM_TYPE_VIDEO, /**< Video element stream type */
- PLAYER_STREAM_TYPE_TEXT, /**< Text type */
+ PLAYER_STREAM_TYPE_DEFAULT, /**< Container type */
+ PLAYER_STREAM_TYPE_AUDIO, /**< Audio element stream type */
+ PLAYER_STREAM_TYPE_VIDEO, /**< Video element stream type */
+ PLAYER_STREAM_TYPE_TEXT, /**< Text type */
} player_stream_type_e;
/**
* @since_tizen 2.4
*/
typedef enum {
- PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
- PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
+ PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
+ PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
} player_media_stream_buffer_status_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_DISPLAY_ROTATION_NONE, /**< Display is not rotated */
- PLAYER_DISPLAY_ROTATION_90, /**< Display is rotated 90 degrees */
- PLAYER_DISPLAY_ROTATION_180, /**< Display is rotated 180 degrees */
- PLAYER_DISPLAY_ROTATION_270, /**< Display is rotated 270 degrees */
+ PLAYER_DISPLAY_ROTATION_NONE, /**< Display is not rotated */
+ PLAYER_DISPLAY_ROTATION_90, /**< Display is rotated 90 degrees */
+ PLAYER_DISPLAY_ROTATION_180, /**< Display is rotated 180 degrees */
+ PLAYER_DISPLAY_ROTATION_270, /**< Display is rotated 270 degrees */
} player_display_rotation_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */
- PLAYER_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */
- PLAYER_DISPLAY_MODE_FULL_SCREEN, /**< Full-screen */
- PLAYER_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full-screen */
- PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size) */
- PLAYER_DISPLAY_MODE_DST_ROI, /**< Dst ROI mode (Deprecated since [3.0]).*/
- PLAYER_DISPLAY_MODE_NUM
+ PLAYER_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */
+ PLAYER_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */
+ PLAYER_DISPLAY_MODE_FULL_SCREEN, /**< Full-screen */
+ PLAYER_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full-screen */
+ PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size) */
+ PLAYER_DISPLAY_MODE_DST_ROI, /**< Dst ROI mode (Deprecated since [3.0]).*/
+ PLAYER_DISPLAY_MODE_NUM
} player_display_mode_e;
/**
* @since_tizen 2.3
*/
typedef enum {
- PLAYER_CONTENT_INFO_ALBUM, /**< Album */
- PLAYER_CONTENT_INFO_ARTIST, /**< Artist */
- PLAYER_CONTENT_INFO_AUTHOR, /**< Author */
- PLAYER_CONTENT_INFO_GENRE, /**< Genre */
- PLAYER_CONTENT_INFO_TITLE, /**< Title */
- PLAYER_CONTENT_INFO_YEAR, /**< Year */
+ PLAYER_CONTENT_INFO_ALBUM, /**< Album */
+ PLAYER_CONTENT_INFO_ARTIST, /**< Artist */
+ PLAYER_CONTENT_INFO_AUTHOR, /**< Author */
+ PLAYER_CONTENT_INFO_GENRE, /**< Genre */
+ PLAYER_CONTENT_INFO_TITLE, /**< Title */
+ PLAYER_CONTENT_INFO_YEAR, /**< Year */
} player_content_info_e;
/**
* @since_tizen 2.3
*
* @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n
- * the packet should be released by media_packet_destroy() after use. \n
- * Otherwises, decoder can't work more because it can't have enough buffer to fill decoded frame.
+ * the packet should be released by media_packet_destroy() after use. \n
+ * Otherwises, decoder can't work more because it can't have enough buffer to fill decoded frame.
*
* @param[in] pkt Reference pointer to the media packet
* @param[in] user_data The user data passed from the callback registration function
* @param[in] width The width of the captured image
* @param[in] height The height of the captured image
* @param[in] fps The frame per second of the video \n
- It can be @c 0 if there is no video stream information.
+ * It can be @c 0 if there is no video stream information.
* @param[in] bit_rate The video bit rate [Hz] \n
* It can be an invalid value if there is no video stream information.
* @param[in] user_data The user data passed from the callback registration function
* @see legacy_player_unprepare()
* @see legacy_player_set_uri()
*/
-int legacy_player_prepare_async (player_h player, player_prepared_cb callback, void* user_data);
+int legacy_player_prepare_async(player_h player, player_prepared_cb callback, void* user_data);
/**
* @brief Resets the media player.
/**
* @brief Sets the player's volume.
* @since_tizen 2.3
- * @details Setting this volume adjusts the player's instance volume, not the system volume.
- * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
+ * @details Setting this volume adjusts the player's instance volume, not the system volume.
+ * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
* To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
- * Finally, it does not support to set other value into each channel currently.
+ * Finally, it does not support to set other value into each channel currently.
*
* @param[in] player The handle to the media player
* @param[in] left The left volume scalar
* @remarks AAC can be supported.
* @remarks H.264 can be supported.
* @remarks This API should be called before calling the legacy_player_prepare() or legacy_player_prepare_async() \n
- to reflect the media information when pipeline is created.
+ * to reflect the media information when pipeline is created.
* @param[in] player The handle to media player
* @param[in] type The type of target stream
* @param[in] format The media format to set audio information
* @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
* @see legacy_player_set_display_rotation()
*/
-int legacy_player_get_display_rotation( player_h player, player_display_rotation_e *rotation);
+int legacy_player_get_display_rotation(player_h player, player_display_rotation_e *rotation);
/**
* @}
* @see legacy_player_audio_effect_set_equalizer_band_level()
* @see legacy_player_audio_effect_set_equalizer_all_bands()
*/
-int legacy_player_audio_effect_get_equalizer_bands_count (player_h player, int *count);
+int legacy_player_audio_effect_get_equalizer_bands_count(player_h player, int *count);
/**
* @brief Sets the gain set for the given equalizer band.
* @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
* @pre The path value can be @c NULL for reset when the player state is set to #PLAYER_STATE_IDLE by calling legacy_player_create() or legacy_player_unprepare().
*/
-int legacy_player_set_subtitle_path(player_h player,const char *path);
+int legacy_player_set_subtitle_path(player_h player, const char *path);
/**
* @brief Registers a callback function to be invoked when a subtitle updates.
* @see legacy_player_unset_video_stream_changed_cb()
* @see legacy_player_video_stream_changed_cb()
*/
-int legacy_player_set_video_stream_changed_cb (player_h player, player_video_stream_changed_cb callback, void *user_data);
+int legacy_player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data);
/**
* @brief Unregisters the video stream changed callback function.
* @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
* @see legacy_player_set_video_stream_changed_cb()
*/
-int legacy_player_unset_video_stream_changed_cb (player_h player);
+int legacy_player_unset_video_stream_changed_cb(player_h player);
/**
* @brief Gets current track index.
* @since_tizen 3.0
*
* @details Player will transite the media source as seamlessly as possible after finishing current playback.
- * If the function call is successful, the uri will be added at the end of uri list.
- * You can add several uris and the set of uris will be played repeatedly if you call the player_set_looping().
- * The first uri in the list is the original uri which is set by player_set_uri().
+ * If the function call is successful, the uri will be added at the end of uri list.
+ * You can add several uris and the set of uris will be played repeatedly if you call the player_set_looping().
+ * The first uri in the list is the original uri which is set by player_set_uri().
*
* @remarks Uri list will be cleared except first one when the player_unprepare() is called.
* If you call the player_set_uri(), you can change the first uri too.
* @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
* @see player_set_uri(), player_set_looping()
*/
-int legacy_player_set_next_uri (player_h player, const char *uri);
+int legacy_player_set_next_uri(player_h player, const char *uri);
/**
* @brief Gets the data source path.
* @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
* @see player_set_uri()
*/
-int legacy_player_get_next_uri (player_h player, char **uri);
+int legacy_player_get_next_uri(player_h player, char **uri);
/**
* @brief Sets the gapless playback status
#define LOG_TAG "TIZEN_N_PLAYER"
//#define USE_ECORE_FUNCTIONS
-#define PLAYER_CHECK_CONDITION(condition,error,msg) \
- if(condition) {} else \
- { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
+#define PLAYER_CHECK_CONDITION(condition, error, msg) \
+ if (condition) {} else \
+ { LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); return error; }; \
#define PLAYER_INSTANCE_CHECK(player) \
- PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER")
+ PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
-#define PLAYER_STATE_CHECK(player,expected_state) \
- PLAYER_CHECK_CONDITION(player->state == expected_state,PLAYER_ERROR_INVALID_STATE,"PLAYER_ERROR_INVALID_STATE")
+#define PLAYER_STATE_CHECK(player, expected_state) \
+ PLAYER_CHECK_CONDITION(player->state == expected_state, PLAYER_ERROR_INVALID_STATE, "PLAYER_ERROR_INVALID_STATE")
#define PLAYER_NULL_ARG_CHECK(arg) \
- PLAYER_CHECK_CONDITION(arg != NULL,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER")
+ PLAYER_CHECK_CONDITION(arg != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
#define PLAYER_RANGE_ARG_CHECK(arg, min, max) \
- PLAYER_CHECK_CONDITION(arg <= max,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") \
- PLAYER_CHECK_CONDITION(arg >= min,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER")
+ PLAYER_CHECK_CONDITION(arg <= max, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER") \
+ PLAYER_CHECK_CONDITION(arg >= min, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
+
+/* user_cb_lock */
+#define LEGACY_PLAYER_USER_CB_LOCK(x_handle, type) \
+ do { \
+ if (_check_enabled_user_cb_lock(type)) \
+ g_mutex_lock(&((player_s*)x_handle)->user_cb_lock[type]); \
+ } while (0)
+
+#define LEGACY_PLAYER_USER_CB_UNLOCK(x_handle, type) \
+ do { \
+ if (_check_enabled_user_cb_lock(type)) \
+ g_mutex_unlock(&((player_s*)x_handle)->user_cb_lock[type]); \
+ } while (0)
+
#ifdef TIZEN_TTRACE
#include <ttrace.h>
#define PLAYER_TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_VIDEO, NAME)
#define PLAYER_TRACE_END() traceEnd(TTRACE_TAG_VIDEO)
-#define PLAYER_TRACE_ASYNC_BEGIN(NAME, COOKIE) traceAsyncBegin (TTRACE_TAG_VIDEO, COOKIE, NAME);
+#define PLAYER_TRACE_ASYNC_BEGIN(NAME, COOKIE) traceAsyncBegin(TTRACE_TAG_VIDEO, COOKIE, NAME);
#define PLAYER_TRACE_ASYNC_END(NAME, COOKIE) traceAsyncEnd(TTRACE_TAG_VIDEO, COOKIE, NAME);
#else
#define PLAYER_TRACE_BEGIN(NAME)
PLAYER_MESSAGE_EOS,
PLAYER_MESSAGE_LOOP_EXIT,
PLAYER_MESSAGE_MAX
-}_player_message_e;
+} _player_message_e;
#endif
-typedef struct _player_s{
+typedef struct _player_s {
MMHandleType mm_handle;
const void* user_cb[MUSE_PLAYER_EVENT_TYPE_NUM];
void* user_data[MUSE_PLAYER_EVENT_TYPE_NUM];
+ GMutex user_cb_lock[MUSE_PLAYER_EVENT_TYPE_NUM];
void* wl_display;
void* display_handle;
player_display_type_e display_type;
int legacy_player_get_timeout_for_muse(player_h player, int *timeout);
int legacy_player_get_num_of_video_out_buffers(player_h player, int *num, int *extra_num);
int legacy_player_set_file_buffering_path(player_h player, const char *file_path);
+bool _check_enabled_user_cb_lock(int event_id);
#ifdef __cplusplus
}
case PLAYER_MESSAGE_ERROR:
{
LOGW("PLAYER_MESSAGE_ERROR");
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])
((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(handle->error_code, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
- } else {
+ else
LOGE("null handle in PLAYER_MESSAGE_ERROR");
- }
}
break;
case PLAYER_MESSAGE_SEEK_DONE:
case PLAYER_MESSAGE_EOS:
{
LOGW("PLAYER_MESSAGE_EOS");
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE]) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])
((player_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_COMPLETE]);
- } else {
+ else
LOGE("null handle in PLAYER_MESSAGE_EOS");
- }
}
break;
case PLAYER_MESSAGE_LOOP_EXIT:
player_s *handle = (player_s *)user_data;
MMPlayerVideoStreamDataType *video_stream = (MMPlayerVideoStreamDataType *)stream;
+ LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
+
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) {
/* media packet and zero-copy */
media_packet_h pkt = NULL;
unsigned char *ptr = video_stream->data[0];
unsigned char *ptr2 = video_stream->data[1];
- if (!ptr)
+ if (!ptr) {
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
return TRUE;
- if (!ptr2 && video_stream->format == MM_PIXEL_FORMAT_NV12T)
+ }
+ if (!ptr2 && video_stream->format == MM_PIXEL_FORMAT_NV12T) {
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
return TRUE;
-
+ }
tsurf = tbm_surface_create(video_stream->width, video_stream->height, bo_format);
if (tsurf) {
/* map surface to set data */
if (tbm_surface_map(tsurf, TBM_SURF_OPTION_READ | TBM_SURF_OPTION_WRITE, &tsuri)) {
LOGE("tbm_surface_map failed");
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
return TRUE;
}
}
}
}
+
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
return TRUE;
}
return 0;
}
+ LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PD);
+
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PD])
((player_pd_message_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PD])(type, handle->user_data[MUSE_PLAYER_EVENT_TYPE_PD]);
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PD);
+
return 0;
}
}
}
+bool _check_enabled_user_cb_lock(int type)
+{
+ if ((type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME) ||
+ (type == MUSE_PLAYER_EVENT_TYPE_PD) ||
+ (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO) ||
+ (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO)) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
/*
* Public Implementation
*/
handle = NULL;
return __player_convert_error_code(ret, (char *)__FUNCTION__);
} else {
+ muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
+
*player = (player_h)handle;
handle->state = PLAYER_STATE_IDLE;
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
handle->is_stopped = FALSE;
handle->is_display_visible = TRUE;
handle->is_media_stream = FALSE;
+
+ for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+ if (_check_enabled_user_cb_lock(type))
+ g_mutex_init(&handle->user_cb_lock[type]);
+ }
#ifdef USE_ECORE_FUNCTIONS
handle->ecore_jobs = g_hash_table_new_full(g_str_hash, g_str_equal, __job_key_to_remove, __job_value_to_destroy);
#else
LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
} else {
+ muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
+
handle->state = PLAYER_STATE_NONE;
+
+ for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+ if (_check_enabled_user_cb_lock(type))
+ g_mutex_clear(&handle->user_cb_lock[type]);
+ }
+
#ifndef USE_ECORE_FUNCTIONS
if (handle->message_queue) {
g_queue_free(handle->message_queue);
PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PD);
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PD] = NULL;
handle->user_data[MUSE_PLAYER_EVENT_TYPE_PD] = NULL;
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PD);
LOGI("[%s] Event type : %d ", __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_PD);
int ret = mm_player_set_pd_message_callback(handle->mm_handle, NULL, NULL);
PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
+
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL;
handle->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL;
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
+
LOGI("Event type : %d ", MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL);
handle->user_cb[event_type] = callback; \
handle->user_data[event_type] = user_data; \
LOGI("[%s] Event type : %d ", __FUNCTION__, event_type); \
-} while (0) \
+} while (0)
bool __audio_stream_callback_ex(MMPlayerAudioStreamDataType *stream, void *user_data)
{
LOGE("[%s] event type %d, status %d, bytes %llu", __FUNCTION__, event_type, status, bytes);
+ LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
+
if (handle->user_cb[event_type]) {
((player_media_stream_buffer_status_cb_ex)handle->user_cb[event_type])(status, bytes, handle->user_data[event_type]);
} else {
LOGE("[%s][type:%d] buffer status cb was not set.", __FUNCTION__, type);
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
return FALSE;
}
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
+
return TRUE;
}
return PLAYER_ERROR_INVALID_PARAMETER;
}
- ret = mm_player_set_media_stream_buffer_status_callback(handle->mm_handle, type, (mm_player_media_stream_buffer_status_callback)__media_stream_buffer_status_callback_ex, (void *)handle);
-
- if (ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret, (char *)__FUNCTION__);
-
if (type == PLAYER_STREAM_TYPE_VIDEO)
event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
else
event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
- LOGI("[%s] Event type : %d ", __FUNCTION__, type);
+
+ ret = mm_player_set_media_stream_buffer_status_callback(handle->mm_handle, type, (mm_player_media_stream_buffer_status_callback)__media_stream_buffer_status_callback_ex, (void *)handle);
+
+ if (ret != MM_ERROR_NONE) {
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ }
+
+ LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
handle->user_cb[event_type] = callback;
handle->user_data[event_type] = user_data;
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
+
+ LOGI("[%s] Event type : %d ", __FUNCTION__, type);
return PLAYER_ERROR_NONE;
}
else
return PLAYER_ERROR_INVALID_PARAMETER;
+ LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
+
handle->user_cb[event_type] = NULL;
handle->user_data[event_type] = NULL;
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
+
LOGI("[%s] Event type : %d ", __FUNCTION__, type);
ret = mm_player_set_media_stream_buffer_status_callback(handle->mm_handle, type, NULL, NULL);
+
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_next_uri (player_h player, const char *uri)
+int legacy_player_set_next_uri(player_h player, const char *uri)
{
PLAYER_INSTANCE_CHECK(player);
player_s * handle = (player_s *) player;
- if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
int ret = mm_player_set_next_uri(handle->mm_handle, uri);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char*)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-int legacy_player_get_next_uri (player_h player, char **uri)
+int legacy_player_get_next_uri(player_h player, char **uri)
{
PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *) player;
- if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
int ret = mm_player_get_next_uri(handle->mm_handle, uri); /* uri will be free in muse_player.c*/
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char*)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
}
int legacy_player_set_gapless(player_h player, bool gapless)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
-}
\ No newline at end of file
+}
void _video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
{
- if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN) {
+ if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN)
LOGE("video buffer is underrun state, current level byte = %llu", bytes);
- }
- else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) {
+ else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW)
LOGE("video buffer is overrun state, current level byte = %llu", bytes);
- }
}
void _audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
{
- if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN) {
+ if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN)
LOGE("audio buffer is underrun state, current level byte = %llu", bytes);
- }
- else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) {
+ else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW)
LOGE("audio buffer is overrun state, current level byte = %llu", bytes);
- }
}
void _video_seek_data_cb(unsigned long long offset, void *user_data)
* Does NOT include package
*/
-int main(){
+int main()
+{
return 0;
}
Name: mmsvc-player
Summary: A Media Player module for muse server
-Version: 0.2.38
+Version: 0.2.39
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0