Ticket #37457: mediatomb_build.diff

File mediatomb_build.diff, 4.9 KB (added by bufflig@…, 11 years ago)

The whole diff that makes it build

Line 
1*** ./configure.ac.orig 2012-12-30 21:20:47.000000000 +0100
2--- configure.ac        2012-12-30 21:21:17.000000000 +0100
3***************
4*** 30,36 ****
5 
6  AC_PREREQ(2.61)
7  AC_INIT([MediaTomb], [0.12.1], [jin@mediatomb.cc])
8! AM_CONFIG_HEADER([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])
12--- 30,36 ----
13 
14  AC_PREREQ(2.61)
15  AC_INIT([MediaTomb], [0.12.1], [jin@mediatomb.cc])
16! AC_CONFIG_HEADERS([autoconfig.h tombupnp/upnp/inc/upnpconfig.h])
17  AC_CONFIG_AUX_DIR(configure_aux)
18  AC_CONFIG_SRCDIR([src/common.h])
19  AM_INIT_AUTOMAKE([1.9 -Wall])
20*** src/metadata/ffmpeg_handler.cc.orig 2012-12-30 21:30:34.000000000 +0100
21--- src/metadata/ffmpeg_handler.cc      2012-12-30 21:29:41.000000000 +0100
22***************
23*** 89,94 ****
24--- 89,121 ----
25 
26        Ref<StringConverter> sc = StringConverter::m2i();
27     
28+       /* Tabs are 4 characters here */
29+       typedef struct {const char *avname; metadata_fields_t field;} mapping_t;
30+       static const mapping_t mapping[] =
31+       {
32+               {"title",   M_TITLE},
33+               {"artist",  M_ARTIST},
34+               {"album",   M_ALBUM},
35+               {"date",    M_DATE},
36+               {"genre",   M_GENRE},
37+               {"comment", M_DESCRIPTION},
38+               {"track",   M_TRACKNUMBER},
39+               {NULL,      M_MAX},
40+       };
41+
42+       if (!pFormatCtx->metadata)
43+               return;
44+       for (const mapping_t *m = mapping; m->avname != NULL; m++)
45+       {
46+               AVDictionaryEntry *tag = NULL;
47+               tag = av_dict_get(pFormatCtx->metadata, m->avname, NULL, 0);
48+               if (tag && tag->value && tag->value[0])
49+               {
50+                       log_debug("Added metadata %s: %s\n", m->avname, tag->value);
51+                       item->setMetadata(MT_KEYS[m->field].upnp, sc->convert(tag->value));
52+               }
53+       }
54+       /* Old algorithm (doesn't work with libav >= 0.7)
55        if (strlen(pFormatCtx->title) > 0)
56      {
57            log_debug("Added metadata title: %s\n", pFormatCtx->title);
58***************
59*** 131,136 ****
60--- 158,164 ----
61          item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp,
62                            sc->convert(String::from(pFormatCtx->track)));
63        }
64+       */
65  }
66 
67  // ffmpeg library calls
68***************
69*** 178,184 ****
70        for(i=0; i<pFormatCtx->nb_streams; i++)
71      {
72                AVStream *st = pFormatCtx->streams[i];
73!               if((st != NULL) && (videoset == false) && (st->codec->codec_type == CODEC_TYPE_VIDEO))
74          {
75              if (st->codec->codec_tag > 0)
76              {
77--- 206,212 ----
78        for(i=0; i<pFormatCtx->nb_streams; i++)
79      {
80                AVStream *st = pFormatCtx->streams[i];
81!               if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO))
82          {
83              if (st->codec->codec_tag > 0)
84              {
85***************
86*** 209,215 ****
87                  *y = st->codec->height;
88                        }
89                }
90!               if(st->codec->codec_type == CODEC_TYPE_AUDIO)
91          {
92                        // Increase number of audiochannels
93                        audioch++;
94--- 237,243 ----
95                  *y = st->codec->height;
96                        }
97                }
98!               if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
99          {
100                        // Increase number of audiochannels
101                        audioch++;
102***************
103*** 251,257 ****
104      int x = 0;
105      int y = 0;
106 
107!       AVFormatContext *pFormatCtx;
108       
109        // Suppress all log messages
110        av_log_set_callback(FfmpegNoOutputStub);
111--- 279,285 ----
112      int x = 0;
113      int y = 0;
114 
115!       AVFormatContext *pFormatCtx = avformat_alloc_context();
116       
117        // Suppress all log messages
118        av_log_set_callback(FfmpegNoOutputStub);
119***************
120*** 259,273 ****
121        // Register all formats and codecs
122      av_register_all();
123 
124!     // Open video file
125!     if (av_open_input_file(&pFormatCtx,
126!                           item->getLocation().c_str(), NULL, 0, NULL) != 0)
127          return; // Couldn't open file
128 
129      // Retrieve stream information
130!     if (av_find_stream_info(pFormatCtx) < 0)
131      {
132!         av_close_input_file(pFormatCtx);
133          return; // Couldn't find stream information
134      }   
135        // Add metadata using ffmpeg library calls
136--- 287,301 ----
137        // Register all formats and codecs
138      av_register_all();
139 
140!       // Open video file
141!     if (avformat_open_input(&pFormatCtx,
142!                           item->getLocation().c_str(), NULL, NULL) != 0)
143          return; // Couldn't open file
144 
145      // Retrieve stream information
146!     if (avformat_find_stream_info(pFormatCtx,NULL) < 0)
147      {
148!         avformat_close_input(&pFormatCtx);
149          return; // Couldn't find stream information
150      }   
151        // Add metadata using ffmpeg library calls
152***************
153*** 276,282 ****
154        addFfmpegResourceFields(item, pFormatCtx, &x, &y);
155       
156      // Close the video file
157!     av_close_input_file(pFormatCtx);
158  }
159 
160  Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)
161--- 304,310 ----
162        addFfmpegResourceFields(item, pFormatCtx, &x, &y);
163       
164      // Close the video file
165!     avformat_close_input(&pFormatCtx);
166  }
167 
168  Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)