changeset 28206:678a664a79ea

Replace deprecated jack_client_new with jack_client_open.
author reimar
date Sun, 04 Jan 2009 11:51:11 +0000
parents ddbc84ded0c7
children 31489c64c2af
files DOCS/man/en/mplayer.1 libao2/ao_jack.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sun Jan 04 09:49:58 2009 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Jan 04 11:51:11 2009 +0000
@@ -2757,6 +2757,9 @@
 .IPs (no)estimate
 Estimate the audio delay, supposed to make the video playback smoother
 (default: enabled).
+.IPs (no)autostart (default: disabled)
+Automatically start jackd if necessary.
+Note that this seems unreliable and will spam stdout with server messages.
 .RE
 .PD 1
 .
--- a/libao2/ao_jack.c	Sun Jan 04 09:49:58 2009 +0000
+++ b/libao2/ao_jack.c	Sun Jan 04 11:51:11 2009 +0000
@@ -227,19 +227,25 @@
            "  name=<client name>\n"
            "    Client name to pass to JACK\n"
            "  estimate\n"
-           "    Estimates the amount of data in buffers (experimental)\n");
+           "    Estimates the amount of data in buffers (experimental)\n"
+           "  autostart\n"
+           "    Automatically start JACK server if necessary\n"
+         );
 }
 
 static int init(int rate, int channels, int format, int flags) {
   const char **matching_ports = NULL;
   char *port_name = NULL;
   char *client_name = NULL;
+  int autostart = 0;
   opt_t subopts[] = {
     {"port", OPT_ARG_MSTRZ, &port_name, NULL},
     {"name", OPT_ARG_MSTRZ, &client_name, NULL},
     {"estimate", OPT_ARG_BOOL, &estimate, NULL},
+    {"autostart", OPT_ARG_BOOL, &autostart, NULL},
     {NULL}
   };
+  jack_options_t open_options = JackUseExactName;
   int port_flags = JackPortIsInput;
   int i;
   estimate = 1;
@@ -255,7 +261,9 @@
     client_name = malloc(40);
     sprintf(client_name, "MPlayer [%d]", getpid());
   }
-  client = jack_client_new(client_name);
+  if (!autostart)
+    open_options |= JackNoStartServer;
+  client = jack_client_open(client_name, open_options, NULL);
   if (!client) {
     mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n");
     goto err_out;