summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Whyman <thev00d00@gentoo.org>2013-12-17 23:39:27 +0000
committerIan Whyman <thev00d00@gentoo.org>2013-12-17 23:39:27 +0000
commit81e92c32beb66fcc21be061256218bdd0047f5cd (patch)
tree1a32fab537902f4c0e7239d2425115a518ef3f7a /net-misc/mediatomb/files
parentVersion bump to 2.6.7; fixes bug #493730, reported by Frank Krömmelbein. Add... (diff)
downloadgentoo-2-81e92c32beb66fcc21be061256218bdd0047f5cd.tar.gz
gentoo-2-81e92c32beb66fcc21be061256218bdd0047f5cd.tar.bz2
gentoo-2-81e92c32beb66fcc21be061256218bdd0047f5cd.zip
Bump to -r7, tidy up ebuild, remove old, add flac and youtube patches, epatch_user #467110 #494398
(Portage version: 2.2.7/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'net-misc/mediatomb/files')
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-flac-metadata.patch446
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-gcc46.patch13
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-gcc47.patch120
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-libav7.patch64
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-mozjs185.patch605
-rw-r--r--net-misc/mediatomb/files/mediatomb-0.12.1-youtube-dl.patch141
6 files changed, 587 insertions, 802 deletions
diff --git a/net-misc/mediatomb/files/mediatomb-0.12.1-flac-metadata.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-flac-metadata.patch
new file mode 100644
index 000000000000..b7725754027b
--- /dev/null
+++ b/net-misc/mediatomb/files/mediatomb-0.12.1-flac-metadata.patch
@@ -0,0 +1,446 @@
+diff -urpN a/build/Makefile.am b/build/Makefile.am
+--- a/build/Makefile.am 2010-03-22 21:39:46.000000000 +1100
++++ b/build/Makefile.am 2013-12-16 10:16:32.426878578 +1100
+@@ -18,6 +18,7 @@ libmediatomb_a_CXXFLAGS = \
+ $(ICONV_CXXFLAGS) \
+ $(LIBMAGIC_CFLAGS) \
+ $(ID3LIB_CFLAGS) \
++ $(FLAC_CFLAGS) \
+ $(LIBEXIF_CFLAGS) \
+ $(ZLIB_CFLAGS) \
+ $(PTHREAD_CFLAGS) \
+@@ -44,6 +45,7 @@ mediatomb_CXXFLAGS = -I$(top_srcdir)/src
+ $(ICONV_CXXFLAGS) \
+ $(LIBMAGIC_CFLAGS) \
+ $(ID3LIB_CFLAGS) \
++ $(FLAC_CFLAGS) \
+ $(LIBEXIF_CFLAGS) \
+ $(ZLIB_CFLAGS) \
+ $(PTHREAD_CFLAGS) \
+@@ -78,6 +80,7 @@ mediatomb_LDADD = \
+ $(JS_LIBS) \
+ $(LIBMAGIC_LIBS) \
+ $(ID3LIB_LIBS) \
++ $(FLAC_LIBS) \
+ $(LIBEXIF_LIBS) \
+ $(ZLIB_LIBS) \
+ $(RT_LIBS) \
+diff -urpN a/build/libmediatomb_src b/build/libmediatomb_src
+--- a/build/libmediatomb_src 2010-03-23 04:09:53.000000000 +1100
++++ b/build/libmediatomb_src 2013-12-16 10:14:49.730356868 +1100
+@@ -98,6 +98,8 @@ libmediatomb_a_SOURCES = \
+ ../src/metadata/libmp4v2_handler.h \
+ ../src/metadata/taglib_handler.cc \
+ ../src/metadata/taglib_handler.h \
++../src/metadata/flac_handler.cc \
++../src/metadata/flac_handler.h \
+ ../src/mpegdemux/buffer.c \
+ ../src/mpegdemux/buffer.h \
+ ../src/mpegdemux/mpegdemux.c \
+diff -urpN a/configure.ac b/configure.ac
+--- a/configure.ac 2010-04-08 08:38:51.000000000 +1000
++++ b/configure.ac 2013-12-16 10:24:16.547793225 +1100
+@@ -1314,6 +1314,35 @@ LDFLAGS="$LDFLAGS_SAVE"
+ LIBS="$LIBS_SAVE"
+ CXXFLAGS="$CXXFLAGS_SAVE"
+ CPPFLAGS="$CPPFLAGS_SAVE"
++
++######### FLAC
++
++FLAC_STATUS=
++
++MT_OPTION([FLAC], [enable],
++ [FLAC metadata extraction with the help of FLAC],[],[])
++
++if test "x$FLAC_OPTION_ENABLED" = xyes; then
++ MT_CHECK_PACKAGE([FLAC],
++ [FLAC/metadata],
++ [FLAC], [main])
++else
++ FLAC_STATUS=disabled
++fi
++
++if test "x$FLAC_STATUS" != xyes; then
++ if (test "x$FLAC_OPTION_REQUESTED" = xyes) &&
++ (test "x$FLAC_OPTION_ENABLED" = xyes); then
++ AC_MSG_ERROR([unable to configure FLAC support])
++ fi
++else
++ CFLAGS="$CFLAGS $FLAC_CFLAGS"
++ CXXFLAGS="$CXXFLAGS $FLAC_CFLAGS"
++ LDFLAGS="$LDFLAGS $FLAC_LDFLAGS $FLAC_LIBS"
++ AC_LANG_SAVE
++ AC_LANG_CPLUSPLUS
++fi
++
+ ######## curl
+
+ CURL_PROG_FOUND=0
+@@ -1914,7 +1943,7 @@ if (test "x$SOPCAST_OPTION_ENABLED" = xy
+ AC_DEFINE([SOPCAST], [1], [Enable support for the SopCast service])
+ fi
+
+-AC_DEFINE_UNQUOTED([COMPILE_INFO], "\thost:\t\t\t$host\n\tsqlite3:\t\t$SQLITE3_STATUS\n\tmysql:\t\t\t$MYSQL_STATUS\n\tlibjs:\t\t\t$JS_OK\n\tlibmagic:\t\t$LIBMAGIC_STATUS\n\tinotify:\t\t$INOTIFY_STATUS\n\tlibexif:\t\t$LIBEXIF_STATUS\n\tid3lib:\t\t\t$ID3LIB_STATUS\n\ttaglib:\t\t\t$TAGLIB_STATUS\n\tffmpeg\t\t\t$FFMPEG_STATUS\n\tlibmp4v2:\t\t$LIBMP4V2_STATUS\n\texternal transcoding:\t$EXTERNAL_TRANSCODING_OPTION_ENABLED\n\tcurl:\t\t\t$CURL_OK\n\tYouTube:\t\t$YOUTUBE_OPTION_ENABLED\n\tlibextractor\t\t$LIBEXTRACTOR_STATUS\n\tdb-autocreate:\t\t$DB_AUTOCREATE_OPTION_ENABLED\n\tdebug log:\t\t$DEBUG_LOG_OPTION_ENABLED\n\tprotocol info extension:$PROTOCOLINFO_EXTENSION_OPTION_ENABLED\n\tffmpegthumbnailer:\t$FFMPEGTHUMBNAILER_STATUS\n\tlastfmlib:\t\t$LASTFMLIB_STATUS\n\tdata directory:\t\t$PACKAGE_DATADIR", [compile option summary])
++AC_DEFINE_UNQUOTED([COMPILE_INFO], "\thost:\t\t\t$host\n\tsqlite3:\t\t$SQLITE3_STATUS\n\tmysql:\t\t\t$MYSQL_STATUS\n\tlibjs:\t\t\t$JS_OK\n\tlibmagic:\t\t$LIBMAGIC_STATUS\n\tinotify:\t\t$INOTIFY_STATUS\n\tlibexif:\t\t$LIBEXIF_STATUS\n\tid3lib:\t\t\t$ID3LIB_STATUS\n\ttaglib:\t\t\t$TAGLIB_STATUS\n\tFLAC:\t\t\t$FLAC_STATUS\n\tffmpeg\t\t\t$FFMPEG_STATUS\n\tlibmp4v2:\t\t$LIBMP4V2_STATUS\n\texternal transcoding:\t$EXTERNAL_TRANSCODING_OPTION_ENABLED\n\tcurl:\t\t\t$CURL_OK\n\tYouTube:\t\t$YOUTUBE_OPTION_ENABLED\n\tlibextractor\t\t$LIBEXTRACTOR_STATUS\n\tdb-autocreate:\t\t$DB_AUTOCREATE_OPTION_ENABLED\n\tdebug log:\t\t$DEBUG_LOG_OPTION_ENABLED\n\tprotocol info extension:$PROTOCOLINFO_EXTENSION_OPTION_ENABLED\n\tffmpegthumbnailer:\t$FFMPEGTHUMBNAILER_STATUS\n\tlastfmlib:\t\t$LASTFMLIB_STATUS\n\tdata directory:\t\t$PACKAGE_DATADIR", [compile option summary])
+
+ ###############
+ AC_CONFIG_FILES([
+@@ -1946,6 +1975,7 @@ echo "inotify : $INOTIFY_S
+ echo "libexif : $LIBEXIF_STATUS"
+ echo "id3lib : $ID3LIB_STATUS"
+ echo "taglib : $TAGLIB_STATUS"
++echo "FLAC : $FLAC_STATUS"
+ echo "libmp4v2 : $LIBMP4V2_STATUS"
+ echo "ffmpeg : $FFMPEG_STATUS"
+ echo "ffmpegthumbnailer : $FFMPEGTHUMBNAILER_STATUS"
+diff -urpN a/src/cds_resource_manager.cc b/src/cds_resource_manager.cc
+--- a/src/cds_resource_manager.cc 2010-03-26 01:58:11.000000000 +1100
++++ b/src/cds_resource_manager.cc 2013-12-16 10:25:15.277987292 +1100
+@@ -372,6 +372,7 @@ void CdsResourceManager::addResources(Re
+ // only add upnp:AlbumArtURI if we have an AA, skip the resource
+ if ((i > 0) && ((item->getResource(i)->getHandlerType() == CH_ID3) ||
+ (item->getResource(i)->getHandlerType() == CH_MP4) ||
++ (item->getResource(i)->getHandlerType() == CH_FLAC) ||
+ (item->getResource(i)->getHandlerType() == CH_EXTURL)))
+ {
+ String rct;
+diff -urpN a/src/config_manager.cc b/src/config_manager.cc
+--- a/src/config_manager.cc 2010-03-26 01:58:11.000000000 +1100
++++ b/src/config_manager.cc 2013-12-16 10:26:57.220886235 +1100
+@@ -624,6 +624,10 @@ String ConfigManager::createDefaultConfi
+ _(CONTENT_TYPE_OGG)));
+ mtcontent->appendElementChild(treat_as(_("audio/x-flac"),
+ _(CONTENT_TYPE_FLAC)));
++ mtcontent->appendElementChild(treat_as(_("audio/x-ms-wma"),
++ _(CONTENT_TYPE_WMA)));
++ mtcontent->appendElementChild(treat_as(_("audio/x-wavpack"),
++ _(CONTENT_TYPE_WAVPACK)));
+ mtcontent->appendElementChild(treat_as(_("image/jpeg"),
+ _(CONTENT_TYPE_JPG)));
+ mtcontent->appendElementChild(treat_as(_("audio/x-mpegurl"),
+diff -urpN a/src/metadata/flac_handler.cc b/src/metadata/flac_handler.cc
+--- a/src/metadata/flac_handler.cc 1970-01-01 10:00:00.000000000 +1000
++++ b/src/metadata/flac_handler.cc 2013-12-16 10:30:19.955604387 +1100
+@@ -0,0 +1,204 @@
++/*MT*
++
++ MediaTomb - http://www.mediatomb.cc/
++
++ flac_handler.cc - this file is part of MediaTomb.
++
++ Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
++ Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
++
++ Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
++ Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
++ Leonhard Wimmer <leo@mediatomb.cc>
++
++ MediaTomb is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License version 2
++ as published by the Free Software Foundation.
++
++ MediaTomb 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
++ version 2 along with MediaTomb; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
++
++ $Id: mediatomb-0.12.1-flac-metadata.patch,v 1.1 2013/12/17 23:39:27 thev00d00 Exp $
++*/
++
++/// \file flac_handler.cc
++/// \brief Implementeation of the FlacHandler class.
++
++#ifdef HAVE_CONFIG_H
++ #include "autoconfig.h"
++#endif
++
++#ifdef HAVE_FLAC
++
++#include <FLAC/all.h>
++
++#include "flac_handler.h"
++#include "string_converter.h"
++#include "config_manager.h"
++#include "common.h"
++#include "tools.h"
++#include "mem_io_handler.h"
++
++#include "content_manager.h"
++
++using namespace zmm;
++
++FlacHandler::FlacHandler() : MetadataHandler()
++{
++}
++
++static void addField(metadata_fields_t field, const FLAC__StreamMetadata* tags, Ref<CdsItem> item)
++{
++ String value;
++ int i;
++
++ Ref<StringConverter> sc = StringConverter::i2i(); // sure is sure
++
++ switch (field)
++ {
++ case M_TITLE:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "TITLE");
++ break;
++ case M_ARTIST:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "ARTIST");
++ break;
++ case M_ALBUM:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "ALBUM");
++ break;
++ case M_DATE:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "DATE");
++ break;
++ case M_GENRE:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "GENRE");
++ break;
++ case M_DESCRIPTION:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "DESCRIPTION");
++ break;
++ case M_TRACKNUMBER:
++ i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, "TRACKNUMBER");
++ break;
++ default:
++ return;
++ }
++
++ if( 0 <= i )
++ value = strchr((const char *)tags->data.vorbis_comment.comments[i].entry, '=') + 1;
++ else
++ return;
++
++ value = trim_string(value);
++
++ if (string_ok(value))
++ {
++ item->setMetadata(MT_KEYS[field].upnp, sc->convert(value));
++ log_debug("Setting metadata on item: %d, %s\n", field, sc->convert(value).c_str());
++ }
++}
++
++void FlacHandler::fillMetadata(Ref<CdsItem> item)
++{
++ FLAC__StreamMetadata* tags = NULL;
++ FLAC__StreamMetadata streaminfo;
++ Ref<StringConverter> sc = StringConverter::i2i(); // sure is sure
++
++ if( !FLAC__metadata_get_tags(item->getLocation().c_str(), &tags) )
++ return;
++
++ if( FLAC__METADATA_TYPE_VORBIS_COMMENT == tags->type )
++ {
++ for (int i = 0; i < M_MAX; i++)
++ addField((metadata_fields_t) i, tags, item);
++ }
++
++ FLAC__metadata_object_delete(tags);
++ tags = NULL;
++
++ if( !FLAC__metadata_get_streaminfo(item->getLocation().c_str(), &streaminfo) )
++ return;
++
++ if( FLAC__METADATA_TYPE_STREAMINFO == streaminfo.type )
++ {
++ // note: UPnP requires bytes/second
++ item->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_BITRATE), String::from((unsigned)((streaminfo.data.stream_info.bits_per_sample * streaminfo.data.stream_info.sample_rate) / 8)));
++ // note: UPnP requires HMS
++ item->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_DURATION), secondsToHMS((unsigned)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate)));
++ item->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_SAMPLEFREQUENCY), String::from(streaminfo.data.stream_info.sample_rate));
++ item->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_NRAUDIOCHANNELS), String::from(streaminfo.data.stream_info.channels));
++ }
++
++ if( !FLAC__metadata_get_picture(item->getLocation().c_str(),
++ &tags,
++ FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER,
++ NULL,
++ NULL,
++ (unsigned)-1,
++ (unsigned)-1,
++ (unsigned)-1,
++ (unsigned)-1 ) )
++ return;
++
++ if( FLAC__METADATA_TYPE_PICTURE == tags->type )
++ {
++ String art_mimetype = tags->data.picture.mime_type;
++ log_debug("Mime type : %s\n", sc->convert(art_mimetype).c_str());
++
++ // saw that simply "PNG" was used with some mp3's, so mimetype setting
++ // was probably invalid
++ if (!string_ok(art_mimetype) || (art_mimetype.index('/') == -1))
++ {
++#ifdef HAVE_MAGIC
++ art_mimetype = ContentManager::getInstance()->getMimeTypeFromBuffer((void *)tags->data.picture.data, tags->data.picture.data_length);
++ if (!string_ok(art_mimetype))
++#endif
++ art_mimetype = _(MIMETYPE_DEFAULT);
++
++ log_debug("Mime type via magic: %s\n", sc->convert(art_mimetype).c_str());
++ }
++
++ // if we could not determine the mimetype, then there is no
++ // point to add the resource - it's probably garbage
++ if (art_mimetype != _(MIMETYPE_DEFAULT))
++ {
++ Ref<CdsResource> resource(new CdsResource(CH_FLAC));
++ resource->addAttribute(MetadataHandler::getResAttrName(R_PROTOCOLINFO), renderProtocolInfo(art_mimetype));
++ resource->addParameter(_(RESOURCE_CONTENT_TYPE), _(ID3_ALBUM_ART));
++ item->addResource(resource);
++ }
++ }
++
++ FLAC__metadata_object_delete(tags);
++}
++
++Ref<IOHandler> FlacHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)
++{
++ FLAC__StreamMetadata* picture = NULL;
++
++ if( !FLAC__metadata_get_picture(item->getLocation().c_str(),
++ &picture,
++ FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER,
++ NULL,
++ NULL,
++ (unsigned)-1,
++ (unsigned)-1,
++ (unsigned)-1,
++ (unsigned)-1 ) )
++ throw _Exception(_("FlacHandler: could not exctract cover from: ") + item->getLocation());
++
++ if( FLAC__METADATA_TYPE_PICTURE != picture->type )
++ throw _Exception(_("TagHandler: resource has no album information"));
++
++ Ref<IOHandler> h(new MemIOHandler((void *)picture->data.picture.data, picture->data.picture.data_length));
++ *data_size = picture->data.picture.data_length;
++
++ FLAC__metadata_object_delete(picture);
++
++ return h;
++}
++
++#endif // HAVE_FLAC
+diff -urpN a/src/metadata/flac_handler.h b/src/metadata/flac_handler.h
+--- a/src/metadata/flac_handler.h 1970-01-01 10:00:00.000000000 +1000
++++ b/src/metadata/flac_handler.h 2013-12-16 10:31:24.061822827 +1100
+@@ -0,0 +1,47 @@
++/*MT*
++
++ MediaTomb - http://www.mediatomb.cc/
++
++ flac_handler.h - this file is part of MediaTomb.
++
++ Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
++ Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
++
++ Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
++ Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
++ Leonhard Wimmer <leo@mediatomb.cc>
++
++ MediaTomb is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License version 2
++ as published by the Free Software Foundation.
++
++ MediaTomb 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
++ version 2 along with MediaTomb; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
++
++ $Id: mediatomb-0.12.1-flac-metadata.patch,v 1.1 2013/12/17 23:39:27 thev00d00 Exp $
++*/
++
++/// \file flac_handler.h
++/// \brief Definition of the FlacHandler class.
++
++#ifndef __METADATA_FLAC_H__
++#define __METADATA_FLAC_H__
++
++#include "metadata_handler.h"
++
++/// \brief This class is responsible for reading FLAC metadata
++class FlacHandler : public MetadataHandler
++{
++public:
++ FlacHandler();
++ virtual void fillMetadata(zmm::Ref<CdsItem> item);
++ virtual zmm::Ref<IOHandler> serveContent(zmm::Ref<CdsItem> item, int resNum, off_t *data_size);
++};
++
++#endif // __METADATA_FLAC_H__
+diff -urpN a/src/metadata_handler.cc b/src/metadata_handler.cc
+--- a/src/metadata_handler.cc 2010-03-26 01:58:11.000000000 +1100
++++ b/src/metadata_handler.cc 2013-12-16 10:35:48.783540865 +1100
+@@ -51,6 +51,10 @@
+ #endif // HAVE_ID3LIB
+ #endif // HAVE_TAGLIB
+
++#ifdef HAVE_FLAC
++#include "metadata/flac_handler.h"
++#endif
++
+ #ifdef HAVE_LIBMP4V2
+ #include "metadata/libmp4v2_handler.h"
+ #endif
+@@ -140,7 +144,8 @@ void MetadataHandler::setMetadata(Ref<Cd
+ if ((content_type == CONTENT_TYPE_MP3) ||
+ ((content_type == CONTENT_TYPE_OGG) &&
+ (!item->getFlag(OBJECT_FLAG_OGG_THEORA))) ||
+- (content_type == CONTENT_TYPE_FLAC))
++ (content_type == CONTENT_TYPE_WMA) ||
++ (content_type == CONTENT_TYPE_WAVPACK))
+ {
+ handler = Ref<MetadataHandler>(new TagHandler());
+ break;
+@@ -155,7 +160,13 @@ void MetadataHandler::setMetadata(Ref<Cd
+ #endif // HAVE_ID3LIB
+ #endif // HAVE_TAGLIB
+
+-
++#ifdef HAVE_FLAC
++ if (content_type == CONTENT_TYPE_FLAC)
++ {
++ handler = Ref<MetadataHandler>(new FlacHandler());
++ break;
++ }
++#endif
+
+ #ifdef HAVE_EXIV2
+ /*
+@@ -277,6 +288,10 @@ Ref<MetadataHandler> MetadataHandler::cr
+ case CH_FFTH:
+ return Ref<MetadataHandler>(new FfmpegHandler());
+ #endif
++#ifdef HAVE_FLAC
++ case CH_FLAC:
++ return Ref<MetadataHandler>(new FlacHandler());
++#endif
+ default:
+ throw _Exception(_("unknown content handler ID: ") + handlerType);
+ }
+diff -urpN a/src/metadata_handler.h b/src/metadata_handler.h
+--- a/src/metadata_handler.h 2010-03-26 01:58:11.000000000 +1100
++++ b/src/metadata_handler.h 2013-12-16 10:52:23.234353526 +1100
+@@ -45,10 +45,13 @@
+ #define CH_EXTURL 4
+ #define CH_MP4 5
+ #define CH_FFTH 6
++#define CH_FLAC 7
+
+ #define CONTENT_TYPE_MP3 "mp3"
+ #define CONTENT_TYPE_OGG "ogg"
+ #define CONTENT_TYPE_FLAC "flac"
++#define CONTENT_TYPE_WMA "wma"
++#define CONTENT_TYPE_WAVPACK "wv"
+ #define CONTENT_TYPE_JPG "jpg"
+ #define CONTENT_TYPE_PLAYLIST "playlist"
+ #define CONTENT_TYPE_MP4 "mp4"
diff --git a/net-misc/mediatomb/files/mediatomb-0.12.1-gcc46.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-gcc46.patch
deleted file mode 100644
index 40b8f51881b4..000000000000
--- a/net-misc/mediatomb/files/mediatomb-0.12.1-gcc46.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-https://sourceforge.net/tracker/?func=detail&aid=3173314&group_id=129766&atid=715782
-https://bugs.gentoo.org/353733
-
---- 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/net-misc/mediatomb/files/mediatomb-0.12.1-gcc47.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-gcc47.patch
deleted file mode 100644
index 5c4687d15a51..000000000000
--- a/net-misc/mediatomb/files/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/net-misc/mediatomb/files/mediatomb-0.12.1-libav7.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-libav7.patch
deleted file mode 100644
index e25697c5021b..000000000000
--- a/net-misc/mediatomb/files/mediatomb-0.12.1-libav7.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/net-misc/mediatomb/files/mediatomb-0.12.1-mozjs185.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-mozjs185.patch
deleted file mode 100644
index eb67540d7c69..000000000000
--- a/net-misc/mediatomb/files/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/net-misc/mediatomb/files/mediatomb-0.12.1-youtube-dl.patch b/net-misc/mediatomb/files/mediatomb-0.12.1-youtube-dl.patch
new file mode 100644
index 000000000000..6001d2fc5661
--- /dev/null
+++ b/net-misc/mediatomb/files/mediatomb-0.12.1-youtube-dl.patch
@@ -0,0 +1,141 @@
+--- mediatomb-0.12.1.orig/src/youtube_video_url.cc 2013-12-17 22:46:24.272442249 +0000
++++ mediatomb-0.12.1/src/youtube_video_url.cc 2013-12-17 22:57:25.968039083 +0000
+@@ -117,89 +117,68 @@ String YouTubeVideoURL::getVideoURL(Stri
+
+ watch = _(YOUTUBE_URL_WATCH) + video_id;
+
+- Ref<URL> url(new URL(YOUTUBE_PAGESIZE));
++ /*
++ * NOTE ON PATCH:
++ *
++ * The original code does not seem to work anymore.
++ *
++ * I have commented-out all the original code, and instead
++ * replaced it with a call/exec to youtube-dl (this is a separate/stand-alone python script).
++ *
++ * Available at http://rg3.github.io/youtube-dl/
++ *
++ *
++ * The current code works on a/my samsung TV. I have not tested it further on other devices.
++ * (I needed a quick fix, because I wanted to watch some video's. :) )
++ *
++ * I thought I would share the results.
++ *
++ * Suggestions / feedback -> bas-patch@tcfaa.nl
++ *
++ * Regards, Bas Nedermeijer
++ */
++
++ int pipefd[2];
++ pipe(pipefd);
++
++ if (fork() == 0)
++ {
++ // close reading end in the child
++ close(pipefd[0]);
++
++ // send stdout to the pipe
++ dup2(pipefd[1], 1);
++ // send stderr to the pipe
++ dup2(pipefd[1], 2);
+
+- Ref<StringBuffer> buffer = url->download(watch, &retcode, curl_handle,
+- false, verbose, true);
+- if (retcode != 200)
+- {
+- throw _Exception(_("Failed to get URL for video with id ")
+- + watch + _("HTTP response code: ") +
+- String::from(retcode));
+- }
++ // this descriptor is no longer needed
++ close(pipefd[1]);
+
+- log_debug("------> GOT BUFFER %s\n", buffer->toString().c_str());
+-
+- Ref<Matcher> matcher = reVideoURLParams->matcher(buffer->toString());
+- String params;
+- if (matcher->next())
+- {
+-// params = trim_string(matcher->group(1));
+- params = trim_string( matcher->group( 0 ) );
+- /*
+- int brace = params.index( '{' );
+- if ( brace > 0 )
+- params = params.substring( brace );
+- brace = params.index( '}' );
+- if ( brace > 0 )
+- params = params.substring( 0, brace + 1 );
+- */
+- Ref<Matcher> m2 = param_t->matcher(params);
+- if (m2->next())
+- {
+- String hmm = m2->group(1);
+- if (string_ok(hmm))
+- params = hmm;
+- else
+- {
+- throw _Exception(_("Could not retrieve \"t\" parameter."));
+- }
+- }
++ // This code assumes youtube-dl is available for usage.
++ execl("/usr/bin/youtube-dl", "/usr/bin/youtube-dl","-g",watch.c_str(),NULL);
+ }
+ else
+ {
+- throw _Exception(_("Failed to get URL for video with id (step 1)") + video_id);
+- }
++ // parent
++ char buffery[8192];
++ memset(&buffery[0], 0, sizeof(buffery));
+
+- params = _(YOUTUBE_URL_GET) + YOUTUBE_URL_PARAM_VIDEO_ID + '=' +
+- video_id + '&' + YOUTUBE_URL_PARAM_T + '=' + params;
++ close(pipefd[1]); // close the write end of the pipe in the parent
+
+- if (mp4)
+- {
+- String format = _("&fmt=18");
+-
+- if (hd)
++ // Hopefully the read is never called twice, otherwise the buffer will become corrupt.
++ while (read(pipefd[0], buffery, sizeof(buffery)) != 0)
+ {
+- matcher = HD->matcher(buffer->toString());
+- if (matcher->next())
+- {
+- if (trim_string(matcher->group(1)) == "true")
+- format = _("&fmt=22");
+- }
+ }
+-
+- params = params + format;
+- }
+
+- buffer = url->download(params, &retcode, curl_handle, true, verbose, true);
++ log_debug("------> GOT BUFFER %s\n", buffery);
++ String result = _(buffery);
+
+- matcher = redirectLocation->matcher(buffer->toString());
+- if (matcher->next())
+- {
+- if (string_ok(trim_string(matcher->group(1))))
+- return trim_string(matcher->group(1));
+- else
+- throw _Exception(_("Failed to get URL for video with id (step 2)")+
+- video_id);
+- }
++ result = trim_string(result);
+
+- if (retcode != 303)
+- {
+- throw _Exception(_("Unexpected reply from YouTube: ") +
+- String::from(retcode));
+- }
++ log_debug("------> GOT BUFFER (after trimming) %s\n", result.c_str());
+
+- throw _Exception(_("Could not retrieve YouTube video URL"));
++ return result;
++ }
+ }
+
+ #endif//YOUTUBE