diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-27 00:30:07 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-27 00:30:07 +0000 |
commit | eebd41dac0b54de5232726cdeff82b607b07ff39 (patch) | |
tree | 6e841bd9e667e3d89cb560a16a57c617dd406250 /apps/app_mp3.c | |
parent | b8ced7b353629450a429447b80f3e61f8959726e (diff) |
Fix search path in app_mp3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_mp3.c')
-rwxr-xr-x | apps/app_mp3.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/apps/app_mp3.c b/apps/app_mp3.c index c8196a75f..d050d5896 100755 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -28,6 +28,7 @@ #include <pthread.h> #include <sys/time.h> +#define LOCAL_MPG_123 "/usr/local/bin/mpg123" #define MPG_123 "/usr/bin/mpg123" static char *tdesc = "Silly MP3 Application"; @@ -60,10 +61,22 @@ static int mp3play(char *filename, int fd) close(x); } /* Execute mpg123, but buffer if it's a net connection */ - if (strncmp(filename, "http://", 7)) - execl(MPG_123, MPG_123, "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL); - else - execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL); + if (strncmp(filename, "http://", 7)) { + /* Most commonly installed in /usr/local/bin */ + execl(LOCAL_MPG_123, "mpg123", "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL); + /* But many places has it in /usr/bin */ + execl(MPG_123, "mpg123", "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL); + /* As a last-ditch effort, try to use PATH */ + execlp("mpg123", "mpg123", "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL); + } + else { + /* Most commonly installed in /usr/local/bin */ + execl(MPG_123, "mpg123", "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL); + /* But many places has it in /usr/bin */ + execl(LOCAL_MPG_123, "mpg123", "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL); + /* As a last-ditch effort, try to use PATH */ + execlp("mpg123", "mpg123", "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL); + } ast_log(LOG_WARNING, "Execute of mpg123 failed\n"); return -1; } |