/* This function should be called after the pipeline goes PAUSED or higher
state. */
gboolean
-_mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) // @
+_mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
{
static gboolean has_duration = FALSE;
static gboolean has_video_attrs = FALSE;
* it to applicaton by calling callback function
*/
int
-__mmplayer_set_state(mm_player_t* player, int state) // @
+__mmplayer_set_state(mm_player_t* player, int state)
{
MMMessageParamType msg = {0, };
int sound_result = MM_ERROR_NONE;
/* do some FSM stuffs before posting new state to application */
interrupted_by_focus = player->sound_focus.by_asm_cb;
- interrupted_by_resource = player->resource_manager.by_rm_cb;
+ interrupted_by_resource = (player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY].by_rm_cb ||
+ player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER].by_rm_cb);
switch (MMPLAYER_CURRENT_STATE(player)) {
case MM_PLAYER_STATE_NULL:
}
static gboolean
-__mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
+__mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data)
{
mm_player_t* player = (mm_player_t*) data;
gboolean ret = TRUE;
static gboolean
-__mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage* msg) // @
+__mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage* msg)
{
/* macro for better code readability */
}
static void
-__mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data) // @
+__mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data)
{
mm_player_t* player = (mm_player_t*) data;
}
static gboolean
-__mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink) // @
+__mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink)
{
GstElement* parent = NULL;
static void
-__mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) // @
+__mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
{
GstPad *sinkpad = NULL;
GstCaps* caps = NULL;
/* FIXIT : check indent */
#if 0
static void
-__mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) // @
+__mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
{
GstPad *sinkpad = NULL;
GstCaps* caps = NULL;
/* don't make video because of not required, and not support multiple track */
if (stype == MM_DISPLAY_SURFACE_NULL) {
LOGD("no video sink by null surface");
- MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
- == MM_ERROR_NONE) {
- /* acquire resources for video playing */
- if (resource_state == RESOURCE_STATE_PREPARED) {
- if (_mmplayer_resource_manager_acquire(&player->resource_manager)
- != MM_ERROR_NONE) {
- LOGE("could not acquire resources for video playing\n");
- _mmplayer_resource_manager_unprepare(&player->resource_manager);
- goto ERROR;
- }
- }
- }
gchar *caps_str = gst_caps_to_string(caps);
if (caps_str && (strstr(caps_str, "ST12") || strstr(caps_str, "SN12")))
}
static void
-__mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) // @
+__mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data)
{
mm_player_t* player = NULL;
MMHandleType attrs = 0;
}
if (surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
/* prepare resource manager for video overlay */
if (resource_state >= RESOURCE_STATE_INITIALIZED) {
- if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_OVERLAY)
+ if (_mmplayer_resource_manager_prepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], RESOURCE_TYPE_VIDEO_OVERLAY)
!= MM_ERROR_NONE) {
LOGE("could not prepare for video_overlay resource\n");
goto ERROR;
}
}
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
- == MM_ERROR_NONE) {
- /* acquire resources for video playing */
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ /* acquire resources for video overlay */
if (resource_state == RESOURCE_STATE_PREPARED) {
- if (_mmplayer_resource_manager_acquire(&player->resource_manager)
- != MM_ERROR_NONE) {
+ if (_mmplayer_resource_manager_acquire(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]) != MM_ERROR_NONE) {
LOGE("could not acquire resources for video playing\n");
- _mmplayer_resource_manager_unprepare(&player->resource_manager);
+ _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
goto ERROR;
}
}
}
int
-_mmplayer_update_video_param(mm_player_t* player, char *param_name) // @
+_mmplayer_update_video_param(mm_player_t* player, char *param_name)
{
MMHandleType attrs = 0;
int surface_type = 0;
return MM_ERROR_NONE;
}
+int
+_mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
+{
+ gboolean disable_overlay = FALSE;
+ mm_player_t* player = (mm_player_t*) hplayer;
+ MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
+ int ret = MM_ERROR_NONE;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->videobin &&
+ player->pipeline->videobin[MMPLAYER_V_SINK].gst,
+ MM_ERROR_PLAYER_NO_OP); /* invalid op */
+
+ if (!g_object_class_find_property(G_OBJECT_GET_CLASS(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "disable-overlay")) {
+ LOGW("Display control is not supported");
+ return MM_ERROR_PLAYER_INTERNAL;
+ }
+
+ g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", &disable_overlay, NULL);
+
+ if (audio_only == (bool)disable_overlay) {
+ LOGE("It's the same with current setting: (%d)", audio_only);
+ return MM_ERROR_NONE;
+ }
+
+ if (audio_only) {
+ LOGE("disable overlay");
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", TRUE, NULL);
+
+ /* release overlay resource */
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ if (resource_state >= RESOURCE_STATE_ACQUIRED) {
+ ret = _mmplayer_resource_manager_release(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to release overlay resource, ret(0x%x)\n", ret);
+ goto ERROR;
+ }
+ }
+ }
+
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == RESOURCE_STATE_PREPARED) {
+ ret = _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to unprepare overlay resource, ret(0x%x)\n", ret);
+ goto ERROR;
+ }
+ }
+ }
+ } else {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ /* prepare resource manager for video overlay */
+ if (resource_state >= RESOURCE_STATE_INITIALIZED) {
+ ret = _mmplayer_resource_manager_prepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], RESOURCE_TYPE_VIDEO_OVERLAY);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("could not prepare for video_overlay resource\n");
+ goto ERROR;
+ }
+ }
+ }
+
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ /* acquire resources for video overlay */
+ if (resource_state == RESOURCE_STATE_PREPARED) {
+ ret = _mmplayer_resource_manager_acquire(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("could not acquire resources for video playing\n");
+ _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
+ goto ERROR;
+ }
+ }
+ }
+
+ LOGD("enable overlay");
+ __mmplayer_video_param_set_display_overlay(player);
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", FALSE, NULL);
+ }
+
+ERROR:
+ MMPLAYER_FLEAVE();
+ return MM_ERROR_NONE;
+}
+
+int
+_mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only)
+{
+ mm_player_t* player = (mm_player_t*) hplayer;
+ gboolean disable_overlay = FALSE;
+
+ MMPLAYER_FENTER();
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(paudio_only, MM_ERROR_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->videobin &&
+ player->pipeline->videobin[MMPLAYER_V_SINK].gst,
+ MM_ERROR_PLAYER_NO_OP); /* invalid op */
+
+ if (!g_object_class_find_property(G_OBJECT_GET_CLASS(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "disable-overlay")) {
+ LOGW("Display control is not supported");
+ return MM_ERROR_PLAYER_INTERNAL;
+ }
+
+ g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", &disable_overlay, NULL);
+
+ *paudio_only = (bool)(disable_overlay);
+
+ LOGD("audio_only : %d", *paudio_only);
+
+ MMPLAYER_FLEAVE();
+
+ return MM_ERROR_NONE;
+}
+
static int
-__mmplayer_gst_element_link_bucket(GList* element_bucket) // @
+__mmplayer_gst_element_link_bucket(GList* element_bucket)
{
GList* bucket = element_bucket;
MMPlayerGstElement* element = NULL;
}
static int
-__mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket) // @
+__mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket)
{
GList* bucket = element_bucket;
MMPlayerGstElement* element = NULL;
}
static void
-__gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data) // @
+__gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data)
{
GstElement *appsrc = element;
tBuffer *buf = (tBuffer *)user_data;
}
static gboolean
-__gst_appsrc_seek_data_mem(GstElement *element, guint64 size, gpointer user_data) // @
+__gst_appsrc_seek_data_mem(GstElement *element, guint64 size, gpointer user_data)
{
tBuffer *buf = (tBuffer *)user_data;
* @see
*/
static int
-__mmplayer_gst_create_pipeline(mm_player_t* player) // @
+__mmplayer_gst_create_pipeline(mm_player_t* player)
{
GstBus *bus = NULL;
MMPlayerGstElement *mainbin = NULL;
}
static int
-__mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
+__mmplayer_gst_destroy_pipeline(mm_player_t* player)
{
gint timeout = 0;
int ret = MM_ERROR_NONE;
return ret;
}
-static int __gst_realize(mm_player_t* player) // @
+static int __gst_realize(mm_player_t* player)
{
gint timeout = 0;
int ret = MM_ERROR_NONE;
return ret;
}
-static int __gst_unrealize(mm_player_t* player) // @
+static int __gst_unrealize(mm_player_t* player)
{
int ret = MM_ERROR_NONE;
return ret;
}
-static int __gst_start(mm_player_t* player) // @
+static int __gst_start(mm_player_t* player)
{
gboolean sound_extraction = 0;
int ret = MM_ERROR_NONE;
MMPLAYER_FLEAVE();
}
-static int __gst_stop(mm_player_t* player) // @
+static int __gst_stop(mm_player_t* player)
{
GstStateChangeReturn change_ret = GST_STATE_CHANGE_SUCCESS;
MMHandleType attrs = 0;
return ret;
}
-int __gst_pause(mm_player_t* player, gboolean async) // @
+int __gst_pause(mm_player_t* player, gboolean async)
{
int ret = MM_ERROR_NONE;
return ret;
}
-int __gst_resume(mm_player_t* player, gboolean async) // @
+int __gst_resume(mm_player_t* player, gboolean async)
{
int ret = MM_ERROR_NONE;
gint timeout = 0;
}
static int
-__gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called) // @
+__gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called)
{
unsigned long dur_msec = 0;
gint64 dur_nsec = 0;
#define TRICKPLAY_OFFSET GST_MSECOND
static int
-__gst_get_position(mm_player_t* player, int format, unsigned long* position) // @
+__gst_get_position(mm_player_t* player, int format, unsigned long* position)
{
MMPlayerStateType current_state = MM_PLAYER_STATE_NONE;
gint64 pos_msec = 0;
}
static int
-__gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param) // @
+__gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param)
{
MMPLAYER_FENTER();
return MM_ERROR_NONE;
}
-static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile* data) // @
+static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile* data)
{
int ret = MM_ERROR_PLAYER_INVALID_URI;
char *path = NULL;
int
-_mmplayer_create_player(MMHandleType handle) // @
+_mmplayer_create_player(MMHandleType handle)
{
int ret = MM_ERROR_PLAYER_INTERNAL;
mm_player_t* player = MM_PLAYER_CAST(handle);
}
/* initialize resource manager */
- if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager, player)) {
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], player)) {
+ LOGE("failed to initialize resource manager\n");
+ goto ERROR;
+ }
+
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], player)) {
LOGE("failed to initialize resource manager\n");
goto ERROR;
}
}
static gboolean
-__mmplayer_init_gstreamer(mm_player_t* player) // @
+__mmplayer_init_gstreamer(mm_player_t* player)
{
static gboolean initialized = FALSE;
static const int max_argc = 50;
}
int
-_mmplayer_destroy(MMHandleType handle) // @
+_mmplayer_destroy(MMHandleType handle)
{
mm_player_t* player = MM_PLAYER_CAST(handle);
LOGE("failed to deregister asm server\n");
/* de-initialize resource manager */
- if (MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager))
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER]))
+ LOGE("failed to deinitialize resource manager\n");
+
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]))
LOGE("failed to deinitialize resource manager\n");
#ifdef USE_LAZY_PAUSE
}
int
-_mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid) // @
+_mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid)
{
mm_player_t* player = (mm_player_t*)hplayer;
MMHandleType attrs = 0;
}
int
-_mmplayer_realize(MMHandleType hplayer) // @
+_mmplayer_realize(MMHandleType hplayer)
{
mm_player_t* player = (mm_player_t*)hplayer;
char *uri = NULL;
if (ret != MM_ERROR_NONE)
LOGE("failed to release sound focus, ret(0x%x)\n", ret);
- if (!player->resource_manager.by_rm_cb && /* is being released */
- _mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (!player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER].by_rm_cb && /* is being released */
+ !player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY].by_rm_cb &&
+ _mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], &resource_state) == MM_ERROR_NONE) {
if (resource_state >= RESOURCE_STATE_ACQUIRED) {
- ret = _mmplayer_resource_manager_release(&player->resource_manager);
+ ret = _mmplayer_resource_manager_release(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER]);
+ if (ret != MM_ERROR_NONE)
+ LOGE("failed to release decoder resource, ret(0x%x)\n", ret);
+ }
+ }
+
+ if (!player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER].by_rm_cb && /* is being released */
+ !player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY].by_rm_cb &&
+ _mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
+ if (resource_state >= RESOURCE_STATE_ACQUIRED) {
+ ret = _mmplayer_resource_manager_release(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
+ if (ret != MM_ERROR_NONE)
+ LOGE("failed to release overlay resource, ret(0x%x)\n", ret);
+ }
+ }
+
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == RESOURCE_STATE_PREPARED) {
+ ret = _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER]);
if (ret != MM_ERROR_NONE)
- LOGE("failed to release resource, ret(0x%x)\n", ret);
+ LOGE("failed to unprepare decoder resource, ret(0x%x)\n", ret);
}
}
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY], &resource_state) == MM_ERROR_NONE) {
if (resource_state == RESOURCE_STATE_PREPARED) {
- ret = _mmplayer_resource_manager_unprepare(&player->resource_manager);
+ ret = _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_OVERLAY]);
if (ret != MM_ERROR_NONE)
- LOGE("failed to unprepare resource, ret(0x%x)\n", ret);
+ LOGE("failed to unprepare overlay resource, ret(0x%x)\n", ret);
}
}
} else
}
int
-_mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, gpointer user_param) // @
+_mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, gpointer user_param)
{
mm_player_t* player = (mm_player_t*)hplayer;
}
int
-_mmplayer_get_state(MMHandleType hplayer, int* state) // @
+_mmplayer_get_state(MMHandleType hplayer, int* state)
{
mm_player_t *player = (mm_player_t*)hplayer;
int
-_mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume) // @
+_mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume)
{
mm_player_t* player = (mm_player_t*) hplayer;
GstElement* vol_element = NULL;
int
-_mmplayer_set_mute(MMHandleType hplayer, int mute) // @
+_mmplayer_set_mute(MMHandleType hplayer, int mute)
{
mm_player_t* player = (mm_player_t*) hplayer;
GstElement* vol_element = NULL;
}
int
-_mmplayer_get_mute(MMHandleType hplayer, int* pmute) // @
+_mmplayer_get_mute(MMHandleType hplayer, int* pmute)
{
mm_player_t* player = (mm_player_t*) hplayer;
}
int
-_mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param) // @
+_mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param)
{
mm_player_t* player = (mm_player_t*) hplayer;
}
int
-_mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param) // @
+_mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param)
{
mm_player_t* player = (mm_player_t*) hplayer;
}
int
-_mmplayer_set_audiostream_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param) // @
+_mmplayer_set_audiostream_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param)
{
mm_player_t* player = (mm_player_t*) hplayer;
}
int
-_mmplayer_start(MMHandleType hplayer) // @
+_mmplayer_start(MMHandleType hplayer)
{
mm_player_t* player = (mm_player_t*) hplayer;
gint ret = MM_ERROR_NONE;
/* NOTE : it should be able to call 'stop' anytime*/
int
-_mmplayer_stop(MMHandleType hplayer) // @
+_mmplayer_stop(MMHandleType hplayer)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
int
-_mmplayer_pause(MMHandleType hplayer) // @
+_mmplayer_pause(MMHandleType hplayer)
{
mm_player_t* player = (mm_player_t*)hplayer;
gint64 pos_msec = 0;
}
int
-_mmplayer_set_position(MMHandleType hplayer, int format, int position) // @
+_mmplayer_set_position(MMHandleType hplayer, int format, int position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
int
-_mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *position) // @
+_mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
int
-_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos) // @
+_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
int
-_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position) // @
+_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
return ret;
}
int
-_mmplayer_adjust_video_postion(MMHandleType hplayer, int offset) // @
+_mmplayer_adjust_video_postion(MMHandleType hplayer, int offset)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
static void
-__mmplayer_typefind_have_type(GstElement *tf, guint probability, // @
+__mmplayer_typefind_have_type(GstElement *tf, guint probability,
GstCaps *caps, gpointer data)
{
mm_player_t* player = (mm_player_t*)data;
/* it will return first created element */
static gboolean
-__mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) // @
+__mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps)
{
MMPlayerGstElement* mainbin = NULL;
const char* mime = NULL;
/* prepare resource manager for video decoder */
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], &resource_state) == MM_ERROR_NONE) {
/* prepare resource manager for video decoder */
if ((resource_state >= RESOURCE_STATE_INITIALIZED) && (resource_state < RESOURCE_STATE_ACQUIRED)) {
- if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_DECODER)
+ if (_mmplayer_resource_manager_prepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], RESOURCE_TYPE_VIDEO_DECODER)
!= MM_ERROR_NONE) {
LOGW("could not prepare for video_decoder resource, skip it.");
result = GST_AUTOPLUG_SELECT_SKIP;
}
}
}
+
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER], &resource_state)
+ == MM_ERROR_NONE) {
+ /* acquire resources for video playing */
+ if (resource_state == RESOURCE_STATE_PREPARED) {
+ if (_mmplayer_resource_manager_acquire(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER])
+ != MM_ERROR_NONE) {
+ LOGE("could not acquire resources for video decoding\n");
+ _mmplayer_resource_manager_unprepare(&player->resource_manager[RESOURCE_TYPE_VIDEO_DECODER]);
+ goto DONE;
+ }
+ }
+ }
}
}
static void
__mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad* new_pad,
-gpointer data) // @
+gpointer data)
{
//mm_player_t* player = (mm_player_t*)data;
GstCaps* caps = NULL;
}
static void
-__mmplayer_init_factories(mm_player_t* player) // @
+__mmplayer_init_factories(mm_player_t* player)
{
MMPLAYER_RETURN_IF_FAIL(player);
}
static void
-__mmplayer_release_factories(mm_player_t* player) // @
+__mmplayer_release_factories(mm_player_t* player)
{
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player);
return FALSE;
}
-static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data) // @
+static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data)
{
const gchar *klass;
static void mrp_state_callback(mrp_res_context_t *context, mrp_res_error_t err, void *user_data)
{
int i = 0;
- const mrp_res_resource_set_t *rset;
- mrp_res_resource_t *resource;
- mm_player_t* player = NULL;
+ const mrp_res_resource_set_t *rset = NULL;
+ mrp_res_resource_t *resource = NULL;
+ MMPlayerResourceManager *resource_manager = NULL;
MMPLAYER_FENTER();
LOGE(" - user data is null\n");
return;
}
- player = (mm_player_t*)user_data;
+ resource_manager = (MMPlayerResourceManager *)user_data;
if (err != MRP_RES_ERROR_NONE) {
- LOGE(" - error message received from Murphy, for the player(%p), err(0x%x)\n", player, err);
+ LOGE(" - error message received from Murphy, for the rm(%p), err(0x%x)\n", resource_manager, err);
return;
}
}
mrp_res_free_string_array(resource_names);
}
- player->resource_manager.is_connected = TRUE;
+ resource_manager->is_connected = TRUE;
break;
case MRP_RES_DISCONNECTED:
LOGD(" - disconnected from Murphy\n");
- if (player->resource_manager.rset) {
- mrp_res_delete_resource_set(player->resource_manager.rset);
- player->resource_manager.rset = NULL;
+ if (resource_manager->rset) {
+ mrp_res_delete_resource_set(resource_manager->rset);
+ resource_manager->rset = NULL;
}
- mrp_res_destroy(player->resource_manager.context);
- player->resource_manager.context = NULL;
- player->resource_manager.is_connected = FALSE;
+ mrp_res_destroy(resource_manager->context);
+ resource_manager->context = NULL;
+ resource_manager->is_connected = FALSE;
break;
}
static void mrp_rset_state_callback(mrp_res_context_t *cx, const mrp_res_resource_set_t *rs, void *user_data)
{
int i = 0;
- mm_player_t *player = (mm_player_t *)user_data;
mrp_res_resource_t *res;
+ MMPlayerResourceManager *resource_manager = (MMPlayerResourceManager *)user_data;
MMPLAYER_FENTER();
- MMPLAYER_RESOURCE_SET_LOCK(&player->resource_manager);
+ MMPLAYER_RESOURCE_SET_LOCK(resource_manager);
- if (!mrp_res_equal_resource_set(rs, player->resource_manager.rset)) {
- LOGW("- resource set(%p) is not same as this player handle's(%p)", rs, player->resource_manager.rset);
- MMPLAYER_RESOURCE_SET_UNLOCK(&player->resource_manager);
+ if (!mrp_res_equal_resource_set(rs, resource_manager->rset)) {
+ LOGW("- resource set(%p) is not same as this player handle's rset(%p)", rs, resource_manager->rset);
+ MMPLAYER_RESOURCE_SET_UNLOCK(resource_manager);
return;
}
- LOGD(" - resource set state of player(%p) is changed to [%s]\n", player, state_to_str(rs->state));
+ LOGD(" - resource set state of rm(%p) is changed to [%s]\n", resource_manager, state_to_str(rs->state));
for (i = 0; i < MRP_RESOURCE_MAX; i++) {
res = mrp_res_get_resource_by_name(rs, resource_str[i]);
if (res == NULL)
LOGD(" -- resource name [%s] -> [%s]'\n", res->name, state_to_str(res->state));
}
- mrp_res_delete_resource_set(player->resource_manager.rset);
- player->resource_manager.rset = mrp_res_copy_resource_set(rs);
+ mrp_res_delete_resource_set(resource_manager->rset);
+ resource_manager->rset = mrp_res_copy_resource_set(rs);
if (rs->state == MRP_RES_RESOURCE_ACQUIRED) {
LOGD(" - resource set is acquired");
- player->resource_manager.state = RESOURCE_STATE_ACQUIRED;
- MMPLAYER_RESOURCE_SET_SIGNAL(&player->resource_manager);
- } else if ((player->resource_manager.state >= RESOURCE_STATE_ACQUIRED) &&
+ resource_manager->state = RESOURCE_STATE_ACQUIRED;
+ MMPLAYER_RESOURCE_SET_SIGNAL(resource_manager);
+ } else if ((resource_manager->state >= RESOURCE_STATE_ACQUIRED) &&
(rs->state == MRP_RES_RESOURCE_AVAILABLE)) {
LOGD(" - resource set is released");
- player->resource_manager.state = RESOURCE_STATE_PREPARED;
- MMPLAYER_RESOURCE_SET_SIGNAL(&player->resource_manager);
+ resource_manager->state = RESOURCE_STATE_PREPARED;
+ MMPLAYER_RESOURCE_SET_SIGNAL(resource_manager);
/* mm player was unrealized by resource conflict. */
- if (player->resource_manager.by_rm_cb == TRUE) {
+ if (resource_manager->by_rm_cb == TRUE) {
LOGD(" - delete resource set ");
- if (player->resource_manager.rset) {
- mrp_res_delete_resource_set(player->resource_manager.rset);
- player->resource_manager.rset = NULL;
+ if (resource_manager->rset) {
+ mrp_res_delete_resource_set(resource_manager->rset);
+ resource_manager->rset = NULL;
}
- player->resource_manager.state = RESOURCE_STATE_INITIALIZED;
- player->resource_manager.by_rm_cb = FALSE;
+ resource_manager->state = RESOURCE_STATE_INITIALIZED;
+ resource_manager->by_rm_cb = FALSE;
}
}
- MMPLAYER_RESOURCE_SET_UNLOCK(&player->resource_manager);
+ MMPLAYER_RESOURCE_SET_UNLOCK(resource_manager);
MMPLAYER_FLEAVE();
}
{
int i = 0;
int result = MM_ERROR_NONE;
- mm_player_t* player = NULL;
- mrp_res_resource_t *res;
+ mm_player_t *player = NULL;
+ MMPlayerResourceManager *resource_manager = NULL;
+ mrp_res_resource_t *res = NULL;
gboolean resource_released = FALSE;
MMPLAYER_FENTER();
LOGE("- user_data is null\n");
return;
}
- player = (mm_player_t*)user_data;
+ resource_manager = (MMPlayerResourceManager *)user_data;
+ player = (mm_player_t *)resource_manager->user_data;
- if (!mrp_res_equal_resource_set(rs, player->resource_manager.rset)) {
- LOGW("- resource set(%p) is not same as this player handle's(%p)", rs, player->resource_manager.rset);
+ if (!mrp_res_equal_resource_set(rs, resource_manager->rset)) {
+ LOGW("- resource set(%p) is not same as this player handle's(%p)", rs, resource_manager->rset);
return;
}
- LOGD(" - resource set state of player(%p) is changed to [%s]\n", player, state_to_str(rs->state));
+ LOGD(" - resource set state of rm(%p) is changed to [%s]\n", resource_manager, state_to_str(rs->state));
for (i = 0; i < MRP_RESOURCE_MAX; i++) {
res = mrp_res_get_resource_by_name(rs, resource_str[i]);
if (res == NULL) {
MMMessageParamType msg = {0, };
unsigned long pos = 0;
- player->resource_manager.by_rm_cb = TRUE; /* will be reset in state cb */
+ resource_manager->by_rm_cb = TRUE; /* will be reset in state cb */
/* get last play position */
if (_mmplayer_get_position((MMHandleType)player, MM_PLAYER_POS_FORMAT_TIME, &pos) != MM_ERROR_NONE) {
resource_manager->rset = mrp_res_create_resource_set(resource_manager->context,
MRP_APP_CLASS_FOR_PLAYER,
mrp_rset_state_callback,
- (void*)resource_manager->user_data);
+ (void*)resource_manager);
if (resource_manager->rset == NULL) {
LOGE(" - could not create resource set\n");
return MM_ERROR_RESOURCE_INTERNAL;
bool mrp_ret = FALSE;
if (resource_manager->rset) {
- mrp_ret = mrp_res_set_release_callback(resource_manager->rset, mrp_resource_release_cb, resource_manager->user_data);
+ mrp_ret = mrp_res_set_release_callback(resource_manager->rset, mrp_resource_release_cb, resource_manager);
if (!mrp_ret) {
LOGE(" - could not set release callback\n");
ret = MM_ERROR_RESOURCE_INTERNAL;
resource_manager->mloop = mrp_mainloop_glib_get(mrp_loop);
g_main_loop_unref(mrp_loop);
if (resource_manager->mloop) {
- resource_manager->context = mrp_res_create(resource_manager->mloop, mrp_state_callback, user_data);
+ resource_manager->context = mrp_res_create(resource_manager->mloop, mrp_state_callback, resource_manager);
if (resource_manager->context == NULL) {
LOGE(" - could not get context for resource manager\n");
mrp_mainloop_destroy(resource_manager->mloop);
case RESOURCE_TYPE_VIDEO_DECODER:
ret = include_resource(resource_manager, resource_str[MRP_RESOURCE_FOR_VIDEO_DECODER]);
break;
+ default:
+ LOGE("unknown resource type %d", resource_type);
+ return MM_ERROR_INVALID_ARGUMENT;
}
}