[0.3.66] add handling about the evas of audio_only APIs 00/142100/1 accepted/tizen/unified/20170807.150708 submit/tizen/20170804.073803
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 2 Aug 2017 12:02:57 +0000 (21:02 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 2 Aug 2017 12:02:57 +0000 (21:02 +0900)
Change-Id: I431a3c762bc003e2b41add7a3fdaaf747f2dc426

include/player_private.h
packaging/capi-media-player.spec
src/player.c

index e724d38..53449a8 100644 (file)
@@ -170,6 +170,7 @@ typedef struct _player_cli_s {
        gboolean have_evas_callback;
        gboolean push_media_stream;
        gboolean support_video;
+       gboolean is_audio_only;
 } player_cli_s;
 
 /* player callback information */
index 34132a2..59de37f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.65
+Version:    0.3.66
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 7a4bd36..bb6ad47 100644 (file)
@@ -1799,6 +1799,7 @@ int player_create(player_h * player)
                pc->push_media_stream = FALSE;
                pc->support_video = FALSE;
                EVAS_INFO(pc)->support_video = FALSE;
+               pc->is_audio_only = FALSE;
 
                PLAYER_VIDEO_SUPPORT_CHECK(pc); /* update supported_video */
 
@@ -1947,6 +1948,7 @@ int player_unprepare(player_h player)
 
        pc->cb_info->video_frame_pool_size = 0;
        __player_remove_tsurf_list(pc);
+       pc->is_audio_only = FALSE;
 
        g_free(ret_buf);
 
@@ -4339,9 +4341,34 @@ int player_set_audio_only(player_h player, bool audio_only)
        player_cli_s *pc = (player_cli_s *) player;
        muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_ONLY;
        char *ret_buf = NULL;
+       player_state_e state = PLAYER_STATE_NONE;
 
        LOGD("ENTER audio_only: %d", audio_only);
 
+       player_msg_send(MUSE_PLAYER_API_GET_STATE, pc, ret_buf, ret);
+
+       /* check player state */
+       if (ret == PLAYER_ERROR_NONE) {
+               player_msg_get(state, ret_buf);
+               g_free(ret_buf);
+               ret_buf = NULL;
+
+               if (state < PLAYER_STATE_READY) {
+                       LOGE("Invalid state %d", state);
+                       return PLAYER_ERROR_INVALID_STATE;
+               }
+       } else {
+               g_free(ret_buf);
+               ret_buf = NULL;
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       if (EVAS_HANDLE(pc)) {
+               pc->is_audio_only = (gboolean)audio_only;
+               return PLAYER_ERROR_NONE;
+       }
+#endif
        player_msg_send1(api, pc, ret_buf, ret, INT, audio_only);
        g_free(ret_buf);
 
@@ -4361,6 +4388,12 @@ int player_is_audio_only(player_h player, bool *paudio_only)
        int audio_only = 0;
 
        LOGD("ENTER");
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       if (EVAS_HANDLE(pc)) {
+               *paudio_only = (bool)pc->is_audio_only;
+               return PLAYER_ERROR_NONE;
+       }
+#endif
 
        player_msg_send(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {