# moc fails to build with ffmpeg enabled



## free-and-bsd (Dec 21, 2013)

Trying to build audio/moc with ffmpeg support -- build fails with errors:


```
ffmpeg.c:232: error: 'struct ffmpeg_data' has no member named 'error'
ffmpeg.c:234: error: 'struct ffmpeg_data' has no member named 'enc'
ffmpeg.c:235: error: 'struct ffmpeg_data' has no member named 'enc'
ffmpeg.c:238: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:239: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:239: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:243: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:245: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:246: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:246: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:247: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:248: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:252: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:253: error: 'struct ffmpeg_data' has no member named 'remain_buf'
ffmpeg.c:254: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:261: error: 'struct ffmpeg_data' has no member named 'ic'
ffmpeg.c:273: warning: implicit declaration of function 'avcodec_decode_audio'
ffmpeg.c:273: error: 'struct ffmpeg_data' has no member named 'enc'
ffmpeg.c:279: error: 'struct ffmpeg_data' has no member named 'error'
ffmpeg.c:311: error: 'struct ffmpeg_data' has no member named 'bitrate'
ffmpeg.c:311: error: 'struct ffmpeg_data' has no member named 'remain_buf_len'
ffmpeg.c:226: warning: unused variable 'avbuf'
ffmpeg.c: In function 'ffmpeg_get_bitrate':
ffmpeg.c:323: error: 'struct ffmpeg_data' has no member named 'bitrate'
ffmpeg.c: In function 'ffmpeg_get_duration':
ffmpeg.c:330: error: 'struct ffmpeg_data' has no member named 'ic'
ffmpeg.c:330: error: 'struct ffmpeg_data' has no member named 'ic'
ffmpeg.c: In function 'ffmpeg_get_error':
ffmpeg.c:363: error: 'struct ffmpeg_data' has no member named 'error'
gmake[3]: *** [libffmpeg_decoder_la-ffmpeg.lo] Error 1
gmake[3]: Leaving directory `/usr/ports/audio/moc/work/moc-2.4.4/decoder_plugins/ffmpeg'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/usr/ports/audio/moc/work/moc-2.4.4/decoder_plugins'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/ports/audio/moc/work/moc-2.4.4'
gmake: *** [all] Error 2
*** [do-build] Error code 1

Stop in /usr/ports/audio/moc.
*** [build] Error code 1

Stop in /usr/ports/audio/moc.
```
Needless to say, multimedia/ffmpeg is installed, and even if it wasn't portmaster would sure take care of that.
My system is FreeBSD 9.2 amd64, fresh installation, base system + everything else from a recent ports tree version (Dec 18 2013).


----------



## segfault (Aug 5, 2014)

Having similar issues on FreeBSD 10-RELEASE. Looks like audio/moc's ffmpeg plugin is using stuff that has been deprecated by the multimedia/ffmpeg project. Attempting to patch and/or notify creator of moc.


----------



## free-and-bsd (Aug 5, 2014)

segfault said:
			
		

> Having similar issues on FreeBSD 10-RELEASE. Looks like audio/moc's ffmpeg plugin is using stuff that has been deprecated by the multimedia/ffmpeg project. Attempting to patch and/or notify creator of moc.


Really? I think the issue has been fixed a long time ago. At least I have no problems here, though I update ports every now and then.


----------



## segfault (Aug 5, 2014)

Looking up the website for moc does show that it was indeed updated to include the plugin changes in moc-2.5.0-alph0. However the newest in ports is moc-2.4.4(stable). Is streaming working for you now? What version of audio/moc and audio/ffmpeg are you using?


----------



## free-and-bsd (Aug 5, 2014)

```
ffmpeg version 2.2.4
built on Jul 11 2014 10:56:08 with FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
```
Oh, sorry!! audio/moc isn't installed here. So that's why I have no problem


----------



## segfault (Aug 5, 2014)

Interesting. I have the same version and still get build errors when making audio/moc from ports. Not sure what manner of magic you've used to make that work but I can't seem to get it.


----------



## free-and-bsd (Aug 5, 2014)

*S*ee my edit above*.*


----------



## free-and-bsd (Aug 5, 2014)

Looks like the code is broken. It uses elements that have long been replaced in the current versions of ffmpeg.


----------



## free-and-bsd (Aug 8, 2014)

*Re: moc fails to buld with ffmpeg enabled: SUCCESS*



			
				segfault said:
			
		

> Having similar issues on FreeBSD 10-RELEASE. Looks like audio/moc's ffmpeg plugin is using stuff that has been deprecated by the multimedia/ffmpeg project. Attempting to patch and/or notify creator of moc.


OK, I have succeeded building it from SVN  :beergrin . Just got so much obsessed with it, you know, couldn't stop...
The SVN version doesn't use AVFormatParameters in ffmpeg.c, which has been removed from ffmpeg libraries but is still used in audio/moc (and "stable" source) and causes it to fail.
So... you can try the following, and maybe the audio/moc port maintainers will consider trying it as well.

```
svn co svn://daper.net/moc/trunk
cd trunk
autoreconf -i
```
(here I followed the advice given by libtoolize and added "LT_CONFIG_LTDL_DIR([libltdl])" declatation to the configure.in file in the top dir)
IMPORTANT: I had to install Berkeley DB from databases/db5 as a requirement (it must be bdb version above 4.1). But then, of course, you will also need devel/autoconf, devel/automake and devel/libtool installed. But this hardly needs to be mentioned, as on a FreeBSD system these things usually are installed as build deps.
Then it's standard:

```
LDFLAGS="-L/usr/local/lib/db5 -L/usr/local/lib -L/usr/lib" CPPFLAGS="-I/usr/include -I/usr/local/inlucde -I/usr/local/include/db5" ./configure --prefix=$HOME/mocp --without-alsa --without-jack --without-speex --without-timidity --without-wavpack
```
Observe here, the configure built by `autoreconf -i` command needs to be told where the Berkeley DB libs and includes are (see the LDFLAGS and CPPFLAGS), or it will fail with really misleading messages. Also, my $CPPFLAGS and $LDFLAGS pointed to the dirs include/db5 and lib/db5, but for databases/db48 it will indeed be include/db48 etc.
Then, the options like --without-$option and --prefix=$PREFIX are up to you... And I use `"./configure"` in my command line, because my shell is /usr/local/bin/bash. If yours is /bin/sh, then the `configure` command invocation will be different, I guess.


```
sudo make
sudo make install
```

... So, this must be it. And it works OK: mp3, aac, flac, what else? I'm yet to explore its numerous functionalities


----------



## free-and-bsd (Oct 25, 2014)

After the last update of the ports tried to recompile it from updated SVN trunk and got errors:

```
common.c: undefined reference to `__UINT64_C'
```
This was finally solved by adding
`CC="/usr/local/bin/gcc48"` in front of the `./configure` line:

```
CC="/usr/local/bin/gcc48" LDFLAGS="-L/usr/local/lib/db5 -L/usr/local/lib -L/usr/lib" CPPFLAGS="-I/usr/include -I/usr/local/inlucde -I/usr/local/include/db5" ./configure --prefix=$HOME/mocp --without-alsa --without-jack --without-speex --without-timidity --without-wavpack
```


----------



## free-and-bsd (Dec 21, 2014)

BTW, new version is out: moc-2.5.0 is the stable version now, though I haven't tried if it builds with ffmpeg as above. Also the moc-2.6-alpha1 is available as a tarball, so I've created a port for my personal usage (moc-devel). This gave an opportunity to appreciate how the above mentioned ./configure complications are easily handled via FreeBSD ports' Makefile.


----------

