Import libmms from oldpackages

This commit is contained in:
Ted Hess 2014-07-17 16:52:21 -04:00
parent 55a2b51764
commit 55eeda5981
2 changed files with 166 additions and 0 deletions

65
libs/libmms/Makefile Normal file
View File

@ -0,0 +1,65 @@
#
# Copyright (C) 2010-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libmms
PKG_VERSION:=0.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/libmms
PKG_MD5SUM:=650ad04a4c8bd79246390b81b29680b6
PKG_LICENSE:=LGPLv2.1
PKG_LICENSE_FILES:=COPYING.LIB
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/libmms
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+glib2
TITLE:=MMS stream protocol library
URL:=http://libmms.sourceforge.net
endef
define Package/libmms/description
LibMMS is a common library for parsing mms:// and mmsh:// type network streams.
These are commonly used to stream Windows Media Video content over the web.
LibMMS itself is only for receiving MMS stream,
it doesn't handle sending at all.
endef
TARGET_CFLAGS += $(FPIC)
define Build/Configure
(cd $(PKG_BUILD_DIR); ./autogen.sh );
$(call Build/Configure/Default)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libmms $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmms.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
$(1)/usr/lib/pkgconfig
endef
define Package/libmms/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmms.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libmms))

View File

@ -0,0 +1,101 @@
diff -burN libmms-0.6.original/src/mms.c libmms-0.6.modified/src/mms.c
--- libmms-0.6.original/src/mms.c 2010-05-31 12:13:04.000000000 +0200
+++ libmms-0.6.modified/src/mms.c 2012-06-25 12:44:06.000000000 +0200
@@ -40,7 +40,6 @@
#include <errno.h>
#include <stdlib.h>
#include <time.h>
-#include <iconv.h>
/********** logging **********/
#define lprintf(...) if (getenv("LIBMMS_DEBUG")) fprintf(stderr, __VA_ARGS__)
@@ -447,17 +446,21 @@
return 1;
}
-static int string_utf16(iconv_t url_conv, char *dest, char *src, int dest_len)
+static int string_utf16(char *dest, char *src, int dest_len)
{
char *ip = src, *op = dest;
size_t ip_len = strlen(src);
- size_t op_len = dest_len - 2; /* reserve 2 bytes for 0 termination */
- if (iconv(url_conv, &ip, &ip_len, &op, &op_len) == (size_t)-1) {
+ if (2 * ip_len + 2 > dest_len) {
lprintf("mms: Error converting uri to unicode: %s\n", strerror(errno));
return 0;
}
+ while (ip_len--) {
+ *op++ = *ip++;
+ *op++ = 0x00;
+ }
+
/* 0 terminate the string */
*op++ = 0;
*op++ = 0;
@@ -1012,7 +1015,6 @@
*/
/* FIXME: got somewhat broken during xine_stream_t->(void*) conversion */
mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth) {
- iconv_t url_conv = (iconv_t)-1;
mms_t *this;
int res;
uint32_t openid;
@@ -1071,12 +1073,6 @@
goto fail;
}
- url_conv = iconv_open("UTF-16LE", "UTF-8");
- if (url_conv == (iconv_t)-1) {
- lprintf("mms: could not get iconv handle to convert url to unicode\n");
- goto fail;
- }
-
/*
* let the negotiations begin...
*/
@@ -1088,7 +1084,7 @@
mms_gen_guid(this->guid);
sprintf(this->str, "NSPlayer/7.0.0.1956; {%s}; Host: %s", this->guid,
this->host);
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos, this->str,
+ res = string_utf16(this->scmd_body + command_buffer.pos, this->str,
CMD_BODY_LEN - command_buffer.pos);
if(!res)
goto fail;
@@ -1117,7 +1113,7 @@
mms_buffer_put_32 (&command_buffer, 0x00000000);
mms_buffer_put_32 (&command_buffer, 0x00989680);
mms_buffer_put_32 (&command_buffer, 0x00000002);
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
+ res = string_utf16(this->scmd_body + command_buffer.pos,
"\\\\192.168.0.129\\TCP\\1037",
CMD_BODY_LEN - command_buffer.pos);
if(!res)
@@ -1156,7 +1152,7 @@
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
+ res = string_utf16(this->scmd_body + command_buffer.pos,
this->uri, CMD_BODY_LEN - command_buffer.pos);
if(!res)
goto fail;
@@ -1266,7 +1262,6 @@
}
}
- iconv_close(url_conv);
lprintf("mms: connect: passed\n");
return this;
@@ -1280,8 +1275,6 @@
gnet_uri_delete(this->guri);
if (this->uri)
free(this->uri);
- if (url_conv != (iconv_t)-1)
- iconv_close(url_conv);
free (this);
return NULL;