static void __mmplayer_zerocopy_set_stride_elevation_bo(MMPlayerVideoStreamDataType *stream, GstMemory *mem);
static gboolean __mmplayer_swcodec_set_stride_elevation(MMPlayerVideoStreamDataType *stream);
static gboolean __mmplayer_swcodec_set_bo(mm_player_t *player, MMPlayerVideoStreamDataType *stream, GstMemory *mem);
+
+static void __mmplayer_set_pause_state(mm_player_t *player);
+static void __mmplayer_set_playing_state(mm_player_t *player);
/*===========================================================================================
| |
| FUNCTION DEFINITIONS |
* it to applicaton by calling callback function
*/
void
-__mmplayer_set_state(mm_player_t* player, int state)
+__mmplayer_set_state(mm_player_t *player, int state)
{
MMMessageParamType msg = {0, };
- gboolean post_bos = FALSE;
MMPLAYER_RETURN_IF_FAIL(player);
case MM_PLAYER_STATE_NULL:
case MM_PLAYER_STATE_READY:
break;
-
case MM_PLAYER_STATE_PAUSED:
- {
- if (!player->sent_bos) {
- /* rtsp case, get content attrs by GstMessage */
- if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
- /* it's first time to update all content attrs. */
- __mmplayer_update_content_attrs(player, ATTR_ALL);
- }
- }
- }
+ __mmplayer_set_pause_state(player);
break;
-
case MM_PLAYER_STATE_PLAYING:
- {
- /* try to get content metadata */
- if (!player->sent_bos) {
- /* 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
- * legacy mmfw-player api */
- __mmplayer_update_content_attrs(player, ATTR_MISSING_ONLY);
- }
-
- if ((player->cmd == MMPLAYER_COMMAND_START) || (player->cmd == MMPLAYER_COMMAND_RESUME)) {
- if (!player->sent_bos)
- __mmplayer_handle_missed_plugin(player);
- }
-
- if (player->resumed_by_rewind && player->playback_rate < 0.0) {
- /* initialize because auto resume is done well. */
- player->resumed_by_rewind = FALSE;
- player->playback_rate = 1.0;
- }
-
- if (!player->sent_bos) {
- /* check audio codec field is set or not
- * we can get it from typefinder or codec's caps.
- */
- gchar *audio_codec = NULL;
- mm_attrs_get_string_by_name(player->attrs, "content_audio_codec", &audio_codec);
-
- /* The codec format can't be sent for audio only case like amr, mid etc.
- * Because, parser don't make related TAG.
- * So, if it's not set yet, fill it with found data.
- */
- if (!audio_codec) {
- if (g_strrstr(player->type, "audio/midi"))
- audio_codec = g_strdup("MIDI");
- else if (g_strrstr(player->type, "audio/x-amr"))
- audio_codec = g_strdup("AMR");
- else if (g_strrstr(player->type, "audio/mpeg") && !g_strrstr(player->type, "mpegversion= (int)1"))
- audio_codec = g_strdup("AAC");
- else
- audio_codec = g_strdup("unknown");
- mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", audio_codec);
-
- MMPLAYER_FREEIF(audio_codec);
- if (mm_attrs_commit_all(player->attrs))
- LOGE("failed to update attributes\n");
-
- LOGD("set audio codec type with caps\n");
- }
-
- post_bos = TRUE;
- }
- }
+ __mmplayer_set_playing_state(player);
break;
-
case MM_PLAYER_STATE_NONE:
default:
LOGW("invalid target state, there is nothing to do.\n");
return;
}
- if (post_bos) {
+ if (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PLAYING
+ && !player->sent_bos) {
MMPLAYER_POST_MSG(player, MM_MESSAGE_BEGIN_OF_STREAM, NULL);
player->sent_bos = TRUE;
}
return FALSE;
}
+
+static void
+__mmplayer_set_pause_state(mm_player_t *player)
+{
+ if (player->sent_bos)
+ return;
+
+ /* rtsp case, get content attrs by GstMessage */
+ if (MMPLAYER_IS_RTSP_STREAMING(player))
+ return;
+
+ /* it's first time to update all content attrs. */
+ __mmplayer_update_content_attrs(player, ATTR_ALL);
+}
+
+static void
+__mmplayer_set_playing_state(mm_player_t *player)
+{
+ gchar *audio_codec = NULL;
+
+ if (player->resumed_by_rewind && player->playback_rate < 0.0) {
+ /* initialize because auto resume is done well. */
+ player->resumed_by_rewind = FALSE;
+ player->playback_rate = 1.0;
+ }
+
+ if (player->sent_bos)
+ return;
+
+ /* 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
+ * legacy mmfw-player api
+ */
+ __mmplayer_update_content_attrs(player, ATTR_MISSING_ONLY);
+
+ if ((player->cmd == MMPLAYER_COMMAND_START)
+ || (player->cmd == MMPLAYER_COMMAND_RESUME)) {
+ __mmplayer_handle_missed_plugin(player);
+ }
+
+ /* check audio codec field is set or not
+ * we can get it from typefinder or codec's caps.
+ */
+ mm_attrs_get_string_by_name(player->attrs, "content_audio_codec", &audio_codec);
+
+ /* The codec format can't be sent for audio only case like amr, mid etc.
+ * Because, parser don't make related TAG.
+ * So, if it's not set yet, fill it with found data.
+ */
+ if (!audio_codec) {
+ if (g_strrstr(player->type, "audio/midi"))
+ audio_codec = "MIDI";
+ else if (g_strrstr(player->type, "audio/x-amr"))
+ audio_codec = "AMR";
+ else if (g_strrstr(player->type, "audio/mpeg")
+ && !g_strrstr(player->type, "mpegversion= (int)1"))
+ audio_codec = "AAC";
+ else
+ audio_codec = "unknown";
+
+ mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", audio_codec);
+
+ if (mm_attrs_commit_all(player->attrs))
+ LOGE("failed to update attributes\n");
+
+ LOGD("set audio codec type with caps\n");
+ }
+
+ return;
+}
\ No newline at end of file