[asterisk-commits] dvossel: trunk r233234 - /trunk/apps/app_mp3.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 4 14:19:58 CST 2009
Author: dvossel
Date: Fri Dec 4 14:19:53 2009
New Revision: 233234
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=233234
Log:
.m3u support for Mp3Player app
(closes issue #14823)
Reported by: macli
Patches:
app_mp3.diff1 uploaded by macli (license )
Tested by: macli, dvossel
Modified:
trunk/apps/app_mp3.c
Modified: trunk/apps/app_mp3.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_mp3.c?view=diff&rev=233234&r1=233233&r2=233234
==============================================================================
--- trunk/apps/app_mp3.c (original)
+++ trunk/apps/app_mp3.c Fri Dec 4 14:19:53 2009
@@ -21,6 +21,9 @@
* \brief Silly application to play an MP3 file -- uses mpg123
*
* \author Mark Spencer <markster at digium.com>
+ *
+ * \note Add feature to play local M3U playlist file
+ * Vincent Li <mchun.li at gmail.com>
*
* \ingroup applications
*/
@@ -47,7 +50,7 @@
/*** DOCUMENTATION
<application name="MP3Player" language="en_US">
<synopsis>
- Play an MP3 file or stream.
+ Play an MP3 file or M3U playlist file or stream.
</synopsis>
<syntax>
<parameter name="Location" required="true">
@@ -56,7 +59,10 @@
</parameter>
</syntax>
<description>
- <para>Executes mpg123 to play the given location, which typically would be a filename or a URL.
+ <para>Executes mpg123 to play the given location, which typically would be a mp3 filename
+ or m3u playlist filename or a URL. Please read http://en.wikipedia.org/wiki/M3U
+ to see how M3U playlist file format is like, Example usage would be
+ exten => 1234,1,MP3Player(/var/lib/asterisk/playlist.m3u)
User can exit by pressing any key on the dialpad, or by hanging up.</para>
</description>
</application>
@@ -88,6 +94,14 @@
execl(MPG_123, "mpg123", "-q", "-s", "-b", "1024","-f", "8192", "--mono", "-r", "8000", filename, (char *)NULL);
/* As a last-ditch effort, try to use PATH */
execlp("mpg123", "mpg123", "-q", "-s", "-b", "1024", "-f", "8192", "--mono", "-r", "8000", filename, (char *)NULL);
+ }
+ else if (strstr(filename, ".m3u")) {
+ /* Most commonly installed in /usr/local/bin */
+ execl(LOCAL_MPG_123, "mpg123", "-q", "-z", "-s", "-b", "1024", "-f", "8192", "--mono", "-r", "8000", "-@", filename, (char *)NULL);
+ /* But many places has it in /usr/bin */
+ execl(MPG_123, "mpg123", "-q", "-z", "-s", "-b", "1024","-f", "8192", "--mono", "-r", "8000", "-@", filename, (char *)NULL);
+ /* As a last-ditch effort, try to use PATH */
+ execlp("mpg123", "mpg123", "-q", "-z", "-s", "-b", "1024", "-f", "8192", "--mono", "-r", "8000", "-@", filename, (char *)NULL);
}
else {
/* Most commonly installed in /usr/local/bin */
More information about the asterisk-commits
mailing list