Re: [Jack-Devel] [PATCH] Jack-1: jack_port_by_name: REVISED

PrevNext  Index
DateWed, 18 Feb 2015 19:40:13 -0500
From Tim E. Real <[hidden] at rogers dot com>
To[hidden] at lists dot jackaudio dot org
In-Reply-ToTim E. Real Re: [Jack-Devel] [PATCH] Jack-1: jack_port_by_name: REVISED
Follow-UpPaul Davis Re: [Jack-Devel] [PATCH] Jack-1: jack_port_by_name: REVISED
Hello? Anyone home?

Paul, have you had a chance to evaluate this?

Thanks.
Tim.

On January 24, 2015 03:30:51 PM Tim E. Real wrote:
> On January 24, 2015 02:22:52 PM John Rigg wrote:
> > On Fri, Jan 23, 2015 at 08:33:51PM -0500, Tim E. Real wrote:
> > > The original message singled out Debian and variants,
> > > 
> > >  but I have seen other distros with this problem.
> > > 
> > > Which is, they don't include /usr/local/lib in /etc/ld.so.conf
> > 
> > Debian includes it in /etc/ld.so.conf.d/libc.conf. IIRC the original
> > message referred to the old (confusing) Debian package naming for jack
> > files, but that was fixed several years ago. Perhaps the Debian reference
> > should now be removed :-)
> > 
> > John
> 
> OK. Apologies, should have asked first.
> Once again I reach a wrong conclusion, where it ends up here  ;-)
> My KUbuntu didn't have the path and I've been through this before,
>  I was certain that was the source of the message.
> 
> I offer this revised straight forward, stern yet toned down patch.
> Tim.
> 
> (Your old .asoundrc examples  helped me with multiple cards. big thx.)
> 
> 
> https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix_ver_2.di
> ff
> 
> diff --git configure.ac configure.ac
> index 5c20236..aee4346 100644
> --- configure.ac
> +++ configure.ac
> @@ -8,6 +8,12 @@ dnl
>  dnl Check for existing JACK installs
>  dnl
> 
> +
> +
> +AC_ARG_ENABLE(force_install,
> +        AC_HELP_STRING([--enable-force-install],[force install CAUTION:
> Read warnings! (default=no)]),,
> +        [ enable_force_install=no ])
> +
>  AC_MSG_CHECKING([existing, conflicting JACK installs])
>  not_overwriting=0
>  installs=
> @@ -30,22 +36,24 @@ if test $not_overwriting -gt 0 ; then
>      echo
>      echo "Complete or partial JACK installs exist in:$installs"
>      echo
> -    echo "Installing this version will leave at least one of these"
> -    echo "existing installations installed and this will probably break"
> -    echo "JACK on your machine. "
> +    echo "WARNING:"
> +    echo "Installing multiple jack versions, even in different locations,"
> +    echo "could cause JACK to break unless your system is setup properly."
> +    echo "Be sure THIS installation is found first in your system's"
> +    echo "executable and library paths."
>      echo
> -    echo "Before building, you should first remove the existing JACK"
> -    echo "installation(s). "
> +    echo "Alternatively, you might be simply reinstalling THIS version."
> +    echo "Or replacing some other local version you built - BE SURE TO"
> +    echo "completely uninstall any such previous local install first !"
>      echo
> -    echo "Alternatively use ./configure --prefix=... to force overwriting"
> -    echo "the existing install."
> -    echo
> -    echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
> -    echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING
> JACK" -    echo "INSTALL. Please contact the distribution packager for JACK
> and" -    echo "ask them to fix their packaging."
> +    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to proceed,"
> +    echo "run ./configure with --enable-force-install"
>      echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
> -    exit 1
> +    echo
> +
> +    if test "x$enable_force_install" = xno; then
> +      exit 1
> +    fi
>  fi
> 
>  AC_CONFIG_AUX_DIR(config)
> diff --git include/internal.h include/internal.h
> index bf622c8..ffb1d1b 100644
> --- include/internal.h
> +++ include/internal.h
> @@ -537,7 +537,7 @@ extern jack_port_t *jack_port_by_id_int (const
> jack_client_t *client,
>  					 jack_port_id_t id, int* free);
> 
>  extern jack_port_t *jack_port_by_name_int (jack_client_t *client,
> -					   const char *port_name);
> +					   const char *port_name, int* free);
>  extern int jack_port_name_equals (jack_port_shared_t* port, const char*
> target);
> 
>  /** Get the size (in bytes) of the data structure used to store
> diff --git libjack/port.c libjack/port.c
> index 481f6e0..5ebfea3 100644
> --- libjack/port.c
> +++ libjack/port.c
> @@ -487,8 +487,16 @@ jack_port_by_id (jack_client_t *client, jack_port_id_t
> id)
>  }
> 
>  jack_port_t *
> -jack_port_by_name_int (jack_client_t *client, const char *port_name)
> +jack_port_by_name_int (jack_client_t *client, const char *port_name, int*
> free)
>  {
> +	JSList *node;
> +	for (node = client->ports; node; node = jack_slist_next (node)) {
> +		if (jack_port_name_equals(((jack_port_t *) node->data)->shared,
> port_name)) {
> +			*free = FALSE;
> +			return (jack_port_t *) node->data;
> +		}
> +	}
> +
>  	unsigned long i, limit;
>  	jack_port_shared_t *port;
> 
> @@ -497,6 +505,7 @@ jack_port_by_name_int (jack_client_t *client, const char
> *port_name)
> 
>  	for (i = 0; i < limit; i++) {
>  		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
> +			*free = TRUE;
>  			return jack_port_new (client, port[i].id,
>  					      client->engine);
>  		}
> @@ -510,6 +519,7 @@ jack_port_by_name (jack_client_t *client,  const char
> *port_name)
>  {
>  	JSList *node;
>  	jack_port_t* port;
> +	int need_free = FALSE;
>  	for (node = client->ports_ext; node; node = jack_slist_next (node)) {
>  		port = node->data;
>  		if (jack_port_name_equals (port->shared, port_name)) {
> @@ -518,10 +528,10 @@ jack_port_by_name (jack_client_t *client,  const char
> *port_name)
>  		}
>  	}
> 
> -	/* Otherwise allocate a new port structure, keep it in the
> +	/* Otherwise possibly allocate a new port structure, keep it in the
>  	 * ports_ext list for later use. */
> -	port = jack_port_by_name_int (client, port_name);
> -	if (port != NULL)
> +	port = jack_port_by_name_int (client, port_name, &need_free);
> +	if (port != NULL && need_free)
>  		client->ports_ext =
>  			jack_slist_prepend (client->ports_ext, port);
>  	return port;
> 
PrevNext  Index

1424306432.30300_0.ltw:2, <1595720.L951AtRzdM at col-desktop>