[FFmpeg-devel] FFmpeg include file policy

usleepless at gmail.com usleepless
Sun Nov 22 21:20:42 CET 2009

Hello Everyone,

I have just been reading along for about 1-2 years, and I must say I am
impressed with the tightness of your guidelines and quality assurance. Wow.

Now I have been working on MythTV for FreeBSD for a couple of years ( since
.18 ). Mythtv includes the FFmpeg source distribution and inherits the
configure script ( They extend it ). I am trying to get MythTV as
crossplatform as is needed to be built easily on FreeBSD from source instead
of port.

I don't want to track every new version and port it again and again. so I
have provided a handful of patches to the MythTV project which they accepted
and things have improved. One patch to the configure script was included in
FFmpeg as well. The latest and greatest .22 requires significant less work.

Now there is an itch which has been there since .18: the MythTV sourcebase
contains a lot of files with #include statements including project files (
so not system library or external library #includes ). Example:


 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301

#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
#include "flv.h"

So because MythTV uses qmake, which tosses /usr/local/include into the
include-dirs, mpeg4audio.h will be fetched from /usr/local/include. It will
be found there because if have ffmpeg also installed from ports. If the
included version in MythTV of FFmpeg differs from the one installed to
/usr/local/include, problems will occur.

So I have been playing around with includefile-directory precedence etc, but
every fix shows another problem. Would it be possible to adopt another
#include statement style, like this?:

#include "../libavcodec/mpeg4audio.h"
#include "../libavformat/avformat.h"
#include "flv.h"

I can imagine it can be useful for other projects integrating FFmpeg as

Or should I learn more about gcc, include-dirs and (q)make first, to see
"the proper" way?

kind regards,


More information about the ffmpeg-devel mailing list