#define MM_VOLUME_FACTOR_MAX 1.0
/* Don't need to sleep for sound fadeout
- * fadeout related fucntion will be deleted(Deprecated)
+ * fadeout related function will be deleted(Deprecated)
*/
#define MM_PLAYER_FADEOUT_TIME_DEFAULT 0
}
/* this function sets the player state and also report
- * it to applicaton by calling callback function
+ * it to application by calling callback function
*/
void
_mmplayer_set_state(mmplayer_t *player, int state)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
#ifdef __DEBUG__
- LOGD("incomming command : %d ", command);
+ LOGD("incoming command : %d ", command);
#endif
current_state = MMPLAYER_CURRENT_STATE(player);
pending_state = MMPLAYER_PENDING_STATE(player);
if (pending_state == MM_PLAYER_STATE_NONE) {
if (current_state == MM_PLAYER_STATE_PAUSED)
goto NO_OP;
- else if (current_state != MM_PLAYER_STATE_PLAYING && current_state != MM_PLAYER_STATE_READY) // support loading state of broswer
+ else if (current_state != MM_PLAYER_STATE_PLAYING && current_state != MM_PLAYER_STATE_READY) // support loading state of browser
goto INVALID_STATE;
} else if (pending_state == MM_PLAYER_STATE_PAUSED) {
goto ALREADY_GOING;
gst_element_set_locked_state(fakesink->gst, TRUE);
/* setting the state to NULL never returns async
- * so no need to wait for completion of state transiton
+ * so no need to wait for completion of state transition
*/
if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(fakesink->gst, GST_STATE_NULL))
LOGE("fakesink state change failure!");
return ret;
}
-/* create fakesink for audio or video path witout audiobin or videobin */
+/* create fakesink for audio or video path without audiobin or videobin */
static void
__mmplayer_gst_make_fakesink(mmplayer_t *player, GstPad *pad, const gchar *name)
{
MMPLAYER_RETURN_VAL_IF_FAIL(player && text_selector, FALSE);
if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
- LOGD("text path is not supproted");
+ LOGD("text path is not supported");
return TRUE;
}
player->textsink_linked = 1;
} else {
/* linked textbin exist which means that the external subtitle path exist already */
- LOGW("ignoring internal subtutle since external subtitle is available");
+ LOGW("ignoring internal subtitle since external subtitle is available");
}
}
sink_pad_name = "text_sink";
if (rotation_angle >= 360)
rotation_angle -= 360;
- /* chech if supported or not */
+ /* check if supported or not */
if (rotation_angle % 90) {
LOGD("not supported rotation angle = %d", rotation_angle);
return FALSE;
}
if (display_angle) {
- /* update user roation */
+ /* update user rotation */
mm_attrs_get_int_by_name(attrs, "display_rotation", &display_rotation);
/* Counter clockwise */
}
}
- /* release audiobin with it's childs */
+ /* release audiobin with it's children */
if (audiobin[MMPLAYER_A_BIN].gst)
gst_object_unref(GST_OBJECT(audiobin[MMPLAYER_A_BIN].gst));
/* set size and timestamp */
mem = gst_buffer_peek_memory(buffer, 0);
stream->length_total = gst_memory_get_sizes(mem, NULL, NULL);
- stream->timestamp = (unsigned int)(GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer))); /* nano sec -> mili sec */
+ stream->timestamp = (unsigned int)(GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer))); /* nano sec -> milli sec */
/* check zero-copy */
if (player->set_mode.video_zc &&
if (pad)
gst_object_unref(GST_OBJECT(pad));
- /* release videobin with it's childs */
+ /* release videobin with it's children */
if (videobin[MMPLAYER_V_BIN].gst)
gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst));
}
}
- /* release textbin with it's childs */
+ /* release textbin with it's children */
if (textbin[MMPLAYER_T_BIN].gst)
gst_object_unref(GST_OBJECT(textbin[MMPLAYER_T_BIN].gst));
/* release signal */
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);
- /* release textbin with it's childs */
+ /* release textbin with it's children */
gst_object_unref(GST_OBJECT(textbin[MMPLAYER_T_BIN].gst));
MMPLAYER_FREEIF(player->pipeline->textbin);
player->pipeline->textbin = textbin = NULL;
if (player->pipeline->textbin) {
LOGE("remove textbin");
- /* release textbin with it's childs */
+ /* release textbin with it's children */
MMPLAYER_RELEASE_ELEMENT(player, player->pipeline->textbin, MMPLAYER_T_BIN);
MMPLAYER_FREEIF(player->pipeline->textbin);
player->pipeline->textbin = NULL;
return MM_ERROR_NONE;
}
- /* check current postion */
+ /* check current position */
player->adjust_subtitle_pos = position;
LOGD("save adjust_subtitle_pos in player");
goto INIT_ERROR;
}
- /* Note : check whether subtitle atrribute uri is set. If uri is set, then try to play subtitle file */
+ /* Note : check whether subtitle attribute uri is set. If uri is set, then try to play subtitle file */
if (__mmplayer_check_subtitle(player)
&& (__mmplayer_gst_create_text_pipeline(player) != MM_ERROR_NONE))
LOGE("failed to create text pipeline");
return ret;
}
-static gboolean
-__mmplayer_can_do_interrupt(mmplayer_t *player)
-{
- if (!player || !player->pipeline || !player->attrs) {
- LOGW("not initialized");
- goto FAILED;
- }
-
- if (player->audio_decoded_cb) {
- LOGW("not support in pcm extraction mode");
- goto FAILED;
- }
-
- /* check if seeking */
- if (player->seek_state != MMPLAYER_SEEK_NONE) {
- MMMessageParamType msg_param;
- memset(&msg_param, 0, sizeof(MMMessageParamType));
- msg_param.code = MM_ERROR_PLAYER_SEEK;
- player->seek_state = MMPLAYER_SEEK_NONE;
- MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
- goto FAILED;
- }
-
- /* check other thread */
- if (!MMPLAYER_CMD_TRYLOCK(player)) {
- LOGW("locked already, cmd state : %d", player->cmd);
-
- /* check application command */
- if (player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME) {
- LOGW("playing.. should wait cmd lock then, will be interrupted");
-
- /* lock will be released at mrp_resource_release_cb() */
- MMPLAYER_CMD_LOCK(player);
- goto INTERRUPT;
- }
- LOGW("nothing to do");
- goto FAILED;
- } else {
- LOGW("can interrupt immediately");
- goto INTERRUPT;
- }
-
-FAILED: /* with CMD UNLOCKED */
- return FALSE;
-
-INTERRUPT: /* with CMD LOCKED, will do UNLOCK at __resource_release_cb() */
- return TRUE;
-}
-
static int
__resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res,
void *user_data)
if (!user_data) {
LOGE("user_data is null");
- return FALSE;
+ return TRUE;
}
+
player = (mmplayer_t *)user_data;
- if (!__mmplayer_can_do_interrupt(player)) {
- LOGW("no need to interrupt, so leave");
- /* FIXME: there is no way to avoid releasing resource. */
- return FALSE;
+ if (!player->pipeline || !player->attrs) {
+ LOGW("not initialized");
+ return TRUE;
+ }
+
+ LOGD("cmd lock player, cmd state : %d", player->cmd);
+ MMPLAYER_CMD_LOCK(player);
+ LOGD("cmd locked player");
+
+ if (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_NULL
+ || MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_NONE) {
+ LOGW("player already destroyed");
+ MMPLAYER_CMD_UNLOCK(player);
+ return TRUE;
}
player->interrupted_by_resource = TRUE;
if (_mmplayer_unrealize((MMHandleType)player) != MM_ERROR_NONE)
LOGE("failed to unrealize");
- /* lock is called in __mmplayer_can_do_interrupt() */
MMPLAYER_CMD_UNLOCK(player);
for (res_idx = MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER; res_idx < MMPLAYER_RESOURCE_TYPE_MAX; res_idx++) {
MMPLAYER_GAPLESS_PLAY_THREAD_SIGNAL(player);
MMPLAYER_GAPLESS_PLAY_THREAD_UNLOCK(player);
- LOGD("waitting for gapless play thread exit");
+ LOGD("waiting for gapless play thread exit");
g_thread_join(player->gapless_play_thread);
g_mutex_clear(&player->gapless_play_thread_mutex);
g_cond_clear(&player->gapless_play_thread_cond);
{
mmplayer_t *player = (mmplayer_t *)hplayer;
int ret = MM_ERROR_NONE;
+ int rm_ret = MM_ERROR_NONE;
+ mmplayer_resource_type_e res_idx = MMPLAYER_RESOURCE_TYPE_MAX;
MMPLAYER_FENTER();
/* unrealize pipeline */
ret = __mmplayer_gst_unrealize(player);
- if (!player->interrupted_by_resource) {
- int rm_ret = MM_ERROR_NONE;
- mmplayer_resource_type_e res_idx = MMPLAYER_RESOURCE_TYPE_MAX;
-
- for (res_idx = MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER; res_idx < MMPLAYER_RESOURCE_TYPE_MAX; res_idx++) {
- rm_ret = __mmplayer_release_hw_resource(player, res_idx);
- if (rm_ret != MM_ERROR_NONE)
- LOGE("failed to release [%d] resources", res_idx);
- }
+ for (res_idx = MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER; res_idx < MMPLAYER_RESOURCE_TYPE_MAX; res_idx++) {
+ rm_ret = __mmplayer_release_hw_resource(player, res_idx);
+ if (rm_ret != MM_ERROR_NONE)
+ LOGE("failed to release [%d] resources", res_idx);
}
player->interrupted_by_resource = FALSE;
/* check current state */
MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_PAUSE);
- /* check pipline reconfigure state */
+ /* check pipeline reconfigure state */
__mmplayer_check_pipeline_reconfigure_state(player);
switch (MMPLAYER_CURRENT_STATE(player)) {
case MM_PLAYER_STATE_READY:
{
/* check prepare async or not.
- * In the case of streaming playback, it's recommned to avoid blocking wait.
+ * In the case of streaming playback, it's recommended to avoid blocking wait.
*/
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
LOGD("prepare working mode : %s", (async ? "async" : "sync"));
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- /* check pipline reconfigure state */
+ /* check pipeline reconfigure state */
__mmplayer_check_pipeline_reconfigure_state(player);
ret = _mmplayer_gst_set_position(player, position, FALSE);
}
int
-_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int position)
+_mmplayer_adjust_subtitle_position(MMHandleType hplayer, int position)
{
mmplayer_t *player = (mmplayer_t *)hplayer;
int ret = MM_ERROR_NONE;
{
GstPad *sinkpad = g_value_get_object (item);
GstElement *element = GST_ELEMENT(user_data);
+ if (!sinkpad || !element) {
+ LOGE("invalid parameter");
+ return;
+ }
+
LOGD("(%s)element release request pad(%s)", GST_ELEMENT_NAME(element), GST_PAD_NAME(sinkpad));
gst_element_release_request_pad(element, GST_PAD(sinkpad));
}
/* filtering exclude keyword */
for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++) {
if (strstr(factory_name, player->ini.exclude_element_keyword[idx])) {
- LOGW("skipping [%s] by exculde keyword [%s]",
+ LOGW("skipping [%s] by exclude keyword [%s]",
factory_name, player->ini.exclude_element_keyword[idx]);
result = GST_AUTOPLUG_SELECT_SKIP;
/* release signal */
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);
- /* release textbin with it's childs */
+ /* release textbin with it's children */
MMPLAYER_RELEASE_ELEMENT(player, player->pipeline->textbin, MMPLAYER_T_BIN);
MMPLAYER_FREEIF(player->pipeline->textbin);
player->pipeline->textbin = NULL;
current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
if (current_state < GST_STATE_PAUSED) {
result = MM_ERROR_PLAYER_INVALID_STATE;
- LOGW("Pipeline not in porper state");
+ LOGW("Pipeline not in proper state");
goto EXIT;
}
if (state != STORAGE_STATE_UNMOUNTABLE && state != STORAGE_STATE_REMOVED)
return MM_ERROR_NONE;
- /* FIXME: text path should be handled seperately. */
+ /* FIXME: text path should be handled separately. */
if (((player->storage_info[MMPLAYER_PATH_VOD].type == STORAGE_TYPE_EXTERNAL)
&& (player->storage_info[MMPLAYER_PATH_VOD].id == id)) ||
((player->storage_info[MMPLAYER_PATH_TEXT].type == STORAGE_TYPE_EXTERNAL)
}
if (!caps_v) {
- LOGD("no negitiated caps from videosink");
+ LOGD("no negotiated caps from videosink");
gst_object_unref(pad);
return FALSE;
}
gchar *path = NULL;
struct stat sb;
- /* FIXIT : please make it clear the dependancy with duration/codec/uritype */
+ /* FIXIT : please make it clear the dependency with duration/codec/uritype */
if (!player->duration)
return FALSE;
/* try to get content metadata */
/* NOTE : giving ATTR_MISSING_ONLY may have dependency with
- * c-api since c-api doesn't use _start() anymore. It may not work propery with
+ * c-api since c-api doesn't use _start() anymore. It may not work properly with
* legacy mmfw-player api
*/
_mmplayer_update_content_attrs(player, ATTR_MISSING_ONLY);