summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-12 10:52:27 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-12 10:52:27 +0200
commitb50208c96cc68f6ae1f20d1c4d250572fb0637c4 (patch)
tree5b6903664bdfc5607407348baa0c2aa2739dcf02
parent351f99ab8d80f1c97864d8e17a88eeb00c7c9164 (diff)
added libmms plugin to stream Microsoft Media Server radio
-rw-r--r--configure.ac16
-rw-r--r--plugins/mms/Makefile.am9
-rw-r--r--plugins/mms/mms.c138
-rw-r--r--streamer.c3
4 files changed, 165 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 0c57ba14..f9f915eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ AC_ARG_ENABLE(wildmidi, [ --disable-wildmidi disable wildmidi plugin (defa
AC_ARG_ENABLE(tta, [ --disable-tta disable tta plugin (default: enabled)], [enable_tta=$enableval], [enable_tta=yes])
AC_ARG_ENABLE(dca, [ --disable-dca disable dca (DTS audio) plugin (default: enabled)], [enable_dca=$enableval], [enable_dca=yes])
AC_ARG_ENABLE(aac, [ --disable-aac disable AAC decoder based on FAAD2 (default: enabled)], [enable_aac=$enableval], [enable_aac=yes])
+AC_ARG_ENABLE(mms, [ --disable-mms disable MMS streaming vfs plugin (default: enabled)], [enable_mms=$enableval], [enable_mms=yes])
PKG_CHECK_MODULES(DEPS, samplerate)
@@ -372,7 +373,17 @@ if test "x$enable_aac" != "xno" ; then
fi
fi
-PLUGINS_DIRS="plugins/lastfm plugins/mpgmad plugins/vorbis plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/dumb plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca plugins/aac"
+if test "x$enable_mms" != "xno" ; then
+ AC_CHECK_LIB([mms], [main], [HAVE_LIBMMS=1])
+ AM_CONDITIONAL(HAVE_LIBMMS, test $HAVE_LIBMMS)
+ if test ${HAVE_LIBMMS} ; then
+ LIBMMS_LIBS="-lmms"
+ AC_SUBST(LIBMMS_LIBS)
+ HAVE_MMS=yes
+ fi
+fi
+
+PLUGINS_DIRS="plugins/lastfm plugins/mpgmad plugins/vorbis plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/dumb plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca plugins/aac plugins/mms"
AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBISPLUGIN" = "xyes")
AM_CONDITIONAL(HAVE_FLAC, test "x$HAVE_FLACPLUGIN" = "xyes")
@@ -404,6 +415,7 @@ AM_CONDITIONAL(HAVE_WILDMIDI, test "x$HAVE_WILDMIDI" = "xyes")
AM_CONDITIONAL(HAVE_TTA, test "x$HAVE_TTA" = "xyes")
AM_CONDITIONAL(HAVE_DCA, test "x$HAVE_DCA" = "xyes")
AM_CONDITIONAL(HAVE_AAC, test "x$HAVE_AAC" = "xyes")
+AM_CONDITIONAL(HAVE_MMS, test "x$HAVE_MMS" = "xyes")
AC_SUBST(PLUGINS_DIRS)
@@ -461,6 +473,7 @@ PRINT_PLUGIN_INFO([wildmidi],[WildMidi player plugin],[test "x$HAVE_WILDMIDI" =
PRINT_PLUGIN_INFO([tta],[TTA player plugin],[test "x$HAVE_TTA" = "xyes"])
PRINT_PLUGIN_INFO([dca],[libdca (DTS Audio) player plugin],[test "x$HAVE_DCA" = "xyes"])
PRINT_PLUGIN_INFO([aac],[AAC player (m4a, aac, mp4) based on FAAD2],[test "x$HAVE_AAC" = "xyes"])
+PRINT_PLUGIN_INFO([mms],[mms streaming support],[test "x$HAVE_MMS" = "xyes"])
echo
@@ -497,6 +510,7 @@ plugins/wildmidi/Makefile
plugins/tta/Makefile
plugins/dca/Makefile
plugins/aac/Makefile
+plugins/mms/Makefile
intl/Makefile
po/Makefile.in
deadbeef.desktop
diff --git a/plugins/mms/Makefile.am b/plugins/mms/Makefile.am
new file mode 100644
index 00000000..c6a06fdb
--- /dev/null
+++ b/plugins/mms/Makefile.am
@@ -0,0 +1,9 @@
+if HAVE_MMS
+mmsdir = $(libdir)/$(PACKAGE)
+pkglib_LTLIBRARIES = mms.la
+mms_la_SOURCES = mms.c
+mms_la_LDFLAGS = -module
+
+mms_la_LIBADD = $(LDADD) $(LIBMMS_LIBS)
+AM_CFLAGS = $(CFLAGS) -std=c99
+endif
diff --git a/plugins/mms/mms.c b/plugins/mms/mms.c
new file mode 100644
index 00000000..617b16f2
--- /dev/null
+++ b/plugins/mms/mms.c
@@ -0,0 +1,138 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include "deadbeef.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <libmms/mmsx.h>
+
+static DB_functions_t *deadbeef;
+typedef struct {
+ DB_vfs_t *vfs;
+ mmsx_t *stream;
+ const mms_io_t *io;
+} MMS_FILE;
+
+static DB_vfs_t plugin;
+
+const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600,
+ 115200,262200,393216,524300,1544000,10485800};
+
+
+const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)",
+ "28.8 Kbps (Modem)", "33.6 Kbps (Modem)",
+ "34.4 Kbps (Modem)", "57.6 Kbps (Modem)",
+ "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)",
+ "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)",
+ "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL};
+
+
+
+static DB_FILE *
+mms_open (const char *fname) {
+ MMS_FILE *fp = malloc (sizeof (MMS_FILE));
+ fp->io = mms_get_default_io_impl();
+ fp->stream = mmsx_connect ((mms_io_t *)fp->io, fp, fname, 1544000);
+ if (!fp->stream) {
+ free (fp);
+ return NULL;
+ }
+ fp->vfs = &plugin;
+ return (DB_FILE*)fp;
+}
+
+static void
+mms_close (DB_FILE *stream) {
+ assert (stream);
+ mmsx_close (((MMS_FILE *)stream)->stream);
+ free (stream);
+}
+
+static size_t
+mms_read (void *ptr, size_t size, size_t nmemb, DB_FILE *stream) {
+ assert (stream);
+ assert (ptr);
+ MMS_FILE *fp = (MMS_FILE *)stream;
+ int res = mmsx_read ((mms_io_t *)fp->io, fp->stream, ptr, size * nmemb);
+ return res;
+}
+
+static int
+mms_seek (DB_FILE *stream, int64_t offset, int whence) {
+ assert (stream);
+ MMS_FILE *fp = (MMS_FILE *)stream;
+ return mmsx_seek ((mms_io_t *)fp->io, fp->stream, offset, whence);
+}
+
+static int64_t
+mms_tell (DB_FILE *stream) {
+ assert (stream);
+ return mmsx_get_current_pos (((MMS_FILE *)stream)->stream);
+}
+
+static void
+mms_rewind (DB_FILE *stream) {
+ assert (stream);
+ // FIXME
+ return;
+}
+
+static int64_t
+mms_getlength (DB_FILE *stream) {
+ assert (stream);
+ MMS_FILE *f = (MMS_FILE *)stream;
+ return mmsx_get_length (f->stream);
+}
+
+const char *
+mms_get_content_type (DB_FILE *stream) {
+ return "audio/wma";
+}
+
+static const char *scheme_names[] = { "mms://", "mmsh://", NULL };
+
+static DB_vfs_t plugin = {
+ DB_PLUGIN_SET_API_VERSION
+ .plugin.version_major = 0,
+ .plugin.version_minor = 1,
+ .plugin.type = DB_PLUGIN_VFS,
+ .plugin.name = "mms vfs",
+ .plugin.descr = "MMS streaming plugin based on libmms",
+ .plugin.author = "Alexey Yakovenko",
+ .plugin.email = "waker@users.sourceforge.net",
+ .plugin.website = "http://deadbeef.sf.net",
+ .open = mms_open,
+ .close = mms_close,
+ .read = mms_read,
+ .seek = mms_seek,
+ .tell = mms_tell,
+ .rewind = mms_rewind,
+ .getlength = mms_getlength,
+ .get_content_type = mms_get_content_type,
+ .scheme_names = scheme_names,
+ .streaming = 1
+};
+
+DB_plugin_t *
+mms_load (DB_functions_t *api) {
+ deadbeef = api;
+ return DB_PLUGIN (&plugin);
+}
+
diff --git a/streamer.c b/streamer.c
index 082ccb19..4b304c3e 100644
--- a/streamer.c
+++ b/streamer.c
@@ -586,6 +586,9 @@ streamer_set_current (playItem_t *it) {
else if (!strcmp (ct, "audio/aac")) {
plug = "ffmpeg";
}
+ else if (!strcmp (ct, "audio/wma")) {
+ plug = "ffmpeg";
+ }
}
mutex_lock (decodemutex);
streamer_file = NULL;