Implement audio policy API 37/45237/1
authorHyongtaek Lim <hyongtaek.lim@samsung.com>
Tue, 4 Aug 2015 02:11:45 +0000 (11:11 +0900)
committerHyongtaek Lim <hyongtaek.lim@samsung.com>
Tue, 4 Aug 2015 02:12:53 +0000 (11:12 +0900)
Change setting sound type (ACR of sound-manager)
1. Define Deprecated enum value of player_interrupted_code_e (ACR of asm)
2. Add deprecated comment for deprecating player_set_sound_type API (ACR of asm)
3. Add player_set_audio_policy_info API (ACR of asm)

Signed-off-by: Hyongtaek Lim <hyongtaek.lim@samsung.com>
Change-Id: I403a55fc712f945fad6919deca2d1f3dd36daa75

CMakeLists.txt
client/src/player2.c
client/test/player_client_test.c
include/player2_private.h
src/player_msg_dispatcher.c

index 59af094..b166bf1 100644 (file)
@@ -28,7 +28,6 @@ ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
-ADD_DEFINITIONS("-DUSE_ASM")
 IF(WAYLAND_SUPPORT)
  ADD_DEFINITIONS("-DHAVE_WAYLAND")
 ENDIF(WAYLAND_SUPPORT)
index cebc9dc..4ec90b8 100644 (file)
@@ -99,7 +99,6 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code,
        return MEDIA_PACKET_FINALIZE;
 }
 
-#ifndef USE_ASM
 static int __player_convert_error_code(int code, char* func_name)
 {
        int ret = PLAYER_ERROR_INVALID_OPERATION;
@@ -236,7 +235,6 @@ static int __player_convert_error_code(int code, char* func_name)
        LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
        return ret;
 }
-#endif /* USE_ASM */
 
 static void * _get_mem(player_cli_s *player, int size)
 {
@@ -1367,7 +1365,6 @@ int player_set_sound_type(player_h player, sound_type_e type)
        return ret;
 }
 
-#ifndef USE_ASM
 int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_info)
 {
        PLAYER_INSTANCE_CHECK(player);
@@ -1410,7 +1407,6 @@ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_inf
        return ret;
 
 }
-#endif /* USE_ASM */
 
 int player_set_audio_latency_mode(player_h player,
                                  audio_latency_mode_e latency_mode)
index 6d18a66..c2e794a 100644 (file)
@@ -69,6 +69,7 @@ enum
        CURRENT_STATUS_FILENAME,
        CURRENT_STATUS_VOLUME,
        CURRENT_STATUS_SOUND_TYPE,
+       CURRENT_STATUS_SOUND_STREAM_INFO,
        CURRENT_STATUS_MUTE,
        CURRENT_STATUS_POSITION_TIME,
        CURRENT_STATUS_LOOPING,
@@ -119,6 +120,7 @@ int g_handle_num = 1;
 int g_menu_state = CURRENT_STATUS_MAINMENU;
 char g_file_list[9][256];
 gboolean quit_pushing;
+sound_stream_info_h g_stream_info_h = NULL;
 
 static void win_del(void *data, Evas_Object *obj, void *event)
 {
@@ -1183,6 +1185,12 @@ static void _player_destroy()
                }
        }
 
+       if (g_stream_info_h)
+       {
+               sound_manager_destroy_stream_information(g_stream_info_h);
+               g_stream_info_h = NULL;
+       }
+
        if (g_video_pkt)
                media_packet_destroy(g_video_pkt);
 
@@ -1337,6 +1345,32 @@ static void set_sound_type(sound_type_e type)
                g_print("set sound type(%d) success", type);
 }
 
+void focus_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+{
+       g_print("FOCUS callback is called, reason_for_change(%d), additional_info(%s), userdata(%p)", reason_for_change, additional_info, user_data);
+       return;
+}
+
+static void set_sound_stream_info(int type)
+{
+       if (g_stream_info_h)
+       {
+               g_print("stream information is already set, please destory handle and try again\n");
+               return;
+       }
+       if (sound_manager_create_stream_information( type, focus_callback, g_player[0], &g_stream_info_h))
+       {
+               g_print("failed to create stream_information()\n");
+               return;
+       }
+       if ( player_set_audio_policy_info(g_player[0], g_stream_info_h) != PLAYER_ERROR_NONE )
+       {
+               g_print("failed to set sound stream information(%p)\n", g_stream_info_h);
+       }
+       else
+               g_print("set stream information(%p) success", g_stream_info_h);
+}
+
 static void get_position()
 {
        int position = 0;
@@ -1942,6 +1976,10 @@ void _interpret_main_menu(char *cmd)
                {
                        g_menu_state = CURRENT_STATUS_SOUND_TYPE;
                }
+               else if (strncmp(cmd, "k", 1) == 0)
+               {
+                       g_menu_state = CURRENT_STATUS_SOUND_STREAM_INFO;
+               }
                else if (strncmp(cmd, "h", 1) == 0 )
                {
                        g_menu_state = CURRENT_STATUS_MUTE;
@@ -2196,6 +2234,10 @@ static void displaymenu()
        {
                g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:FIXED)\n");
        }
+       else if (g_menu_state == CURRENT_STATUS_SOUND_STREAM_INFO)
+       {
+               g_print("*** input sound stream type.(0:MEDIA 1:SYSTEM 2:ALARM 3:NOTIFICATION 4:RINGTONE 5:CALL 6:VOIP)\n");
+       }
        else if (g_menu_state == CURRENT_STATUS_MUTE)
        {
                g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
@@ -2333,6 +2375,13 @@ static void interpret (char *cmd)
                        reset_menu_state();
                }
                break;
+               case CURRENT_STATUS_SOUND_STREAM_INFO:
+               {
+                       int type = atoi(cmd);
+                       set_sound_stream_info(type);
+                       reset_menu_state();
+               }
+               break;
                case CURRENT_STATUS_MUTE:
                {
                        int mute = atoi(cmd);
index 89cc498..a622b50 100644 (file)
@@ -65,9 +65,7 @@ extern "C" {
                MM_PLAYER_API_SET_VOLUME,
                MM_PLAYER_API_GET_VOLUME,
                MM_PLAYER_API_SET_SOUND_TYPE,
-#ifndef USE_ASM
                MM_PLAYER_API_SET_AUDIO_POLICY_INFO,
-#endif
                MM_PLAYER_API_SET_AUDIO_LATENCY_MODE,
                MM_PLAYER_API_GET_AUDIO_LATENCY_MODE,
                MM_PLAYER_API_SET_PLAY_POSITION,
index a551954..d5b619d 100644 (file)
@@ -75,10 +75,8 @@ extern int player_set_display_wl_for_mused(player_h player, player_display_type_
 #else
 extern int player_set_display_for_mused(player_h player, player_display_type_e type, unsigned int xhandle);
 #endif
-#ifndef USE_ASM
 extern int player_set_audio_policy_info_for_mused(player_h player,
        char *stream_type, int stream_index);
-#endif
 
 int player_set_shm_stream_path_for_mused (player_h player, const char *stream_path);
 int player_get_raw_video_caps(player_h player, char **caps);
@@ -1016,7 +1014,6 @@ static int player_disp_set_sound_type(Client client)
        return ret;
 }
 
-#ifndef USE_ASM
 static int player_disp_set_audio_policy_info(Client client)
 {
        int ret = -1;
@@ -1036,7 +1033,6 @@ static int player_disp_set_audio_policy_info(Client client)
 
        return ret;
 }
-#endif /* USE_ASM */
 
 static int player_disp_set_latency_mode(Client client)
 {