Fix for coding rules 30/54330/1 accepted/tizen/mobile/20151216.052433 accepted/tizen/tv/20151216.052544 accepted/tizen/wearable/20151216.052601 submit/tizen/20151216.011711
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 15 Dec 2015 02:31:19 +0000 (11:31 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 15 Dec 2015 02:31:19 +0000 (11:31 +0900)
Change-Id: I74d3ba3b507126116bb38941bef5948bb14e75aa

src/device-manager.c
src/module-policy.c
src/module-sound-player.c
src/module-tizenaudio-sink.c
src/module-tizenaudio-source.c
src/stream-manager-priv.h
src/stream-manager-volume.c
src/stream-manager.c
src/stream-manager.h

index 6f44f033dcc1c7c6c378180bb153d2af09e42d71..9a0ea06fb37692ef6ff68d58c25e8857c2952a10 100644 (file)
@@ -199,7 +199,7 @@ static const char* const valid_alsa_device_modargs[] = {
 
 /* A macro to ease iteration through all entries */
 #define PA_HASHMAP_FOREACH_KEY(e, h, state, key) \
-    for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state),(const void**)&(key)); (e); (e) = pa_hashmap_iterate((h), &(state), (const void**)&(key)))
+    for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), (const void**)&(key)); (e); (e) = pa_hashmap_iterate((h), &(state), (const void**)&(key)))
 
 #define PA_DEVICE(pulse_device, pdt) \
     pdt == PA_DEVICE_TYPE_SINK ? ((pa_sink *) pulse_device) : ((pa_source *) pulse_device)
@@ -655,7 +655,7 @@ static pa_bool_t pulse_device_is_alsa(pa_proplist *prop) {
     }
 
     if ((api_name = pa_proplist_gets(prop, PA_PROP_DEVICE_API))) {
-        if (pa_streq (api_name, DEVICE_API_ALSA)) {
+        if (pa_streq(api_name, DEVICE_API_ALSA)) {
             return TRUE;
         } else {
             return FALSE;
@@ -674,7 +674,7 @@ static pa_bool_t pulse_device_is_bluez(pa_proplist *prop) {
     }
 
     if ((api_name = pa_proplist_gets(prop, PA_PROP_DEVICE_API))) {
-        if (pa_streq (api_name, DEVICE_API_BLUEZ)) {
+        if (pa_streq(api_name, DEVICE_API_BLUEZ)) {
             return TRUE;
         } else {
             return FALSE;
@@ -703,7 +703,7 @@ static pa_bool_t pulse_device_is_usb(pa_proplist *prop) {
     const char *bus_name = NULL;
 
     if ((bus_name = pa_proplist_gets(prop, PA_PROP_DEVICE_BUS))) {
-        if (pa_streq (bus_name, DEVICE_BUS_USB)) {
+        if (pa_streq(bus_name, DEVICE_BUS_USB)) {
             return TRUE;
         } else {
             return FALSE;
@@ -950,7 +950,7 @@ static void dump_playback_device_list(pa_hashmap *playback_devices) {
 }
 
 static void dump_capture_device_list(pa_hashmap *capture_devices) {
-    pa_source *source= NULL;
+    pa_source *source = NULL;
     void *state = NULL;
     const char *role;
 
@@ -1019,7 +1019,7 @@ static pa_bool_t pulse_device_class_is_sound(pa_proplist *prop) {
     const char *device_class = NULL;
 
     if ((device_class = pa_proplist_gets(prop, PA_PROP_DEVICE_CLASS))) {
-        if (device_class && pa_streq (device_class, DEVICE_CLASS_SOUND)) {
+        if (device_class && pa_streq(device_class, DEVICE_CLASS_SOUND)) {
             return TRUE;
         } else {
             return FALSE;
@@ -1037,7 +1037,7 @@ static pa_bool_t pulse_device_class_is_monitor(pa_proplist *prop) {
     }
 
     if ((device_class = pa_proplist_gets(prop, PA_PROP_DEVICE_CLASS))) {
-        if (device_class && pa_streq (device_class, DEVICE_CLASS_MONITOR)) {
+        if (device_class && pa_streq(device_class, DEVICE_CLASS_MONITOR)) {
             return TRUE;
         } else {
             return FALSE;
@@ -1305,7 +1305,7 @@ static dm_device* _device_item_set_active_profile(dm_device *device_item, const
     dm_device_profile *profile_item = NULL;
     uint32_t idx, active_profile_idx = PA_INVALID_INDEX, prev_active_profile = PA_INVALID_INDEX;
 
-    if (!device_item || !device_item->profiles ) {
+    if (!device_item || !device_item->profiles) {
         pa_log_error("Invalid Parameter");
         return NULL;
     }
@@ -1363,7 +1363,7 @@ static dm_device* _device_item_set_active_profile_auto(dm_device *device_item) {
     uint32_t idx, prev_active_profile;
     unsigned int device_size;
 
-    if (!device_item || !device_item->profiles ) {
+    if (!device_item || !device_item->profiles) {
         pa_log_error("Invalid Parameter");
         return NULL;
     }
@@ -1630,12 +1630,12 @@ static dm_device_profile* _device_profile_add_pulse_device(dm_device_profile *pr
     if (pdt == PA_DEVICE_TYPE_SINK) {
         if (!(profile_item->playback_devices))
             profile_item->playback_devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-        if(pa_hashmap_put(profile_item->playback_devices, (void *)role, pulse_device) < 0)
+        if (pa_hashmap_put(profile_item->playback_devices, (void *)role, pulse_device) < 0)
             return NULL;
     } else {
         if (!(profile_item->capture_devices))
             profile_item->capture_devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-        if(pa_hashmap_put(profile_item->capture_devices, (void *)role, pulse_device) < 0)
+        if (pa_hashmap_put(profile_item->capture_devices, (void *)role, pulse_device) < 0)
             return NULL;
     }
 
@@ -1650,7 +1650,7 @@ static dm_device_profile* _device_profile_add_sink(dm_device_profile *profile_it
 
     if (!(profile_item->playback_devices))
         profile_item->playback_devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    if(pa_hashmap_put(profile_item->playback_devices, (void *)role, sink) < 0)
+    if (pa_hashmap_put(profile_item->playback_devices, (void *)role, sink) < 0)
         return NULL;
 
     return profile_item;
@@ -1673,7 +1673,7 @@ static dm_device_profile* _device_profile_add_source(dm_device_profile *profile_
 
     if (!(profile_item->capture_devices))
         profile_item->capture_devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    if(pa_hashmap_put(profile_item->capture_devices, (void *)role, source) < 0)
+    if (pa_hashmap_put(profile_item->capture_devices, (void *)role, source) < 0)
         return NULL;
 
     return profile_item;
@@ -1885,7 +1885,7 @@ static pa_source* _device_manager_set_default_source(pa_device_manager *dm,  con
         return NULL;
     }
 
-    if (!(source= pa_hashmap_get(profile_item->capture_devices, role))) {
+    if (!(source = pa_hashmap_get(profile_item->capture_devices, role))) {
         pa_log_warn("cannot get source for %s", role);
         return NULL;
     }
@@ -1904,7 +1904,7 @@ static dm_device_profile* handle_not_predefined_device_profile(void *pulse_devic
     else
         direc = DM_DEVICE_DIRECTION_IN;
 
-    if(!(profile_item = create_device_profile(device_profile, direc, NULL, NULL))) {
+    if (!(profile_item = create_device_profile(device_profile, direc, NULL, NULL))) {
         pa_log_error("create_device_profile failed");
         goto failed;
     }
@@ -1921,7 +1921,7 @@ static dm_device_profile* handle_not_predefined_device_profile(void *pulse_devic
     }
 
     return profile_item;
-failed :
+failed:
     if (profile_item)
         pa_xfree(profile_item);
     return NULL;
@@ -1988,14 +1988,14 @@ static dm_device* handle_not_predefined_device(pa_device_manager *dm, void *puls
         }
     }
 
-    if(!(profile_item = handle_not_predefined_device_profile(pulse_device, pdt, device_profile))) {
+    if (!(profile_item = handle_not_predefined_device_profile(pulse_device, pdt, device_profile))) {
         pa_log_error("failed to handle unknown device profile");
         goto failed;
     }
     _device_profile_update_direction(profile_item);
 
     if (device_class == DM_DEVICE_CLASS_BT) {
-        if((device_item = _device_manager_get_device(dm->device_list, DEVICE_TYPE_BT))) {
+        if ((device_item = _device_manager_get_device(dm->device_list, DEVICE_TYPE_BT))) {
             pa_log_debug("found bt device");
             _device_item_add_profile(device_item, profile_item, NULL, dm);
             goto end;
@@ -2221,7 +2221,7 @@ static dm_device* handle_device_type_available(struct device_type_info *type_inf
 
     return device_item;
 
-failed :
+failed:
     if (playback)
         pa_hashmap_free(playback);
     if (capture)
@@ -2276,8 +2276,8 @@ static void handle_predefined_device_loaded(void *pulse_device, pa_device_type_t
                Check device_item is already exists.
                If already exists, add loaded sink or source to that.
             */
-            if((device_item = _device_manager_get_device(dm->device_list, type_info->type))) {
-                if((profile_item = _device_item_get_profile(device_item, type_info->profile))) {
+            if ((device_item = _device_manager_get_device(dm->device_list, type_info->type))) {
+                if ((profile_item = _device_item_get_profile(device_item, type_info->profile))) {
                     pa_log_debug("device_item for %s.%s already exists", type_info->type, type_info->profile);
                     if (!_device_profile_add_pulse_device(profile_item,  role,  pulse_device,  pdt))
                         pa_log_error("add pulse device to profile_item failed");
@@ -2315,7 +2315,7 @@ static pa_bool_t _device_type_direction_available(struct device_type_info *type_
 }
 
 static void handle_sink_unloaded(pa_sink *sink, pa_device_manager *dm) {
-    dm_device_profile *profile_item= NULL;
+    dm_device_profile *profile_item = NULL;
     struct device_type_info *type_info;
     dm_device *device_item;
     uint32_t device_idx = 0, profile_idx;
@@ -2378,7 +2378,7 @@ static void handle_sink_unloaded(pa_sink *sink, pa_device_manager *dm) {
 }
 
 static void handle_source_unloaded(pa_source *source, pa_device_manager *dm) {
-    dm_device_profile *profile_item= NULL;
+    dm_device_profile *profile_item = NULL;
     struct device_type_info *type_info;
     dm_device *device_item;
     uint32_t device_idx = 0, profile_idx;
@@ -2386,7 +2386,7 @@ static void handle_source_unloaded(pa_source *source, pa_device_manager *dm) {
     void *state = NULL;
     const char *role;
 
-    if (!source|| !dm) {
+    if (!source || !dm) {
         pa_log_error("Invalid Paramter");
         return;
     }
@@ -2420,7 +2420,7 @@ static void handle_source_unloaded(pa_source *source, pa_device_manager *dm) {
 
                 if (!pa_hashmap_size(profile_item->capture_devices)) {
                     pa_hashmap_free(profile_item->capture_devices);
-                    profile_item->capture_devices= NULL;
+                    profile_item->capture_devices = NULL;
 
                     if (profile_item->direction == DM_DEVICE_DIRECTION_BOTH) {
                         type_info = _device_manager_get_type_info(dm->type_infos, profile_item->device_item->type, profile_item->profile);
@@ -2478,7 +2478,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, pa_dev
             pa_log_debug("argument null");
             return PA_HOOK_OK;
         }
-        if(!(role = device_file_info_get_role_with_params(file_info, device_string_removed_params))) {
+        if (!(role = device_file_info_get_role_with_params(file_info, device_string_removed_params))) {
             pa_log_error("No role for %s", file_info->device_string);
             return PA_HOOK_OK;
         }
@@ -2601,7 +2601,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
             pa_log_debug("argument null");
             return PA_HOOK_OK;
         }
-        if(!(role = device_file_info_get_role_with_params(file_info, device_string_removed_params))) {
+        if (!(role = device_file_info_get_role_with_params(file_info, device_string_removed_params))) {
             pa_log_error("No role for %s", file_info->device_string);
             return PA_HOOK_OK;
         }
@@ -2851,7 +2851,7 @@ static struct device_file_info* parse_device_file_object(json_object *device_fil
 
     return file_info;
 
-failed :
+failed:
 
     return NULL;
 }
@@ -2919,8 +2919,7 @@ static struct device_file_map *parse_device_file_map() {
             pa_log_debug("[DEBUG_PARSE] ----------------- Capture Device Files ------------------");
             file_map->capture = parse_device_file_array_object(capture_devices_o);
         }
-    }
-    else {
+    } else {
         pa_log_error("Get device files object failed");
         return NULL;
     }
@@ -2966,7 +2965,7 @@ static pa_hashmap* parse_device_role_map(json_object *device_role_map_o) {
 
     return roles;
 
-failed :
+failed:
     if (roles)
         pa_xfree(roles);
 
@@ -3016,7 +3015,7 @@ static pa_idxset* parse_device_type_infos() {
                 if ((device_prop_o = json_object_object_get(device_o, "profile")) && json_object_is_type(device_prop_o, json_type_string)) {
                     device_profile = json_object_get_string(device_prop_o);
                     pa_log_debug("[DEBUG_PARSE] Profile: %s", device_profile);
-                    type_info->profile= device_profile;
+                    type_info->profile = device_profile;
                 } else {
                     pa_log_debug("no device-profile");
                 }
@@ -3076,18 +3075,16 @@ static pa_idxset* parse_device_type_infos() {
                 }
                 pa_idxset_put(type_infos, type_info, NULL);
 
-            }
-            else {
+            } else {
                 pa_log_debug("Get device type object failed");
             }
         }
-    }
-    else {
+    } else {
         pa_log_debug("Get device type array object failed");
     }
     return type_infos;
 
-failed :
+failed:
     if (type_infos)
         pa_xfree(type_infos);
 
@@ -3122,8 +3119,8 @@ static int handle_device_connected(pa_device_manager *dm, const char *device_typ
         return -1;
     }
 
-    if((device_item = _device_manager_get_device(dm->device_list, type_info->type))) {
-        if((profile_item = _device_item_get_profile(device_item, type_info->profile))) {
+    if ((device_item = _device_manager_get_device(dm->device_list, type_info->type))) {
+        if ((profile_item = _device_item_get_profile(device_item, type_info->profile))) {
             pa_log_debug("device_item for %s.%s already exists", type_info->type, type_info->profile);
             return 0;
         }
@@ -3157,7 +3154,7 @@ static int handle_device_disconnected(pa_device_manager *dm, const char *device_
 
     PA_IDXSET_FOREACH(device_item, dm->device_list, device_idx) {
         if (pa_streq(device_item->type, device_type)) {
-            if((profile_item = _device_item_get_profile(device_item, device_profile))) {
+            if ((profile_item = _device_item_get_profile(device_item, device_profile))) {
                 if (_device_item_get_size(device_item) == 1) {
                     _device_list_remove_device(dm->device_list, device_item, dm);
                     notify_device_connection_changed(device_item, FALSE, dm);
@@ -3564,7 +3561,7 @@ static pa_bool_t device_item_match_for_mask(dm_device *device_item, int device_f
     }
     if (need_to_check_for_state) {
         match = FALSE;
-        if ((COMPOUND_STATE(profile_item)== DM_DEVICE_STATE_DEACTIVATED) && (device_flags & DEVICE_STATE_DEACTIVATED_FLAG))
+        if ((COMPOUND_STATE(profile_item) == DM_DEVICE_STATE_DEACTIVATED) && (device_flags & DEVICE_STATE_DEACTIVATED_FLAG))
             match = TRUE;
         else if ((COMPOUND_STATE(profile_item) == DM_DEVICE_STATE_ACTIVATED) && (device_flags & DEVICE_STATE_ACTIVATED_FLAG))
             match = TRUE;
@@ -3660,7 +3657,7 @@ static int method_call_bt_sco_get_property(DBusConnection *conn, pa_bool_t *is_w
                     continue;
                 dbus_message_iter_get_basic(&dict_entry_val, &codec);
                 pa_log_debug("Codec = [%d]", codec);
-                *is_wide_band= codec == BT_MSBC_CODEC_ID ? TRUE : FALSE;
+                *is_wide_band = (codec == BT_MSBC_CODEC_ID) ? TRUE : FALSE;
             } else if (pa_streq("nrec", property) && nrec) {
                 dbus_message_iter_next(&dict_entry);
                 dbus_message_iter_recurse(&dict_entry, &dict_entry_val);
@@ -3753,7 +3750,7 @@ static void handle_get_connected_device_list(DBusConnection *conn, DBusMessage *
     pa_assert_se(dbus_message_iter_open_container(&msg_iter, DBUS_TYPE_ARRAY, "(isiis)", &array_iter));
 
     PA_IDXSET_FOREACH(device_item, dm->device_list, device_idx) {
-        if(!(profile_item = pa_idxset_get_by_index(device_item->profiles, device_item->active_profile))) {
+        if (!(profile_item = pa_idxset_get_by_index(device_item->profiles, device_item->active_profile))) {
             pa_log_error("no active profile");
             continue;
         }
@@ -3842,7 +3839,7 @@ static void handle_test_device_status_change(DBusConnection *conn, DBusMessage *
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
 
     dbus_error_init(&error);
-    if(!dbus_message_get_args(msg, NULL,
+    if (!dbus_message_get_args(msg, NULL,
                                        DBUS_TYPE_STRING, &device_type,
                                        DBUS_TYPE_STRING, &device_profile,
                                        DBUS_TYPE_INT32, &status,
@@ -3888,7 +3885,7 @@ static DBusHandlerResult handle_device_manager_methods(DBusConnection *conn, DBu
     pa_assert(userdata);
 
     for (method_idx = 0; method_idx < METHOD_HANDLER_MAX; method_idx++) {
-        if (dbus_message_is_method_call(msg, DBUS_INTERFACE_DEVICE_MANAGER, method_handlers[method_idx].method_name )) {
+        if (dbus_message_is_method_call(msg, DBUS_INTERFACE_DEVICE_MANAGER, method_handlers[method_idx].method_name)) {
             method_handlers[method_idx].receive_cb(conn, msg, userdata);
             return DBUS_HANDLER_RESULT_HANDLED;
         }
index 7008639ace73b70f7a1a2c86a295dabfb2e2d563..1de03eb217ee81b14dbd0b4f0aaa11e362347ce6 100644 (file)
@@ -211,9 +211,9 @@ enum signal_index {
 
 /* Macros */
 #define CONVERT_TO_DEVICE_DIRECTION(stream_type)\
-    ((stream_type==STREAM_SINK_INPUT)?DM_DEVICE_DIRECTION_OUT:DM_DEVICE_DIRECTION_IN)
+    ((stream_type == STREAM_SINK_INPUT) ? DM_DEVICE_DIRECTION_OUT : DM_DEVICE_DIRECTION_IN)
 #define IS_AVAILABLE_DIRECTION(stream_type, device_direction) \
-    ((stream_type==STREAM_SINK_INPUT)?(device_direction & DM_DEVICE_DIRECTION_OUT):(device_direction & DM_DEVICE_DIRECTION_IN))
+    ((stream_type == STREAM_SINK_INPUT) ? (device_direction & DM_DEVICE_DIRECTION_OUT) : (device_direction & DM_DEVICE_DIRECTION_IN))
 
 /* PCM Dump */
 #define PA_DUMP_INI_DEFAULT_PATH                "/usr/etc/mmfw_audio_pcm_dump.ini"
@@ -441,7 +441,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
                                     pa_log_warn("  -- could not get combine_sink_arg1");
                             } else if (!combine_sink_arg2) {
                                 sink = combine_sink_arg2 = pa_device_manager_get_sink(device, DEVICE_ROLE_NORMAL);
-                                if(sink && !pa_streq(sink->name, combine_sink_arg1->name)) {
+                                if (sink && !pa_streq(sink->name, combine_sink_arg1->name)) {
                                     pa_log_debug("  -- combine_sink_arg2[%s]", sink->name);
                                     /* load combine sink */
                                     if (!u->module_combine_sink_for_ex) {
@@ -451,7 +451,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
                                         pa_xfree(args);
                                     }
                                     sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED_EX, PA_NAMEREG_SINK);
-                                    PA_IDXSET_FOREACH (s, combine_sink_arg1->inputs, s_idx) {
+                                    PA_IDXSET_FOREACH(s, combine_sink_arg1->inputs, s_idx) {
                                         if (s == data->stream) {
                                             pa_sink_input_move_to(s, sink, FALSE);
                                             pa_log_debug("  -- *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, sink, sink->name);
@@ -459,7 +459,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
                                         }
                                     }
                                 } else if (!sink) {
-                                    pa_log_warn ("  -- could not get combine_sink_arg2");
+                                    pa_log_warn("  -- could not get combine_sink_arg2");
                                 }
                             }
                             if (data->origins_from_new_data)
@@ -478,7 +478,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
                                         pa_source_output_move_to(data->stream, source, FALSE);
                                 }
                             } else
-                                pa_log_warn ("  -- could not get source");
+                                pa_log_warn("  -- could not get source");
                         }
                     }
                 }
@@ -486,7 +486,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
         }
     }
 
-    if ((data->stream_type==STREAM_SINK_INPUT)?!(*(data->proper_sink)):!(*(data->proper_source))) {
+    if ((data->stream_type == STREAM_SINK_INPUT) ? !(*(data->proper_sink)) : !(*(data->proper_source))) {
         pa_log_warn("[SELECT] could not find a proper sink/source, set it to null sink/source");
         if (data->stream_type == STREAM_SINK_INPUT)
             *(data->proper_sink) = null_sink;
@@ -629,17 +629,17 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
         }
         route_info.num_of_devices = 1;
         route_info.device_infos = pa_xmalloc0(sizeof(hal_device_info)*route_info.num_of_devices);
-        route_info.device_infos[0].direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
+        route_info.device_infos[0].direction = (data->stream_type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
 
         /* unload combine sink */
-        if (data->stream_type==STREAM_SINK_INPUT && u->module_combine_sink) {
+        if (data->stream_type == STREAM_SINK_INPUT && u->module_combine_sink) {
             pa_log_info("[ROUTE][RESET] unload module[%s]", SINK_NAME_COMBINED);
             combine_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK);
             null_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_NULL, PA_NAMEREG_SINK);
             if (!combine_sink || !null_sink)
                 pa_log_error("[ROUTE][RESET] could not get combine_sink(%p) or null_sink(%p)", combine_sink, null_sink);
             else {
-                PA_IDXSET_FOREACH (s, combine_sink->inputs, s_idx) {
+                PA_IDXSET_FOREACH(s, combine_sink->inputs, s_idx) {
                     pa_sink_input_move_to(s, null_sink, FALSE);
                     pa_log_debug("[ROUTE][RESET] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, null_sink, null_sink->name);
                 }
@@ -669,7 +669,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                         pa_log_debug("  ** found a matched device: type[%-16s], direction[0x%x]", dm_device_type, dm_device_direction);
                         use_internal_codec = pa_device_manager_is_device_use_internal_codec(device, CONVERT_TO_DEVICE_DIRECTION(data->stream_type), DEVICE_ROLE_NORMAL);
                         if (use_internal_codec) {
-                            hal_direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
+                            hal_direction = (data->stream_type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
                             route_info.num_of_devices++;
                             route_info.device_infos = pa_xrealloc(route_info.device_infos, sizeof(hal_device_info)*route_info.num_of_devices);
                             route_info.device_infos[route_info.num_of_devices-1].type = dm_device_type;
@@ -690,7 +690,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                 if (data->route_type == STREAM_ROUTE_TYPE_AUTO) {
                     /* check if this device uses internal codec */
                     use_internal_codec = pa_device_manager_is_device_use_internal_codec(device, CONVERT_TO_DEVICE_DIRECTION(data->stream_type), DEVICE_ROLE_NORMAL);
-                    if(use_internal_codec) {
+                    if (use_internal_codec) {
                         /* set other device's state to deactivated */
                         PA_IDXSET_FOREACH(_device, conn_devices, conn_idx) {
                             if (device == _device)
@@ -708,9 +708,9 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                     sink = pa_device_manager_get_sink(device, DEVICE_ROLE_NORMAL);
 
                     /* unload combine sink */
-                    if (data->stream_type==STREAM_SINK_INPUT && u->module_combine_sink) {
+                    if (data->stream_type == STREAM_SINK_INPUT && u->module_combine_sink) {
                         if ((combine_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK))) {
-                            PA_IDXSET_FOREACH (s, combine_sink->inputs, s_idx) {
+                            PA_IDXSET_FOREACH(s, combine_sink->inputs, s_idx) {
                                 pa_sink_input_move_to(s, sink, FALSE);
                                 pa_log_debug("[ROUTE][AUTO] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, sink, sink->name);
                             }
@@ -745,7 +745,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                                 pa_xfree(args);
                             }
                             if ((sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK))) {
-                                PA_IDXSET_FOREACH (s, combine_sink_arg1->inputs, s_idx) {
+                                PA_IDXSET_FOREACH(s, combine_sink_arg1->inputs, s_idx) {
                                     if (s == data->stream) {
                                         pa_sink_input_move_to(s, sink, FALSE);
                                         pa_log_debug("[ROUTE][AUTO_ALL] *** sink-nput(%p,%u) moves to sink(%p,%s)",
@@ -766,7 +766,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                     } else {
                         /* move sink-inputs/source-outputs if needed */
                         if (data->idx_streams) {
-                            PA_IDXSET_FOREACH (s, data->idx_streams, s_idx) { /* data->idx_streams: null_sink */
+                            PA_IDXSET_FOREACH(s, data->idx_streams, s_idx) { /* data->idx_streams: null_sink */
                                 if (!pa_stream_manager_get_route_type(s, FALSE, data->stream_type, &route_type) &&
                                     (route_type == STREAM_ROUTE_TYPE_AUTO_ALL)) {
                                     if ((data->stream_type == STREAM_SINK_INPUT) && (sink && (sink != ((pa_sink_input*)s)->sink))) {
@@ -810,7 +810,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                 dm_device_id = pa_device_manager_get_device_id(latest_device);
                 use_internal_codec = pa_device_manager_is_device_use_internal_codec(latest_device, CONVERT_TO_DEVICE_DIRECTION(data->stream_type), DEVICE_ROLE_NORMAL);
                 if (use_internal_codec) {
-                    hal_direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
+                    hal_direction = (data->stream_type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
                     route_info.num_of_devices++;
                     route_info.device_infos = pa_xrealloc(route_info.device_infos, sizeof(hal_device_info)*route_info.num_of_devices);
                     route_info.device_infos[route_info.num_of_devices-1].type = dm_device_type;
@@ -838,7 +838,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                 /* unload combine sink */
                 if (data->stream_type == STREAM_SINK_INPUT && u->module_combine_sink) {
                     if ((combine_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK))) {
-                        PA_IDXSET_FOREACH (s, combine_sink->inputs, s_idx) {
+                        PA_IDXSET_FOREACH(s, combine_sink->inputs, s_idx) {
                             pa_sink_input_move_to(s, sink, FALSE);
                             pa_log_debug("[ROUTE][AUTO_LAST_CONN] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, sink, sink->name);
                         }
@@ -897,7 +897,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                                 route_info.num_of_devices++;
                                 route_info.device_infos = pa_xrealloc(route_info.device_infos, sizeof(hal_device_info)*route_info.num_of_devices);
                                 route_info.device_infos[route_info.num_of_devices-1].type = dm_device_type;
-                                route_info.device_infos[route_info.num_of_devices-1].direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
+                                route_info.device_infos[route_info.num_of_devices-1].direction = (data->stream_type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
                                 pa_log_info("  ** found a matched device and set state to ACTIVATED: type[%-16s], direction[0x%x]",
                                     route_info.device_infos[route_info.num_of_devices-1].type, dm_device_direction);
                                 /* set device state to activated */
@@ -917,7 +917,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
             else if (data->stream_type == STREAM_SOURCE_OUTPUT)
                 source = pa_device_manager_get_source(device, DEVICE_ROLE_NORMAL);
             if (data->idx_streams) {
-                PA_IDXSET_FOREACH (s, data->idx_streams, idx) {
+                PA_IDXSET_FOREACH(s, data->idx_streams, idx) {
                     if (sink && (sink != ((pa_sink_input*)s)->sink)) {
                         pa_sink_input_move_to(s, sink, FALSE);
                         pa_log_debug("[ROUTE][MANUAL] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, sink, sink->name);
@@ -932,7 +932,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
 
     if (route_info.device_infos) {
         /* send information to HAL to set routing */
-        if(pa_hal_manager_do_route (u->hal_manager, &route_info))
+        if (pa_hal_manager_do_route(u->hal_manager, &route_info))
             pa_log_error("[ROUTE] Failed to pa_hal_manager_do_route()");
         pa_xfree(route_info.device_infos);
     }
@@ -954,7 +954,7 @@ static pa_hook_result_t route_option_update_hook_cb(pa_core *c, pa_stream_manage
     route_option.value = data->value;
 
     /* send information to HAL to update routing option */
-    if(pa_hal_manager_update_route_option (u->hal_manager, &route_option))
+    if (pa_hal_manager_update_route_option(u->hal_manager, &route_option))
         pa_log_error("[ROUTE_OPT] Failed to pa_hal_manager_update_route_option()");
 
     return PA_HOOK_OK;
@@ -1007,7 +1007,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_device_
                 if (combine_sink->inputs) {
                     if (!sink)
                         sink = null_sink;
-                    PA_IDXSET_FOREACH (s, combine_sink->inputs, idx) {
+                    PA_IDXSET_FOREACH(s, combine_sink->inputs, idx) {
                         /* re-route this stream to the remaining device using internal codec */
                         pa_sink_input_move_to(s, sink, FALSE);
                         pa_log_debug("[CONN] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, sink, sink->name);
@@ -1023,7 +1023,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_device_
             /* unload combine sink for external devices */
             if ((combine_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED_EX, PA_NAMEREG_SINK))) {
                 if (combine_sink->inputs) {
-                    PA_IDXSET_FOREACH (s, combine_sink->inputs, idx) {
+                    PA_IDXSET_FOREACH(s, combine_sink->inputs, idx) {
                         pa_sink_input_move_to(s, null_sink, FALSE);
                         pa_log_debug("[CONN] *** sink-input(%p,%u) moves to sink(%p,%s)", s, ((pa_sink_input*)s)->index, null_sink, null_sink->name);
                     }
@@ -1208,7 +1208,7 @@ static DBusHandlerResult dbus_filter_audio_handler(DBusConnection *c, DBusMessag
 
     pa_assert(userdata);
 
-    if(dbus_message_get_type(s)!=DBUS_MESSAGE_TYPE_SIGNAL)
+    if (dbus_message_get_type(s) != DBUS_MESSAGE_TYPE_SIGNAL)
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     pa_log_info("Audio handler received msg");
@@ -1228,7 +1228,7 @@ static DBusHandlerResult dbus_filter_audio_handler(DBusConnection *c, DBusMessag
             DBUS_TYPE_STRING, &arg_s,
             DBUS_TYPE_INVALID)) {
             goto fail;
-        } else{
+        } else {
             _do_something2(arg_s, userdata);
         }
     } else if (dbus_message_is_signal(s, AUDIO_CLIENT_INTERFACE_NAME, "TestSignalFromClient1")) {
@@ -1236,7 +1236,7 @@ static DBusHandlerResult dbus_filter_audio_handler(DBusConnection *c, DBusMessag
             DBUS_TYPE_STRING, &arg_s,
             DBUS_TYPE_INVALID)) {
             goto fail;
-        } else{
+        } else {
             _do_something2(arg_s, userdata);
         }
     } else {
@@ -1278,10 +1278,10 @@ static DBusHandlerResult handle_get_property(DBusConnection *conn, DBusMessage *
                 }
             }
         }
-        else{
+       else {
             pa_log_warn("Not our interface, not handle it");
         }
-    } else{
+    } else {
         pa_log_warn("Wrong Signature");
         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_SIGNATURE,  "Wrong Signature, Expected (ss)");
     }
@@ -1305,10 +1305,10 @@ static DBusHandlerResult handle_get_all_property(DBusConnection *conn, DBusMessa
             handle_get_all(conn, msg, userdata);
             return DBUS_HANDLER_RESULT_HANDLED;
         }
-        else{
+       else {
             pa_log_warn("Not our interface, not handle it");
         }
-    } else{
+    } else {
         pa_log_warn("Wrong Signature");
         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_SIGNATURE,  "Wrong Signature, Expected (ss)");
     }
@@ -1341,11 +1341,11 @@ static DBusHandlerResult handle_set_property(DBusConnection *conn, DBusMessage *
         if (pa_streq(interface_name, INTERFACE_POLICY)) {
             for (prop_idx = 0; prop_idx < PROPERTY_MAX; prop_idx++) {
                 if (pa_streq(property_name, property_handlers[prop_idx].property_name)) {
-                    if (pa_streq(property_handlers[prop_idx].type,property_sig)) {
+                    if (pa_streq(property_handlers[prop_idx].type, property_sig)) {
                         property_handlers[prop_idx].set_cb(conn, msg, &variant_iter, userdata);
                         return DBUS_HANDLER_RESULT_HANDLED;
                     }
-                    else{
+                   else {
                         pa_log_warn("Wrong Property Signature");
                         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_SIGNATURE,  "Wrong Signature, Expected (ssv)");
                     }
@@ -1353,10 +1353,10 @@ static DBusHandlerResult handle_set_property(DBusConnection *conn, DBusMessage *
                 }
             }
         }
-        else{
+       else {
             pa_log_warn("Not our interface, not handle it");
         }
-    } else{
+    } else {
         pa_log_warn("Wrong Signature");
         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_SIGNATURE,  "Wrong Signature, Expected (ssv)");
     }
@@ -1373,12 +1373,12 @@ static DBusHandlerResult handle_policy_methods(DBusConnection *conn, DBusMessage
     pa_assert(userdata);
 
     for (method_idx = 0; method_idx < METHOD_HANDLER_MAX; method_idx++) {
-        if (dbus_message_is_method_call(msg, INTERFACE_POLICY, method_handlers[method_idx].method_name )) {
+        if (dbus_message_is_method_call(msg, INTERFACE_POLICY, method_handlers[method_idx].method_name)) {
             if (pa_streq(dbus_message_get_signature(msg), method_arg_signatures[method_idx])) {
                 method_handlers[method_idx].receive_cb(conn, msg, userdata);
                 return DBUS_HANDLER_RESULT_HANDLED;
             }
-            else{
+           else {
                 pa_log_warn("Wrong Argument Signature");
                 pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_SIGNATURE,  "Wrong Signature, Expected %s", method_arg_signatures[method_idx]);
                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1429,13 +1429,13 @@ static DBusHandlerResult method_call_handler(DBusConnection *c, DBusMessage *m,
 
     if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
         return handle_introspect(c, m, u);
-    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get")){
+    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get")) {
         return handle_get_property(c, m, u);
-    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Set")){
+    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Set")) {
         return  handle_set_property(c, m, u);
-    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll")){
+    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll")) {
         return handle_get_all_property(c, m, u);
-    } else{
+    } else {
         return handle_policy_methods(c, m, u);
     }
 
@@ -1451,9 +1451,9 @@ static void endpoint_init(struct userdata *u)
     pa_log_debug("Dbus endpoint init");
 
     if (u && u->dbus_conn) {
-        if(!dbus_connection_register_object_path(pa_dbus_connection_get(u->dbus_conn), OBJECT_PATH, &vtable_endpoint, u))
+        if (!dbus_connection_register_object_path(pa_dbus_connection_get(u->dbus_conn), OBJECT_PATH, &vtable_endpoint, u))
             pa_log_error("Failed to register object path");
-    } else{
+    } else {
         pa_log_error("Cannot get dbus connection to register object path");
     }
 }
@@ -1462,9 +1462,9 @@ static void endpoint_done(struct userdata* u)
 {
     pa_log_debug("Dbus endpoint done");
     if (u && u->dbus_conn) {
-        if(!dbus_connection_unregister_object_path(pa_dbus_connection_get(u->dbus_conn), OBJECT_PATH))
+        if (!dbus_connection_unregister_object_path(pa_dbus_connection_get(u->dbus_conn), OBJECT_PATH))
             pa_log_error("Failed to unregister object path");
-    } else{
+    } else {
         pa_log_error("Cannot get dbus connection to unregister object path");
     }
 }
@@ -1522,13 +1522,13 @@ static void dbus_init(struct userdata* u)
         }
         pa_log_error("Unable to contact D-Bus system bus: %s: %s", error.name, error.message);
         goto fail;
-    } else{
+    } else {
         pa_log_debug("Got dbus connection");
     }
 
     u->dbus_conn = connection;
 
-    if( watch_signals(u) < 0 )
+    if (watch_signals(u) < 0)
         pa_log_error("dbus watch signals failed");
     else
         pa_log_debug("dbus ready to get signals");
@@ -1548,7 +1548,7 @@ static void dbus_deinit(struct userdata* u)
         endpoint_done(u);
         unwatch_signals(u);
 
-        if (u->dbus_conn){
+        if (u->dbus_conn) {
             pa_dbus_connection_unref(u->dbus_conn);
             u->dbus_conn = NULL;
         }
index 9341c8353ee76988b59f5cdbf56766978022391d..761ca213febc822b60aae89dcd07629f483fc90a 100644 (file)
@@ -79,10 +79,10 @@ enum method_handler_index {
 
 static pa_dbus_arg_info simple_play_args[]    = { { "uri", "s", "in" },
                                                  { "role", "s", "in" },
-                                         { "volume_gain", "s", "in" }};
+                                         { "volume_gain", "s", "in" } };
 static pa_dbus_arg_info sample_play_args[]    = { { "sample_name", "s", "in" },
                                                          { "role", "s", "in" },
-                                                 { "volume_gain", "s", "in" }};
+                                                 { "volume_gain", "s", "in" } };
 
 static const char* signature_args_for_in[] = { "sss", "sss" };
 
@@ -357,7 +357,7 @@ static DBusHandlerResult handle_methods(DBusConnection *conn, DBusMessage *msg,
     pa_assert(userdata);
 
     for (idx = 0; idx < METHOD_HANDLER_MAX; idx++) {
-        if (dbus_message_is_method_call(msg, SOUND_PLAYER_INTERFACE, method_handlers[idx].method_name )) {
+        if (dbus_message_is_method_call(msg, SOUND_PLAYER_INTERFACE, method_handlers[idx].method_name)) {
             if (pa_streq(dbus_message_get_signature(msg), signature_args_for_in[idx])) {
                 method_handlers[idx].receive_cb(conn, msg, userdata);
                 return DBUS_HANDLER_RESULT_HANDLED;
@@ -412,7 +412,7 @@ static void send_signal_for_eos(struct userdata *u, int32_t stream_idx) {
 }
 #endif
 
-static int init_ipc (struct userdata *u) {
+static int init_ipc(struct userdata *u) {
     int pre_mask;
 #ifdef HAVE_DBUS
 #ifndef USE_DBUS_PROTOCOL
@@ -428,7 +428,7 @@ static int init_ipc (struct userdata *u) {
     pa_log_info("Initialization for IPC");
 
     pre_mask = umask(0);
-    if (mknod(KEYTONE_PATH,S_IFIFO|0660,0)<0)
+    if (mknod(KEYTONE_PATH, S_IFIFO|0660, 0) < 0)
         pa_log_warn("mknod failed. errno=[%d][%s]", errno, strerror(errno));
 
     umask(pre_mask);
@@ -443,11 +443,11 @@ static int init_ipc (struct userdata *u) {
     fcntl(u->fd, F_SETFL, O_NONBLOCK);
 
     /* change access mode so group can use keytone pipe */
-    if (fchmod (u->fd, 0666) == -1)
+    if (fchmod(u->fd, 0666) == -1)
         pa_log_warn("Changing keytone access mode is failed. errno=[%d][%s]", errno, strerror(errno));
 
     /* change group due to security request */
-    if (fchown (u->fd, -1, KEYTONE_GROUP) == -1)
+    if (fchown(u->fd, -1, KEYTONE_GROUP) == -1)
         pa_log_warn("Changing keytone group is failed. errno=[%d][%s]", errno, strerror(errno));
 
     u->io = u->module->core->mainloop->io_new(u->module->core->mainloop, u->fd, PA_IO_EVENT_INPUT|PA_IO_EVENT_HANGUP, io_event_callback, u);
@@ -482,7 +482,7 @@ fail:
     return -1;
 }
 
-static void deinit_ipc (struct userdata *u) {
+static void deinit_ipc(struct userdata *u) {
 
     pa_assert(u);
 
@@ -502,7 +502,7 @@ static void deinit_ipc (struct userdata *u) {
     }
 #else
     if (u->dbus_conn) {
-        if(!dbus_connection_unregister_object_path(pa_dbus_connection_get(u->dbus_conn), SOUND_PLAYER_OBJECT_PATH))
+        if (!dbus_connection_unregister_object_path(pa_dbus_connection_get(u->dbus_conn), SOUND_PLAYER_OBJECT_PATH))
             pa_log_error("Failed to unregister object path");
         u->dbus_conn = NULL;
     }
index 07e7ed3f38e90f69fa6b46aa01f4074e0a8b5ded..577fde074b2095fd699830938ac1a4a3a01c81e9 100644 (file)
@@ -113,7 +113,7 @@ static const char* const valid_modargs[] = {
     NULL
 };
 
-static int build_pollfd (struct userdata *u) {
+static int build_pollfd(struct userdata *u) {
     int32_t ret;
     struct pollfd *pollfd;
     int fd = -1;
@@ -519,7 +519,7 @@ int pa__init(pa_module*m) {
     pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_rtpoll(u->sink, u->rtpoll);
 
-    unsuspend (u);
+    unsuspend(u);
 
     u->block_usec = BLOCK_USEC;
     u->timestamp = 0ULL;
index 435026486a457980a1e20f787c3d7fe954815c04..41d175a2bf291c7f2dd576402bb367cd001f89a6 100644 (file)
@@ -114,7 +114,7 @@ static const char* const valid_modargs[] = {
     NULL
 };
 
-static int build_pollfd (struct userdata *u) {
+static int build_pollfd(struct userdata *u) {
     int32_t ret;
     struct pollfd *pollfd;
     int fd = -1;
@@ -471,7 +471,7 @@ int pa__init(pa_module*m) {
     pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_rtpoll(u->source, u->rtpoll);
 
-    unsuspend (u);
+    unsuspend(u);
 
     u->block_usec = BLOCK_USEC;
     u->latency_time = u->block_usec;
index 6305294b21cbd0900bff8a18fc656b8a94d9737a..b7cd18fc3315088db706b94d95fb7ad0eab95b5b 100644 (file)
@@ -27,16 +27,16 @@ typedef enum _stream_direction {
 } stream_direction_t;
 
 #define GET_STREAM_NEW_SAMPLE_SPEC_PTR(stream, type) \
-      (type == STREAM_SINK_INPUT? &(((pa_sink_input_new_data*)stream)->sample_spec) : &(((pa_source_output_new_data*)stream)->sample_spec))
+      (type == STREAM_SINK_INPUT ? &(((pa_sink_input_new_data*)stream)->sample_spec) : &(((pa_source_output_new_data*)stream)->sample_spec))
 
 #define GET_STREAM_NEW_SAMPLE_SPEC(stream, type) \
-      (type == STREAM_SINK_INPUT? ((pa_sink_input_new_data*)stream)->sample_spec : ((pa_source_output_new_data*)stream)->sample_spec)
+      (type == STREAM_SINK_INPUT ? ((pa_sink_input_new_data*)stream)->sample_spec : ((pa_source_output_new_data*)stream)->sample_spec)
 
 #define GET_STREAM_SAMPLE_SPEC(stream, type) \
-      (type == STREAM_SINK_INPUT? ((pa_sink_input*)stream)->sample_spec : ((pa_source_output*)stream)->sample_spec)
+      (type == STREAM_SINK_INPUT ? ((pa_sink_input*)stream)->sample_spec : ((pa_source_output*)stream)->sample_spec)
 
 #define IS_FOCUS_ACQUIRED(focus, type) \
-      (type == STREAM_SINK_INPUT? (focus & STREAM_FOCUS_ACQUIRED_PLAYBACK) : (focus & STREAM_FOCUS_ACQUIRED_CAPTURE))
+      (type == STREAM_SINK_INPUT ? (focus & STREAM_FOCUS_ACQUIRED_PLAYBACK) : (focus & STREAM_FOCUS_ACQUIRED_CAPTURE))
 
 typedef struct _stream_info {
     int32_t priority;
index 35df3e5dd1263436ae3e580143d930260337e274..3caa36633e19b503f8ae962660aae3c082ae431d 100644 (file)
@@ -53,7 +53,7 @@ enum gain_type {
 };
 
 /* TODO : after preparing gain map, we can remove it */
-static const char *__get_gain_type_string_by_idx (uint32_t gain_type_idx) {
+static const char *__get_gain_type_string_by_idx(uint32_t gain_type_idx) {
     switch (gain_type_idx) {
     case GAIN_TYPE_DEFAULT:           return "default";
     case GAIN_TYPE_DIALER:            return "dialer";
@@ -70,7 +70,7 @@ static const char *__get_gain_type_string_by_idx (uint32_t gain_type_idx) {
     }
 }
 
-static int load_out_volume_conf_file (pa_stream_manager *m) {
+static int load_out_volume_conf_file(pa_stream_manager *m) {
     int ret = 0;
     dictionary *dict = NULL;
     uint32_t gain_type_idx = 0;
@@ -110,7 +110,7 @@ static int load_out_volume_conf_file (pa_stream_manager *m) {
                     /* convert dB volume to linear volume */
                     double *vol_value = pa_xmalloc0(sizeof(double));
                     *vol_value = 0.0f;
-                    if(strncmp(token, "0", strlen(token)))
+                    if (strncmp(token, "0", strlen(token)))
                         *vol_value = pow(10.0, (atof(token) - 100) / 20.0);
                     if (!v->values[STREAM_DIRECTION_OUT].idx_volume_values)
                         v->values[STREAM_DIRECTION_OUT].idx_volume_values = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
@@ -291,7 +291,7 @@ int32_t set_volume_level_by_type(pa_stream_manager *m, stream_type_t stream_type
         if (get_volume_value(m, stream_type, is_hal_volume, volume_type, volume_level, &volume_linear))
             return -1;
 
-        PA_IDXSET_FOREACH(s, stream_type == STREAM_SINK_INPUT?m->core->sink_inputs:m->core->source_outputs, idx) {
+        PA_IDXSET_FOREACH(s, stream_type == STREAM_SINK_INPUT ? m->core->sink_inputs : m->core->source_outputs, idx) {
             if ((volume_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
                 /* Get modifier for gain */
                 modifier_gain = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
@@ -318,7 +318,7 @@ int32_t set_volume_level_by_type(pa_stream_manager *m, stream_type_t stream_type
             }
         }
     } else {
-        PA_IDXSET_FOREACH(s, stream_type == STREAM_SINK_INPUT?m->core->sink_inputs:m->core->source_outputs, idx) {
+        PA_IDXSET_FOREACH(s, stream_type == STREAM_SINK_INPUT ? m->core->sink_inputs : m->core->source_outputs, idx) {
             if ((volume_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
                 /* Get modifier for gain */
                 modifier_gain = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
@@ -436,7 +436,7 @@ int32_t set_volume_level_by_idx(pa_stream_manager *m, stream_type_t stream_type,
     const char *modifier_gain = NULL;
     pa_assert(m);
 
-    s = pa_idxset_get_by_index(stream_type == STREAM_SINK_INPUT?m->core->sink_inputs:m->core->source_outputs, idx);
+    s = pa_idxset_get_by_index(stream_type == STREAM_SINK_INPUT ? m->core->sink_inputs : m->core->source_outputs, idx);
     if ((volume_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
         /* Get modifier for gain */
         modifier_gain = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
@@ -713,7 +713,7 @@ int32_t set_volume_mute_with_new_data(pa_stream_manager *m, void *stream, stream
     return 0;
 }
 
-static void dump_volumes (pa_stream_manager *m) {
+static void dump_volumes(pa_stream_manager *m) {
     volume_info *s = NULL;
     const char *volume_type = NULL;
     const char *modifier_gain = NULL;
@@ -748,7 +748,7 @@ static void dump_volumes (pa_stream_manager *m) {
     return;
 }
 
-int32_t init_volumes (pa_stream_manager *m) {
+int32_t init_volumes(pa_stream_manager *m) {
     int ret = 0;
     void *state = NULL;
     volume_info *v = NULL;
@@ -790,7 +790,7 @@ int32_t init_volumes (pa_stream_manager *m) {
     return ret;
 }
 
-void deinit_volumes (pa_stream_manager *m) {
+void deinit_volumes(pa_stream_manager *m) {
     volume_info *v = NULL;
     void *state = NULL;
     uint32_t idx = 0;
index dd20e7ef37304b2210af9beb3616894899c1aecc..822dc5c05fcbbc3323c04a356d1ed1ce991be8a3 100644 (file)
@@ -195,7 +195,7 @@ static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
 };
 
 const char *dbus_str_none = "none";
-const char* stream_manager_dbus_ret_str[] = {"STREAM_MANAGER_RETURN_OK","STREAM_MANAGER_RETURN_ERROR", "STREAM_MANAGER_RETURN_ERROR_NO_STREAM"};
+const char* stream_manager_dbus_ret_str[] = {"STREAM_MANAGER_RETURN_OK", "STREAM_MANAGER_RETURN_ERROR", "STREAM_MANAGER_RETURN_ERROR_NO_STREAM"};
 enum {
     RET_MSG_INDEX_OK,
     RET_MSG_INDEX_ERROR,
@@ -430,7 +430,7 @@ static int get_available_streams(pa_stream_manager *m, stream_list *list) {
             }
         }
         list->num_of_streams = i;
-        pa_log_debug("  num_of_streams[%d]",i);
+        pa_log_debug("  num_of_streams[%d]", i);
     } else {
         pa_log_error("stream_map is not initialized..");
         return -1;
@@ -522,7 +522,7 @@ static void handle_get_stream_list(DBusConnection *conn, DBusMessage *msg, void
     memset(&list, 0, sizeof(stream_list));
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
     dbus_message_iter_init_append(reply, &msg_iter);
-    if(!get_available_streams(m, &list)) {
+    if (!get_available_streams(m, &list)) {
         pa_dbus_append_basic_array_variant(&msg_iter, DBUS_TYPE_STRING, &list.types, list.num_of_streams);
         pa_dbus_append_basic_array_variant(&msg_iter, DBUS_TYPE_INT32, &list.priorities, list.num_of_streams);
     } else {
@@ -552,7 +552,7 @@ static void handle_get_stream_info(DBusConnection *conn, DBusMessage *msg, void
     memset(&info, 0, sizeof(stream_info_per_type));
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
     dbus_message_iter_init_append(reply, &msg_iter);
-    if(!get_stream_info(m, type, &info)) {
+    if (!get_stream_info(m, type, &info)) {
         pa_dbus_append_basic_variant(&msg_iter, DBUS_TYPE_INT32, &info.priority);
         pa_dbus_append_basic_variant(&msg_iter, DBUS_TYPE_INT32, &info.route_type);
         pa_dbus_append_basic_array_variant(&msg_iter, DBUS_TYPE_STRING, &info.volume_types, STREAM_DIRECTION_MAX);
@@ -1030,7 +1030,7 @@ static void handle_get_current_volume_type(DBusConnection *conn, DBusMessage *ms
         goto FAILURE;
     }
 
-    s = (stream_type == STREAM_SINK_INPUT)?(void*)(m->cur_highest_priority.sink_input):(void*)(m->cur_highest_priority.source_output);
+    s = (stream_type == STREAM_SINK_INPUT) ? (void*)(m->cur_highest_priority.sink_input) : (void*)(m->cur_highest_priority.source_output);
     if (s) {
         type = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE);
         pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_STRING, &type, DBUS_TYPE_INVALID));
@@ -1077,7 +1077,7 @@ static void handle_update_focus_status(DBusConnection *conn, DBusMessage *msg, v
                 count = pa_idxset_size(sp->idx_sink_inputs);
                 PA_IDXSET_FOREACH(stream, sp->idx_sink_inputs, idx) {
                     pa_proplist_sets(GET_STREAM_PROPLIST(stream, STREAM_SINK_INPUT), PA_PROP_MEDIA_FOCUS_STATUS,
-                                     IS_FOCUS_ACQUIRED(sp->focus_status, STREAM_SINK_INPUT)?STREAM_FOCUS_PLAYBACK:STREAM_FOCUS_NONE);
+                                     IS_FOCUS_ACQUIRED(sp->focus_status, STREAM_SINK_INPUT) ? STREAM_FOCUS_PLAYBACK : STREAM_FOCUS_NONE);
                     if (--count == 0)
                         process_stream(m, stream, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_FOCUS_CHANGED, FALSE);
                 }
@@ -1086,7 +1086,7 @@ static void handle_update_focus_status(DBusConnection *conn, DBusMessage *msg, v
                 count = pa_idxset_size(sp->idx_source_outputs);
                 PA_IDXSET_FOREACH(stream, sp->idx_source_outputs, idx) {
                     pa_proplist_sets(GET_STREAM_PROPLIST(stream, STREAM_SOURCE_OUTPUT), PA_PROP_MEDIA_FOCUS_STATUS,
-                                     IS_FOCUS_ACQUIRED(sp->focus_status, STREAM_SOURCE_OUTPUT)?STREAM_FOCUS_CAPTURE:STREAM_FOCUS_NONE);
+                                     IS_FOCUS_ACQUIRED(sp->focus_status, STREAM_SOURCE_OUTPUT) ? STREAM_FOCUS_CAPTURE : STREAM_FOCUS_NONE);
                     if (--count == 0)
                         process_stream(m, stream, STREAM_SOURCE_OUTPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_FOCUS_CHANGED, FALSE);
                 }
@@ -1115,7 +1115,7 @@ static DBusHandlerResult handle_methods(DBusConnection *conn, DBusMessage *msg,
     pa_assert(m);
 
     for (idx = 0; idx < METHOD_HANDLER_MAX; idx++) {
-        if (dbus_message_is_method_call(msg, STREAM_MANAGER_INTERFACE, method_handlers[idx].method_name )) {
+        if (dbus_message_is_method_call(msg, STREAM_MANAGER_INTERFACE, method_handlers[idx].method_name)) {
             pa_log_debug("Message signature [%s] (Expected [%s])", dbus_message_get_signature(msg), signature_args_for_in[idx]);
             if (pa_streq(dbus_message_get_signature(msg), signature_args_for_in[idx])) {
                 method_handlers[idx].receive_cb(conn, msg, userdata);
@@ -1182,7 +1182,7 @@ static int convert_route_type(stream_route_type_t *route_type, const char *route
     return ret;
 }
 
-static void dump_stream_map (pa_stream_manager *m) {
+static void dump_stream_map(pa_stream_manager *m) {
     stream_info *s = NULL;
     const char *role = NULL;
     char *name = NULL;
@@ -1209,7 +1209,7 @@ static void dump_stream_map (pa_stream_manager *m) {
     return;
 }
 
-static int init_stream_map (pa_stream_manager *m) {
+static int init_stream_map(pa_stream_manager *m) {
     volume_info *v;
     stream_info *s;
     json_object *o;
@@ -1244,62 +1244,62 @@ static int init_stream_map (pa_stream_manager *m) {
     pa_assert(m);
 
     o = json_object_from_file(STREAM_MAP_FILE);
-    if(is_error(o)) {
+    if (is_error(o)) {
         pa_log_error("Read stream-map file(%s) failed", STREAM_MAP_FILE);
         return -1;
     }
 
     /* Volumes */
     m->volume_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    if((volume_array_o = json_object_object_get(o, STREAM_MAP_VOLUMES)) && json_object_is_type(volume_array_o, json_type_array)) {
+    if ((volume_array_o = json_object_object_get(o, STREAM_MAP_VOLUMES)) && json_object_is_type(volume_array_o, json_type_array)) {
         num_of_volume_types = json_object_array_length(volume_array_o);
         for (i = 0; i < num_of_volume_types; i++) {
-            if((volume_o = json_object_array_get_idx(volume_array_o, i)) && json_object_is_type(volume_o, json_type_object)) {
+            if ((volume_o = json_object_array_get_idx(volume_array_o, i)) && json_object_is_type(volume_o, json_type_object)) {
                 v = pa_xmalloc0(sizeof(volume_info));
                 pa_log_debug("volume found [%d]", i);
-                if((volume_type_o = json_object_object_get(volume_o, STREAM_MAP_VOLUME_TYPE)) && json_object_is_type(volume_type_o, json_type_string)) {
+                if ((volume_type_o = json_object_object_get(volume_o, STREAM_MAP_VOLUME_TYPE)) && json_object_is_type(volume_type_o, json_type_string)) {
                     volume_type = json_object_get_string(volume_type_o);
                     pa_log_debug(" - type : %s", volume_type);
                 } else {
                     pa_log_error("Get volume type failed");
                     goto failed;
                 }
-                if((is_hal_volume_o = json_object_object_get(volume_o, STREAM_MAP_VOLUME_IS_FOR_HAL)) && json_object_is_type(is_hal_volume_o, json_type_int)) {
+                if ((is_hal_volume_o = json_object_object_get(volume_o, STREAM_MAP_VOLUME_IS_FOR_HAL)) && json_object_is_type(is_hal_volume_o, json_type_int)) {
                     v->is_hal_volume_type = (pa_bool_t)json_object_get_int(is_hal_volume_o);
                     pa_log_debug(" - is-hal-volume : %d", v->is_hal_volume_type);
                 } else {
                     pa_log_error("Get is-hal-volume failed");
                     goto failed;
                 }
-                pa_hashmap_put(m->volume_infos,(void*)volume_type, v);
+                pa_hashmap_put(m->volume_infos, (void*)volume_type, v);
             }
         }
     }
 
     /* Streams */
     m->stream_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-    if((stream_array_o = json_object_object_get(o, STREAM_MAP_STREAMS)) && json_object_is_type(stream_array_o, json_type_array)) {
+    if ((stream_array_o = json_object_object_get(o, STREAM_MAP_STREAMS)) && json_object_is_type(stream_array_o, json_type_array)) {
         num_of_stream_types = json_object_array_length(stream_array_o);
         for (i = 0; i < num_of_stream_types; i++) {
 
-            if((stream_o = json_object_array_get_idx(stream_array_o, i)) && json_object_is_type(stream_o, json_type_object)) {
+            if ((stream_o = json_object_array_get_idx(stream_array_o, i)) && json_object_is_type(stream_o, json_type_object)) {
                 s = pa_xmalloc0(sizeof(stream_info));
                 pa_log_debug("stream found [%d]", i);
-                if((role_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_ROLE)) && json_object_is_type(role_o, json_type_string)) {
+                if ((role_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_ROLE)) && json_object_is_type(role_o, json_type_string)) {
                     role = json_object_get_string(role_o);
                     pa_log_debug(" - role : %s", role);
                 } else {
                     pa_log_error("Get stream role failed");
                     goto failed;
                 }
-                if((priority_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_PRIORITY)) && json_object_is_type(priority_o, json_type_int)) {
+                if ((priority_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_PRIORITY)) && json_object_is_type(priority_o, json_type_int)) {
                     s->priority = json_object_get_int(priority_o);
                     pa_log_debug(" - priority : %d", s->priority);
                 } else {
                     pa_log_error("Get stream priority failed");
                     goto failed;
                 }
-                if((route_type_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_ROUTE_TYPE)) && json_object_is_type(route_type_o, json_type_string)) {
+                if ((route_type_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_ROUTE_TYPE)) && json_object_is_type(route_type_o, json_type_string)) {
                     if (convert_route_type(&(s->route_type), json_object_get_string(route_type_o))) {
                         pa_log_error("convert stream route-type failed");
                         goto failed;
@@ -1309,14 +1309,14 @@ static int init_stream_map (pa_stream_manager *m) {
                     pa_log_error("Get stream route-type failed");
                     goto failed;
                 }
-                if((volume_types_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_VOLUME_TYPES)) && json_object_is_type(volume_types_o, json_type_object)) {
-                    if((volume_type_in_o = json_object_object_get(volume_types_o, STREAM_MAP_STREAM_VOLUME_TYPE_IN)) && json_object_is_type(volume_type_in_o, json_type_string))
+                if ((volume_types_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_VOLUME_TYPES)) && json_object_is_type(volume_types_o, json_type_object)) {
+                    if ((volume_type_in_o = json_object_object_get(volume_types_o, STREAM_MAP_STREAM_VOLUME_TYPE_IN)) && json_object_is_type(volume_type_in_o, json_type_string))
                         s->volume_types[STREAM_DIRECTION_IN] = json_object_get_string(volume_type_in_o);
                     else {
                         pa_log_error("Get stream volume-type-in failed");
                         goto failed;
                     }
-                    if((volume_type_out_o = json_object_object_get(volume_types_o, STREAM_MAP_STREAM_VOLUME_TYPE_OUT)) && json_object_is_type(volume_type_out_o, json_type_string))
+                    if ((volume_type_out_o = json_object_object_get(volume_types_o, STREAM_MAP_STREAM_VOLUME_TYPE_OUT)) && json_object_is_type(volume_type_out_o, json_type_string))
                         s->volume_types[STREAM_DIRECTION_OUT] = json_object_get_string(volume_type_out_o);
                     else {
                         pa_log_error("Get stream volume-type-out failed");
@@ -1327,13 +1327,13 @@ static int init_stream_map (pa_stream_manager *m) {
                     pa_log_error("Get stream volume-types failed");
                     goto failed;
                 }
-                if((avail_in_devices_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_IN_DEVICES)) && json_object_is_type(avail_in_devices_o, json_type_array)) {
+                if ((avail_in_devices_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_IN_DEVICES)) && json_object_is_type(avail_in_devices_o, json_type_array)) {
                     j = 0;
                     s->idx_avail_in_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
                     num_of_avail_in_devices = json_object_array_length(avail_in_devices_o);
                     pa_log_debug(" - avail-in-devices");
                     for (j = 0; j < num_of_avail_in_devices; j++) {
-                        if((in_device_o = json_object_array_get_idx(avail_in_devices_o, j)) && json_object_is_type(in_device_o, json_type_string)) {
+                        if ((in_device_o = json_object_array_get_idx(avail_in_devices_o, j)) && json_object_is_type(in_device_o, json_type_string)) {
                             pa_idxset_put(s->idx_avail_in_devices, (void*)json_object_get_string(in_device_o), NULL);
                             pa_log_debug("      device[%d] : %s", j, json_object_get_string(in_device_o));
                            }
@@ -1342,13 +1342,13 @@ static int init_stream_map (pa_stream_manager *m) {
                     pa_log_error("Get stream avail-in-devices failed");
                     goto failed;
                 }
-                if((avail_out_devices_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_OUT_DEVICES)) && json_object_is_type(avail_out_devices_o, json_type_array)) {
+                if ((avail_out_devices_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_OUT_DEVICES)) && json_object_is_type(avail_out_devices_o, json_type_array)) {
                     j = 0;
                     s->idx_avail_out_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
                     num_of_avail_out_devices = json_object_array_length(avail_out_devices_o);
                     pa_log_debug(" - avail-out-devices");
                     for (j = 0; j < num_of_avail_out_devices; j++) {
-                        if((out_device_o = json_object_array_get_idx(avail_out_devices_o, j)) && json_object_is_type(out_device_o, json_type_string)) {
+                        if ((out_device_o = json_object_array_get_idx(avail_out_devices_o, j)) && json_object_is_type(out_device_o, json_type_string)) {
                             pa_idxset_put(s->idx_avail_out_devices, (void*)json_object_get_string(out_device_o), NULL);
                             pa_log_debug("      device[%d] : %s", j, json_object_get_string(out_device_o));
                            }
@@ -1357,13 +1357,13 @@ static int init_stream_map (pa_stream_manager *m) {
                     pa_log_error("Get stream avail-out-devices failed");
                     goto failed;
                 }
-                if((avail_frameworks_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_FRAMEWORKS)) && json_object_is_type(avail_frameworks_o, json_type_array)) {
+                if ((avail_frameworks_o = json_object_object_get(stream_o, STREAM_MAP_STREAM_AVAIL_FRAMEWORKS)) && json_object_is_type(avail_frameworks_o, json_type_array)) {
                     j = 0;
                     s->idx_avail_frameworks = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
                     num_of_avail_frameworks = json_object_array_length(avail_frameworks_o);
                     pa_log_debug(" - avail-frameworks");
                     for (j = 0; j < num_of_avail_frameworks; j++) {
-                        if((framework_o = json_object_array_get_idx(avail_frameworks_o, j)) && json_object_is_type(framework_o, json_type_string)) {
+                        if ((framework_o = json_object_array_get_idx(avail_frameworks_o, j)) && json_object_is_type(framework_o, json_type_string)) {
                             pa_idxset_put(s->idx_avail_frameworks, (void*)json_object_get_string(framework_o), NULL);
                             pa_log_debug("      framework[%d] : %s", j, json_object_get_string(framework_o));
                            }
@@ -1372,7 +1372,7 @@ static int init_stream_map (pa_stream_manager *m) {
                     pa_log_error("Get stream avail-frameworks failed");
                     goto failed;
                 }
-                pa_hashmap_put(m->stream_infos,(void*)role, s);
+                pa_hashmap_put(m->stream_infos, (void*)role, s);
             }
         }
     } else {
@@ -1406,7 +1406,7 @@ failed:
     return -1;
 }
 
-static void deinit_stream_map (pa_stream_manager *m) {
+static void deinit_stream_map(pa_stream_manager *m) {
     stream_info *s = NULL;
     volume_info *v = NULL;
     void *state = NULL;
@@ -2014,7 +2014,7 @@ static void do_notify(pa_stream_manager *m, notify_command_type_t command, strea
     case NOTIFY_COMMAND_UPDATE_ROUTE_OPTION: {
         pa_assert(user_data);
         memset(&hook_call_option_data, 0, sizeof(pa_stream_manager_hook_data_for_option));
-        s = (type == STREAM_SINK_INPUT) ? (void*)(m->cur_highest_priority.sink_input):
+        s = (type == STREAM_SINK_INPUT) ? (void*)(m->cur_highest_priority.sink_input) :
                                           (void*)(m->cur_highest_priority.source_output);
         if (s) {
             role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
@@ -2034,7 +2034,7 @@ static void do_notify(pa_stream_manager *m, notify_command_type_t command, strea
             stream_conn_info.role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
             stream_conn_info.direction = (type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
             stream_conn_info.idx = (type == STREAM_SINK_INPUT) ? ((pa_sink_input*)s)->index : ((pa_source_output*)s)->index;
-            stream_conn_info.is_connected = (command == NOTIFY_COMMAND_INFORM_STREAM_CONNECTED)?TRUE:FALSE;
+            stream_conn_info.is_connected = (command == NOTIFY_COMMAND_INFORM_STREAM_CONNECTED) ? TRUE : FALSE;
             pa_hal_manager_update_stream_connection_info(m->hal, &stream_conn_info);
         }
         break;
@@ -2080,18 +2080,18 @@ static process_stream_result_t process_stream(pa_stream_manager *m, void *stream
                     /* set sample_spec */
                     rate_str = pa_proplist_gets(req_format->plist, PA_PROP_FORMAT_RATE);
                     ch_str = pa_proplist_gets(req_format->plist, PA_PROP_FORMAT_CHANNELS);
-                    if (pa_format_info_get_prop_string(req_format, PA_PROP_FORMAT_SAMPLE_FORMAT, &format_str)==0)
+                    if (pa_format_info_get_prop_string(req_format, PA_PROP_FORMAT_SAMPLE_FORMAT, &format_str) == 0)
                         ((pa_sink_input_new_data*)stream)->sample_spec.format = pa_parse_sample_format((const char*)format_str);
                     pa_log_info("req rate(%s), req ch(%s), req format(%s)", rate_str, ch_str, format_str);
                     if (ch_str)
-                        ((pa_sink_input_new_data*)stream)->sample_spec.channels = atoi (ch_str);
+                        ((pa_sink_input_new_data*)stream)->sample_spec.channels = atoi(ch_str);
                     if (rate_str)
-                        ((pa_sink_input_new_data*)stream)->sample_spec.rate = atoi (rate_str);
+                        ((pa_sink_input_new_data*)stream)->sample_spec.rate = atoi(rate_str);
                     /* set channel map if it is not set by client */
                     if (!((pa_sink_input_new_data*)stream)->channel_map_is_set) {
                         pa_channel_map_init_auto(&(((pa_sink_input_new_data*)stream)->channel_map),
                                                 ((pa_sink_input_new_data*)stream)->sample_spec.channels, PA_CHANNEL_MAP_ALSA);
-                        pa_log_info("set default channel_map: channels(%u)",((pa_sink_input_new_data*)stream)->channel_map.channels);
+                        pa_log_info("set default channel_map: channels(%u)", ((pa_sink_input_new_data*)stream)->channel_map.channels);
                         ((pa_sink_input_new_data*)stream)->channel_map_is_set = TRUE;
                     }
                 }
@@ -2425,7 +2425,7 @@ static pa_hook_result_t sink_input_state_changed_cb(pa_core *core, pa_sink_input
     state = pa_sink_input_get_state(i);
     pa_log_info("start sink_input_state_changed_cb(), sink-input(%p), state(%d)", i, state);
 
-    switch(state) {
+    switch (state) {
     case PA_SINK_INPUT_CORKED: {
         process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, FALSE);
         break;
@@ -2450,7 +2450,7 @@ static pa_hook_result_t sink_input_move_start_cb(pa_core *core, pa_sink_input *i
     if (core->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    pa_log_debug ("sink_input_move_start_cb, i(%p, index:%u)", i, i->index);
+    pa_log_debug("sink_input_move_start_cb, i(%p, index:%u)", i, i->index);
 
     set_volume_mute_by_idx(m, i->index, STREAM_SINK_INPUT, TRUE);
 
@@ -2465,7 +2465,7 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *
     if (core->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    pa_log_debug ("sink_input_move_finish_cb, i(%p, index:%u)", i, i->index);
+    pa_log_debug("sink_input_move_finish_cb, i(%p, index:%u)", i, i->index);
 
     set_volume_mute_by_idx(m, i->index, STREAM_SINK_INPUT, FALSE);
 
@@ -2518,7 +2518,7 @@ static pa_hook_result_t source_output_state_changed_cb(pa_core *core, pa_source_
     state = pa_source_output_get_state(o);
     pa_log_debug("start source_output_state_changed_cb(), source-output(%p), state(%d)", o, state);
 
-    switch(state) {
+    switch (state) {
     case PA_SOURCE_OUTPUT_CORKED: {
         process_stream(m, o, STREAM_SOURCE_OUTPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, FALSE);
         break;
@@ -2542,7 +2542,7 @@ static pa_hook_result_t source_output_move_start_cb(pa_core *core, pa_source_out
     if (core->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    pa_log_debug ("source_output_move_start_cb, o(%p, index:%u)", o, o->index);
+    pa_log_debug("source_output_move_start_cb, o(%p, index:%u)", o, o->index);
 
     set_volume_mute_by_idx(m, o->index, STREAM_SINK_INPUT, TRUE);
 
@@ -2557,7 +2557,7 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou
     if (core->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    pa_log_debug ("source_output_move_finish_cb, o(%p, index:%u)", o, o->index);
+    pa_log_debug("source_output_move_finish_cb, o(%p, index:%u)", o, o->index);
 
     set_volume_mute_by_idx(m, o->index, STREAM_SINK_INPUT, FALSE);
 
@@ -2744,7 +2744,7 @@ static void update_sink_or_source_as_device_change(stream_route_type_t stream_ro
     pa_source *null_source = NULL;
     pa_bool_t available = FALSE;
     pa_bool_t use_internal_codec = FALSE;
-    cached_device_list cached_prev_dev_list[MAX_CACHED_LEN] = {{NULL,0},};
+    cached_device_list cached_prev_dev_list[MAX_CACHED_LEN] = {{NULL, 0}, };
     uint32_t cnt = 0;
     pa_sink *combine_sink = NULL;
 
@@ -2768,7 +2768,7 @@ static void update_sink_or_source_as_device_change(stream_route_type_t stream_ro
         else
             source = pa_device_manager_get_source(device, DEVICE_ROLE_NORMAL);
 
-        PA_IDXSET_FOREACH (s, streams, s_idx) { /* streams: core->source_outputs/core->sink_inputs */
+        PA_IDXSET_FOREACH(s, streams, s_idx) { /* streams: core->source_outputs/core->sink_inputs */
             if (!pa_stream_manager_get_route_type(s, FALSE, stream_type, &route_type) && (route_type == stream_route_type)) {
                 role = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_ROLE);
                 pa_log_debug("  -- idx(%u), route_type(%d), role(%s)", s_idx, route_type, role);
@@ -2869,7 +2869,7 @@ static void update_sink_or_source_as_device_change(stream_route_type_t stream_ro
 
         /* set device state to deactivated */
         if (cnt) {
-            PA_IDXSET_FOREACH (s, streams, s_idx) { /* streams: core->source_outputs/core->sink_inputs */
+            PA_IDXSET_FOREACH(s, streams, s_idx) { /* streams: core->source_outputs/core->sink_inputs */
                 if ((cur_device_type = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV))) {
                     for (cnt = 0; cached_prev_dev_list[cnt].device_type; cnt++) {
                         pa_log_warn("  -- cur_device(%s), cached_device(%s)", cur_device_type, cached_prev_dev_list[cnt].device_type);
@@ -2899,7 +2899,7 @@ static void update_sink_or_source_as_device_change(stream_route_type_t stream_ro
     } else if (stream_route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
         pa_log_info("[SM][UPDATE_SINK_SOURCE][EXT] deivce_type(%s), is_connected(%d))", device_type, is_connected);
         if (!is_connected) {
-            PA_IDXSET_FOREACH (s, streams, s_idx) { /* streams: source->outputs/sink->inputs */
+            PA_IDXSET_FOREACH(s, streams, s_idx) { /* streams: source->outputs/sink->inputs */
                 if (!pa_stream_manager_get_route_type(s, FALSE, stream_type, &route_type) && route_type == stream_route_type) {
                     if (stream_type == STREAM_SOURCE_OUTPUT) {
                         /* move it to null source if this role is for external device */
@@ -2954,7 +2954,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_device_
     if (!use_internal_codec && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
         if ((sink = pa_device_manager_get_sink(data->device, DEVICE_ROLE_NORMAL)))
             update_sink_or_source_as_device_change(STREAM_ROUTE_TYPE_MANUAL_EXT, sink->inputs,
-                                                   STREAM_SINK_INPUT,data->device, data->is_connected, m);
+                                                   STREAM_SINK_INPUT, data->device, data->is_connected, m);
         else
             pa_log_error("[SM][CONN] could not get sink");
     }
@@ -2979,7 +2979,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_device_
         if (!pa_stream_manager_get_route_type(m->cur_highest_priority.source_output, FALSE, STREAM_SOURCE_OUTPUT, &route_type)) {
             if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
                 if (use_internal_codec) {
-                    PA_IDXSET_FOREACH (s, m->cur_highest_priority.source_output->source->outputs, s_idx) {
+                    PA_IDXSET_FOREACH(s, m->cur_highest_priority.source_output->source->outputs, s_idx) {
                         if (!data->is_connected && !pa_stream_manager_get_route_type(s, FALSE, STREAM_SOURCE_OUTPUT, &route_type) &&
                             ((route_type == STREAM_ROUTE_TYPE_AUTO) || (route_type == STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED))) {
                             /* remove activated device info. if it has the AUTO route type */
@@ -3003,7 +3003,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_device_
         if (!pa_stream_manager_get_route_type(m->cur_highest_priority.sink_input, FALSE, STREAM_SINK_INPUT, &route_type)) {
             if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
                 if (use_internal_codec) {
-                    PA_IDXSET_FOREACH (s, m->cur_highest_priority.sink_input->sink->inputs, s_idx) {
+                    PA_IDXSET_FOREACH(s, m->cur_highest_priority.sink_input->sink->inputs, s_idx) {
                         if (!data->is_connected && !pa_stream_manager_get_route_type(s, FALSE, STREAM_SINK_INPUT, &route_type) &&
                             ((route_type == STREAM_ROUTE_TYPE_AUTO) || (route_type == STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED))) {
                             /* remove activated device info. if it has the AUTO route type */
@@ -3045,7 +3045,7 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
         return;
     }
     name = pa_proplist_gets(client->proplist, PA_PROP_APPLICATION_NAME);
-    if (name && strncmp (name, STREAM_MANAGER_CLIENT_NAME, strlen(STREAM_MANAGER_CLIENT_NAME))) {
+    if (name && strncmp(name, STREAM_MANAGER_CLIENT_NAME, strlen(STREAM_MANAGER_CLIENT_NAME))) {
         pa_log_warn(" - this is not a client(%s) that we should take care of, skip it", name);
         return;
     }
@@ -3083,7 +3083,7 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
     }
 }
 
-static int init_ipc (pa_stream_manager *m) {
+static int init_ipc(pa_stream_manager *m) {
 #ifdef HAVE_DBUS
 #ifdef USE_DBUS_PROTOCOL
     pa_assert(m);
@@ -3126,7 +3126,7 @@ fail:
     return -1;
 }
 
-static void deinit_ipc (pa_stream_manager *m) {
+static void deinit_ipc(pa_stream_manager *m) {
     pa_assert(m);
 
 #ifdef HAVE_DBUS
@@ -3139,7 +3139,7 @@ static void deinit_ipc (pa_stream_manager *m) {
     }
 #else
     if (m->dbus_conn) {
-        if(!dbus_connection_unregister_object_path(pa_dbus_connection_get(m->dbus_conn), STREAM_MANAGER_OBJECT_PATH))
+        if (!dbus_connection_unregister_object_path(pa_dbus_connection_get(m->dbus_conn), STREAM_MANAGER_OBJECT_PATH))
             pa_log_error("failed to unregister object path");
         m->dbus_conn = NULL;
     }
@@ -3219,8 +3219,8 @@ pa_stream_manager* pa_stream_manager_init(pa_core *c) {
     m->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_CLIENT | PA_SUBSCRIPTION_MASK_SAMPLE_CACHE, (pa_subscription_cb_t)subscribe_cb, m);
 
     m->comm.comm = pa_communicator_get(c);
-    m->comm.comm_hook_device_connection_changed_slot = pa_hook_connect(pa_communicator_hook(m->comm.comm,PA_COMMUNICATOR_HOOK_DEVICE_CONNECTION_CHANGED),
-            PA_HOOK_EARLY + 10, (pa_hook_cb_t) device_connection_changed_hook_cb, m);
+    m->comm.comm_hook_device_connection_changed_slot = pa_hook_connect(pa_communicator_hook(m->comm.comm, PA_COMMUNICATOR_HOOK_DEVICE_CONNECTION_CHANGED),
+            PA_HOOK_EARLY + 10, (pa_hook_cb_t)device_connection_changed_hook_cb, m);
 
     return m;
 
index a868721190c6faab46e4ae3c7cc244d5b62bbd36..93b3c3de0dce6c52b7a8a85fb3a00f678eefa3a6 100644 (file)
@@ -9,10 +9,10 @@
       (route_type_str && !pa_atoi(route_type_str, (int32_t*)&route_type) && (route_type == STREAM_ROUTE_TYPE_AUTO))
 
 #define GET_STREAM_NEW_PROPLIST(stream, type) \
-      (type == STREAM_SINK_INPUT? ((pa_sink_input_new_data*)stream)->proplist : ((pa_source_output_new_data*)stream)->proplist)
+      (type == STREAM_SINK_INPUT ? ((pa_sink_input_new_data*)stream)->proplist : ((pa_source_output_new_data*)stream)->proplist)
 
 #define GET_STREAM_PROPLIST(stream, type) \
-      (type == STREAM_SINK_INPUT? ((pa_sink_input*)stream)->proplist : ((pa_source_output*)stream)->proplist)
+      (type == STREAM_SINK_INPUT ? ((pa_sink_input*)stream)->proplist : ((pa_source_output*)stream)->proplist)
 
 #define SINK_NAME_COMBINED            "sink_combined"
 #define SINK_NAME_NULL                "sink_null"