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 --------------------------------------------------------------------
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 --------------------------------------------------------------------
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 ####
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 "
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
#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;
#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)
#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
} pa_echo_canceller_method_t;
enum {
- AEC_SET_VOLUME,
- AEC_SET_DEVICE,
+ AEC_SET_VOLUME,
+ AEC_SET_DEVICE,
};
#ifdef HAVE_WEBRTC
}
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
#include <errno.h>
#include <linux/limits.h>
-#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 */
#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 */
};
#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;
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
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 */
}
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 */
}
}
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);
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);
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) {
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:
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) {
}
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);
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;
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. */
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);
/* 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_SHIFT, WINDOW_TYPE);
-
- /* Save filter data */
- FILE* f2 = fopen(filter_data_name, "w");
- if (f2) {
- if (fwrite(c->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_SHIFT, WINDOW_TYPE);
+
+ /* Save filter data */
+ FILE* f2 = fopen(filter_data_name, "w");
+ if (f2) {
+ if (fwrite(c->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
#ifdef USE_DLOG
#include <dlog.h>
-#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"
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:
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:
/* 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);
}
#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) {
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)
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);
}
}
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);
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")
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();
}
} 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;
goto quit;
}
- } else if (pa_streq(argv[optind], "help")) {
+ } else if (pa_streq(argv[optind], "help")) {
help(bn);
ret = 0;
goto quit;