changeset 503:fe2c60ca8c98 trunk

[svn] - mms transport - summarize which transports will be built in configure
author nenolod
date Sun, 21 Jan 2007 21:45:52 -0800
parents d9fe80b35381
children 4ddafd821a25
files ChangeLog configure.ac mk/rules.mk.in src/mms/Makefile src/mms/mms.c
diffstat 5 files changed, 299 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 21 21:15:15 2007 -0800
+++ b/ChangeLog	Sun Jan 21 21:45:52 2007 -0800
@@ -1,3 +1,16 @@
+2007-01-22 05:15:15 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1090]
+  - remove broken mms code, libmms-based transport in progress
+  
+  trunk/src/wma/libffwma/Makefile |    2 
+  trunk/src/wma/libffwma/mms.c    | 1496 ----------------------------------------
+  trunk/src/wma/libffwma/mms.h    |   65 -
+  trunk/src/wma/libffwma/mmsh.c   | 1274 ----------------------------------
+  trunk/src/wma/libffwma/mmsh.h   |   53 -
+  trunk/src/wma/libffwma/mmsio.h  |   80 --
+  6 files changed, 1 insertion(+), 2969 deletions(-)
+
+
 2007-01-22 05:01:41 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1088]
   - ssl support (no idea why, but hey, we can!)
--- a/configure.ac	Sun Jan 21 21:15:15 2007 -0800
+++ b/configure.ac	Sun Jan 21 21:45:52 2007 -0800
@@ -980,9 +980,12 @@
 dnl check_hex must be UPPERCASE if any hex letters are present
 check_hex="070907"
 
-AC_MSG_CHECKING([for curl >= $check])
-
-PKG_CHECK_MODULES(CURL, [libcurl >= 7.9.7], [	CONTAINER_PLUGINS="$CONTAINER_PLUGINS curl" ], [scrobbler="no"])
+have_curl="no"
+PKG_CHECK_MODULES(CURL, [libcurl >= 7.9.7],
+[
+	CONTAINER_PLUGINS="$CONTAINER_PLUGINS curl"
+	have_curl="yes"
+], [scrobbler="no"])
 
 if test "x$scrobbler" = "xyes"; then
 	GENERAL_PLUGINS="$GENERAL_PLUGINS scrobbler"
@@ -993,6 +996,21 @@
 
 dnl *** End of Scrobbler checks ***
 
+dnl *** MMS
+
+AC_ARG_ENABLE(mms,
+[  --disable-mms           disable mms support. (default=enabled)],
+[have_mms=$enableval],
+[have_mms=yes])
+
+if test "x$ap_disable_paranormal" = "xyes"; then
+    have_mms=no
+    AC_MSG_RESULT([*** mms plugin disabled by request ***])
+else
+    have_mms=yes
+    PKG_CHECK_MODULES(MMS, [libmms >= 0.3], [CONTAINER_PLUGINS="$CONTAINER_PLUGINS mms" ], [have_mms="no"])
+fi
+
 dnl *** libparanormal checks
 
 AC_ARG_ENABLE(paranormal,
@@ -1215,6 +1233,12 @@
 echo "  Paranormal Visualization Library:       $have_paranormal"
 echo "  ProjectM (GL milkdrop):                 $have_projectm"
 echo
+echo "  Transport"
+echo "  ---------"
+echo "  stdio transport:                        yes"
+echo "  curl-based http/https:                  $have_curl"
+echo "  libmms-based mms:                       $have_mms"
+echo
 echo "  Container"
 echo "  ---------"
 echo "  Winamp PLS playlist format (pls):       yes"
--- a/mk/rules.mk.in	Sun Jan 21 21:15:15 2007 -0800
+++ b/mk/rules.mk.in	Sun Jan 21 21:45:52 2007 -0800
@@ -341,3 +341,5 @@
 XXF86VM_LIBS ?= @XXF86VM_LIBS@
 LIBPROJECTM_CFLAGS ?= @LIBPROJECTM_CFLAGS@
 LIBPROJECTM_LIBS ?= @LIBPROJECTM_LIBS@
+MMS_CFLAGS ?= @MMS_CFLAGS@
+MMS_LIBS ?= @MMS_LIBS@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mms/Makefile	Sun Jan 21 21:45:52 2007 -0800
@@ -0,0 +1,19 @@
+include ../../mk/rules.mk
+include ../../mk/init.mk
+
+OBJECTIVE_LIBS = libmms$(SHARED_SUFFIX)
+
+# XXX
+LIBDIR = $(plugindir)/$(CONTAINER_PLUGIN_DIR)
+
+SOURCES = mms.c
+
+OBJECTS = ${SOURCES:.c=.o}
+
+CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(MMS_CFLAGS) $(ARCH_DEFINES) -I../../intl -I../..
+
+CXXFLAGS = $(CFLAGS)
+
+LIBADD = $(GTK_LIBS) $(MMS_LIBS)
+
+include ../../mk/objective.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mms/mms.c	Sun Jan 21 21:45:52 2007 -0800
@@ -0,0 +1,238 @@
+/*  Audacious
+ *  Copyright (c) 2007 William Pitcock
+ *
+ *  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 <glib.h>
+
+#include <audacious/vfs.h>
+#include <audacious/plugin.h>
+#include <stdio.h>
+
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <libmms/mms.h>
+
+/*
+ * TODO:
+ *   - mmsh:// support
+ */
+
+typedef struct {
+    mms_t *mms;
+    GSList *charstack;
+} MMSHandle;
+
+VFSFile *
+mms_vfs_fopen_impl(const gchar * path,
+          const gchar * mode)
+{
+    VFSFile *file;
+    MMSHandle *handle;
+
+    if (!path || !mode)
+	return NULL;
+
+    file = g_new(VFSFile, 1);
+    handle = g_new0(MMSHandle, 1);
+
+    file->handle = handle;
+
+    if (file->handle == NULL) {
+        g_free(file);
+        file = NULL;
+    }
+
+    handle->mms = mms_connect(NULL, NULL, path, 128 * 1024);
+
+    if (handle->mms == NULL) {
+        g_free(handle);
+        g_free(file);
+        file = NULL;
+    }
+
+    return file;
+}
+
+gint
+mms_vfs_fclose_impl(VFSFile * file)
+{
+    gint ret = 0;
+
+    if (file == NULL)
+        return -1;
+
+    if (file->handle)
+    {
+        MMSHandle *handle = (MMSHandle *) file->handle;
+
+        mms_close(handle->mms);
+        g_free(handle);
+    }
+
+    return ret;
+}
+
+size_t
+mms_vfs_fread_impl(gpointer ptr,
+          size_t size,
+          size_t nmemb,
+          VFSFile * file)
+{
+    MMSHandle *handle;
+    gint ret;
+
+    if (file == NULL)
+        return 0;
+
+    handle = (MMSHandle *) file->handle;
+
+    ret = mms_read(NULL, handle->mms, ptr, size * nmemb);
+
+    if (ret < 0)
+    {
+        g_message("** mms **: errno(%d): %s", errno, strerror(errno));
+        ret = EOF;
+    }
+
+    return ret;
+}
+
+size_t
+mms_vfs_fwrite_impl(gconstpointer ptr,
+           size_t size,
+           size_t nmemb,
+           VFSFile * file)
+{
+    return -1;
+}
+
+gint
+mms_vfs_getc_impl(VFSFile *stream)
+{
+    MMSHandle *handle = (MMSHandle *) stream->handle;
+    guchar c;
+
+    if (handle->charstack != NULL)
+    {
+        c = GPOINTER_TO_UINT(handle->charstack->data);
+        handle->charstack = g_slist_remove_link(handle->charstack, handle->charstack);
+        return c;
+    }
+    else
+    {
+        mms_read(NULL, handle->mms, &c, 1);
+        return c;
+    }
+
+    return EOF;
+}
+
+gint
+mms_vfs_ungetc_impl(gint c, VFSFile *stream)
+{
+    MMSHandle *handle = (MMSHandle *) stream->handle;
+
+    handle->charstack = g_slist_append(handle->charstack, GUINT_TO_POINTER(c));
+
+    if (handle->charstack != NULL)
+        return c;
+
+    return EOF;
+}
+
+gint
+mms_vfs_fseek_impl(VFSFile * file,
+          glong offset,
+          gint whence)
+{
+    return -1;
+}
+
+void
+mms_vfs_rewind_impl(VFSFile * file)
+{
+    return;
+}
+
+glong
+mms_vfs_ftell_impl(VFSFile * file)
+{
+    MMSHandle *handle = (MMSHandle *) file->handle;
+
+    return mms_get_current_pos(handle->mms);
+}
+
+gboolean
+mms_vfs_feof_impl(VFSFile * file)
+{
+    MMSHandle *handle = (MMSHandle *) file->handle;
+
+    return (gboolean) (mms_get_current_pos(handle->mms) ==
+		       mms_get_length(handle->mms));
+}
+
+gint
+mms_vfs_truncate_impl(VFSFile * file, glong size)
+{
+    return -1;
+}
+
+VFSConstructor mms_const = {
+	"mms://",
+	mms_vfs_fopen_impl,
+	mms_vfs_fclose_impl,
+	mms_vfs_fread_impl,
+	mms_vfs_fwrite_impl,
+	mms_vfs_getc_impl,
+	mms_vfs_ungetc_impl,
+	mms_vfs_fseek_impl,
+	mms_vfs_rewind_impl,
+	mms_vfs_ftell_impl,
+	mms_vfs_feof_impl,
+	mms_vfs_truncate_impl
+};
+
+static void init(void)
+{
+	vfs_register_transport(&mms_const);
+}
+
+static void cleanup(void)
+{
+#if 0
+	vfs_unregister_transport(&mms_const);
+#endif
+}
+
+LowlevelPlugin llp_mms = {
+	NULL,
+	NULL,
+	"mms:// URI Transport",
+	init,
+	cleanup,
+};
+
+LowlevelPlugin *get_lplugin_info(void)
+{
+        return &llp_mms;
+}
+