From f5f1db081e198674fb0ecab6d1e4a7b90258fce4 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Mon, 19 Sep 2016 14:20:33 +0900 Subject: [PATCH] Fix indent [Version] 5.0-95 [Profile] Common [Issue Type] Code Clean Change-Id: I442b29170e395a4dca1924072ecabf76270d0b20 --- configure.ac | 54 ++++---- packaging/pulseaudio.spec | 2 +- src/daemon/main.c | 2 +- src/modules/alsa/alsa-ucm.c | 2 +- src/modules/alsa/module-alsa-card.c | 8 +- src/modules/echo-cancel/module-echo-cancel.c | 68 +++++----- src/modules/module-suspend-on-idle.c | 194 +++++++++++++-------------- src/pulse/ext-node-manager.c | 16 +-- src/pulse/simple.c | 14 +- src/pulse/simple.h | 2 +- src/pulsecore/ffmpeg/resample2.c | 50 +++---- src/pulsecore/log.c | 38 +++--- src/pulsecore/proplist-util.c | 19 ++- src/pulsecore/protocol-native.c | 144 ++++++++++---------- src/pulsecore/sink-input.c | 8 +- src/utils/pactl.c | 82 +++++------ 16 files changed, 352 insertions(+), 351 deletions(-) diff --git a/configure.ac b/configure.ac index bb7a368..b309ded 100644 --- a/configure.ac +++ b/configure.ac @@ -649,17 +649,17 @@ AC_SUBST(VCONF_LIBS) dnl use dlog -------------------------------------------------------------------------- AC_ARG_ENABLE(dlog, AC_HELP_STRING([--enable-dlog], [using dlog]), [ - case "${enableval}" in - yes) USE_DLOG=yes ;; - no) USE_DLOG=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-dlog) ;; - esac - ],[USE_DLOG=no]) + case "${enableval}" in + yes) USE_DLOG=yes ;; + no) USE_DLOG=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-dlog) ;; + esac +],[USE_DLOG=no]) if test "x$USE_DLOG" = "xyes"; then - PKG_CHECK_MODULES(DLOG, dlog) - AC_SUBST(DLOG_CFLAGS) - AC_SUBST(DLOG_LIBS) + PKG_CHECK_MODULES(DLOG, dlog) + AC_SUBST(DLOG_CFLAGS) + AC_SUBST(DLOG_LIBS) fi AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes") dnl end -------------------------------------------------------------------- @@ -667,12 +667,12 @@ dnl end -------------------------------------------------------------------- dnl use bt-profile-set -------------------------------------------------------------------------- AC_ARG_ENABLE(bt-profile-set, AC_HELP_STRING([--enable-bt-profile-set], [enable bt profile param]), [ - case "${enableval}" in + case "${enableval}" in yes) USE_BT_PROFILE_SET=yes ;; no) USE_BT_PROFILE_SET=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-bt-profile-set) ;; - esac - ],[USE_BT_PROFILE_SET=no]) + esac +],[USE_BT_PROFILE_SET=no]) AM_CONDITIONAL(USE_BT_PROFILE_SET, test "x$USE_BT_PROFILE_SET" = "xyes") dnl end -------------------------------------------------------------------- @@ -711,23 +711,23 @@ AS_IF([test "x$HAVE_LIBSAMPLERATE" = "x1"], AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [ AC_ARG_ENABLE(pmlock, AC_HELP_STRING([--enable-pmlock], [using Samsung power management api]), [ - case "${enableval}" in - yes) USE_PM_LOCK=yes ;; - no) USE_PM_LOCK=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmlock) ;; - esac - ],[USE_PM_LOCK=no]) + case "${enableval}" in + yes) USE_PM_LOCK=yes ;; + no) USE_PM_LOCK=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmlock) ;; + esac +],[USE_PM_LOCK=no]) AM_CONDITIONAL(USE_PM_LOCK, test "x$USE_PM_LOCK" = "xyes") #### pre-link option #### AC_ARG_ENABLE(prelink, AC_HELP_STRING([--enable-prelink], [enable pre-link feature]), [ - case "${enableval}" in - yes) USE_PRELINK=yes ;; - no) USE_PRELINK=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-prelink) ;; - esac - ],[USE_PRELINK=no]) + case "${enableval}" in + yes) USE_PRELINK=yes ;; + no) USE_PRELINK=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-prelink) ;; + esac +],[USE_PRELINK=no]) AM_CONDITIONAL([USE_PRELINK], [test "x$USE_PRELINK" = "xyes"]) #### pulseaudio-ready option #### @@ -1652,9 +1652,9 @@ AS_IF([test "x$HAVE_ESOUND" = "x1" -a "x$USE_PER_USER_ESOUND_SOCKET" = "x1"], EN AS_IF([test "x$HAVE_GCOV" = "x1"], ENABLE_GCOV=yes, ENABLE_GCOV=no) AS_IF([test "x$HAVE_LIBCHECK" = "x1"], ENABLE_TESTS=yes, ENABLE_TESTS=no) AS_IF([test "x$enable_legacy_database_entry_format" != "xno"], ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=yes, ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=no) -AS_IF([test "x$USE_DLOG" = "x1"], ENABLE_DLOG=yes, ENABLE_DLOG=no) -AS_IF([test "x$USE_PM_LOCK" = "x1"], ENABLE_PM_LOCK=yes, ENABLE_PM_LOCK=no) -AS_IF([test "x$USE_BT_PROFILE_SET" = "x1"], ENABLE_BT_PROFILE_SET=yes, ENABLE_BT_PROFILE_SET=no) +AS_IF([test "x$USE_DLOG" = "xyes"], ENABLE_DLOG=yes, ENABLE_DLOG=no) +AS_IF([test "x$USE_PM_LOCK" = "xyes"], ENABLE_PM_LOCK=yes, ENABLE_PM_LOCK=no) +AS_IF([test "x$USE_BT_PROFILE_SET" = "xyes"], ENABLE_BT_PROFILE_SET=yes, ENABLE_BT_PROFILE_SET=no) AS_IF([test "x$HAVE_BT_A2DP_APTX" = "x1"], HAVE_BT_A2DP_APTX=yes, HAVE_BT_A2DP_APTX=no) echo " diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index b27a650..512e134 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -11,7 +11,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 5.0 -Release: 94 +Release: 95 Group: Multimedia/Audio License: LGPL-2.1+ URL: http://pulseaudio.org diff --git a/src/daemon/main.c b/src/daemon/main.c index 41311fd..5ee6c85 100755 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -1171,7 +1171,7 @@ int main(int argc, char *argv[]) { #ifdef HAVE_DBUS #if defined(__TIZEN__) && defined(SYSTEM_SERVER_LOOKUP) - /* TIZEN pulseaudio is running as system mode currently, thus use SYSTEM BUS */ + /* TIZEN pulseaudio is running as system mode currently, thus use SYSTEM BUS */ if ((server_lookup = pa_dbusobj_server_lookup_new(c))) { if (!(lookup_service_bus = register_dbus_name(c, DBUS_BUS_SYSTEM, "org.PulseAudio1"))) goto finish; diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c index 9d6f9ea..30ffa2f 100644 --- a/src/modules/alsa/alsa-ucm.c +++ b/src/modules/alsa/alsa-ucm.c @@ -1391,7 +1391,7 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_ucm_config *ucm, pa_alsa_mapping *m, #ifdef __TIZEN__ ucm->core, #endif - m->device_strings[0], NULL, &try_ss, + m->device_strings[0], NULL, &try_ss, &try_map, mode, &try_period_size, &try_buffer_size, 0, NULL, NULL, exact_channels); if (pcm && !exact_channels) diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index 826e86c..9485d0d 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -687,11 +687,11 @@ int pa__init(pa_module *m) { #ifdef HAVE_UDEV fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET"); #ifdef ENABLE_UDEV_ONLY_USB - pa_log("PULSE_PROFILE_SET = %s", fn); - if (fn == NULL) { + pa_log("PULSE_PROFILE_SET = %s", fn); + if (fn == NULL) { fn = strdup ("tizen_usb.conf"); - pa_log("(new) PULSE_PROFILE_SET = %s", fn); - } + pa_log("(new) PULSE_PROFILE_SET = %s", fn); + } #endif #endif diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 8f791ce..a865c9f 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -98,8 +98,8 @@ typedef enum { } pa_echo_canceller_method_t; enum { - AEC_SET_VOLUME, - AEC_SET_DEVICE, + AEC_SET_VOLUME, + AEC_SET_DEVICE, }; #ifdef HAVE_WEBRTC @@ -1599,40 +1599,40 @@ static pa_echo_canceller_method_t get_ec_method_from_string(const char *method) } static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connection *c, uint32_t tag, pa_tagstruct *t) { - uint32_t command; - uint32_t value; - pa_tagstruct *reply = NULL; - pa_assert(p); - pa_assert(m); - pa_assert(c); - pa_assert(t); - - if (pa_tagstruct_getu32(t, &command) < 0) - goto fail; - - reply = pa_tagstruct_new(NULL, 0); - pa_tagstruct_putu32(reply, PA_COMMAND_REPLY); - pa_tagstruct_putu32(reply, tag); - - switch (command) { - case AEC_SET_VOLUME: { - pa_tagstruct_getu32(t,&value); - pa_log_debug("AEC_SET_VOLUME in echo cancel = %d",value); - break; - } - case AEC_SET_DEVICE: { - pa_tagstruct_getu32(t,&value); - pa_log_debug("AEC_SET_DEVICE in echo cancel = %d",value); - break; - } - default: - goto fail; - } - pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply); - return 0; + uint32_t command; + uint32_t value; + pa_tagstruct *reply = NULL; + pa_assert(p); + pa_assert(m); + pa_assert(c); + pa_assert(t); + + if (pa_tagstruct_getu32(t, &command) < 0) + goto fail; + + reply = pa_tagstruct_new(NULL, 0); + pa_tagstruct_putu32(reply, PA_COMMAND_REPLY); + pa_tagstruct_putu32(reply, tag); + + switch (command) { + case AEC_SET_VOLUME: { + pa_tagstruct_getu32(t,&value); + pa_log_debug("AEC_SET_VOLUME in echo cancel = %d",value); + break; + } + case AEC_SET_DEVICE: { + pa_tagstruct_getu32(t,&value); + pa_log_debug("AEC_SET_DEVICE in echo cancel = %d",value); + break; + } + default: + goto fail; + } + pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply); + return 0; fail: - return -1; + return -1; } /* Common initialisation bits between module-echo-cancel and the standalone diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c index 8350917..886fcd1 100644 --- a/src/modules/module-suspend-on-idle.c +++ b/src/modules/module-suspend-on-idle.c @@ -48,13 +48,13 @@ #include #include -#define SOCK_PATH "/tmp/pm_sock" -#define SHIFT_UNLOCK 4 -#define SHIFT_UNLOCK_PARAMETER 12 -#define SHIFT_CHANGE_STATE 8 -#define SHIFT_HOLD_KEY_BLOCK 16 -#define SHIFT_CHANGE_TIMEOUT 20 -#define TIMEOUT_RESET_BIT 0x80 +#define SOCK_PATH "/tmp/pm_sock" +#define SHIFT_UNLOCK 4 +#define SHIFT_UNLOCK_PARAMETER 12 +#define SHIFT_CHANGE_STATE 8 +#define SHIFT_HOLD_KEY_BLOCK 16 +#define SHIFT_CHANGE_TIMEOUT 20 +#define TIMEOUT_RESET_BIT 0x80 #define LCD_NORMAL 0x1 /**< NORMAL state */ #define LCD_DIM 0x2 /**< LCD dimming state */ @@ -74,10 +74,10 @@ #define PM_KEEP_TIMER 0x2 /**< keep timer for unlock */ struct pwr_msg { - pid_t pid; - unsigned int cond; - unsigned int timeout; - unsigned int timeout2; + pid_t pid; + unsigned int cond; + unsigned int timeout; + unsigned int timeout2; }; #endif /* USE_PM_LOCK */ @@ -94,11 +94,11 @@ static const char* const valid_modargs[] = { }; #ifdef USE_PM_LOCK -#define PM_TYPE_SINK 0x01 -#define PM_TYPE_SOURCE 0x02 +#define PM_TYPE_SINK 0x01 +#define PM_TYPE_SOURCE 0x02 -#define UPDATE_PM_LOCK(current,type) (current |= type) -#define UPDATE_PM_UNLOCK(current,type) (current &= ~type) +#define UPDATE_PM_LOCK(current,type) (current |= type) +#define UPDATE_PM_UNLOCK(current,type) (current &= ~type) #endif /* USE_PM_LOCK */ struct userdata { pa_core *core; @@ -140,68 +140,68 @@ struct device_info { static int send_msg(unsigned int s_bits, unsigned int timeout, unsigned int timeout2) { - int rc = 0; - int sock; - struct pwr_msg p; - struct sockaddr_un remote; - - p.pid = getpid(); - p.cond = s_bits; - p.timeout = timeout; - p.timeout2 = timeout2; - - sock = socket(AF_UNIX, SOCK_DGRAM, 0); - if (sock == -1) { - return -1; - } - - remote.sun_family = AF_UNIX; - if(strlen(SOCK_PATH) >= sizeof(remote.sun_path)) { - return -1; - } - strncpy(remote.sun_path, SOCK_PATH, sizeof(remote.sun_path)); - - rc = sendto(sock, (void *)&p, sizeof(p), 0, (struct sockaddr *)&remote, - sizeof(struct sockaddr_un)); - - close(sock); - return rc; + int rc = 0; + int sock; + struct pwr_msg p; + struct sockaddr_un remote; + + p.pid = getpid(); + p.cond = s_bits; + p.timeout = timeout; + p.timeout2 = timeout2; + + sock = socket(AF_UNIX, SOCK_DGRAM, 0); + if (sock == -1) { + return -1; + } + + remote.sun_family = AF_UNIX; + if(strlen(SOCK_PATH) >= sizeof(remote.sun_path)) { + return -1; + } + strncpy(remote.sun_path, SOCK_PATH, sizeof(remote.sun_path)); + + rc = sendto(sock, (void *)&p, sizeof(p), 0, (struct sockaddr *)&remote, + sizeof(struct sockaddr_un)); + + close(sock); + return rc; } static int pm_lock_state(unsigned int s_bits, unsigned int flag, - unsigned int timeout) + unsigned int timeout) { - switch (s_bits) { - case LCD_NORMAL: - case LCD_DIM: - case LCD_OFF: - break; - default: - return -1; - } - if (flag & GOTO_STATE_NOW) - /* if the flag is true, go to the locking state directly */ - s_bits = s_bits | (s_bits << SHIFT_CHANGE_STATE); - if (flag & HOLD_KEY_BLOCK) - s_bits = s_bits | (1 << SHIFT_HOLD_KEY_BLOCK); - - return send_msg(s_bits, timeout, 0); + switch (s_bits) { + case LCD_NORMAL: + case LCD_DIM: + case LCD_OFF: + break; + default: + return -1; + } + if (flag & GOTO_STATE_NOW) + /* if the flag is true, go to the locking state directly */ + s_bits = s_bits | (s_bits << SHIFT_CHANGE_STATE); + if (flag & HOLD_KEY_BLOCK) + s_bits = s_bits | (1 << SHIFT_HOLD_KEY_BLOCK); + + return send_msg(s_bits, timeout, 0); } static int pm_unlock_state(unsigned int s_bits, unsigned int flag) { - switch (s_bits) { - case LCD_NORMAL: - case LCD_DIM: - case LCD_OFF: - break; - default: - return -1; - } - - s_bits = (s_bits << SHIFT_UNLOCK); - s_bits = (s_bits | (flag << SHIFT_UNLOCK_PARAMETER)); - return send_msg(s_bits, 0, 0); + switch (s_bits) { + case LCD_NORMAL: + case LCD_DIM: + case LCD_OFF: + break; + default: + return -1; + } + + s_bits = (s_bits << SHIFT_UNLOCK); + s_bits = (s_bits | (flag << SHIFT_UNLOCK_PARAMETER)); + return send_msg(s_bits, 0, 0); } #endif @@ -222,14 +222,14 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval pa_sink_suspend(d->sink, true, PA_SUSPEND_IDLE); pa_core_maybe_vacuum(d->userdata->core); #ifdef USE_PM_LOCK - UPDATE_PM_UNLOCK(d->userdata->pm_state, PM_TYPE_SINK); - if(!(d->userdata->pm_state)) { - ret = pm_unlock_state(LCD_OFF, PM_SLEEP_MARGIN); - if(ret != -1) - pa_log_info("sink pm_unlock_state success [%d]", ret); - else - pa_log_error("sink pm_unlock_state failed [%d]", ret); - } + UPDATE_PM_UNLOCK(d->userdata->pm_state, PM_TYPE_SINK); + if(!(d->userdata->pm_state)) { + ret = pm_unlock_state(LCD_OFF, PM_SLEEP_MARGIN); + if(ret != -1) + pa_log_info("sink pm_unlock_state success [%d]", ret); + else + pa_log_error("sink pm_unlock_state failed [%d]", ret); + } #endif /* USE_PM_LOCK */ } @@ -241,12 +241,12 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval UPDATE_PM_UNLOCK(d->userdata->pm_state, PM_TYPE_SOURCE); if(!(d->userdata->pm_state)) { - ret = pm_unlock_state(LCD_OFF, PM_SLEEP_MARGIN); - if(ret != -1) - pa_log_info("source pm_unlock_state success [%d]", ret); - else - pa_log_error("source pm_unlock_state failed [%d]", ret); - } + ret = pm_unlock_state(LCD_OFF, PM_SLEEP_MARGIN); + if(ret != -1) + pa_log_info("source pm_unlock_state success [%d]", ret); + else + pa_log_error("source pm_unlock_state failed [%d]", ret); + } #endif /* USE_PM_LOCK */ } } @@ -277,13 +277,13 @@ static void resume(struct device_info *d) { if (d->sink) { #ifdef USE_PM_LOCK - UPDATE_PM_LOCK(d->userdata->pm_state, PM_TYPE_SINK); - ret = pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0); - if(ret != -1) { - pa_log_info("sink pm_lock_state success [%d]", ret); - } else { - pa_log_error("sink pm_lock_state failed [%d]", ret); - } + UPDATE_PM_LOCK(d->userdata->pm_state, PM_TYPE_SINK); + ret = pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0); + if(ret != -1) { + pa_log_info("sink pm_lock_state success [%d]", ret); + } else { + pa_log_error("sink pm_lock_state failed [%d]", ret); + } #endif /* USE_PM_LOCK */ pa_log_debug("Sink %s becomes busy.", d->sink->name); pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE); @@ -291,13 +291,13 @@ static void resume(struct device_info *d) { if (d->source) { #ifdef USE_PM_LOCK - UPDATE_PM_LOCK(d->userdata->pm_state, PM_TYPE_SOURCE); - ret = pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0); - if(ret != -1) { - pa_log_info("source pm_lock_state success [%d]", ret); - } else { - pa_log_error("source pm_lock_state failed [%d]", ret); - } + UPDATE_PM_LOCK(d->userdata->pm_state, PM_TYPE_SOURCE); + ret = pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0); + if(ret != -1) { + pa_log_info("source pm_lock_state success [%d]", ret); + } else { + pa_log_error("source pm_lock_state failed [%d]", ret); + } #endif /* USE_PM_LOCK */ pa_log_debug("Source %s becomes busy.", d->source->name); pa_source_suspend(d->source, false, PA_SUSPEND_IDLE); diff --git a/src/pulse/ext-node-manager.c b/src/pulse/ext-node-manager.c index 5cb3feb..ca8aff1 100644 --- a/src/pulse/ext-node-manager.c +++ b/src/pulse/ext-node-manager.c @@ -124,7 +124,7 @@ static void ext_node_manager_read_cb(pa_pdispatch *pd, uint32_t command, uint32_ memset(&i, 0, sizeof(i)); - i.props = pa_proplist_new(); + i.props = pa_proplist_new(); if (pa_tagstruct_gets(t, &i.name) < 0 || pa_tagstruct_get_proplist(t, i.props) < 0) { @@ -138,14 +138,14 @@ static void ext_node_manager_read_cb(pa_pdispatch *pd, uint32_t command, uint32_ cb(o->context, &i, 0, o->userdata); } - pa_proplist_free(i.props); + pa_proplist_free(i.props); } - /* let's send end marker */ - if (o->callback) { - pa_ext_node_manager_read_cb_t cb = (pa_ext_node_manager_read_cb_t) o->callback; - cb(o->context, &i, 1, o->userdata); - } + /* let's send end marker */ + if (o->callback) { + pa_ext_node_manager_read_cb_t cb = (pa_ext_node_manager_read_cb_t) o->callback; + cb(o->context, &i, 1, o->userdata); + } } finish: @@ -249,7 +249,7 @@ pa_operation *pa_ext_node_manager_connect_nodes( pa_operation *pa_ext_node_manager_disconnect_nodes( pa_context *c, - uint32_t conn_id, + uint32_t conn_id, pa_context_success_cb_t cb, void *userdata) { diff --git a/src/pulse/simple.c b/src/pulse/simple.c index 43d0e14..af2dd7f 100644 --- a/src/pulse/simple.c +++ b/src/pulse/simple.c @@ -105,18 +105,18 @@ static void context_state_cb(pa_context *c, void *userdata) { } static void stream_success_context_cb(pa_stream *s, int success, void *userdata) { - pa_simple *p = userdata; - pa_assert(s); - pa_assert(p); + pa_simple *p = userdata; + pa_assert(s); + pa_assert(p); p->operation_success = success; pa_threaded_mainloop_signal(p->mainloop, 0); } static void success_context_cb(pa_context *c, int success, void *userdata) { - pa_simple *p = userdata; - pa_assert(c); - pa_assert(p); + pa_simple *p = userdata; + pa_assert(c); + pa_assert(p); p->operation_success = success; pa_threaded_mainloop_signal(p->mainloop, 0); @@ -596,7 +596,7 @@ int pa_simple_get_stream_index(pa_simple *p, unsigned int *idx, int *rerror) { CHECK_DEAD_GOTO(p, rerror, unlock_and_fail); - *idx = pa_stream_get_index(p->stream); + *idx = pa_stream_get_index(p->stream); pa_threaded_mainloop_unlock(p->mainloop); return 0; diff --git a/src/pulse/simple.h b/src/pulse/simple.h index 219fbed..8fc021a 100644 --- a/src/pulse/simple.h +++ b/src/pulse/simple.h @@ -140,7 +140,7 @@ pa_simple* pa_simple_new_proplist( const pa_sample_spec *ss, /**< The sample type to use */ const pa_channel_map *map, /**< The channel map to use, or NULL for default */ const pa_buffer_attr *attr, /**< Buffering attributes, or NULL for default */ - pa_proplist *proplist, /**< Properties, or NULL for default */ + pa_proplist *proplist, /**< Properties, or NULL for default */ int *error /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */ ); /** Close and free the connection to the server. The connection object becomes invalid when this is called. */ diff --git a/src/pulsecore/ffmpeg/resample2.c b/src/pulsecore/ffmpeg/resample2.c index d71fef2..90f9669 100644 --- a/src/pulsecore/ffmpeg/resample2.c +++ b/src/pulsecore/ffmpeg/resample2.c @@ -189,9 +189,9 @@ int64_t __gettime(void) AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff) { #ifdef DEBUG_MODE - int64_t start = __gettime (); - printf("[%s][%d] out=%d, in=%d, filter_size=%d, phase_shift=%d, linear=%d, cutoff=%f\n", __func__, __LINE__, - out_rate, in_rate, filter_size, phase_shift, linear, cutoff); + int64_t start = __gettime (); + printf("[%s][%d] out=%d, in=%d, filter_size=%d, phase_shift=%d, linear=%d, cutoff=%f\n", __func__, __LINE__, + out_rate, in_rate, filter_size, phase_shift, linear, cutoff); #endif AVResampleContext *c= av_mallocz(sizeof(AVResampleContext)); double factor= FFMIN(out_rate * cutoff / in_rate, 1.0); @@ -222,29 +222,29 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, /* Check whether pre-created file is exists */ FILE* f1 = fopen(filter_data_name, "r"); if (f1) { - /* Read pre-created filter data */ - if (fread (c->filter_bank, 1, filter_bank_size, f1) != filter_bank_size) { - printf ("Error!!! Loading Filter [%s]!!!!!\n", filter_data_name); - } else { - printf ("Filter [%s] Loaded!!!!\n", filter_data_name); - } - fclose (f1); + /* Read pre-created filter data */ + if (fread (c->filter_bank, 1, filter_bank_size, f1) != filter_bank_size) { + printf ("Error!!! Loading Filter [%s]!!!!!\n", filter_data_name); + } else { + printf ("Filter [%s] Loaded!!!!\n", filter_data_name); + } + fclose (f1); } else { - /* If not exist, Create filter data */ - av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<filter_bank, 1, filter_bank_size, f2) == filter_bank_size) { - printf ("Filter data [%s] saved\n", filter_data_name); - } else { - printf ("Error!!! Writing Filter data [%s]\n", filter_data_name); - } - fclose (f2); - } else { - printf ("Error!!! Failed to open filter data file [%s]\n", filter_data_name); - } + /* If not exist, Create filter data */ + av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<filter_bank, 1, filter_bank_size, f2) == filter_bank_size) { + printf ("Filter data [%s] saved\n", filter_data_name); + } else { + printf ("Error!!! Writing Filter data [%s]\n", filter_data_name); + } + fclose (f2); + } else { + printf ("Error!!! Failed to open filter data file [%s]\n", filter_data_name); + } } #endif // PRELOAD_FILTER diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 52fcd19..21f3703 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -63,23 +63,23 @@ #ifdef USE_DLOG #include -#define DLOG_TAG "PULSEAUDIO" - -#define COLOR_BLACK 30 -#define COLOR_RED 31 -#define COLOR_GREEN 32 -#define COLOR_BLUE 34 -#define COLOR_MAGENTA 35 -#define COLOR_CYAN 36 -#define COLOR_WHITE 97 -#define COLOR_B_GRAY 100 -#define COLOR_B_RED 101 -#define COLOR_B_GREEN 102 -#define COLOR_B_YELLOW 103 -#define COLOR_B_BLUE 104 -#define COLOR_B_MAGENTA 105 -#define COLOR_B_CYAN 106 -#define COLOR_REVERSE 7 +#define DLOG_TAG "PULSEAUDIO" + +#define COLOR_BLACK 30 +#define COLOR_RED 31 +#define COLOR_GREEN 32 +#define COLOR_BLUE 34 +#define COLOR_MAGENTA 35 +#define COLOR_CYAN 36 +#define COLOR_WHITE 97 +#define COLOR_B_GRAY 100 +#define COLOR_B_RED 101 +#define COLOR_B_GREEN 102 +#define COLOR_B_YELLOW 103 +#define COLOR_B_BLUE 104 +#define COLOR_B_MAGENTA 105 +#define COLOR_B_CYAN 106 +#define COLOR_REVERSE 7 #endif #define ENV_LOG_SYSLOG "PULSE_LOG_SYSLOG" @@ -586,7 +586,7 @@ void pa_log_levelv_meta( SLOG (LOG_DEBUG, DLOG_TAG, "%s%s%s%s", timestamp, location, t, pa_strempty(bt)); break; case PA_LOG_INFO: - case PA_LOG_NOTICE: // no notice category in dlog, use info instead. + case PA_LOG_NOTICE: /* no notice category in dlog, use info instead */ SLOG (LOG_INFO, DLOG_TAG, "%s%s%s%s", timestamp, location, t, pa_strempty(bt)); break; case PA_LOG_WARN: @@ -618,7 +618,7 @@ void pa_log_levelv_meta( SLOG (LOG_DEBUG, DLOG_TAG, "\033[%dm%s%s%s%s\033[0m", COLOR_GREEN, timestamp, location, t, pa_strempty(bt)); break; case PA_LOG_INFO: - case PA_LOG_NOTICE: // no notice category in dlog, use info instead. + case PA_LOG_NOTICE: /* no notice category in dlog, use info instead */ SLOG (LOG_INFO, DLOG_TAG, "\033[%dm%s%s%s%s\033[0m", COLOR_BLUE, timestamp, location, t, pa_strempty(bt)); break; case PA_LOG_WARN: diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c index 0a8dbca..4be8484 100644 --- a/src/pulsecore/proplist-util.c +++ b/src/pulsecore/proplist-util.c @@ -292,23 +292,22 @@ char *pa_proplist_get_stream_group_extended(pa_proplist *p, const char *prefix, /* try first to get the preferred stream group, then fallback to hard coded order */ if (preferred_stream_group) { if (!strcmp(preferred_stream_group, "media.role.within.application.name")) { - if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_NAME)) && - (q = pa_proplist_gets(p, PA_PROP_MEDIA_ROLE))) { - t = pa_sprintf_malloc("%s-by-media-role-within-application-name:%s-%s", prefix, q, r); - } else { - /* make r NULL to be able to fallback to "standard" stream restore code */ + if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_NAME)) && + (q = pa_proplist_gets(p, PA_PROP_MEDIA_ROLE))) { + t = pa_sprintf_malloc("%s-by-media-role-within-application-name:%s-%s", prefix, q, r); + } else { + /* make r NULL to be able to fallback to "standard" stream restore code */ r = NULL; - } - } - else if ((r = pa_proplist_gets(p, preferred_stream_group))) { + } + } else if ((r = pa_proplist_gets(p, preferred_stream_group))) { if (!strcmp(preferred_stream_group, PA_PROP_MEDIA_ROLE)) t = pa_sprintf_malloc("%s-by-media-role:%s", prefix, r); - else if (!strcmp(preferred_stream_group, PA_PROP_APPLICATION_ID)) + else if (!strcmp(preferred_stream_group, PA_PROP_APPLICATION_ID)) t = pa_sprintf_malloc("%s-by-application-id:%s", prefix, r); else if (!strcmp(preferred_stream_group, PA_PROP_APPLICATION_NAME)) t = pa_sprintf_malloc("%s-by-application-name:%s", prefix, r); else if (!strcmp(preferred_stream_group, PA_PROP_MEDIA_NAME)) - t = pa_sprintf_malloc("%s-by-media-name:%s", prefix, r); + t = pa_sprintf_malloc("%s-by-media-name:%s", prefix, r); else t = pa_sprintf_malloc("%s-fallback:%s", prefix, r); } diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 2602068..7087223 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -4666,80 +4666,80 @@ static void command_set_default_sink_or_source(pa_pdispatch *pd, uint32_t comman #ifdef __TIZEN__ static void command_set_default_sink_by_api_bus(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { - pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); - pa_sink *sink; - pa_bool_t found = FALSE; - const char *api, *bus; - const char *api_string, *bus_string, *form_factor; - uint32_t idx; - - pa_native_connection_assert_ref(c); - pa_assert(t); - - if (pa_tagstruct_gets(t, &api) < 0 || - pa_tagstruct_gets(t, &bus) < 0 || - !pa_tagstruct_eof(t)) { - protocol_error(c); - return; - } - - CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - CHECK_VALIDITY(c->pstream, !api || pa_utf8_valid(api), tag, PA_ERR_INVALID); - CHECK_VALIDITY(c->pstream, !bus || pa_utf8_valid(bus), tag, PA_ERR_INVALID); - - pa_assert(command == PA_COMMAND_SET_DEFAULT_SINK_BY_API_BUS); - - PA_IDXSET_FOREACH(sink, c->protocol->core->sinks, idx) { - if (sink && sink->proplist) { - api_string = pa_proplist_gets(sink->proplist, "device.api"); - if (api_string) { - pa_log_debug("Found api = [%s]\n", api_string); - if (!strcmp(api, api_string)) { - bus_string = pa_proplist_gets(sink->proplist, "device.bus"); - if (bus_string) { - pa_log_debug("Found bus = [%s]\n", bus_string); - if(!strcmp(bus, bus_string)) { - pa_log_debug(" ** FOUND!!! set default sink to [%s]\n", sink->name); - found = TRUE; - break; - } else { - pa_log_debug("No string [%s] match, match with form_factor = internal\n", bus); - form_factor = pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_FORM_FACTOR ); - if (form_factor) { - if(!strcmp(form_factor, "internal")) { - pa_log_debug("Found internal device(sink) , set (%s) as default sink", sink->name); - found = TRUE; - break; - } - } - else { - pa_log_debug("This device doesn't have form factor property"); + pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); + pa_sink *sink; + pa_bool_t found = FALSE; + const char *api, *bus; + const char *api_string, *bus_string, *form_factor; + uint32_t idx; + + pa_native_connection_assert_ref(c); + pa_assert(t); + + if (pa_tagstruct_gets(t, &api) < 0 || + pa_tagstruct_gets(t, &bus) < 0 || + !pa_tagstruct_eof(t)) { + protocol_error(c); + return; + } + + CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); + CHECK_VALIDITY(c->pstream, !api || pa_utf8_valid(api), tag, PA_ERR_INVALID); + CHECK_VALIDITY(c->pstream, !bus || pa_utf8_valid(bus), tag, PA_ERR_INVALID); + + pa_assert(command == PA_COMMAND_SET_DEFAULT_SINK_BY_API_BUS); + + PA_IDXSET_FOREACH(sink, c->protocol->core->sinks, idx) { + if (sink && sink->proplist) { + api_string = pa_proplist_gets(sink->proplist, "device.api"); + if (api_string) { + pa_log_debug("Found api = [%s]\n", api_string); + if (!strcmp(api, api_string)) { + bus_string = pa_proplist_gets(sink->proplist, "device.bus"); + if (bus_string) { + pa_log_debug("Found bus = [%s]\n", bus_string); + if(!strcmp(bus, bus_string)) { + pa_log_debug(" ** FOUND!!! set default sink to [%s]\n", sink->name); + found = TRUE; + break; + } else { + pa_log_debug("No string [%s] match, match with form_factor = internal\n", bus); + form_factor = pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_FORM_FACTOR ); + if (form_factor) { + if(!strcmp(form_factor, "internal")) { + pa_log_debug("Found internal device(sink) , set (%s) as default sink", sink->name); + found = TRUE; + break; } } - } else { - pa_log_debug(" Found no bus "); - if (!strcmp(DEVICE_BUS_BUILTIN, bus)) { - pa_log_debug(" searching bus was builtin, then select this"); - found = TRUE; - break; - } - } - } else { - pa_log_debug("No string [%s] match!!!!\n", api); - } - } - - } - } - - if (!found) - sink = NULL; - - CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); - - pa_namereg_set_default_sink(c->protocol->core, sink); - - pa_pstream_send_simple_ack(c->pstream, tag); + else { + pa_log_debug("This device doesn't have form factor property"); + } + } + } else { + pa_log_debug(" Found no bus "); + if (!strcmp(DEVICE_BUS_BUILTIN, bus)) { + pa_log_debug(" searching bus was builtin, then select this"); + found = TRUE; + break; + } + } + } else { + pa_log_debug("No string [%s] match!!!!\n", api); + } + } + + } + } + + if (!found) + sink = NULL; + + CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); + + pa_namereg_set_default_sink(c->protocol->core, sink); + + pa_pstream_send_simple_ack(c->pstream, tag); } static void command_set_default_sink_for_usb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 52e93e2..999527a 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1529,8 +1529,8 @@ void pa_sink_input_set_volume_ramp( pa_cvolume_ramp_convert(ramp, &i->ramp, i->sample_spec.rate); pa_log_debug("setting volume ramp with target vol:%d and length:%ld", - i->ramp.ramps[0].target, - i->ramp.ramps[0].length); + i->ramp.ramps[0].target, + i->ramp.ramps[0].length); /* This tells the sink that volume ramp changed */ if (send_msg) @@ -1644,9 +1644,9 @@ static void pa_sink_input_cork_really(pa_sink_input *i, bool b) { pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); if (i->corked_internal == false && i->corked == false) - b = false; + b = false; else - b = true; + b = true; sink_input_set_state(i, b ? PA_SINK_INPUT_CORKED : PA_SINK_INPUT_RUNNING); } diff --git a/src/utils/pactl.c b/src/utils/pactl.c index d8921f1..8c292aa 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -1028,23 +1028,23 @@ static void source_output_toggle_mute_callback(pa_context *c, const pa_source_ou } static void node_list_callback(pa_context *c, - const pa_ext_node_manager_info *info, - int eol, - void *userdata) { + const pa_ext_node_manager_info *info, + int eol, + void *userdata) { if (!eol) { - const char *node_id = pa_proplist_gets(info->props, "index"); - if (node_id != NULL) { - printf("Node #%s (%s)\n", node_id, info->name); - printf("%s\n", pa_proplist_to_string(info->props)); - } + const char *node_id = pa_proplist_gets(info->props, "index"); + if (node_id != NULL) { + printf("Node #%s (%s)\n", node_id, info->name); + printf("%s\n", pa_proplist_to_string(info->props)); + } } else - complete_action(); + complete_action(); } static void node_connect_callback(pa_context *c, - uint32_t conne_id, - void *userdata) { + uint32_t conne_id, + void *userdata) { printf("New connection id: %d\n", conne_id); @@ -1840,8 +1840,8 @@ static void context_state_callback(pa_context *c, void *userdata) { o = pa_context_get_sample_info_list(c, get_sample_info_callback, NULL); else if (pa_streq(list_type, "cards")) o = pa_context_get_card_info_list(c, get_card_info_callback, NULL); - else if (pa_streq(list_type, "nodes")) - o = pa_ext_node_manager_read_nodes(c, node_list_callback, NULL); + else if (pa_streq(list_type, "nodes")) + o = pa_ext_node_manager_read_nodes(c, node_list_callback, NULL); else if (pa_streq(list_type, "volume-controls") || pa_streq(list_type, "mute-controls") || pa_streq(list_type, "devices") @@ -2062,18 +2062,20 @@ static void context_state_callback(pa_context *c, void *userdata) { connect_to_volume_api(); break; - case NODE_CONNECT: - pa_operation_unref(pa_ext_node_manager_connect_nodes(c, - src_node_id, - dst_node_id, - node_connect_callback, - NULL)); - break; - case NODE_DISCONNECT: - pa_operation_unref(pa_ext_node_manager_disconnect_nodes(c, conn_id, - simple_callback, - NULL)); - break; + + case NODE_CONNECT: + pa_operation_unref(pa_ext_node_manager_connect_nodes(c, + src_node_id, + dst_node_id, + node_connect_callback, + NULL)); + break; + + case NODE_DISCONNECT: + pa_operation_unref(pa_ext_node_manager_disconnect_nodes(c, conn_id, + simple_callback, + NULL)); + break; default: pa_assert_not_reached(); @@ -2717,25 +2719,25 @@ int main(int argc, char *argv[]) { } } else if (pa_streq(argv[optind], "node-connect")) { - action = NODE_CONNECT; + action = NODE_CONNECT; - if (argc != optind+3) { - pa_log(_("You have to specify a source and destination node indexes")); - goto quit; - } + if (argc != optind+3) { + pa_log(_("You have to specify a source and destination node indexes")); + goto quit; + } - src_node_id = (uint32_t) atoi(argv[optind+1]); - dst_node_id = (uint32_t) atoi(argv[optind+2]); + src_node_id = (uint32_t) atoi(argv[optind+1]); + dst_node_id = (uint32_t) atoi(argv[optind+2]); - } else if (pa_streq(argv[optind], "node-disconnect")) { - action = NODE_DISCONNECT; + } else if (pa_streq(argv[optind], "node-disconnect")) { + action = NODE_DISCONNECT; - if (argc != optind+2) { - pa_log(_("You have to specify a connection id")); - goto quit; - } + if (argc != optind+2) { + pa_log(_("You have to specify a connection id")); + goto quit; + } - conn_id = (uint32_t) atoi(argv[optind+1]); + conn_id = (uint32_t) atoi(argv[optind+1]); } else if (pa_streq(argv[optind], "set-volume-control-volume")) { action = SET_VOLUME_CONTROL_VOLUME; @@ -2789,7 +2791,7 @@ int main(int argc, char *argv[]) { goto quit; } - } else if (pa_streq(argv[optind], "help")) { + } else if (pa_streq(argv[optind], "help")) { help(bn); ret = 0; goto quit; -- 2.7.4