[0.3.112] add test path for audio offload 14/201314/2 accepted/tizen/unified/20190313.151529 submit/tizen/20190313.054921
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 12 Mar 2019 09:23:00 +0000 (18:23 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Tue, 12 Mar 2019 11:02:06 +0000 (20:02 +0900)
Change-Id: Ie36998921c959001c55abcd9c4682fc1af776b0c

packaging/capi-media-player.spec
src/player_internal.c
test/player_test.c

index 766a464..3485bbd 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.111
+Version:    0.3.112
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 60b9322..5f2ef00 100644 (file)
@@ -435,3 +435,41 @@ int player_get_codec_type(player_h player, player_stream_type_e stream_type, pla
        LOGD("LEAVE");
        return ret;
 }
+
+int player_set_audio_offload_enabled(player_h player, bool enabled)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_OFFLOAD_ENABLED;
+       player_cli_s *pc = (player_cli_s *)player;
+       char *ret_buf = NULL;
+       int val = (int)enabled;
+
+       LOGD("ENTER");
+
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
+       g_free(ret_buf);
+       return ret;
+}
+
+int player_is_audio_offload_enabled(player_h player, bool *enabled)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(enabled);
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_IS_AUDIO_OFFLOAD_ENABLED;
+       player_cli_s *pc = (player_cli_s *)player;
+       char *ret_buf = NULL;
+       int val = -1;
+
+       LOGD("ENTER");
+
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+       if (ret == PLAYER_ERROR_NONE) {
+               player_msg_get(val, ret_buf);
+               *enabled = (bool)val;
+       }
+
+       g_free(ret_buf);
+       return ret;
+}
index bd6f2f7..5154081 100644 (file)
@@ -60,6 +60,9 @@ typedef enum {
        TIZEN_PROFILE_COMMON = 0x10,
 } tizen_profile_t;
 
+extern int player_set_audio_offload_enabled(player_h player, bool enabled);
+extern int player_is_audio_offload_enabled(player_h player, bool *enabled);
+
 #ifdef USE_EVENT_HANDLER
 static void event_handler_cb(enum libinput_event_type ev_t, int x, int y, void *data, float e[3]);
 static void event_handler_set_dov_fov();
@@ -168,6 +171,7 @@ enum {
        CURRENT_STATUS_AUDIO_CODEC_TYPE,
        CURRENT_STATUS_VIDEO_CODEC_TYPE,
        CURRENT_STATUS_REPLAYGAIN_ENABLE,
+       CURRENT_STATUS_AUDIO_OFFLOAD,
 };
 
 #define MAX_HANDLE 20
@@ -2044,6 +2048,17 @@ static void is_replaygain_enabled(bool *enable)
        g_print("                                                            ==> [Player_Test] replaygain = %d\n", *enable);
 }
 
+static void set_audio_offload_enabled(bool enabled)
+{
+       bool is_enabled = false;
+
+       player_is_audio_offload_enabled(g_player[0], &is_enabled);
+       g_print("[Player_Test] offload setting %d -> %d\n", is_enabled, enabled);
+
+       if (player_set_audio_offload_enabled(g_player[0], enabled) != PLAYER_ERROR_NONE)
+               g_print("failed to set audio offload\n");
+}
+
 #ifdef USE_EVENT_HANDLER
 static void event_handler_cb(enum libinput_event_type ev_t, int x, int y, void *data, float e[3])
 {
@@ -2263,6 +2278,8 @@ void _interpret_main_menu(char *cmd)
                        g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM;
                } else if (strncmp(cmd, "lb", 2) == 0) {
                        get_buffering_position();
+               } else if (strncmp(cmd, "ol", 2) == 0) {
+                       g_menu_state = CURRENT_STATUS_AUDIO_OFFLOAD;
                } else {
                        g_print("unknown menu \n");
                }
@@ -2348,6 +2365,7 @@ void display_sub_basic()
        g_print("szz. Set Zoom with FOV\n");
        g_print("[Replaygain] rgs. Set Replaygain\t\t");
        g_print("rgg. Get replaygain\n");
+       g_print("[Offload] ol. Set audio offload\n");
        g_print("[etc] sp. Set Progressive Download\t");
        g_print("gp. Get Progressive Download status\t");
        g_print("mp. memory playback\n");
@@ -2439,6 +2457,8 @@ static void displaymenu()
                g_print("*** set video codec type (1: HW, 2: SW) \n");
        } else if (g_menu_state == CURRENT_STATUS_REPLAYGAIN_ENABLE) {
                g_print("*** input replaygain value.(0:disable, 1: enable) \n");
+       } else if (g_menu_state == CURRENT_STATUS_AUDIO_OFFLOAD) {
+               g_print("*** input audio offload value.(0:disable, 1: enable) \n");
        } else {
                g_print("*** unknown status.\n");
                quit_program();
@@ -2784,6 +2804,13 @@ static void interpret(char *cmd)
                        reset_menu_state();
                }
                break;
+       case CURRENT_STATUS_AUDIO_OFFLOAD:
+               {
+                       value1 = atoi(cmd);
+                       set_audio_offload_enabled(value1);
+                       reset_menu_state();
+               }
+               break;
        }
 
        g_timeout_add(100, timeout_menu_display, 0);