#37457: mediatomb @0.12.1 config and build failure due to updated autoconf and ffmpeg -----------------------+-------------------------------- Reporter: bufflig@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Keywords: | Port: mediatomb -----------------------+-------------------------------- I've had problems compiling mediatomb, that probably boil down to new versions of autoconf and ffmpeg library. Maybe also because I have ffmpeg- devel, I'm not sure. First, the port fails with: ----------- {{{ :debug:configure Executing command line: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_mediatomb/mediatomb/work/mediatomb-0.12.1" && autoreconf --install :info:configure configure.ac:33: warning: macro 'AM_CONFIG_HEADER' not found in library [...] :info:configure configure.ac:1781: the top level :info:configure configure.ac:33: error: possibly undefined macro: AM_CONFIG_HEADER :info:configure If this token and others are legitimate, please use m4_pattern_allow. :info:configure See the Autoconf documentation. }}} ---------------- - which is a pretty common problem. If one fixes the configure.ac: ---------------- {{{ *** ./configure.ac.orig 2012-12-30 21:20:47.000000000 +0100 --- configure.ac 2012-12-30 21:21:17.000000000 +0100 *************** *** 30,36 **** AC_PREREQ(2.61) AC_INIT([MediaTomb], [0.12.1], [jin@mediatomb.cc]) ! AM_CONFIG_HEADER([autoconfig.h tombupnp/upnp/inc/upnpconfig.h]) AC_CONFIG_AUX_DIR(configure_aux) AC_CONFIG_SRCDIR([src/common.h]) AM_INIT_AUTOMAKE([1.9 -Wall]) --- 30,36 ---- AC_PREREQ(2.61) AC_INIT([MediaTomb], [0.12.1], [jin@mediatomb.cc]) ! AC_CONFIG_HEADERS([autoconfig.h tombupnp/upnp/inc/upnpconfig.h]) AC_CONFIG_AUX_DIR(configure_aux) AC_CONFIG_SRCDIR([src/common.h]) AM_INIT_AUTOMAKE([1.9 -Wall]) }}} ---------------- - one will get into new trouble: ---------------- {{{ :info:build mv -f .deps/libmediatomb_a-main.Tpo .deps/libmediatomb_a- main.Po :info:build ../src/metadata/ffmpeg_handler.cc: In function ?<80><98>void addFfmp egMetadataFields(zmm::Ref<CdsItem>, AVFormatContext*)?<80><99>: :info:build ../src/metadata/ffmpeg_handler.cc:92: error: ?<80><98>struct AVForma tContext?<80><99> has no member named ?<80><98>title?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:94: error: ?<80><98>struct AVForma tContext?<80><99> has no member named ?<80><98>title?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:96: error: ?<80><98>struct AVForma tContext?<80><99> has no member named ?<80><98>title?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:98: error: ?<80><98>struct AVForma tContext?<80><99> has no member named ?<80><98>author?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:100: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>author?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:102: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>author?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:104: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>album?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:106: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>album?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:108: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>album?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:110: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>year?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:112: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>year?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:114: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>year?<80><99> :info:build /usr/bin/llvm-g++-4.2 -DHAVE_CONFIG_H -I. -I.. -I../tombupnp/upnp/in c -I/opt/local/include -I../src -I../tombupnp/ixml/inc -I../tombupnp/threaduti l/inc -I../tombupnp/upnp/inc -I.. -I/opt/local/include/js -I/opt/local/include /taglib -D_THREAD_SAFE -I/opt/local/include -pipe -O2 -arch x86_64 -MT libmediatomb_a-id3_handler.o -MD -MP -MF .deps/libmediatomb_a- id3_handler.Tp o -c -o libmediatomb_a-id3_handler.o `test -f '../src/metadata/id3_handler.cc' | | echo './'`../src/metadata/id3_handler.cc :info:build ../src/metadata/ffmpeg_handler.cc:116: error: ?<80><98>struct AVForm atContext?<80><99> has no member named ?<80><98>genre?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:118: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>genre?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:120: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>genre?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:122: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>comment?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:124: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>comment?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:126: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>comment?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:128: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>track?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:130: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>track?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc:132: error: ?<80><98>struct AVFormatContext?<80><99> has no member named ?<80><98>track?<80><99> :info:build ../src/metadata/ffmpeg_handler.cc: In function ?<80><98>void addFfmpegResourceFields(zmm::Ref<CdsItem>, AVFormatContext*, int*, int*)?<80><99>: :info:build ../src/metadata/ffmpeg_handler.cc:181: error: ?<80><98>CODEC_TYPE_VIDEO?<80><99> was not declared in this scope :info:build ../src/metadata/ffmpeg_handler.cc:212: error: ?<80><98>CODEC_TYPE_AUDIO?<80><99> was not declared in this scope :info:build ../src/metadata/ffmpeg_handler.cc: In member function ?<80><98>virtual void FfmpegHandler::fillMetadata(zmm::Ref<CdsItem>)?<80><99>: :info:build ../src/metadata/ffmpeg_handler.cc:264: error: ?<80><98>av_open_input_file?<80><99> was not declared in this scope :info:build ../src/metadata/ffmpeg_handler.cc:268: warning: ?<80><98>av_find_stream_info?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1446) :info:build ../src/metadata/ffmpeg_handler.cc:268: warning: ?<80><98>av_find_stream_info?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1446) :info:build ../src/metadata/ffmpeg_handler.cc:270: warning: ?<80><98>av_close_in av_close_input_file?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1622) :info:build ../src/metadata/ffmpeg_handler.cc:270: warning: ?<80><98>av_close_input_file?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1622) :info:build ../src/metadata/ffmpeg_handler.cc:279: warning: ?<80><98>av_close_input_file?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1622) :info:build ../src/metadata/ffmpeg_handler.cc:279: warning: ?<80><98>av_close_input_file?<80><99> is deprecated (declared at /opt/local/include/libavformat/avformat.h:1622) :info:build make[2]: *** [libmediatomb_a-ffmpeg_handler.o] Error 1 }}} ------------------ - which should be due to the change in ffmpeg's API, why one can search the net for two patches that will fix this and apply them, resulting in... -------------------------- {{{ *** src/metadata/ffmpeg_handler.cc.orig 2012-12-30 21:30:34.000000000 +0100 --- src/metadata/ffmpeg_handler.cc 2012-12-30 21:29:41.000000000 +0100 *************** *** 89,94 **** --- 89,121 ---- 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++) + { + 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); + 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,136 **** --- 158,164 ---- item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp, sc->convert(String::from(pFormatCtx->track))); } + */ } // ffmpeg library calls *************** *** 178,184 **** 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->codec->codec_tag > 0) { --- 206,212 ---- for(i=0; i<pFormatCtx->nb_streams; i++) { AVStream *st = pFormatCtx->streams[i]; ! if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)) { if (st->codec->codec_tag > 0) { *************** *** 209,215 **** *y = st->codec->height; } } ! if(st->codec->codec_type == CODEC_TYPE_AUDIO) { // Increase number of audiochannels audioch++; --- 237,243 ---- *y = st->codec->height; } } ! if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { // Increase number of audiochannels audioch++; *************** *** 251,257 **** int x = 0; int y = 0; ! AVFormatContext *pFormatCtx; // Suppress all log messages av_log_set_callback(FfmpegNoOutputStub); --- 279,285 ---- int x = 0; int y = 0; ! AVFormatContext *pFormatCtx = avformat_alloc_context(); // Suppress all log messages av_log_set_callback(FfmpegNoOutputStub); *************** *** 259,273 **** // 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) return; // Couldn't open file // Retrieve stream information ! if (av_find_stream_info(pFormatCtx) < 0) { ! av_close_input_file(pFormatCtx); return; // Couldn't find stream information } // Add metadata using ffmpeg library calls --- 287,301 ---- // Register all formats and codecs av_register_all(); ! // Open video file ! if (avformat_open_input(&pFormatCtx, ! item->getLocation().c_str(), NULL, NULL) != 0) return; // Couldn't open file // Retrieve stream information ! if (avformat_find_stream_info(pFormatCtx,NULL) < 0) { ! avformat_close_input(&pFormatCtx); return; // Couldn't find stream information } // Add metadata using ffmpeg library calls *************** *** 276,282 **** addFfmpegResourceFields(item, pFormatCtx, &x, &y); // Close the video file ! av_close_input_file(pFormatCtx); } Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size) --- 304,310 ---- addFfmpegResourceFields(item, pFormatCtx, &x, &y); // Close the video file ! avformat_close_input(&pFormatCtx); } Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size) }}} -------------------------------- - and so it builds. And my versions... {{{
port list | grep mediatomb mediatomb @0.12.1 net/mediatomb port list | grep ffmpeg gst-ffmpeg @0.10.13 gnome/gst-ffmpeg ffmpegthumbs @4.9.3 kde/ffmpegthumbs ffmpeg @1.0.1 multimedia/ffmpeg ffmpeg-devel @20121205 multimedia/ffmpeg-devel port version Version: 2.1.2 }}} Just thought maybe anyone else might get into the same trouble and will find this fix useful, or maybe it should in some way be included into mediatomb.
Cheers, /Patrik -- Ticket URL: <https://trac.macports.org/ticket/37457> MacPorts <http://www.macports.org/> Ports system for Mac OS