[Line coverage] 1. fix precondition of unprepare 2. remove dead code to check state... 19/43419/2 accepted/tizen/mobile/20150710.003536 accepted/tizen/tv/20150710.003545 accepted/tizen/wearable/20150710.003552 submit/tizen/20150709.060520
authorHyunil Park <hyunil46.park@samsung.com>
Thu, 9 Jul 2015 03:56:10 +0000 (12:56 +0900)
committerHeechul Jeon <heechul.jeon@samsung.com>
Thu, 9 Jul 2015 05:59:34 +0000 (22:59 -0700)
Change-Id: I307773129c675aa098550b757b9b870d774f665b
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
include/mobile/player.h
include/wearable/player.h
packaging/capi-media-player.spec
src/player.c

index 86d8750..0cd195e 100755 (executable)
@@ -884,6 +884,7 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player);
 /**
  * @brief  Pushes elementary stream to decode audio or video
  * @since_tizen 2.4
+ * @remarks player_set_media_stream_info() should be called before using this API.
  * @param[in]  player   The handle to media player
  * @param[in]  packet   The media packet to decode
  * @return @c 0 on success,
@@ -1860,6 +1861,7 @@ int player_unset_video_stream_changed_cb (player_h player);
  * @brief Gets current track index.
  * @since_tizen 2.4
  * @details Index starts from 0.
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[out] index  The index of track
@@ -1878,6 +1880,7 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *in
  * @brief Gets language code of a track.
  * @since_tizen 2.4
  * @remarks @a code must be released with @c free() by caller
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[in] index  The index of track
@@ -1896,6 +1899,7 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i
 /**
  * @brief Gets the track count.
  * @since_tizen 2.4
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[out] count The number of track
@@ -1913,6 +1917,7 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *coun
 /**
  * @brief Selects a track to play.
  * @since_tizen 2.4
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[in] index  The index of track
index f25ad14..67b1db9 100755 (executable)
@@ -883,6 +883,7 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player);
 /**
  * @brief  Pushes elementary stream to decode audio or video
  * @since_tizen 2.4
+ * @remarks player_set_media_stream_info() should be called before using this API.
  * @param[in]  player   The handle to media player
  * @param[in]  packet   The media packet to decode
  * @return @c 0 on success,
@@ -1859,6 +1860,7 @@ int player_unset_video_stream_changed_cb (player_h player);
  * @brief Gets current track index.
  * @since_tizen 2.4
  * @details Index starts from 0.
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[out] index  The index of track
@@ -1877,6 +1879,7 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *in
  * @brief Gets language code of a track.
  * @since_tizen 2.4
  * @remarks @a code must be released with @c free() by caller
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[in] index  The index of track
@@ -1895,6 +1898,7 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i
 /**
  * @brief Gets the track count.
  * @since_tizen 2.4
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[out] count The number of track
@@ -1912,6 +1916,7 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *coun
 /**
  * @brief Selects a track to play.
  * @since_tizen 2.4
+ * @remarks PLAYER_STREAM_TYPE_VIDEO is not supported.
  * @param[in] player The handle to the media player
  * @param[in] type The type of target stream
  * @param[in] index  The index of track
index a0a2260..ff38704 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       capi-media-player
 Summary:    A Media Player library in Tizen Native API
-Version:    0.2.4
+Version:    0.2.5
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 0b36518..240b69f 100644 (file)
@@ -1351,7 +1351,7 @@ int player_unprepare (player_h player)
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
 
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
+       if (!__player_state_validate(handle, PLAYER_STATE_READY))
        {
                LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
                return PLAYER_ERROR_INVALID_STATE;
@@ -1754,11 +1754,6 @@ int      player_set_looping (player_h player, bool looping)
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int value = 0;
        if(looping==TRUE)
@@ -1782,12 +1777,8 @@ int player_is_looping (player_h player, bool *looping)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(looping);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
        int count;
+
        int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_PLAYBACK_COUNT , &count, (char*)NULL);
        if(ret != MM_ERROR_NONE)
        {
@@ -1847,11 +1838,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        int wl_window_height = 0;
 #endif
        int ret;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        if (type != PLAYER_DISPLAY_TYPE_NONE && display == NULL)
        {
@@ -2356,11 +2342,6 @@ int player_audio_effect_get_equalizer_bands_count (player_h player, int *count)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(count);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count);
        if(ret != MM_ERROR_NONE)
@@ -2374,11 +2355,6 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(band_levels);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length);
        if(ret != MM_ERROR_NONE)
@@ -2396,11 +2372,6 @@ int player_audio_effect_set_equalizer_band_level(player_h player, int index, int
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_set_level(handle->mm_handle,MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
        if(ret != MM_ERROR_NONE)
@@ -2419,11 +2390,6 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(level);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_get_level(handle->mm_handle,MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
        if(ret != MM_ERROR_NONE)
@@ -2438,11 +2404,6 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int
        PLAYER_NULL_ARG_CHECK(min);
        PLAYER_NULL_ARG_CHECK(max);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max);
        if(ret != MM_ERROR_NONE)
@@ -2456,11 +2417,6 @@ int player_audio_effect_get_equalizer_band_frequency(player_h player, int index,
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(frequency);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency);
        if(ret != MM_ERROR_NONE)
@@ -2474,11 +2430,6 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(range);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range);
        if(ret != MM_ERROR_NONE)
@@ -2491,11 +2442,6 @@ int player_audio_effect_equalizer_clear(player_h player)
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle);
        if(ret != MM_ERROR_NONE)
@@ -2514,11 +2460,6 @@ int player_audio_effect_equalizer_is_available(player_h player, bool *available)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(available);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) :  current state - %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
        int ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ);
        if(ret != MM_ERROR_NONE)
@@ -3095,15 +3036,9 @@ int player_push_media_stream(player_h player, media_packet_h packet)
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       /**/
-       PLAYER_CHECK_CONDITION(handle->error_code == PLAYER_ERROR_NONE, PLAYER_ERROR_NOT_SUPPORTED_FILE, "can't support this format");
-       if (handle->state < PLAYER_STATE_IDLE || handle->state > PLAYER_STATE_PAUSED)
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,
-                       __FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
 
+       PLAYER_CHECK_CONDITION(handle->error_code == PLAYER_ERROR_NONE,
+               PLAYER_ERROR_NOT_SUPPORTED_FILE, "can't support this format");
 
        int ret = mm_player_submit_packet(handle->mm_handle, packet);
 
@@ -3167,11 +3102,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(max_size);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
+
        unsigned long long _max_size;
        int ret = mm_player_get_media_stream_buffer_max_size(handle->mm_handle, type, &_max_size);
        if(ret != MM_ERROR_NONE)
@@ -3209,11 +3140,7 @@ int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(percent);
        player_s * handle = (player_s *) player;
-       if (!__player_state_validate(handle, PLAYER_STATE_IDLE))
-       {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
-               return PLAYER_ERROR_INVALID_STATE;
-       }
+
        unsigned int _value;
        int ret = mm_player_get_media_stream_buffer_min_percent(handle->mm_handle, type, &_value);
        if(ret != MM_ERROR_NONE)
@@ -3266,9 +3193,6 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *coun
                case PLAYER_STREAM_TYPE_AUDIO:
                        track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
                        break;
-               case PLAYER_STREAM_TYPE_VIDEO:
-                       track_type = MM_PLAYER_TRACK_TYPE_VIDEO;
-                       break;
                case PLAYER_STREAM_TYPE_TEXT:
                        track_type = MM_PLAYER_TRACK_TYPE_TEXT;
                        break;
@@ -3303,9 +3227,6 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *in
                case PLAYER_STREAM_TYPE_AUDIO:
                        track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
                        break;
-               case PLAYER_STREAM_TYPE_VIDEO:
-                       track_type = MM_PLAYER_TRACK_TYPE_VIDEO;
-                       break;
                case PLAYER_STREAM_TYPE_TEXT:
                        track_type = MM_PLAYER_TRACK_TYPE_TEXT;
                        break;
@@ -3340,9 +3261,6 @@ int player_select_track(player_h player, player_stream_type_e type, int index)
                case PLAYER_STREAM_TYPE_AUDIO:
                        track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
                        break;
-               case PLAYER_STREAM_TYPE_VIDEO:
-                       track_type = MM_PLAYER_TRACK_TYPE_VIDEO;
-                       break;
                case PLAYER_STREAM_TYPE_TEXT:
                        track_type = MM_PLAYER_TRACK_TYPE_TEXT;
                        break;