Re: [pulseaudio-discuss] asoundrc, configure one virtual device for both input and output

2012-06-30 Thread Tanu Kaskinen
(CC'ing alsa-devel, because I had problems with building alsa-plugins)

On Sun, 2012-07-01 at 14:16 +0900, Amar Akshat wrote:
> Help me here with two things,
> 
> 1) How do I fix this and test, as in should I clone the alsa-project,
> or download alsa code and fix and compile ? In case I have to clone
> it, can you also provide me the clone instructions.

git clone git://git.alsa-project.org/alsa-plugins.git alsa-plugins
cd alsa-plugins
./gitcompile --enable-pulseaudio

If the configure script complains about missing dependencies, you'll
need to install them.

After you have made your changes, I believe you should be able to test
them by running "make && sudo make install". I haven't tried that
myself.

I tried the "./gitcompile --enable-pulseaudio" command myself, and had
this problem:

Making all in pulse
make[2]: Entering directory `/home/tanu/dev/alsa-plugins/pulse'
/bin/bash ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..
-Wall -g -I/usr/include/alsa-D_REENTRANT -I/usr/local/include   
-D_GNU_SOURCE -g -O2 -MT ctl_pulse.lo -MD -MP -MF .deps/ctl_pulse.Tpo -c -o 
ctl_pulse.lo ctl_pulse.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -g -I/usr/include/alsa 
-D_REENTRANT -I/usr/local/include -D_GNU_SOURCE -g -O2 -MT ctl_pulse.lo -MD -MP 
-MF .deps/ctl_pulse.Tpo -c ctl_pulse.c  -fPIC -DPIC -o .libs/ctl_pulse.o
mv -f .deps/ctl_pulse.Tpo .deps/ctl_pulse.Plo
/bin/bash ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..
-Wall -g -I/usr/include/alsa-D_REENTRANT -I/usr/local/include   
-D_GNU_SOURCE -g -O2 -MT pulse.lo -MD -MP -MF .deps/pulse.Tpo -c -o pulse.lo 
pulse.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -g -I/usr/include/alsa 
-D_REENTRANT -I/usr/local/include -D_GNU_SOURCE -g -O2 -MT pulse.lo -MD -MP -MF 
.deps/pulse.Tpo -c pulse.c  -fPIC -DPIC -o .libs/pulse.o
mv -f .deps/pulse.Tpo .deps/pulse.Plo
/bin/bash ../libtool --tag=CC   --mode=link gcc -Wall -g -I/usr/include/alsa
-D_REENTRANT -I/usr/local/include   -D_GNU_SOURCE -g -O2 -module -avoid-version 
-export-dynamic -no-undefined   -o libasound_module_ctl_pulse.la -rpath 
/usr/lib/alsa-lib ctl_pulse.lo pulse.lo -lasound-L/usr/local/lib -lpulse   
-lasound 
libtool: link: gcc -shared  -fPIC -DPIC  .libs/ctl_pulse.o .libs/pulse.o   
-L/usr/local/lib /usr/local/lib/libpulse.so -lasound  -O2   -pthread 
-Wl,-soname -Wl,libasound_module_ctl_pulse.so -o 
.libs/libasound_module_ctl_pulse.so
/bin/sed: can't read /usr/lib/x86_64-linux-gnu/libsndfile.la: No such file or 
directory
libtool: link: `/usr/lib/x86_64-linux-gnu/libsndfile.la' is not a valid libtool 
archive
make[2]: *** [libasound_module_ctl_pulse.la] Error 1
make[2]: Leaving directory `/home/tanu/dev/alsa-plugins/pulse'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tanu/dev/alsa-plugins'
make: *** [all] Error 2

Debian doesn't ship libsndfile.la, so I tried installing libsndfile from
source. That didn't help at all. I eventually figured that since the
alsa build system doesn't reference libsndfile at all, libpulse must
somehow have a reference to /usr/lib/x86_64-linux-gnu/libsndfile.la
(even though my system has never had that file installed). I rebuilt
pulseaudio and installed it, and now it works (apparently because the
rebuilt version references the version of libsndfile that was built from
source, which includes libsndfile.la, instead of referencing the system
version of libsndfile).

Does anyone know if the build system of alsa-plugins could be improved
so that it doesn't use any external .la files when linking?

> 2) and after my modifications, my config in asoundrc should look like this ?
> 
> pcm.pulse_dev1 {
>   type pulse
>   source alsa_input.pci-_00_1b.0.analog-stereo
>   sink alsa_output.pci-_00_1b.0.analog-mono
> }

Yes.

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] asoundrc, configure one virtual device for both input and output

2012-06-30 Thread Amar Akshat
Help me here with two things,

1) How do I fix this and test, as in should I clone the alsa-project,
or download alsa code and fix and compile ? In case I have to clone
it, can you also provide me the clone instructions.

2) and after my modifications, my config in asoundrc should look like this ?

pcm.pulse_dev1 {
  type pulse
  source alsa_input.pci-_00_1b.0.analog-stereo
  sink alsa_output.pci-_00_1b.0.analog-mono
}



On Sat, Jun 30, 2012 at 5:38 PM, Tanu Kaskinen  wrote:
> On Sat, 2012-06-30 at 17:04 +0900, Amar Akshat wrote:
>> On Sat, Jun 30, 2012 at 4:47 PM, Tanu Kaskinen  wrote:
>> > Is the GUI in a different process than the sip stack? If yes, then the
>> > environment variables have to be set by the sip stack. Are you able to
>> > alter the sip stack, or are you only doing the GUI part?
>> >
>>
>> I only handle the GUI part - the sip-stack is a 3rd party software.
>
> You didn't answer my question about the process separation - do you use
> the sip stack as a library or is it a separate process?
>
> If it's a separate process, then the cleanest solution would certainly
> be to fix the pulse plugin. Would you be interested in doing that? It
> shouldn't be hard at all. The code can be seen here:
> git.alsa-project.org/?p=alsa-plugins.git;a=blob;f=pulse/pcm_pulse.c
>
> The "device" parameter is parsed in SND_PCM_PLUGIN_DEFINE_FUNC().
> Parsing "sink" and "source" can be done in the same way. The "device"
> parameter is used in pulse_prepare(). You would use the "sink" and
> "source" in the same place.
>
> --
> Tanu
>



-- 

Thank you...

Amar Akshat (アマール)

 "Walking on water and developing software from a specification are
easy if both are frozen."
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] add a new log target that enables to create new log file if it exists

2012-06-30 Thread Deng Zhengrong
---
 src/daemon/cmdline.c |4 ++--
 src/daemon/daemon-conf.c |   33 +
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index 2c4c4b5..8fffda1 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -141,7 +141,7 @@ void pa_cmdline_help(const char *argv0) {
"this time passed\n"
"  --log-level[=LEVEL]   Increase or set verbosity 
level\n"
"  -vIncrease the verbosity 
level\n"
-   "  --log-target={auto,syslog,stderr,file:PATH}\n"
+   "  --log-target={auto,syslog,stderr,file:PATH,newfile:PATH}\n"
"Specify the log target\n"
"  --log-meta[=BOOL] Include code location in 
log messages\n"
"  --log-time[=BOOL] Include timestamps in log 
messages\n"
@@ -315,7 +315,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char 
*const argv [], int *d
 
 case ARG_LOG_TARGET:
 if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
-pa_log(_("Invalid log target: use either 'syslog', 
'stderr' or 'auto' or a valid file name 'file:'."));
+pa_log(_("Invalid log target: use either 'syslog', 
'stderr' or 'auto' or a valid file name 'file:', 'newfile:'."));
 goto fail;
 }
 break;
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index dd2e7b6..74ae26d 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -176,6 +176,8 @@ void pa_daemon_conf_free(pa_daemon_conf *c) {
 pa_xfree(c);
 }
 
+#define PA_LOG_MAX_SUFFIX_NUMBER 100
+
 int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
 pa_assert(c);
 pa_assert(string);
@@ -203,6 +205,37 @@ int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const 
char *string) {
 printf("Failed to open target file %s, error : %s\n", file_path, 
pa_cstrerror(errno));
 return -1;
 }
+} else if (pa_startswith(string, "newfile:")) {
+char file_path[512];
+int log_fd;
+int version = 0;
+int left_size;
+char *p;
+
+pa_strlcpy(file_path, string + 8, sizeof(file_path));
+
+left_size = sizeof(file_path) - strlen(file_path);
+p = file_path + strlen(file_path);
+
+do {
+memset(p, 0, left_size);
+
+if (version > 0)
+pa_snprintf(p, left_size, ".%d", version);
+} while (++version <= PA_LOG_MAX_SUFFIX_NUMBER &&
+ (log_fd = open(file_path, O_RDWR|O_TRUNC|O_CREAT|O_EXCL, 
S_IRUSR | S_IWUSR)) < 0);
+
+if (version > PA_LOG_MAX_SUFFIX_NUMBER) {
+memset(p, 0, left_size);
+printf("Tried to open target files '%s', '%s.1', '%s.2' ... 
'%s.%d', but all failed.\n",
+   file_path, file_path, file_path, file_path, 
PA_LOG_MAX_SUFFIX_NUMBER - 1);
+return -1;
+} else {
+printf("Opened target file %s\n", file_path);
+c->auto_log_target = 0;
+c->log_target = PA_LOG_FD;
+pa_log_set_fd(log_fd);
+}
 } else
 return -1;
 
-- 
1.7.7.6

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] man: Add latency offset documentation to the cli syntax.

2012-06-30 Thread Tanu Kaskinen
On Thu, 2012-06-28 at 15:02 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelić)" 
> 
> The new latency offset command is now documented in the
> pulse-cli-syntax man page.
> ---
>  man/pulse-cli-syntax.5.xml.in | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/man/pulse-cli-syntax.5.xml.in b/man/pulse-cli-syntax.5.xml.in
> index 9d3f278..9bd59d1 100644
> --- a/man/pulse-cli-syntax.5.xml.in
> +++ b/man/pulse-cli-syntax.5.xml.in
> @@ -161,6 +161,11 @@ USA.
>  
>  
>  
> +  set-port-latency-offset card-index|card-name 
> port-name offset 
> +  Change the latency offset of a port belonging to the 
> specified card
> +
> +
> +
>suspend-sink|suspend-source index|name 
> boolean
>Suspend (i.e. disconnect from the underlying hardware) a 
> sink
>(resp. source).

Thanks, pushed.

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2 0/2] Protocol extension for the latency offset

2012-06-30 Thread Tanu Kaskinen
On Thu, 2012-06-28 at 15:00 +0200, poljar (Damir Jelić) wrote:
> This is the second version of the protocol extension patch for the latency 
> offset. 
> This version has updated the type and fixed Tanu's complaints
> 
> The sink and source infos don't list the latency offset anymore.

Both patches pushed. Thanks!

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] introspect: Add functions to handle the latency offset.

2012-06-30 Thread Tanu Kaskinen
On Thu, 2012-06-28 at 15:00 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelic)" 
> 
> This includes updating the native protocol and the client API.
> A new command was added to allow setting the latency offset.
> 
> Also the card list command now shows the latency offset if there
> are ports available.
> 
> Update protocol to 27.

Looks very good. Will push soon. I did one change, described below:

> +static void command_set_port_latency_offset(pa_pdispatch *pd, uint32_t 
> command, uint32_t tag, pa_tagstruct *t, void *userdata) {
> +pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
> +const char *port_name, *card_name;
> +uint32_t idx = PA_INVALID_INDEX;
> +int64_t offset;
> +pa_card *card = NULL;
> +pa_device_port *port = NULL;
> +
> +pa_native_connection_assert_ref(c);
> +pa_assert(t);
> +
> +if (pa_tagstruct_getu32(t, &idx) < 0 ||
> +pa_tagstruct_gets(t, &card_name) < 0 ||
> +pa_tagstruct_gets(t, &port_name) < 0 ||
> +pa_tagstruct_gets64(t, &offset) < 0 ||
> +!pa_tagstruct_eof(t)) {
> +protocol_error(c);
> +}
> +
> +CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
> +CHECK_VALIDITY(c->pstream, !card_name || 
> pa_namereg_is_valid_name(card_name), tag, PA_ERR_INVALID);

> +CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || card_name, tag, 
> PA_ERR_INVALID);
> +CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !card_name, tag, 
> PA_ERR_INVALID);
> +CHECK_VALIDITY(c->pstream, !card_name || idx == PA_INVALID_INDEX, tag, 
> PA_ERR_INVALID);

I claim that the last check is redundant. There are two error cases that
need to be caught: when card_name is NULL and idx is INVALID (caught by
the first check), and when card_name is not NULL and idx is not INVALID
(caught by both the second and third checks).

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Fix spelling of separated: s, sepera, separa, g

2012-06-30 Thread Tanu Kaskinen
On Sat, 2012-06-30 at 10:06 +0200, Paul Menzel wrote:
> Dear PulseAudio folks,
> 
> 
> could you please apply the patch.

Done, thanks for the patch!

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/2] card-restore: Add the ability to save and restore the latency offset.

2012-06-30 Thread Tanu Kaskinen
On Thu, 2012-06-28 at 13:17 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelić)" 
> 
> module-card-restore now saves the latency offsets.
> 
> This change includes a entry version bump.
> 
> The entry now consists of a port count and a port name and offset for
> every port that belongs to the relevant card.
> ---
>  src/modules/module-card-restore.c | 90 
> ++-
>  1 file changed, 88 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/module-card-restore.c 
> b/src/modules/module-card-restore.c
> index e90e610..55589c8 100644
> --- a/src/modules/module-card-restore.c
> +++ b/src/modules/module-card-restore.c
> @@ -68,11 +68,14 @@ struct userdata {
>  pa_database *database;
>  };
>  
> -#define ENTRY_VERSION 1
> +#define ENTRY_VERSION 2
>  
>  struct entry {
>  uint8_t version;
>  char *profile;
> +uint8_t port_count;

I'd go with uint32_t. It's unlikely that 8 bits wouldn't be enough, but
I think it's still somewhat possible that some card would some day have
more than 255 ports.

> +char **port_names;
> +int64_t *port_offsets;

I'd prefer one array of structs containing the port info, instead of
multiple arrays where each item contains one field of the port info.

>  };
>  
>  static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const 
> struct timeval *t, void *userdata) {
> @@ -99,14 +102,31 @@ static void trigger_save(struct userdata *u) {
>  
>  static struct entry* entry_new(void) {
>  struct entry *r = pa_xnew0(struct entry, 1);
> +
>  r->version = ENTRY_VERSION;
> +r->port_count = 0;
> +r->port_names = NULL;
> +r->port_offsets = NULL;
> +

These changes can be dropped, because the entry is already zeroed.

>  return r;
>  }
>  
>  static void entry_free(struct entry* e) {
> +int i;

I'd prefer unsigned for variables that are inherently unsigned in
nature, like array indexes. This is such a minor thing that if you are
at all against the change, don't do it.

> +
>  pa_assert(e);
>  
>  pa_xfree(e->profile);
> +
> +if (e->port_count > 0)
> +for (i = 0; i < e->port_count; i++)
> +pa_xfree(e->port_names[i]);
> +
> +if (e->port_names)
> +pa_xfree(e->port_names);
> +if (e->port_offsets)
> +pa_xfree(e->port_offsets);
> +
>  pa_xfree(e);
>  }
>  
> @@ -114,6 +134,7 @@ static pa_bool_t entry_write(struct userdata *u, const 
> char *name, const struct
>  pa_tagstruct *t;
>  pa_datum key, data;
>  pa_bool_t r;
> +int i;

"int" -> "unsigned"

>  
>  pa_assert(u);
>  pa_assert(name);
> @@ -122,6 +143,12 @@ static pa_bool_t entry_write(struct userdata *u, const 
> char *name, const struct
>  t = pa_tagstruct_new(NULL, 0);
>  pa_tagstruct_putu8(t, e->version);
>  pa_tagstruct_puts(t, e->profile);
> +pa_tagstruct_putu8(t, e->port_count);
> +
> +for (i = 0; i < e->port_count; i++) {
> +pa_tagstruct_puts(t, e->port_names[i]);
> +pa_tagstruct_puts64(t, e->port_offsets[i]);
> +}
>  
>  key.data = (char *) name;
>  key.size = strlen(name);
> @@ -177,6 +204,8 @@ static struct entry* entry_read(struct userdata *u, const 
> char *name) {
>  struct entry *e = NULL;
>  pa_tagstruct *t = NULL;
>  const char* profile;
> +const char *port_name = NULL;
> +int64_t port_offset = 0;

These could be declared later, because they are not needed at this
scope.

>  
>  pa_assert(u);
>  pa_assert(name);
> @@ -201,6 +230,28 @@ static struct entry* entry_read(struct userdata *u, 
> const char *name) {
>  
>  e->profile = pa_xstrdup(profile);
>  
> +if (e->version >= 2) {
> +int i;

"int" -> "unsigned"

> +
> +pa_tagstruct_getu8(t, &e->port_count);

The return value must be checked.

> +
> +if (e->port_count > 0) {
> +e->port_names = pa_xnew(char*, e->port_count);
> +e->port_offsets = pa_xnew(int64_t, e->port_count);
> +
> +for (i = 0; i < e->port_count; i++) {
> +if (pa_tagstruct_gets(t, &port_name) < 0 ||
> +pa_tagstruct_gets64(t, &port_offset) < 0) {
> +e->port_count = i;
> +goto fail;
> +}
> +
> +e->port_names[i] = pa_xstrdup(port_name);
> +e->port_offsets[i] = port_offset;
> +}
> +}
> +}
> +
>  if (!pa_tagstruct_eof(t))
>  goto fail;
>  
> @@ -237,6 +288,10 @@ fail:
>  static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, 
> uint32_t idx, void *userdata) {
>  struct userdata *u = userdata;
>  struct entry *entry, *old;
> +void *state;

Can be declared later.

> +int i = 0;

"int" -> "unsigned"

> +pa_bool_t dirty = false;
> +pa_device_port *p;

These can be declared later. Also, you should use "FALSE" instead of
"false". (We could start a discussion about deprecating pa_bool_t and
starting

[pulseaudio-discuss] Transitioning from pa_bool_t to C99 bool

2012-06-30 Thread Tanu Kaskinen
Hi,

We handle booleans with these definitions:

/* This type is not intended to be used in exported APIs! Use classic "int" 
there! */
#ifdef HAVE_STD_BOOL
typedef bool pa_bool_t;
#else
typedef int pa_bool_t;
#endif

#ifndef FALSE
#define FALSE ((pa_bool_t) 0)
#endif

#ifndef TRUE
#define TRUE (!FALSE)
#endif

As far as I know, the "bool" data type is a feature of C99, and we also
rely on other other C99 features, so I don't think there's any benefit
in having the HAVE_STD_BOOL check, or compatibility problems if we drop
the check. We could define pa_bool_t as bool unconditionally. And if we
do that, then we could as well start using bool directly instead of
wrapping it in pa_bool_t.

Therefore, I propose that we deprecate pa_bool_t (I have a feeling that
someone has proposed that already before, but that discussion didn't go
anywhere). My proposal for the transition strategy is that pa_bool_t is
kept for now, but it would always be defined as bool. New boolean
variables should not use pa_bool_t. Old pa_bool_t uses would be
converted gradually like was done e.g. with pa_streq(). There was
recently a patch that changed all remaining strcmp() uses into
pa_streq(), and if someone wants to write a patch that converts all
pa_bool_t instances into bool in one go, that's fine for me.

What do others think?

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] card-restore: Handle reading NULL profile name from the database.

2012-06-30 Thread Tanu Kaskinen
It's assumed in a couple of places that entry_read()
initializes entry->profile to a non-NULL string. This patch
makes those assumptions hold.
---
 src/modules/module-card-restore.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/modules/module-card-restore.c 
b/src/modules/module-card-restore.c
index 1079a72..8f9434a 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -199,6 +199,9 @@ static struct entry* entry_read(struct userdata *u, const 
char *name) {
 goto fail;
 }
 
+if (!profile)
+profile = "";
+
 e->profile = pa_xstrdup(profile);
 
 if (!pa_tagstruct_eof(t))
-- 
1.7.10

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] asoundrc, configure one virtual device for both input and output

2012-06-30 Thread Tanu Kaskinen
On Sat, 2012-06-30 at 17:04 +0900, Amar Akshat wrote:
> On Sat, Jun 30, 2012 at 4:47 PM, Tanu Kaskinen  wrote:
> > Is the GUI in a different process than the sip stack? If yes, then the
> > environment variables have to be set by the sip stack. Are you able to
> > alter the sip stack, or are you only doing the GUI part?
> >
> 
> I only handle the GUI part - the sip-stack is a 3rd party software.

You didn't answer my question about the process separation - do you use
the sip stack as a library or is it a separate process?

If it's a separate process, then the cleanest solution would certainly
be to fix the pulse plugin. Would you be interested in doing that? It
shouldn't be hard at all. The code can be seen here:
git.alsa-project.org/?p=alsa-plugins.git;a=blob;f=pulse/pcm_pulse.c

The "device" parameter is parsed in SND_PCM_PLUGIN_DEFINE_FUNC().
Parsing "sink" and "source" can be done in the same way. The "device"
parameter is used in pulse_prepare(). You would use the "sink" and
"source" in the same place.

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] device-port: Send a subscription event when the offset changes.

2012-06-30 Thread Tanu Kaskinen
On Thu, 2012-06-28 at 13:17 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelić)" 
> 
> When the offset changes a subscription event should be sent to the
> relevant card.

Thanks, will push soon.

> ---
>  src/pulsecore/device-port.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
> index 46e37e2..f39fc33 100644
> --- a/src/pulsecore/device-port.c
> +++ b/src/pulsecore/device-port.c
> @@ -116,6 +116,8 @@ void pa_device_port_hashmap_free(pa_hashmap *h) {
>  
>  void pa_device_port_set_latency_offset(pa_device_port *p, pa_usec_t offset) {
>  uint32_t state;
> +pa_core *core;
> +pa_card *card;
>  
>  pa_assert(p);
>  
> @@ -139,4 +141,10 @@ void pa_device_port_set_latency_offset(pa_device_port 
> *p, pa_usec_t offset) {
>  break;
>  }
>  }
> +
> +/* Post subscriptions to the card which owns us */

This sentence doesn't make much sense. You're not pushing subscriprions,
you're sending notifications (I know that the text is copy-pasted from
elsewhere, but copy-pasting nonsense doesn't make it any less nonsense).
I've removed the comment altogether, since I think the code is clear
enough (and I intend to make it even clearer soon - I'll add a pa_card
pointer to pa_device_port so that it will be unnecessary to search the
right card).

> +pa_assert_se(core = p->core);
> +PA_IDXSET_FOREACH(card, core->cards, state)
> +if (p == pa_hashmap_get(card->ports, p->name))
> +pa_subscription_post(core, 
> PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index);
>  }

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Fix spelling of separated: s, sepera, separa, g

2012-06-30 Thread Paul Menzel
Dear PulseAudio folks,


could you please apply the patch.


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] asoundrc, configure one virtual device for both input and output

2012-06-30 Thread Amar Akshat
On Sat, Jun 30, 2012 at 4:47 PM, Tanu Kaskinen  wrote:
> On Sat, 2012-06-30 at 03:37 +0900, Amar Akshat wrote:
>> > Do you reopen the audio stream when the routing changes? I guess you
>> > have to do that, since ALSA doesn't provide a mechanism to move a live
>> > stream from one device to another. You could then set the PULSE_SINK and
>> > PULSE_SOURCE environment variables prior to opening a new stream - that
>> > way you could use just "default", and the routing would be controlled by
>> > those environment variables. I asked about reopening the streams,
>> > because the environment variables only have effect when you create a new
>> > stream.
>>
>> Thats true, my sip stack, reopens the audio stream when routing
>> changes, infact, my sip-stack creates audio stream for every call.
>> I have a doubt, when we pass "default"  as the sound device, does the
>> pulseaudio refer to PULSE_SINK and PULSE_SOURCE environment variables
>> internally to identify sink/source? If yes, then I guess setting these
>> variables can do the trick for me.
>
> Yes, libpulse uses those environment variables internally. libpulse is
> used by the "pulse" alsa plugin.
>
> Is the GUI in a different process than the sip stack? If yes, then the
> environment variables have to be set by the sip stack. Are you able to
> alter the sip stack, or are you only doing the GUI part?
>

I only handle the GUI part - the sip-stack is a 3rd party software.

> --
> Tanu
>



-- 

Thank you...

Amar Akshat (アマール)

 "Walking on water and developing software from a specification are
easy if both are frozen."
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] conf-parser: Initialize the state to zero immediately.

2012-06-30 Thread Tanu Kaskinen
On Fri, 2012-06-29 at 23:19 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelić)" 
> 
> Set the state variable immediately to zero so if we fail to open the
> configuration file we don't check an uninitialized pointer and free an
> nonexistent  proplist.

Thanks, good catch!

> ---
>  src/pulsecore/conf-parser.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
> index 10b020c..acaf7b8 100644
> --- a/src/pulsecore/conf-parser.c
> +++ b/src/pulsecore/conf-parser.c
> @@ -159,6 +159,7 @@ int pa_config_parse(const char *filename, FILE *f, const 
> pa_config_item *t, pa_p
>  int r = -1;
>  pa_bool_t do_close = !f;
>  pa_config_parser_state state;
> +pa_zero(state);
>  
>  pa_assert(filename);
>  pa_assert(t);

I prefer to not have any code before the assertion section, so I moved
the pa_zero() call after the assertions.

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] asoundrc, configure one virtual device for both input and output

2012-06-30 Thread Tanu Kaskinen
On Sat, 2012-06-30 at 03:37 +0900, Amar Akshat wrote:
> > Do you reopen the audio stream when the routing changes? I guess you
> > have to do that, since ALSA doesn't provide a mechanism to move a live
> > stream from one device to another. You could then set the PULSE_SINK and
> > PULSE_SOURCE environment variables prior to opening a new stream - that
> > way you could use just "default", and the routing would be controlled by
> > those environment variables. I asked about reopening the streams,
> > because the environment variables only have effect when you create a new
> > stream.
> 
> Thats true, my sip stack, reopens the audio stream when routing
> changes, infact, my sip-stack creates audio stream for every call.
> I have a doubt, when we pass "default"  as the sound device, does the
> pulseaudio refer to PULSE_SINK and PULSE_SOURCE environment variables
> internally to identify sink/source? If yes, then I guess setting these
> variables can do the trick for me.

Yes, libpulse uses those environment variables internally. libpulse is
used by the "pulse" alsa plugin.

Is the GUI in a different process than the sip stack? If yes, then the
environment variables have to be set by the sip stack. Are you able to
alter the sip stack, or are you only doing the GUI part?

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss