Ticket #37457: patch-mediatomb.diff

File patch-mediatomb.diff, 4.5 KB (added by dbevans (David B. Evans), 11 years ago)

Revised patch for Portfile and files directory

  • Portfile

     
    3838
    3939use_autoreconf      yes
    4040
    41 patchfiles          patch-configure.ac.diff
     41patchfiles          patch-configure.ac.diff \
     42                    patch-src-metadata-ffmpeg_handler.cc.diff
    4243
    4344if {${configure.compiler} == "clang"} {
    4445    configure.compiler llvm-gcc-4.2
  • files/patch-configure.ac.diff

     
    1 --- configure.ac.orig   2010-03-25 10:47:02.000000000 -0500
    2 +++ configure.ac        2010-03-25 16:11:28.000000000 -0500
     1--- configure.ac.orig   2010-04-07 15:38:51.000000000 -0700
     2+++ configure.ac        2013-01-10 01:42:00.000000000 -0800
     3@@ -30,7 +30,7 @@
     4 
     5 AC_PREREQ(2.61)
     6 AC_INIT([MediaTomb], [0.12.1], [jin@mediatomb.cc])
     7-AM_CONFIG_HEADER([autoconfig.h tombupnp/upnp/inc/upnpconfig.h])
     8+AC_CONFIG_HEADERS([autoconfig.h tombupnp/upnp/inc/upnpconfig.h])
     9 AC_CONFIG_AUX_DIR(configure_aux)
     10 AC_CONFIG_SRCDIR([src/common.h])
     11 AM_INIT_AUTOMAKE([1.9 -Wall])
    312@@ -692,8 +692,7 @@
    413         AC_MSG_NOTICE([You are running OSX, assuming threadsafe gethostbyname version])
    514 elif test $CYGWIN_OS -eq 1; then
  • files/patch-src-metadata-ffmpeg_handler.cc.diff

     
     1--- src/metadata/ffmpeg_handler.cc.orig 2010-03-25 07:58:10.000000000 -0700
     2+++ src/metadata/ffmpeg_handler.cc      2013-01-10 16:04:04.000000000 -0800
     3@@ -89,6 +89,33 @@
     4 
     5        Ref<StringConverter> sc = StringConverter::m2i();
     6     
     7+       /* Tabs are 4 characters here */
     8+       typedef struct {const char *avname; metadata_fields_t field;} mapping_t;
     9+       static const mapping_t mapping[] =
     10+       {
     11+               {"title",   M_TITLE},
     12+               {"artist",  M_ARTIST},
     13+               {"album",   M_ALBUM},
     14+               {"date",    M_DATE},
     15+               {"genre",   M_GENRE},
     16+               {"comment", M_DESCRIPTION},
     17+               {"track",   M_TRACKNUMBER},
     18+               {NULL,      M_MAX},
     19+       };
     20+
     21+       if (!pFormatCtx->metadata)
     22+               return;
     23+       for (const mapping_t *m = mapping; m->avname != NULL; m++)
     24+       {
     25+               AVDictionaryEntry *tag = NULL;
     26+               tag = av_dict_get(pFormatCtx->metadata, m->avname, NULL, 0);
     27+               if (tag && tag->value && tag->value[0])
     28+               {
     29+                       log_debug("Added metadata %s: %s\n", m->avname, tag->value);
     30+                       item->setMetadata(MT_KEYS[m->field].upnp, sc->convert(tag->value));
     31+               }
     32+       }
     33+       /* Old algorithm (doesn't work with libav >= 0.7)
     34        if (strlen(pFormatCtx->title) > 0)
     35     {
     36            log_debug("Added metadata title: %s\n", pFormatCtx->title);
     37@@ -131,6 +158,7 @@
     38         item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp,
     39                           sc->convert(String::from(pFormatCtx->track)));
     40        }
     41+       */
     42 }
     43 
     44 // ffmpeg library calls
     45@@ -178,7 +206,7 @@
     46        for(i=0; i<pFormatCtx->nb_streams; i++)
     47     {
     48                AVStream *st = pFormatCtx->streams[i];
     49-               if((st != NULL) && (videoset == false) && (st->codec->codec_type == CODEC_TYPE_VIDEO))
     50+               if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO))
     51         {
     52             if (st->codec->codec_tag > 0)
     53             {
     54@@ -209,7 +237,7 @@
     55                 *y = st->codec->height;
     56                        }
     57                }
     58-               if(st->codec->codec_type == CODEC_TYPE_AUDIO)
     59+               if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
     60         {
     61                        // Increase number of audiochannels
     62                        audioch++;
     63@@ -260,14 +288,14 @@
     64     av_register_all();
     65 
     66     // Open video file
     67-    if (av_open_input_file(&pFormatCtx,
     68-                          item->getLocation().c_str(), NULL, 0, NULL) != 0)
     69+    if (avformat_open_input(&pFormatCtx,
     70+                          item->getLocation().c_str(), NULL, NULL) != 0)
     71         return; // Couldn't open file
     72 
     73     // Retrieve stream information
     74-    if (av_find_stream_info(pFormatCtx) < 0)
     75+    if (avformat_find_stream_info(pFormatCtx, NULL) < 0)
     76     {
     77-        av_close_input_file(pFormatCtx);
     78+        avformat_close_input(&pFormatCtx);
     79         return; // Couldn't find stream information
     80     }   
     81        // Add metadata using ffmpeg library calls
     82@@ -276,7 +304,7 @@
     83        addFfmpegResourceFields(item, pFormatCtx, &x, &y);
     84       
     85     // Close the video file
     86-    av_close_input_file(pFormatCtx);
     87+    avformat_close_input(&pFormatCtx);
     88 }
     89 
     90 Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)