aboutsummaryrefslogtreecommitdiff
path: root/multimedia/mediatomb
diff options
context:
space:
mode:
authorHeinz Wiesinger <pprkut@slackbuilds.org>2013-11-03 19:35:13 +0100
committerRobby Workman <rworkman@slackbuilds.org>2013-11-04 00:46:04 -0600
commit23f6a701163591343d44ad55b36fecba20ee25f1 (patch)
tree666eff8d4a7396de6530831d04cd8beccab25799 /multimedia/mediatomb
parent1c3f749344fc820ebfff38a183b9caece401c160 (diff)
multimedia/mediatomb: Updated for version b66dc1f.
Signed-off-by: Heinz Wiesinger <pprkut@slackbuilds.org>
Diffstat (limited to 'multimedia/mediatomb')
-rw-r--r--multimedia/mediatomb/libav_0.7_support.patch64
-rw-r--r--multimedia/mediatomb/libavformat.patch52
-rw-r--r--multimedia/mediatomb/mediatomb-0.12.1-gcc46.patch10
-rw-r--r--multimedia/mediatomb/mediatomb-0.12.1-gcc47.patch120
-rw-r--r--multimedia/mediatomb/mediatomb-0.12.1-mozjs185.patch605
-rw-r--r--multimedia/mediatomb/mediatomb-mp4v2-check.patch86
-rw-r--r--multimedia/mediatomb/mediatomb.SlackBuild23
-rw-r--r--multimedia/mediatomb/mediatomb.info6
-rw-r--r--multimedia/mediatomb/samsung-mkv.patch445
9 files changed, 542 insertions, 869 deletions
diff --git a/multimedia/mediatomb/libav_0.7_support.patch b/multimedia/mediatomb/libav_0.7_support.patch
deleted file mode 100644
index e25697c5021b2..0000000000000
--- a/multimedia/mediatomb/libav_0.7_support.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-=== modified file 'src/metadata/ffmpeg_handler.cc'
---- old/src/metadata/ffmpeg_handler.cc 2010-08-25 17:07:03 +0000
-+++ new/src/metadata/ffmpeg_handler.cc 2011-05-19 04:33:32 +0000
-@@ -89,6 +89,33 @@
-
- Ref<StringConverter> sc = StringConverter::m2i();
-
-+ /* Tabs are 4 characters here */
-+ typedef struct {const char *avname; metadata_fields_t field;} mapping_t;
-+ static const mapping_t mapping[] =
-+ {
-+ {"title", M_TITLE},
-+ {"artist", M_ARTIST},
-+ {"album", M_ALBUM},
-+ {"date", M_DATE},
-+ {"genre", M_GENRE},
-+ {"comment", M_DESCRIPTION},
-+ {"track", M_TRACKNUMBER},
-+ {NULL, M_MAX},
-+ };
-+
-+ if (!pFormatCtx->metadata)
-+ return;
-+ for (const mapping_t *m = mapping; m->avname != NULL; m++)
-+ {
-+ AVMetadataTag *tag = NULL;
-+ tag = av_metadata_get(pFormatCtx->metadata, m->avname, NULL, 0);
-+ if (tag && tag->value && tag->value[0])
-+ {
-+ log_debug("Added metadata %s: %s\n", m->avname, tag->value);
-+ item->setMetadata(MT_KEYS[m->field].upnp, sc->convert(tag->value));
-+ }
-+ }
-+ /* Old algorithm (doesn't work with libav >= 0.7)
- if (strlen(pFormatCtx->title) > 0)
- {
- log_debug("Added metadata title: %s\n", pFormatCtx->title);
-@@ -131,6 +158,7 @@
- item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp,
- sc->convert(String::from(pFormatCtx->track)));
- }
-+ */
- }
-
- // ffmpeg library calls
-@@ -178,7 +206,7 @@
- for(i=0; i<pFormatCtx->nb_streams; i++)
- {
- AVStream *st = pFormatCtx->streams[i];
-- if((st != NULL) && (videoset == false) && (st->codec->codec_type == CODEC_TYPE_VIDEO))
-+ if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO))
- {
- if (st->codec->codec_tag > 0)
- {
-@@ -209,7 +237,7 @@
- *y = st->codec->height;
- }
- }
-- if(st->codec->codec_type == CODEC_TYPE_AUDIO)
-+ if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
- {
- // Increase number of audiochannels
- audioch++;
-
diff --git a/multimedia/mediatomb/libavformat.patch b/multimedia/mediatomb/libavformat.patch
deleted file mode 100644
index 96685ea155b13..0000000000000
--- a/multimedia/mediatomb/libavformat.patch
+++ /dev/null
@@ -1,52 +0,0 @@
---- mediatomb-0.12.1.orig/src/metadata/ffmpeg_handler.cc 2012-06-18 02:50:35.000000000 -0400
-+++ mediatomb-0.12.1/src/metadata/ffmpeg_handler.cc 2012-06-18 02:59:02.000000000 -0400
-@@ -107,8 +107,8 @@
- return;
- for (const mapping_t *m = mapping; m->avname != NULL; m++)
- {
-- AVMetadataTag *tag = NULL;
-- tag = av_metadata_get(pFormatCtx->metadata, m->avname, NULL, 0);
-+ AVDictionaryEntry *tag = NULL;
-+ tag = av_dict_get(pFormatCtx->metadata, m->avname, NULL, 0);
- if (tag && tag->value && tag->value[0])
- {
- log_debug("Added metadata %s: %s\n", m->avname, tag->value);
-@@ -278,7 +278,7 @@
- int x = 0;
- int y = 0;
-
-- AVFormatContext *pFormatCtx;
-+ AVFormatContext *pFormatCtx = avformat_alloc_context();
-
- // Suppress all log messages
- av_log_set_callback(FfmpegNoOutputStub);
-@@ -286,15 +286,15 @@
- // Register all formats and codecs
- av_register_all();
-
-- // Open video file
-- if (av_open_input_file(&pFormatCtx,
-- item->getLocation().c_str(), NULL, 0, NULL) != 0)
-+ // Open video file
-+ if (avformat_open_input(&pFormatCtx,
-+ item->getLocation().c_str(), NULL, NULL) != 0)
- return; // Couldn't open file
-
- // Retrieve stream information
-- if (av_find_stream_info(pFormatCtx) < 0)
-+ if (avformat_find_stream_info(pFormatCtx,NULL) < 0)
- {
-- av_close_input_file(pFormatCtx);
-+ avformat_close_input(&pFormatCtx);
- return; // Couldn't find stream information
- }
- // Add metadata using ffmpeg library calls
-@@ -303,7 +303,7 @@
- addFfmpegResourceFields(item, pFormatCtx, &x, &y);
-
- // Close the video file
-- av_close_input_file(pFormatCtx);
-+ avformat_close_input(&pFormatCtx);
- }
-
- Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)
diff --git a/multimedia/mediatomb/mediatomb-0.12.1-gcc46.patch b/multimedia/mediatomb/mediatomb-0.12.1-gcc46.patch
deleted file mode 100644
index 0f4fe490f4246..0000000000000
--- a/multimedia/mediatomb/mediatomb-0.12.1-gcc46.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/src/zmm/object.h
-+++ b/src/zmm/object.h
-@@ -33,6 +33,7 @@
- #define __ZMM_OBJECT_H__
-
- #include <new> // for size_t
-+#include <cstddef>
- #include "atomic.h"
-
- namespace zmm
diff --git a/multimedia/mediatomb/mediatomb-0.12.1-gcc47.patch b/multimedia/mediatomb/mediatomb-0.12.1-gcc47.patch
deleted file mode 100644
index 5c4687d15a518..0000000000000
--- a/multimedia/mediatomb/mediatomb-0.12.1-gcc47.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-diff --git a/src/hash/dbo_hash.h b/src/hash/dbo_hash.h
-index 2e58627..16c15b3 100644
---- a/src/hash/dbo_hash.h
-+++ b/src/hash/dbo_hash.h
-@@ -106,7 +106,7 @@ public:
- inline bool remove(KT key)
- {
- struct dbo_hash_slot<KT, VT> *slot;
-- if (! search(key, &slot))
-+ if (! this->search(key, &slot))
- return false;
- slot->key = deletedKey;
- slot->value->release();
-@@ -136,7 +136,7 @@ public:
- inline void put(KT key, zmm::Ref<VT> value)
- {
- struct dbo_hash_slot<KT, VT> *slot;
-- search(key, &slot);
-+ this->search(key, &slot);
- put(key, (hash_slot_t)slot, value);
- }
- void put(KT key, hash_slot_t destSlot, zmm::Ref<VT> value)
-@@ -162,7 +162,7 @@ public:
- inline zmm::Ref<VT> get(KT key)
- {
- struct dbo_hash_slot<KT, VT> *slot;
-- bool found = search(key, &slot);
-+ bool found = this->search(key, &slot);
- if (found)
- return zmm::Ref<VT>(slot->value);
- else
-@@ -174,7 +174,7 @@ public:
- inline zmm::Ref<VT> get(KT key, hash_slot_t *destSlot)
- {
- struct dbo_hash_slot<KT, VT> **slot = (struct dbo_hash_slot<KT, VT> **)destSlot;
-- bool found = search(key, slot);
-+ bool found = this->search(key, slot);
- if (found)
- return zmm::Ref<VT>((*slot)->value);
- else
-diff --git a/src/hash/dbr_hash.h b/src/hash/dbr_hash.h
-index 6e65d7f..7028890 100644
---- a/src/hash/dbr_hash.h
-+++ b/src/hash/dbr_hash.h
-@@ -124,7 +124,7 @@ public:
- inline bool remove(KT key)
- {
- struct dbr_hash_slot<KT> *slot;
-- if (! search(key, &slot))
-+ if (! this->search(key, &slot))
- return false;
- slot->key = deletedKey;
- int array_slot = slot->array_slot;
-@@ -134,7 +134,7 @@ public:
- return true;
- }
- data_array[array_slot] = data_array[--this->count];
-- if (! search(data_array[array_slot], &slot))
-+ if (! this->search(data_array[array_slot], &slot))
- {
- log_debug("DBR-Hash-Error: (%d; array_slot=%d; count=%d)\n", data_array[array_slot], array_slot, this->count);
- throw zmm::Exception(_("DBR-Hash-Error: key in data_array not found in hashtable"));
-@@ -146,7 +146,7 @@ public:
- inline void put(KT key)
- {
- struct dbr_hash_slot<KT> *slot;
-- if (! search(key, &slot))
-+ if (! this->search(key, &slot))
- {
- #ifdef TOMBDEBUG
- if (this->count >= realCapacity)
-@@ -194,7 +194,7 @@ public:
- inline bool exists(KT key)
- {
- struct dbr_hash_slot<KT> *slot;
-- return search(key, &slot);
-+ return this->search(key, &slot);
- }
-
- /*
-diff --git a/src/hash/dso_hash.h b/src/hash/dso_hash.h
-index adfb97f..03ec852 100644
---- a/src/hash/dso_hash.h
-+++ b/src/hash/dso_hash.h
-@@ -100,7 +100,7 @@ public:
- inline bool remove(zmm::String key)
- {
- struct dso_hash_slot<VT> *slot;
-- if (! search(key, &slot))
-+ if (! this->search(key, &slot))
- return false;
- slot->key->release();
- slot->value->release();
-@@ -112,7 +112,7 @@ public:
- inline void put(zmm::String key, zmm::Ref<VT> value)
- {
- struct dso_hash_slot<VT> *slot;
-- search(key, &slot);
-+ this->search(key, &slot);
- put(key, (hash_slot_t)slot, value);
- }
- void put(zmm::String key, hash_slot_t destSlot, zmm::Ref<VT> value)
-@@ -141,7 +141,7 @@ public:
- inline zmm::Ref<VT> get(zmm::String key)
- {
- struct dso_hash_slot<VT> *slot;
-- bool found = search(key, &slot);
-+ bool found = this->search(key, &slot);
- if (found)
- return zmm::Ref<VT>(slot->value);
- else
-@@ -153,7 +153,7 @@ public:
- inline zmm::Ref<VT> get(zmm::String key, hash_slot_t *destSlot)
- {
- struct dso_hash_slot<VT> **slot = (struct dso_hash_slot<VT> **)destSlot;
-- bool found = search(key, slot);
-+ bool found = this->search(key, slot);
- if (found)
- return zmm::Ref<VT>((*slot)->value);
- else
diff --git a/multimedia/mediatomb/mediatomb-0.12.1-mozjs185.patch b/multimedia/mediatomb/mediatomb-0.12.1-mozjs185.patch
deleted file mode 100644
index eb67540d7c69f..0000000000000
--- a/multimedia/mediatomb/mediatomb-0.12.1-mozjs185.patch
+++ /dev/null
@@ -1,605 +0,0 @@
---- mediatomb-0.12.1/configure.ac 2010-04-07 18:38:51.000000000 -0400
-+++ mediatomb-0.12.1/configure.ac 2011-11-16 21:56:46.000000000 -0500
-@@ -1006,14 +1006,23 @@
- MOZLIB=smjs
- ],
- [
-- LDFLAGS="-L$JS_SEARCH_LIBS $LDFLAGS_SAVE -lmozjs $ADD_PTHREAD_CFLAGS"
-- AC_CHECK_LIB(mozjs, JS_NewObject,
-+ LDFLAGS="-L$JS_SEARCH_LIBS $LDFLAGS_SAVE -lmozjs185 $ADD_PTHREAD_CFLAGS"
-+ AC_CHECK_LIB(mozjs185, JS_NewObject,
- [
-- JS_LIBS="-L$JS_SEARCH_LIBS -lmozjs"
-- MOZLIB=mozjs
-+ JS_LIBS="-L$JS_SEARCH_LIBS -lmozjs185"
-+ MOZLIB=mozjs185
- ],
- [
-- AC_MSG_ERROR([Spidermonkey not found in requested location $JS_SEARCH_LIBS])
-+ LDFLAGS="-L$JS_SEARCH_LIBS $LDFLAGS_SAVE -lmozjs $ADD_PTHREAD_CFLAGS"
-+ AC_CHECK_LIB(mozjs, JS_NewObject,
-+ [
-+ JS_LIBS="-L$JS_SEARCH_LIBS -lmozjs"
-+ MOZLIB=mozjs
-+ ],
-+ [
-+ AC_MSG_ERROR([Spidermonkey not found in requested location $JS_SEARCH_LIBS])
-+ ]
-+ )
- ]
- )
- ]
-@@ -1036,39 +1045,58 @@
- ],
- [
- unset ac_cv_lib_smjs_JS_NewObject
-- AC_CHECK_LIB(mozjs, JS_NewObject,
-+ AC_CHECK_LIB(mozjs185, JS_NewObject,
- [
-- MOZLIB=mozjs
-- JS_LIBS="-lmozjs"
-+ MOZLIB=mozjs185
-+ JS_LIBS="-lmozjs185"
- ],
- [
-- LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE $ADD_PTHREAD_CFLAGS"
-- unset ac_cv_lib_js_JS_NewObject
-- AC_CHECK_LIB(js, JS_NewObject,
-- [
-- JS_LIBS="-L$SEARCH_DIR_LIBS -ljs"
-- MOZLIB=js
-- ],
-- [
-- unset ac_cv_lib_smjs_JS_NewObject
-- AC_CHECK_LIB(smjs, JS_NewObject,
-- [
-- JS_LIBS="-L$SEARCH_DIR_LIBS -lsmjs"
-- MOZLIB=smjs
-- ],
-- [
-- LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs"
-- unset ac_cv_lib_mozjs_JS_NewObject
-- AC_CHECK_LIB(mozjs, JS_NewObject,
-- [
-- JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs"
-- MOZLIB=mozjs
-- ],
-- [
-- JS_OK=missing
-- AC_MSG_RESULT(libjs/libsmjs link failed, giving up)
-- ]
-- )
-+ unset ac_cv_lib_smjs_JS_NewObject
-+ AC_CHECK_LIB(mozjs, JS_NewObject,
-+ [
-+ MOZLIB=mozjs
-+ JS_LIBS="-lmozjs"
-+ ],
-+ [
-+ LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE $ADD_PTHREAD_CFLAGS"
-+ unset ac_cv_lib_js_JS_NewObject
-+ AC_CHECK_LIB(js, JS_NewObject,
-+ [
-+ JS_LIBS="-L$SEARCH_DIR_LIBS -ljs"
-+ MOZLIB=js
-+ ],
-+ [
-+ unset ac_cv_lib_smjs_JS_NewObject
-+ AC_CHECK_LIB(smjs, JS_NewObject,
-+ [
-+ JS_LIBS="-L$SEARCH_DIR_LIBS -lsmjs"
-+ MOZLIB=smjs
-+ ],
-+ [
-+ LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs185"
-+ unset ac_cv_lib_mozjs_JS_NewObject
-+ AC_CHECK_LIB(mozjs185, JS_NewObject,
-+ [
-+ JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs185"
-+ MOZLIB=mozjs185
-+ ],
-+ [
-+ LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs"
-+ unset ac_cv_lib_mozjs_JS_NewObject
-+ AC_CHECK_LIB(mozjs, JS_NewObject,
-+ [
-+ JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs"
-+ MOZLIB=mozjs
-+ ],
-+ [
-+ JS_OK=missing
-+ AC_MSG_RESULT(libjs/libsmjs link failed, giving up)
-+ ]
-+ )
-+ ]
-+ )
-+ ]
-+ )
- ]
- )
- ]
-diff -ur mediatomb-0.12.1.orig/build/Makefile.in mediatomb-0.12.1/build/Makefile.in
---- mediatomb-0.12.1.orig/build/Makefile.in 2010-04-07 18:40:15.000000000 -0400
-+++ mediatomb-0.12.1/build/Makefile.in 2011-11-16 22:28:06.000000000 -0500
-@@ -257,7 +257,7 @@
- CXX = @CXX@
- CXXCPP = @CXXCPP@
- CXXDEPMODE = @CXXDEPMODE@
--CXXFLAGS = @CXXFLAGS@
-+CXXFLAGS = -fpermissive @CXXFLAGS@
- CYGPATH_W = @CYGPATH_W@
- DB_AUTOCREATE_OPTION_ENABLED = @DB_AUTOCREATE_OPTION_ENABLED@
- DB_AUTOCREATE_OPTION_REQUESTED = @DB_AUTOCREATE_OPTION_REQUESTED@
-diff -ur mediatomb-0.12.1.orig/src/scripting/import_script.cc mediatomb-0.12.1/src/scripting/import_script.cc
---- mediatomb-0.12.1.orig/src/scripting/import_script.cc 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/import_script.cc 2011-11-16 22:28:06.000000000 -0500
-@@ -53,8 +53,8 @@
- try
- {
- load(scriptPath);
-- root = JS_NewScriptObject(cx, script);
-- JS_AddNamedRoot(cx, &root, "ImportScript");
-+ root = JS_NewObject(cx, NULL, script, NULL);
-+ JS_AddNamedObjectRoot(cx, &root, "ImportScript");
- }
- catch (Exception ex)
- {
-@@ -117,7 +117,7 @@
- #endif
-
- if (root)
-- JS_RemoveRoot(cx, &root);
-+ JS_RemoveObjectRoot(cx, &root);
-
- #ifdef JS_THREADSAFE
- JS_EndRequest(cx);
-diff -ur mediatomb-0.12.1.orig/src/scripting/js_functions.cc mediatomb-0.12.1/src/scripting/js_functions.cc
---- mediatomb-0.12.1.orig/src/scripting/js_functions.cc 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/js_functions.cc 2011-11-16 22:28:21.000000000 -0500
-@@ -49,30 +49,45 @@
- extern "C" {
-
- JSBool
--js_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+js_print(JSContext *cx, uintN argc, jsval *argv)
- {
-- uintN i;
-+ uintN i, j;
- JSString *str;
-
- for (i = 0; i < argc; i++)
- {
-- str = JS_ValueToString(cx, argv[i]);
-+ String fmtStr;
-+ for (j = 0; j < argc; j++)
-+ {
-+ if (j == i)
-+ fmtStr = fmtStr + "S";
-+ else
-+ fmtStr = fmtStr + "*";
-+ }
-+ if(!JS_ConvertArguments(cx, 1, JS_ARGV(cx, argv), fmtStr.c_str(), &str))
-+ {
-+ log_debug("Could not parse input arguments\n");
-+ return JS_TRUE;
-+ }
-+
- if (!str)
- return JS_TRUE;
-- argv[i] = STRING_TO_JSVAL(str);
-- log_js("%s\n", JS_GetStringBytes(str));
-+
-+ char * log_str = JS_EncodeString(cx, str);
-+ log_js("%s\n", log_str);
-+ JS_free(cx, log_str);
- }
- return JS_TRUE;
- }
-
- JSBool
--js_copyObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+js_copyObject(JSContext *cx, uintN argc, jsval *argv)
- {
- jsval arg;
- JSObject *js_cds_obj;
- JSObject *js_cds_clone_obj;
-
-- Script *self = (Script *)JS_GetPrivate(cx, obj);
-+ Script *self = (Script *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, argv));
-
- try
- {
-@@ -91,7 +106,7 @@
-
- self->cdsObject2jsObject(cds_obj, js_cds_clone_obj);
-
-- *rval = OBJECT_TO_JSVAL(js_cds_clone_obj);
-+ JS_SET_RVAL(cx, argv, OBJECT_TO_JSVAL(js_cds_clone_obj));
-
- return JS_TRUE;
-
-@@ -110,28 +125,58 @@
- }
-
- JSBool
--js_addCdsObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+js_addCdsObject(JSContext *cx, uintN argc, jsval *argv)
- {
- try
- {
-- jsval arg;
-- JSString *str;
-- String path;
-- String containerclass;
-+ // Inputs from native code
-+ JSObject *js_cds_obj = NULL;
-+ JSString *str = NULL;
-+ JSString *cont = NULL;
-
-- JSObject *js_cds_obj;
-+ String path = nil;
-+ String containerclass = nil;
-+
-+ JSObject *obj = JS_THIS_OBJECT(cx, argv);
- JSObject *js_orig_obj = NULL;
- Ref<CdsObject> orig_object;
-
- Ref<StringConverter> p2i;
- Ref<StringConverter> i2i;
-+ switch (argc)
-+ {
-+ case 0:
-+ log_debug("No input arguments given\n");
-+ return JS_FALSE;
-+ case 1:
-+ if(!JS_ConvertArguments(cx, 1, JS_ARGV(cx, argv), "o", &js_cds_obj))
-+ {
-+ log_debug("Could not parse input arguments\n");
-+ return JS_TRUE;
-+ }
-+ break;
-+ case 2:
-+ if(!JS_ConvertArguments(cx, 2, JS_ARGV(cx, argv), "oS", &js_cds_obj, &str))
-+ {
-+ log_debug("Could not parse input arguments\n");
-+ return JS_TRUE;
-+ }
-+ break;
-+ default:
-+ if(!JS_ConvertArguments(cx, 3, JS_ARGV(cx, argv), "oSS", &js_cds_obj, &str, &cont))
-+ {
-+ log_debug("Could not parse input arguments\n");
-+ return JS_TRUE;
-+ }
-+ break;
-+ }
-
- Script *self = (Script *)JS_GetPrivate(cx, obj);
-
- if (self == NULL)
- {
- log_debug("Could not retrieve class instance from global object\n");
-- return JS_FALSE;
-+ return JS_TRUE;
- }
-
- if (self->whoami() == S_PLAYLIST)
-@@ -142,26 +187,17 @@
- {
- i2i = StringConverter::i2i();
- }
--
-- arg = argv[0];
-- if (!JSVAL_IS_OBJECT(arg))
-- return JS_TRUE;
-- if (!JS_ValueToObject(cx, arg, &js_cds_obj))
-- return JS_TRUE;
-
-- // root it
-- argv[0] = OBJECT_TO_JSVAL(js_cds_obj);
-
-- str = JS_ValueToString(cx, argv[1]);
- if (!str)
- path = _("/");
- else
-- path = JS_GetStringBytes(str);
-+ path = JS_EncodeString(cx, str);
-+
-
-- JSString *cont = JS_ValueToString(cx, argv[2]);
- if (cont)
- {
-- containerclass = JS_GetStringBytes(cont);
-+ containerclass = JS_EncodeString(cx, cont);
- if (!string_ok(containerclass) || containerclass == "undefined")
- containerclass = nil;
- }
-@@ -177,9 +213,6 @@
- return JS_TRUE;
- }
-
-- // root it
-- argv[1] = OBJECT_TO_JSVAL(js_orig_obj);
--
- orig_object = self->jsObject2cdsObject(js_orig_obj, self->getProcessedObject());
- if (orig_object == nil)
- return JS_TRUE;
-@@ -285,8 +318,7 @@
- JSString *str2 = JS_NewStringCopyN(cx, tmp.c_str(), tmp.length());
- if (!str2)
- return JS_TRUE;
-- *rval = STRING_TO_JSVAL(str2);
--
-+ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(str2));
- return JS_TRUE;
- }
- catch (ServerShutdownException se)
-@@ -302,7 +334,7 @@
- return JS_TRUE;
- }
-
--static JSBool convert_charset_generic(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval, charset_convert_t chr)
-+static JSBool convert_charset_generic(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, charset_convert_t chr)
- {
- try
- {
-@@ -321,7 +353,7 @@
- {
- str = JS_ValueToString(cx, argv[0]);
- if (str)
-- result = JS_GetStringBytes(str);
-+ result = JS_EncodeString(cx, str);
- }
-
- if (result != nil)
-@@ -330,7 +362,7 @@
- JSString *str2 = JS_NewStringCopyN(cx, result.c_str(), result.length());
- if (!str2)
- return JS_TRUE;
-- *rval = STRING_TO_JSVAL(str2);
-+ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(str2));
- }
- }
- catch (ServerShutdownException se)
-@@ -347,24 +379,23 @@
- }
-
-
--JSBool js_f2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+JSBool js_f2i(JSContext *cx, uintN argc, jsval *argv)
- {
-- return convert_charset_generic(cx, obj, argc, argv, rval, F2I);
-+ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, F2I);
- }
-
--JSBool js_m2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+JSBool js_m2i(JSContext *cx, uintN argc, jsval *argv)
- {
-- return convert_charset_generic(cx, obj, argc, argv, rval, M2I);
--}
-+ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, M2I); }
-
--JSBool js_p2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+JSBool js_p2i(JSContext *cx, uintN argc, jsval *argv)
- {
-- return convert_charset_generic(cx, obj, argc, argv, rval, P2I);
-+ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, P2I);
- }
-
--JSBool js_j2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+JSBool js_j2i(JSContext *cx, uintN argc, jsval *argv)
- {
-- return convert_charset_generic(cx, obj, argc, argv, rval, J2I);
-+ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, J2I);
- }
-
- } // extern "C"
-diff -ur mediatomb-0.12.1.orig/src/scripting/js_functions.h mediatomb-0.12.1/src/scripting/js_functions.h
---- mediatomb-0.12.1.orig/src/scripting/js_functions.h 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/js_functions.h 2011-11-16 22:28:06.000000000 -0500
-@@ -40,18 +40,18 @@
- extern "C" {
-
- /// \brief Log output.
--JSBool js_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-+JSBool js_print(JSContext *cx, uintN argc, jsval *argv);
-
- /// \brief Adds an object to the database.
--JSBool js_addCdsObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-+JSBool js_addCdsObject(JSContext *cx, uintN argc, jsval *argv);
-
- /// \brief Makes a copy of an CDS object.
--JSBool js_copyObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-+JSBool js_copyObject(JSContext *cx, uintN argc, jsval *argv);
-
--JSBool js_f2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
--JSBool js_m2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
--JSBool js_p2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
--JSBool js_j2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-+JSBool js_f2i(JSContext *cx, uintN argc, jsval *argv);
-+JSBool js_m2i(JSContext *cx, uintN argc, jsval *argv);
-+JSBool js_p2i(JSContext *cx, uintN argc, jsval *argv);
-+JSBool js_j2i(JSContext *cx, uintN argc, jsval *argv);
-
- } // extern "C"
-
-diff -ur mediatomb-0.12.1.orig/src/scripting/playlist_parser_script.cc mediatomb-0.12.1/src/scripting/playlist_parser_script.cc
---- mediatomb-0.12.1.orig/src/scripting/playlist_parser_script.cc 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/playlist_parser_script.cc 2011-11-16 22:28:06.000000000 -0500
-@@ -46,9 +46,9 @@
- extern "C" {
-
- static JSBool
--js_readln(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-+js_readln(JSContext *cx, uintN argc, jsval *argv)
- {
-- PlaylistParserScript *self = (PlaylistParserScript *)JS_GetPrivate(cx, obj);
-+ PlaylistParserScript *self = (PlaylistParserScript *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, argv));
-
- String line;
-
-@@ -69,7 +69,7 @@
-
- JSString *jsline = JS_NewStringCopyZ(cx, line.c_str());
-
-- *rval = STRING_TO_JSVAL(jsline);
-+ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(jsline));
-
- return JS_TRUE;
- }
-@@ -93,8 +93,8 @@
-
- String scriptPath = ConfigManager::getInstance()->getOption(CFG_IMPORT_SCRIPTING_PLAYLIST_SCRIPT);
- load(scriptPath);
-- root = JS_NewScriptObject(cx, script);
-- JS_AddNamedRoot(cx, &root, "PlaylistScript");
-+ root = JS_NewObject(cx, NULL, script, NULL);
-+ JS_AddNamedObjectRoot(cx, &root, "PlaylistScript");
- }
- catch (Exception ex)
- {
-@@ -245,7 +245,7 @@
- #endif
-
- if (root)
-- JS_RemoveRoot(cx, &root);
-+ JS_RemoveObjectRoot(cx, &root);
-
- #ifdef JS_THREADSAFE
- JS_EndRequest(cx);
-diff -ur mediatomb-0.12.1.orig/src/scripting/script.cc mediatomb-0.12.1/src/scripting/script.cc
---- mediatomb-0.12.1.orig/src/scripting/script.cc 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/script.cc 2011-11-16 22:28:06.000000000 -0500
-@@ -87,7 +87,7 @@
- str = JS_ValueToString(cx, val);
- if (! str)
- return nil;
-- return JS_GetStringBytes(str);
-+ return JS_EncodeString(cx, str);
- }
-
- int Script::getBoolProperty(JSObject *obj, String name)
-@@ -427,14 +427,14 @@
- try
- {
- common_script = _load(common_scr_path);
-- common_root = JS_NewScriptObject(cx, common_script);
-- JS_AddNamedRoot(cx, &common_root, "common-script");
-+ common_root = JS_NewObject(cx, NULL, common_script, NULL);
-+ JS_AddNamedObjectRoot(cx, &common_root, "common-script");
- _execute(common_script);
- }
- catch (Exception e)
- {
- if (common_root)
-- JS_RemoveRoot(cx, &common_root);
-+ JS_RemoveObjectRoot(cx, &common_root);
-
- log_js("Unable to load %s: %s\n", common_scr_path.c_str(),
- e.getMessage().c_str());
-@@ -460,7 +460,7 @@
- JS_BeginRequest(cx);
- #endif
- if (common_root)
-- JS_RemoveRoot(cx, &common_root);
-+ JS_RemoveObjectRoot(cx, &common_root);
-
- /*
- * scripts are unrooted and will be cleaned up by GC
-@@ -504,11 +504,11 @@
- static JSClass global_class =
- {
- "global", /* name */
-- JSCLASS_HAS_PRIVATE, /* flags */
-+ JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS,/* flags */
- JS_PropertyStub, /* add property */
- JS_PropertyStub, /* del property */
- JS_PropertyStub, /* get property */
-- JS_PropertyStub, /* set property */
-+ JS_StrictPropertyStub, /* set property */
- JS_EnumerateStandardClasses, /* enumerate */
- JS_ResolveStub, /* resolve */
- JS_ConvertStub, /* convert */
-@@ -517,7 +517,7 @@
- };
-
- /* create the global object here */
-- glob = JS_NewObject(cx, &global_class, NULL, NULL);
-+ glob = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
- if (! glob)
- throw _Exception(_("Scripting: could not initialize glboal class"));
-
-@@ -539,12 +539,12 @@
- throw _Exception(_("Scripting: JS_DefineFunctions failed"));
- }
-
--JSScript *Script::_load(zmm::String scriptPath)
-+JSObject *Script::_load(zmm::String scriptPath)
- {
- if (glob == NULL)
- initGlobalObject();
-
-- JSScript *scr;
-+ JSObject *scr;
-
- String scriptText = read_text_file(scriptPath);
-
-@@ -571,14 +571,11 @@
-
- void Script::load(zmm::String scriptPath)
- {
-- if (script)
-- JS_DestroyScript(cx, script);
--
- script = _load((scriptPath));
- }
-
-
--void Script::_execute(JSScript *scr)
-+void Script::_execute(JSObject *scr)
- {
- jsval ret_val;
-
-@@ -662,7 +659,7 @@
- JSObject *js_meta = getObjectProperty(js, _("meta"));
- if (js_meta)
- {
-- JS_AddNamedRoot(cx, &js_meta, "meta");
-+ JS_AddNamedObjectRoot(cx, &js_meta, "meta");
- /// \todo: only metadata enumerated in MT_KEYS is taken
- for (int i = 0; i < M_MAX; i++)
- {
-@@ -687,7 +684,7 @@
- }
- }
- }
-- JS_RemoveRoot(cx, &js_meta);
-+ JS_RemoveObjectRoot(cx, &js_meta);
- }
-
- // stuff that has not been exported to js
-diff -ur mediatomb-0.12.1.orig/src/scripting/script.h mediatomb-0.12.1/src/scripting/script.h
---- mediatomb-0.12.1.orig/src/scripting/script.h 2010-03-25 10:58:05.000000000 -0400
-+++ mediatomb-0.12.1/src/scripting/script.h 2011-11-16 22:28:06.000000000 -0500
-@@ -66,8 +66,8 @@
- JSRuntime *rt;
- JSContext *cx;
- JSObject *glob;
-- JSScript *script;
-- JSScript *common_script;
-+ JSObject *script;
-+ JSObject *common_script;
-
- public:
- Script(zmm::Ref<Runtime> runtime);
-@@ -115,8 +115,8 @@
- JSObject *common_root;
-
- void initGlobalObject();
-- JSScript *_load(zmm::String scriptPath);
-- void _execute(JSScript *scr);
-+ JSObject *_load(zmm::String scriptPath);
-+ void _execute(JSObject *scr);
- zmm::Ref<StringConverter> _p2i;
- zmm::Ref<StringConverter> _j2i;
- zmm::Ref<StringConverter> _f2i;
diff --git a/multimedia/mediatomb/mediatomb-mp4v2-check.patch b/multimedia/mediatomb/mediatomb-mp4v2-check.patch
new file mode 100644
index 0000000000000..226a22a63154f
--- /dev/null
+++ b/multimedia/mediatomb/mediatomb-mp4v2-check.patch
@@ -0,0 +1,86 @@
+commit bed8f03202336fc7863ec6a39e130473f59061c6
+Author: Sergey 'Jin' Bostandzhyan <jin at mediatomb dot cc>
+Date: Sun Jan 27 23:08:04 2013 +0100
+
+ Extra configure check for libmp4v2 compatibility
+
+ We do not support the newer libmpv2 version yet, so don't error out when
+ compiling, catch it in configure.
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index f4962c6..3cc5ec3 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -533,7 +533,8 @@ AC_DEFUN([MT_CHECK_OPTIONAL_PACKAGE],
+ AC_MSG_ERROR([unable to configure $1 support])
+ fi
+
+- if test "x$mt_[]translit($1, `/.-', `___')_status" = xyes; then
++ if ((test "x$mt_[]translit($1, `/.-', `___')_status" = xyes) &&
++ (test "x$9" != "xundef")); then
+ AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
+ fi
+
+diff --git a/configure.ac b/configure.ac
+index e72dd78..9241797 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1390,7 +1390,7 @@ LIBMP4V2_STATUS=
+
+ MT_CHECK_OPTIONAL_PACKAGE([libmp4v2], [disable],
+ [libmp4v2 support for mp4 metadata extraction],
+- [$MP4_HEADER], [mp4v2], [MP4Read])
++ [$MP4_HEADER], [mp4v2], [MP4Read], [], [], [undef])
+
+ if test "x$LIBMP4V2_STATUS" = xyes; then
+ CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
+@@ -1399,6 +1399,37 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
+ AC_DEFINE_UNQUOTED([LIBMP4V2_INCLUDE], [<$MP4_HEADER.h>], [$MP4_HEADER.h])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
++ AC_MSG_CHECKING([for libmp4v2 compatibility])
++ AC_COMPILE_IFELSE(
++ [AC_LANG_PROGRAM(
++ [
++ #include <$MP4_HEADER.h>
++ ],
++ [
++ (void)MP4GetMetadataName(0, 0);
++ ]
++ )],
++ [
++ AC_MSG_RESULT([yes])
++ AC_DEFINE([HAVE_LIBMP4V2], [1], [libmp4v2 library presence])
++ ],
++ [
++ AC_MSG_RESULT([not compatible])
++ if test "x$LIBMP4V2_OPTION_REQUESTED" = "xyes"; then
++ AC_MSG_ERROR([Unable to configure libmp4v2 support])
++ else
++ LIBMP4V2_STATUS="not compatible"
++ fi
++ ])
++ LDFLAGS="$LDFLAGS_SAVE"
++ CFLAGS="$CFLAGS_SAVE"
++ CXXFLAGS="$CXXFLAGS_SAVE"
++fi
++
++if test "x$LIBMP4V2_STATUS" = "xyes"; then
++ CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $LIBMP4V2_CFLAGS"
++ LDFLAGS="$LDFLAGS $LIBMP4V2_LDFLAGS $LIBMP4V2_LIBS"
+ AC_MSG_CHECKING([for MP4GetMetadataCoverArtCount() in libmp4v2])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+@@ -1437,7 +1468,10 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
+ AC_MSG_RESULT([no])
+ ])
+
+- AC_LANG_RESTORE
++ AC_LANG_RESTORE
++ LDFLAGS="$LDFLAGS_SAVE"
++ CFLAGS="$CFLAGS_SAVE"
++ CXXFLAGS="$CXXFLAGS_SAVE"
+ fi
+
+ ########## INOTIFY TOOLS
diff --git a/multimedia/mediatomb/mediatomb.SlackBuild b/multimedia/mediatomb/mediatomb.SlackBuild
index 76007b588f1d4..fcee5c90b13a5 100644
--- a/multimedia/mediatomb/mediatomb.SlackBuild
+++ b/multimedia/mediatomb/mediatomb.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for mediatomb
-# Copyright 2010-2012 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 2010-2013 Heinz Wiesinger, Amsterdam, The Netherlands
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,8 +23,8 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=mediatomb
-VERSION=${VERSION:-0.12.1}
-BUILD=${BUILD:-5}
+VERSION=${VERSION:-b66dc1f}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -72,26 +72,19 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
-# Fix building with newer ffmpeg releases
-patch -p1 -i $CWD/libav_0.7_support.patch
-patch -p1 -i $CWD/libavformat.patch
-
# Fix building with new libmp4v2
+patch -p1 -R -i $CWD/mediatomb-mp4v2-check.patch
patch -p1 -i $CWD/mediatomb-0.12.1-libmp4v2_191_p479.patch
-# Fix compiling with gcc 4.7
-patch -p1 -i $CWD/mediatomb-0.12.1-gcc46.patch
-patch -p1 -i $CWD/mediatomb-0.12.1-gcc47.patch
-
-# Check for js185 in addition to the usual js packages
-patch -p1 -i $CWD/mediatomb-0.12.1-mozjs185.patch
+# Fix support for Samsung TVs
+patch -p1 -i $CWD/samsung-mkv.patch
-autoreconf
+autoreconf -vif
# We need LDFLAGS="-ldl" for proper sqlite detection
CFLAGS="$SLKCFLAGS" \
diff --git a/multimedia/mediatomb/mediatomb.info b/multimedia/mediatomb/mediatomb.info
index b4b223aecc59f..e78081786a9a9 100644
--- a/multimedia/mediatomb/mediatomb.info
+++ b/multimedia/mediatomb/mediatomb.info
@@ -1,8 +1,8 @@
PRGNAM="mediatomb"
-VERSION="0.12.1"
+VERSION="b66dc1f"
HOMEPAGE="http://mediatomb.cc/"
-DOWNLOAD="http://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz"
-MD5SUM="e927dd5dc52d3cfcebd8ca1af6f0d3c2"
+DOWNLOAD="http://www.liwjatan.at/files/src/mediatomb/mediatomb-b66dc1f.tar.xz"
+MD5SUM="7f4eb80f9e708564e6b8db45ee63f002"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/multimedia/mediatomb/samsung-mkv.patch b/multimedia/mediatomb/samsung-mkv.patch
new file mode 100644
index 0000000000000..6b146d7b0fe5a
--- /dev/null
+++ b/multimedia/mediatomb/samsung-mkv.patch
@@ -0,0 +1,445 @@
+Workaround for Samsung Smart TV 2012 :
+ - URI patch made by swiergot http://sourceforge.net/tracker/index.php?func=detail&aid=3532724&group_id=129766&atid=715782
+ - per device content-type engine : change video/x-matroska with video/x-mkv for Samsung devices only
+
+--- a/tombupnp/upnp/src/genlib/miniserver/miniserver.c
++++ b/tombupnp/upnp/src/genlib/miniserver/miniserver.c
+@@ -842,6 +842,8 @@
+ return UPNP_E_INTERNAL_ERROR; // miniserver running
+ }
+
++ ssdpdevices_init(&GlobalSsdpDevices);
++
+ miniSocket =
+ ( MiniServerSockArray * ) malloc( sizeof( MiniServerSockArray ) );
+ if( miniSocket == NULL )
+@@ -963,5 +965,8 @@
+ }
+ shutdown( sock, SD_BOTH );
+ UpnpCloseSocket( sock );
++
++ ssdpdevices_destroy(&GlobalSsdpDevices);
++
+ return 0;
+ }
+--- a/tombupnp/upnp/src/genlib/net/http/webserver.c
++++ b/tombupnp/upnp/src/genlib/net/http/webserver.c
+@@ -1211,6 +1211,7 @@
+ *
+ * Parameters:
+ * IN http_message_t *req ; HTTP Request message
++* IN SOCKINFO *info ; Socket info (fd with remote ip & port)
+ * OUT enum resp_type *rtype ; Tpye of response
+ * OUT membuffer *headers ;
+ * OUT membuffer *filename ; Get filename from request document
+@@ -1230,6 +1231,7 @@
+ ************************************************************************/
+ static int
+ process_request( IN http_message_t * req,
++ IN SOCKINFO *info,
+ OUT enum resp_type *rtype,
+ OUT membuffer * headers,
+ OUT membuffer * filename,
+@@ -1473,6 +1475,19 @@
+ goto error_handler;
+ }
+
++ // change "x-matroska" by "x-mkv", for samsung devices only
++ char *newtype;
++ if((strcmp(finfo.content_type, "video/x-matroska")==0)) {
++ if(ssdpdevice_servermatch(&GlobalSsdpDevices, info->foreign_ip_addr.s_addr, "samsung")) {
++// printf("Req from Samsung device : %s\n", finfo.content_type);
++ // change is made in two steps : free the previous string, malloc a new one
++ if((newtype= (char *) strdup("video/x-mkv"))) {
++ free(finfo.content_type);
++ finfo.content_type = newtype;
++ }
++ }
++ }
++
+ if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) {
+ //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
+ //Transfer-Encoding: chunked
+@@ -1800,7 +1815,7 @@
+ //Process request should create the different kind of header depending on the
+ //the type of request.
+ ret =
+- process_request( req, &rtype, &headers, &filename, &xmldoc,
++ process_request( req, info, &rtype, &headers, &filename, &xmldoc,
+ &RespInstr, &Fp);
+ if( ret != UPNP_E_SUCCESS ) {
+ // send error code
+--- a/tombupnp/upnp/src/genlib/net/uri/uri.c
++++ b/tombupnp/upnp/src/genlib/net/uri/uri.c
+@@ -1042,7 +1042,8 @@
+ out->path_type = REL_PATH;
+ }
+
+- if( ( ( begin_hostport + 1 ) < max ) && ( in[begin_hostport] == '/' )
++ //parse hostport only if scheme was found
++ if( ( begin_hostport > 0 ) && ( ( begin_hostport + 1 ) < max ) && ( in[begin_hostport] == '/' )
+ && ( in[begin_hostport + 1] == '/' ) ) {
+ begin_hostport += 2;
+
+@@ -1059,6 +1060,12 @@
+ out->hostport.text.size = 0;
+ out->hostport.text.buff = 0;
+ begin_path = begin_hostport;
++
++ //remove excessive leading slashes (fix for Samsung Smart TV 2012)
++ while( ( ( begin_path + 1 ) < max ) && ( in[begin_path] == '/' ) && ( in[begin_path + 1] == '/') ) {
++ begin_path++;
++ }
++
+ }
+
+ begin_fragment =
+--- a/tombupnp/upnp/src/inc/ssdplib.h
++++ b/tombupnp/upnp/src/inc/ssdplib.h
+@@ -161,9 +161,22 @@
+ struct sockaddr_in dest_addr;
+ } ssdp_thread_data;
+
++typedef struct
++{
++ ithread_mutex_t mutex;
++ LinkedList deviceslist;
++} ssdpdevices_t;
++
++typedef struct
++{
++ uint32_t s_addr;
++ char *serverdesc;
++} ssdp_device_t;
+
+ /* globals */
+
++extern ssdpdevices_t GlobalSsdpDevices;
++
+ CLIENTONLY(extern SOCKET gSsdpReqSocket;);
+
+ typedef int (*ParserFun)(char *, Event *);
+@@ -174,6 +187,64 @@
+ //int AnalyzeCommand(char * szCommand, Event * Evt);
+
+ /************************************************************************
++* Function : ssdpdevices_free
++*
++* Parameters :
++* void *d ;
++*
++* Description : Free memory allocated for each SSDP Device
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++void ssdpdevice_free( void *d );
++
++/************************************************************************
++* Function : ssdpdevice_compare
++*
++* Parameters :
++* void* param1 ;
++* void* param2 ;
++*
++* Description : Compare two SSDP devices by their ip address
++*
++* Return : int ;
++*
++* Note :
++************************************************************************/
++int ssdpdevice_compare( void *param1, void *param2 );
++
++/************************************************************************
++* Function : ssdpdevices_init
++*
++* Parameters :
++* INOUT ssdpdevices_t* s ; Array of SSDP Devices
++*
++* Description : Initialize and allocate memory for the array of SSDP devices
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++
++void ssdpdevices_init(ssdpdevices_t* s);
++
++/************************************************************************
++* Function : ssdpdevices_destroy
++*
++* Parameters :
++* INOUT ssdpdevices_t* msg ; Array of SSDP Devices
++*
++* Description : Free memory allocated for the Array of SSDP Devices
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++void ssdpdevices_destroy( ssdpdevices_t *s );
++
++/************************************************************************
+ * Function : Make_Socket_NoBlocking
+ *
+ * Parameters:
+--- a/tombupnp/upnp/src/ssdp/ssdp_server.c
++++ b/tombupnp/upnp/src/ssdp/ssdp_server.c
+@@ -52,8 +52,231 @@
+ #include "unixutil.h"
+ #endif
+
++#include <regex.h>
++
+ #define MAX_TIME_TOREAD 45
+
++// global containing the array of devices
++ssdpdevices_t GlobalSsdpDevices;
++
++/************************************************************************
++* Function : ssdpdevices_free
++*
++* Parameters :
++* void *msg ;
++*
++* Description : Free memory allocated for each SSDP Device
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++void
++ssdpdevice_free( void *d )
++{
++ ssdp_device_t *sd = ( ssdp_device_t * ) d;
++
++ free(sd->serverdesc);
++
++ free( sd );
++}
++
++/************************************************************************
++* Function : ssdpdevice_compare
++*
++* Parameters :
++* void* param1 ;
++* void* param2 ;
++*
++* Description : Compare two SSDP devices by their ip address
++*
++* Return : int ;
++*
++* Note :
++************************************************************************/
++int
++ssdpdevice_compare( void *param1,
++ void *param2 )
++{
++ assert( param1 != NULL );
++ assert( param2 != NULL );
++
++ return ( ( ssdp_device_t * ) param1 )->s_addr ==
++ ( ( ssdp_device_t * ) param2 )->s_addr;
++}
++
++/************************************************************************
++* Function : ssdpdevices_init
++*
++* Parameters :
++* INOUT ssdpdevices_t* s ; Array of SSDP Devices
++*
++* Description : Initialize and allocate memory for the array of SSDP devices
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++
++void ssdpdevices_init(ssdpdevices_t* s) {
++ ithread_mutex_init( &s->mutex, NULL );
++ ListInit( &s->deviceslist, ssdpdevice_compare, ssdpdevice_free );
++}
++
++/************************************************************************
++* Function : ssdpdevices_destroy
++*
++* Parameters :
++* INOUT ssdpdevices_t* s ; Array of SSDP Devices
++*
++* Description : Free memory allocated for the Array of SSDP Devices
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++void
++ssdpdevices_destroy( ssdpdevices_t *s )
++{
++ int ret;
++
++ assert( s != NULL );
++
++ ithread_mutex_lock( &s->mutex );
++ ListDestroy( &s->deviceslist, 1 );
++ ithread_mutex_unlock( &s->mutex );
++
++ ret = ithread_mutex_destroy( &s->mutex );
++ assert( ret == 0 );
++
++}
++
++/************************************************************************
++* Function : create_device_node
++*
++* Parameters :
++* IN uint32_t *ip4addr; IP Address
++* IN membuffer *mbuf; Server descripton
++*
++* Description : Create a device structure and fill it with ip & description
++*
++* Return : ssdp_device_t *
++*
++* Note :
++************************************************************************/
++
++ssdp_device_t *create_device(uint32_t ipaddr, membuffer *mbuf) {
++ ssdp_device_t *newd;
++ if( (newd = (ssdp_device_t *) malloc(sizeof(ssdp_device_t)))) {
++ if( ( newd->serverdesc = str_alloc ( mbuf->buf, mbuf->length) ) ) {
++ newd->s_addr = ipaddr;
++ return(newd);
++ }
++ free(newd);
++ }
++ return(NULL);
++}
++
++
++/************************************************************************
++* Function : ssdpdevices_updatelist
++*
++* Parameters :
++* INOUT ssdpdevices_t* s ; Array of SSDP Devices
++* IN uint32_t *ip4addr; IP Address
++* IN char *serverstr; Server descripton
++*
++* Description : Insert or update the list with given device
++*
++* Return : void ;
++*
++* Note :
++************************************************************************/
++void
++ssdpdevices_updatelist( ssdpdevices_t *s, uint32_t ip4addr, membuffer *serverstr)
++{
++ assert( s != NULL );
++ assert( ip4addr != 0 );
++ assert( serverstr != NULL );
++
++ int found = 0;
++
++ // Loop through each existing device
++ ithread_mutex_lock( &s->mutex );
++ LinkedList *l = &s->deviceslist;
++ ListNode *temp = NULL;
++ ssdp_device_t *d,*newd;
++ for (temp = ListHead(l);temp!=NULL;temp = ListNext(l,temp))
++ {
++ d=(ssdp_device_t *)temp->item;
++ if(d->s_addr == ip4addr) {
++ found = 1;
++ break;
++ }
++ }
++
++ // Add the entry if necessary
++ if(!found) {
++ if( ( newd = create_device(ip4addr, serverstr))) {
++ ListAddTail( l, newd);
++ }
++ }
++ ithread_mutex_unlock( &s->mutex );
++
++}
++
++/************************************************************************
++* Function : ssdpdevice_descmatch
++*
++* Parameters :
++* IN ssdpdevices_t* s ; Array of SSDP Devices
++* IN uint32_t ipaddr; Ip addres to check
++* IN char *regexp; Regex to match
++*
++* Description : Check whether the device's description matches the given regex
++*
++* Return : int (1 = match, else no match)
++*
++* Note :
++************************************************************************/
++int
++ssdpdevice_servermatch( ssdpdevices_t *s, uint32_t ip4addr, char *regex)
++{
++ assert( s != NULL );
++ assert( ip4addr != 0 );
++ assert( regex != NULL );
++
++ int ret = 0;
++ regex_t reg;
++
++ if( regcomp(&reg, regex, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
++ printf("Invalid regex : %s\n", regex);
++ return(0);
++ }
++
++ // Loop through each existing device
++ ithread_mutex_lock( &s->mutex );
++ LinkedList *l = &s->deviceslist;
++ ListNode *temp = NULL;
++ ssdp_device_t *d;
++ for (temp = ListHead(l);temp!=NULL;temp = ListNext(l,temp))
++ {
++ d=(ssdp_device_t *)temp->item;
++ if(d->s_addr == ip4addr) {
++ // We found the ip addr, let's check if the desc contains the searched string
++ if(regexec(&reg, d->serverdesc, 0, NULL, 0) == 0) {
++ ret=1;
++ }
++ break;
++ }
++ }
++
++ ithread_mutex_unlock( &s->mutex );
++ return(ret);
++}
++
++
++
+ CLIENTONLY( SOCKET gSsdpReqSocket = 0;
+ )
+
+@@ -756,6 +979,24 @@
+ if( !valid_ssdp_msg( &parser->msg ) ) {
+ goto error_handler;
+ }
++
++ // update liste of devices for each NOTIFY received
++
++ if ( parser->msg.method == HTTPMETHOD_NOTIFY ) {
++// printf( "SSDP recvd code NOTIFY = %d from %s\n", parser->msg.method, inet_ntoa(data->dest_addr.sin_addr));
++ LinkedList *g=&parser->msg.headers;
++ ListNode *temp = NULL;
++ http_header_t *h;
++ for (temp = ListHead(g);temp!=NULL;temp = ListNext(g,temp))
++ {
++ h=(http_header_t *)temp->item;
++ if(strncasecmp(h->name.buf, "SERVER", h->name.length) == 0) {
++ ssdpdevices_updatelist(&GlobalSsdpDevices, data->dest_addr.sin_addr.s_addr, &h->value);
++ }
++ }
++
++ }
++
+ return 0; //////// done; thread will free 'data'
+
+ error_handler: