*/
typedef void (*player_video_stream_changed_cb) (int width, int height, int fps, int bit_rate, void *user_data);
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+/**
+ * @brief Called when the buffer needs to be released for gapless.
+ * @since_tizen 4.0
+ * @details It will be invoked when the player is under the construction for gapless.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre It will be invoked when the playback is completed if you register this callback using legacy_player_set_completed_cb().
+ * @see legacy_player_set_retrieve_buffer_cb()
+ * @see legacy_player_unset_retrieve_buffer_cb()
+ */
+typedef void (*player_retrieve_buffer_cb)(void *user_data);
+#endif
+
/**
* @brief Creates a player handle for playing multimedia content.
* @since_tizen 2.3
*/
int legacy_player_select_track(player_h player, player_stream_type_e type, int index);
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+/**
+ * @brief Registers a callback function that is to be invoked when the buffer needs to be released for gapless.
+ * @since_tizen 4.0
+ * @param[in] player The handle to the media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @post player_retrieve_buffer_cb() will be invoked.
+ * @see legacy_player_unset_retrieve_buffer_cb()
+ */
+int legacy_player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 4.0
+ * @param[in] player The handle to the media player
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see legacy_player_set_retrieve_buffer_cb()
+ */
+int legacy_player_unset_retrieve_buffer_cb(player_h player);
+#endif
/**
* @}
*/
PLAYER_MESSAGE_SEEK_DONE,
PLAYER_MESSAGE_EOS,
PLAYER_MESSAGE_LOOP_EXIT,
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ PLAYER_MESSAGE_GAPLESS_CONSTRUCTION,
+#endif
PLAYER_MESSAGE_MAX
} _player_message_e;
#endif
g_mutex_unlock(&handle->message_queue_lock); \
LOGI("Retrieved message [%d] from queue", handle->current_message); \
} else { \
- LOGI("Failed to retrive message from queue"); \
+ LOGI("Failed to retrieve message from queue"); \
handle->current_message = PLAYER_MESSAGE_NONE; \
} \
} while (0)
__REMOVE_ECORE_JOB(handle, __JOB_KEY_EOS);
LOGI("End");
}
+
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+static void __job_retrieve_buffer_cb(void *user_data)
+{
+ player_s *handle = (player_s *)user_data;
+ LOGI("Start");
+ handle->is_doing_jobs = TRUE;
+ ((player_retrieve_buffer_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]);
+ __REMOVE_ECORE_JOB(handle, "test");
+ LOGI("End");
+}
+#endif
#else
static void __message_cb_loop(void *data)
{
LOGE("null handle in PLAYER_MESSAGE_EOS");
}
break;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ case PLAYER_MESSAGE_GAPLESS_CONSTRUCTION:
+ {
+ LOGW("PLAYER_MESSAGE_GAPLESS_CONSTRUCTION");
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]) {
+ ((player_retrieve_buffer_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]);
+ } else {
+ LOGE("null handle in PLAYER_MESSAGE_GAPLESS_CONSTRUCTION");
+ }
+ }
+ break;
+#endif
case PLAYER_MESSAGE_LOOP_EXIT:
{
LOGW("PLAYER_MESSAGE_LOOP_EXIT");
#endif
}
break;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ case MM_MESSAGE_GAPLESS_CONSTRUCTION: /* 0x105 */
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]) {
+#ifdef USE_ECORE_FUNCTIONS
+ __ADD_ECORE_JOB(handle, "test", __job_retrieve_buffer_cb);
+#else
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_GAPLESS_CONSTRUCTION);
+#endif
+ }
+ break;
+#endif
case MM_MESSAGE_BUFFERING: /* 0x103 */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])
((player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
return __unset_callback(MUSE_PLAYER_EVENT_TYPE_COMPLETE, player);
}
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+int legacy_player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data)
+{
+ return __set_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player, callback, user_data);
+}
+
+int legacy_player_unset_retrieve_buffer_cb(player_h player)
+{
+ return __unset_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player);
+}
+#endif
+
int legacy_player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data)
{
return __set_callback(MUSE_PLAYER_EVENT_TYPE_INTERRUPT, player, callback, user_data);
MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK,
MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED,
MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED,
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER,
+#endif
MUSE_PLAYER_EVENT_TYPE_NUM
} muse_player_event_e;
__player_callback(ev, (muse_module_h)user_data);
}
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+static void _retrieve_buffer_cb(void *user_data)
+{
+ muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER;
+ __player_callback(ev, (muse_module_h)user_data);
+}
+#endif
+
static void _set_completed_cb(player_h player, void *module, bool set)
{
if (set)
legacy_player_unset_completed_cb(player);
}
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+static void _set_retrieve_buffer_cb(player_h player, void *module, bool set)
+{
+ if (set)
+ legacy_player_set_retrieve_buffer_cb(player, _retrieve_buffer_cb, module);
+ else
+ legacy_player_unset_retrieve_buffer_cb(player);
+}
+#endif
+
static void _capture_video_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
_set_media_stream_audio_seek_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */
NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */
_set_video_stream_changed_cb, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ _set_retrieve_buffer_cb, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
+#endif
};
static int _push_media_stream(muse_player_handle_s *muse_player, player_push_media_msg_type *push_media, char *buf)