Hi!

As reported on http://bugs.gentoo.org/347481 the osg 2.8.3 release (and
current trunk probably as well, as far as I can tell) has problems
compiling against recent ffmpeg snapshots. The critical commit there is
SVN revision 25652 from 2010-11-02, which is now in git:

http://git.ffmpeg.org/?p=ffmpeg.git;a=commitdiff;h=262d1c5d2206467809fd

By default it introduces a preprocessor macro called SampleFormat:

#define SampleFormat AVSampleFormat

As a consequence, all references to SampleFormat in osg will be
rewritten, even if they refer to some other C++ namespace. This leads to
errors like this:

error: ‘AVSampleFormat’ in class ‘osg::AudioStream’ does not name a type

Luckily the commit also provides a means to avoid the definition. Simply
include this line before including the av*.h from ffmpeg:

#define FF_API_OLD_SAMPLE_FMT 0

I'd suggest you include this line in FFmpegHeaders.hpp:

--- OpenSceneGraph-2.8.3.orig/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp
+++ OpenSceneGraph-2.8.3/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp
@@ -6,6 +6,7 @@
 extern "C"
 {
 #define __STDC_CONSTANT_MACROS
+#define FF_API_OLD_SAMPLE_FMT 0
 #include <errno.h>    // for error codes defined in avformat.h
 #include <stdint.h>
 #include <avcodec.h>

You can also download this patch from the Gentoo bug report:
http://bugs.gentoo.org/attachment.cgi?id=261477
Feel free to include this in the osg sources.

If you want to reply to this mail, please cc a personal copy to me, as I
won't follow list mails too closely.

Greetings,
 Martin von Gagern

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to