[asterisk-commits] russell: trunk r98676 - /trunk/apps/app_jack.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 13 22:53:08 CST 2008


Author: russell
Date: Sun Jan 13 22:53:08 2008
New Revision: 98676

URL: http://svn.digium.com/view/asterisk?view=rev&rev=98676
Log:
Add another small option for the JACK app and JACK_HOOK function.  The 'n'
option tells JACK not to start jackd automatically if it is not already
running.  Otherwise, the default is that jackd will get started for you if
it isn't running already.

Modified:
    trunk/apps/app_jack.c

Modified: trunk/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_jack.c?view=diff&rev=98676&r1=98675&r2=98676
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Sun Jan 13 22:53:08 2008
@@ -63,7 +63,9 @@
 "    i(<name>) - Connect the output port that gets created to the specified\n" \
 "                jack input port.\n" \
 "    o(<name>) - Connect the input port that gets created to the specified\n" \
-"                jack output port.\n"
+"                jack output port.\n" \
+"    n         - Do not automatically start the JACK server if it is not already\n" \
+"                running.\n"
 
 static char *jack_app = "JACK";
 static char *jack_synopsis = 
@@ -94,6 +96,7 @@
 	double input_resample_factor;
 	unsigned int stop:1;
 	unsigned int has_audiohook:1;
+	unsigned int no_start_server:1;
 	/*! Only used with JACK_HOOK */
 	struct ast_audiohook audiohook;
 };
@@ -349,6 +352,7 @@
 {
 	const char *chan_name;
 	jack_status_t status = 0;
+	jack_options_t jack_options = JackNullOption;
 
 	ast_channel_lock(chan);
 	chan_name = ast_strdupa(chan->name);
@@ -360,11 +364,15 @@
 	if (!(jack_data->input_rb = jack_ringbuffer_create(RINGBUFFER_SIZE)))
 		return -1;
 
+	if (jack_data->no_start_server)
+		jack_options |= JackNoStartServer;
+
 	if (!ast_strlen_zero(jack_data->server_name)) {
-		jack_data->client = jack_client_open(chan_name, JackServerName, &status,
+		jack_options |= JackServerName;
+		jack_data->client = jack_client_open(chan_name, jack_options, &status,
 			jack_data->server_name);
 	} else {
-		jack_data->client = jack_client_open(chan_name, JackNullOption, &status);
+		jack_data->client = jack_client_open(chan_name, jack_options, &status);
 	}
 
 	if (status)
@@ -598,9 +606,10 @@
 }
 
 enum {
-	OPT_SERVER_NAME = (1 << 0),
-	OPT_INPUT_PORT =  (1 << 1),
-	OPT_OUTPUT_PORT = (1 << 2),
+	OPT_SERVER_NAME =    (1 << 0),
+	OPT_INPUT_PORT =     (1 << 1),
+	OPT_OUTPUT_PORT =    (1 << 2),
+	OPT_NOSTART_SERVER = (1 << 3),
 };
 
 enum {
@@ -615,6 +624,7 @@
 	AST_APP_OPTION_ARG('s', OPT_SERVER_NAME, OPT_ARG_SERVER_NAME),
 	AST_APP_OPTION_ARG('i', OPT_INPUT_PORT, OPT_ARG_INPUT_PORT),
 	AST_APP_OPTION_ARG('o', OPT_OUTPUT_PORT, OPT_ARG_OUTPUT_PORT),
+	AST_APP_OPTION('n', OPT_NOSTART_SERVER),
 END_OPTIONS );
 
 static struct jack_data *jack_data_alloc(void)
@@ -671,6 +681,8 @@
 			return -1;
 		}
 	}
+
+	jack_data->no_start_server = ast_test_flag(&options, OPT_NOSTART_SERVER) ? 1 : 0;
 
 	return 0;
 }




More information about the asterisk-commits mailing list