[0.6.121] removed dead code 23/185623/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 1 Aug 2018 07:14:17 +0000 (16:14 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 1 Aug 2018 07:14:17 +0000 (16:14 +0900)
Change-Id: I0e17cd93317233a1466bcbc238be1623797fb799

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_priv.h
src/mm_player_attrs.c
src/mm_player_priv.c

index cbfc9b6..635d1b3 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.120
+Version:    0.6.121
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 224e523..f5ef4c8 100644 (file)
@@ -357,19 +357,6 @@ typedef enum {
        MM_PLAYER_BUFFERING_MODE_MAX,
 } MMPlayerBufferingMode;
 
-typedef enum {
-       MM_PLAYER_FOCUS_CHANGED_COMPLETED = 0,
-       MM_PLAYER_FOCUS_CHANGED_BY_MEDIA,
-       MM_PLAYER_FOCUS_CHANGED_BY_CALL,
-       MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG,
-       MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT,
-       MM_PLAYER_FOCUS_CHANGED_BY_ALARM,
-       MM_PLAYER_FOCUS_CHANGED_BY_EMERGENCY,
-       MM_PLAYER_FOCUS_CHANGED_BY_NOTIFICATION,
-       MM_PLAYER_FOCUS_CHANGED_BY_UNKNOWN,
-} MMPlayerFocusChangedMsg;
-
-
 /**
  * Edge Properties of the text.
  */
index b62b312..23a1d7e 100644 (file)
@@ -939,7 +939,7 @@ int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
 int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
 int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state);
 int __mmplayer_gst_set_state(mm_player_t* player, GstElement * pipeline,  GstState state, gboolean async, gint timeout);
-int __mmplayer_set_state(mm_player_t* player, int state);
+void __mmplayer_set_state(mm_player_t* player, int state);
 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
 gboolean __mmplayer_dump_pipeline_state(mm_player_t* player);
 void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id);
index 656df1e..4a61de0 100644 (file)
@@ -657,24 +657,6 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        MMPLAYER_MAX_INT
                },
                {
-                       "pcm_extraction_start_msec",    // set start position to extract pcm
-                       MM_ATTRS_TYPE_INT,
-                       MM_ATTRS_FLAG_RW,
-                       (void *) 0,
-                       MM_ATTRS_VALID_TYPE_INT_RANGE,
-                       0,
-                       MMPLAYER_MAX_INT
-               },
-               {
-                       "pcm_extraction_end_msec",      // set end position to extract pcm
-                       MM_ATTRS_TYPE_INT,
-                       MM_ATTRS_FLAG_RW,
-                       (void *) 0,
-                       MM_ATTRS_VALID_TYPE_INT_RANGE,
-                       0,
-                       MMPLAYER_MAX_INT
-               },
-               {
                        "pd_mode",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
index 99d61c2..5102b47 100644 (file)
@@ -210,7 +210,6 @@ static int          __gst_set_message_callback(mm_player_t* player, MMMessageCallback ca
 
 static gboolean __gst_send_event_to_sink(mm_player_t* player, GstEvent* event);
 
-static int __mmplayer_set_pcm_extraction(mm_player_t* player);
 static gboolean __mmplayer_can_extract_pcm(mm_player_t* player);
 
 /* util */
@@ -560,18 +559,18 @@ static MMStreamingType __mmplayer_get_stream_service_type(mm_player_t* player)
 /* this function sets the player state and also report
  * it to applicaton by calling callback function
  */
-int
+void
 __mmplayer_set_state(mm_player_t* player, int state)
 {
        MMMessageParamType msg = {0, };
        gboolean post_bos = FALSE;
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+       MMPLAYER_RETURN_IF_FAIL(player);
 
        if (MMPLAYER_CURRENT_STATE(player) == state) {
                LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state));
                MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
-               return MM_ERROR_NONE;
+               return;
        }
 
        /* update player states */
@@ -680,15 +679,14 @@ __mmplayer_set_state(mm_player_t* player, int state)
 
                /* state changed by resource callback */
                if (player->interrupted_by_resource) {
-                       msg.state.code = MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT;
-                       MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
+                       MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, NULL);
                } else { /* state changed by usecase */
                        MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_CHANGED, &msg);
                }
        } else {
                LOGD("intermediate state, do nothing.\n");
                MMPLAYER_PRINT_STATE(player);
-               return MM_ERROR_NONE;
+               return;
        }
 
        if (post_bos) {
@@ -696,7 +694,7 @@ __mmplayer_set_state(mm_player_t* player, int state)
                player->sent_bos = TRUE;
        }
 
-       return MM_ERROR_NONE;
+       return;
 }
 
 static gpointer __mmplayer_next_play_thread(gpointer data)
@@ -7197,7 +7195,6 @@ static int __gst_pending_seek(mm_player_t* player)
 
 static int __gst_start(mm_player_t* player)
 {
-       gboolean sound_extraction = 0;
        int ret = MM_ERROR_NONE;
        gboolean async = FALSE;
 
@@ -7205,34 +7202,20 @@ static int __gst_start(mm_player_t* player)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       /* get sound_extraction property */
-       mm_attrs_get_int_by_name(player->attrs, "pcm_extraction", &sound_extraction);
-
        /* NOTE : if SetPosition was called before Start. do it now */
        /* streaming doesn't support it. so it should be always sync */
        /* !!create one more api to check if there is pending seek rather than checking variables */
-       if ((player->pending_seek.is_pending || sound_extraction) && !MMPLAYER_IS_STREAMING(player)) {
+       if (player->pending_seek.is_pending && !MMPLAYER_IS_STREAMING(player)) {
                MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
                ret = __gst_pause(player, FALSE);
                if (ret != MM_ERROR_NONE) {
-                       LOGE("failed to set state to PAUSED for pending seek\n");
+                       LOGE("failed to set state to PAUSED for pending seek");
                        return ret;
                }
 
                MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
-
-               if (sound_extraction) {
-                       LOGD("setting pcm extraction\n");
-
-                       ret = __mmplayer_set_pcm_extraction(player);
-                       if (MM_ERROR_NONE != ret) {
-                               LOGW("failed to set pcm extraction\n");
-                               return ret;
-                       }
-               } else {
-                       if (MM_ERROR_NONE != __gst_pending_seek(player))
-                               LOGW("failed to seek pending postion. starting from the begin of content.\n");
-               }
+               if (__gst_pending_seek(player) != MM_ERROR_NONE)
+                               LOGW("failed to seek pending postion. starting from the begin of content");
        }
 
        LOGD("current state before doing transition");
@@ -7240,9 +7223,6 @@ static int __gst_start(mm_player_t* player)
        MMPLAYER_PRINT_STATE(player);
 
        /* set pipeline state to PLAYING  */
-       if (player->es_player_push_mode)
-               async = TRUE;
-       /* set pipeline state to PLAYING  */
        ret = __mmplayer_gst_set_state(player,
                player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
 
@@ -7446,11 +7426,8 @@ int __gst_resume(mm_player_t* player, gboolean async)
        MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_PLAYING;
        MMPLAYER_PRINT_STATE(player);
 
-       /* generate dot file before returning error */
-       MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-resume");
-
        if (async)
-               LOGD("do async state transition to PLAYING.\n");
+               LOGD("do async state transition to PLAYING");
 
        /* set pipeline state to PLAYING */
        timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
@@ -7458,17 +7435,15 @@ int __gst_resume(mm_player_t* player, gboolean async)
        ret = __mmplayer_gst_set_state(player,
                player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, timeout);
        if (ret != MM_ERROR_NONE) {
-               LOGE("failed to set state to PLAYING\n");
-               return ret;
+               LOGE("failed to set state to PLAYING");
+               goto EXIT;
        } else {
-               if (async == FALSE) {
-                       // MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
-                       LOGD("update state machine to %d\n", MM_PLAYER_STATE_PLAYING);
-                       ret = __mmplayer_set_state(player, MM_PLAYER_STATE_PLAYING);
-               }
+               if (async == FALSE)
+                       MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
        }
 
-       /* generate dot file before returning error */
+EXIT:
+       /* generate dot file */
        MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-resume");
 
        MMPLAYER_FLEAVE();
@@ -9099,23 +9074,12 @@ _mmplayer_start(MMHandleType hplayer)
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        /* check current state */
        MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_START);
 
-       /* NOTE : we should check and create pipeline again if not created as we destroy
-        * whole pipeline when stopping in streamming playback
-        */
-       if (!player->pipeline) {
-               ret = __gst_realize(player);
-               if (MM_ERROR_NONE != ret) {
-                       LOGE("failed to realize before starting. only in streamming\n");
-                       /* unlock */
-                       return ret;
-               }
-       }
-
+       /* PD - start streaming */
        ret = __mmplayer_start_streaming_ext(player);
        if (ret != MM_ERROR_NONE) {
                LOGE("failed to start streaming ext 0x%X", ret);
@@ -9127,6 +9091,11 @@ _mmplayer_start(MMHandleType hplayer)
        if (ret != MM_ERROR_NONE)
                LOGE("failed to start player.\n");
 
+       if ((player->streamer) && (player->streamer->buffering_state & MM_PLAYER_BUFFERING_IN_PROGRESS)) {
+               LOGD("force playing start even during buffering");
+               player->streamer->buffering_state = MM_PLAYER_BUFFERING_ABORT;
+       }
+
        MMPLAYER_FLEAVE();
 
        return ret;
@@ -9393,72 +9362,6 @@ _mmplayer_resume(MMHandleType hplayer)
        return ret;
 }
 
-static int
-__mmplayer_set_pcm_extraction(mm_player_t* player)
-{
-       gint64 start_nsec = 0;
-       gint64 end_nsec = 0;
-       gint64 dur_nsec = 0;
-       gint64 dur_msec = 0;
-       int required_start = 0;
-       int required_end = 0;
-       int ret = 0;
-
-       MMPLAYER_FENTER();
-
-       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
-
-       mm_attrs_multiple_get(player->attrs,
-               NULL,
-               "pcm_extraction_start_msec", &required_start,
-               "pcm_extraction_end_msec", &required_end,
-               NULL);
-
-       LOGD("pcm extraction required position is from [%d] to [%d](msec)\n", required_start, required_end);
-
-       if (required_start == 0 && required_end == 0) {
-               LOGD("extracting entire stream");
-               return MM_ERROR_NONE;
-       } else if (required_start < 0 || required_start > required_end || required_end < 0) {
-               LOGD("invalid range for pcm extraction");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       /* get duration */
-       ret = gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec);
-       if (!ret) {
-               LOGE("failed to get duration");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-       dur_msec = GST_TIME_AS_MSECONDS(dur_nsec);
-
-       if (dur_msec < required_end) {
-               // FIXME
-               LOGD("invalid end pos for pcm extraction");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       start_nsec = required_start * G_GINT64_CONSTANT(1000000);
-       end_nsec = required_end * G_GINT64_CONSTANT(1000000);
-
-       if ((!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
-                                       1.0,
-                                       GST_FORMAT_TIME,
-                                       (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
-                                       GST_SEEK_TYPE_SET, start_nsec,
-                                       GST_SEEK_TYPE_SET, end_nsec))) {
-               LOGE("failed to seek for pcm extraction\n");
-
-               return MM_ERROR_PLAYER_SEEK;
-       }
-
-       LOGD("succeeded to set up segment extraction from [%llu] to [%llu](nsec)\n", start_nsec, end_nsec);
-
-       MMPLAYER_FLEAVE();
-
-       return MM_ERROR_NONE;
-}
-
 int
 _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
 {