diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index c6586862e9bc86fddb8bacf65a207aaf2f0b1a5c..529bf24cd789d09843581f855cb7ecae35ae2c33 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -35,6 +35,7 @@
 
 #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
 
+#include <stdint.h>
 #include <time.h>
 #include <stdio.h>  /* FILE */
 #include "libavcodec/avcodec.h"
diff --git a/libavformat/ffm.h b/libavformat/ffm.h
index 52a84094a82b00ca1dc6ac5285bc7a387bdb4064..1ede49a2857d90790953eaa12804df7ad08eda0b 100644
--- a/libavformat/ffm.h
+++ b/libavformat/ffm.h
@@ -22,7 +22,9 @@
 #ifndef FFMPEG_FFM_H
 #define FFMPEG_FFM_H
 
+#include <stdint.h>
 #include "avformat.h"
+#include "avio.h"
 
 /* The FFM file is made of blocks of fixed size */
 #define FFM_HEADER_SIZE 14
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 6acebc34b7402531c91c7f1bc5cc033b0350dc05..23ddcaaecba732f3bd5bf0dd3d0b0fc7be3dc315 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -22,6 +22,7 @@
 #ifndef FFMPEG_NUT_H
 #define FFMPEG_NUT_H
 
+#include <stdint.h>
 //#include <limits.h>
 //#include "libavutil/adler32.h"
 //#include "libavcodec/mpegaudio.h"
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index 4e88d0e3931659bcdb0de676164adfe12b15e5b7..09407d2ff65d0704a1a0ca3baec1a9d99a3f6ca2 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -25,6 +25,7 @@
 #ifndef FFMPEG_OGGDEC_H
 #define FFMPEG_OGGDEC_H
 
+#include <stdint.h>
 #include "avformat.h"
 
 typedef struct ogg_codec {
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index 34970e39520c8707ef322dac085b4bb7f7a07969..4c32ad54a269a10c0aa6e9f137be8b1ad5fd713a 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -27,6 +27,8 @@
  * miscellaneous OS support macros and functions.
  */
 
+#include "config.h"
+
 #ifdef __MINGW32__
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
diff --git a/libavformat/raw.h b/libavformat/raw.h
index 3d851c829b740797505a540cb6470acde23132cd..d83bf3ab0cf7ce351d60c6f3b4581b12fa3a13f9 100644
--- a/libavformat/raw.h
+++ b/libavformat/raw.h
@@ -22,6 +22,7 @@
 #ifndef FFMPEG_RAW_H
 #define FFMPEG_RAW_H
 
+#include <stdint.h>
 #include "avformat.h"
 
 int pcm_read_seek(AVFormatContext *s,
diff --git a/libavformat/rm.h b/libavformat/rm.h
index 2f7f8df2eeb96dcf84caf39e9567b83acb7a42db..0fea7291231ee517fda3efcd3155af59f5573e47 100644
--- a/libavformat/rm.h
+++ b/libavformat/rm.h
@@ -22,6 +22,7 @@
 #ifndef FFMPEG_RM_H
 #define FFMPEG_RM_H
 
+#include <stdint.h>
 #include "avformat.h"
 
 
diff --git a/libavformat/rtp.h b/libavformat/rtp.h
index 36affed42041f98aaf8f5578ecb4bbc815567527..1603471c7c6fc1ef0c93bbec13286db15d2e572d 100644
--- a/libavformat/rtp.h
+++ b/libavformat/rtp.h
@@ -21,6 +21,7 @@
 #ifndef FFMPEG_RTP_H
 #define FFMPEG_RTP_H
 
+#include <stdint.h>
 #include "libavcodec/avcodec.h"
 #include "avformat.h"
 
diff --git a/libavformat/rtp_aac.h b/libavformat/rtp_aac.h
index 24b41cc425513a022a520f2a135528b59ad68c00..d4cbb59707196017c294289a8edb303c629fbce6 100644
--- a/libavformat/rtp_aac.h
+++ b/libavformat/rtp_aac.h
@@ -20,6 +20,7 @@
 #ifndef FFMPEG_RTP_AAC_H
 #define FFMPEG_RTP_AAC_H
 
+#include <stdint.h>
 #include "avformat.h"
 
 void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size);
diff --git a/libavformat/rtp_h264.h b/libavformat/rtp_h264.h
index 0f23e525cc3a359b1ea628e078c76e293fd03019..db23f79128a91ec7a5d90a74bea81c708bd6055a 100644
--- a/libavformat/rtp_h264.h
+++ b/libavformat/rtp_h264.h
@@ -22,6 +22,7 @@
 #ifndef FFMPEG_RTP_H264_H
 #define FFMPEG_RTP_H264_H
 
+#include <stdint.h>
 #include "rtp_internal.h"
 
 extern RTPDynamicProtocolHandler ff_h264_dynamic_handler;
diff --git a/libavformat/rtp_mpv.h b/libavformat/rtp_mpv.h
index 36e649a8916e9d49df10c88ea17b771d3c8cac88..c17939bc9f682208c1b0359c753b1700c53d7626 100644
--- a/libavformat/rtp_mpv.h
+++ b/libavformat/rtp_mpv.h
@@ -20,6 +20,7 @@
 #ifndef FFMPEG_RTP_MPV_H
 #define FFMPEG_RTP_MPV_H
 
+#include <stdint.h>
 #include "avformat.h"
 
 void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size);
diff --git a/libavformat/swf.h b/libavformat/swf.h
index 8249f7ddf957200aa3a4cf904410b0baa3cd4a3e..4ae2b90ef3901b630820d6e1e8ebc3eee6cf4d38 100644
--- a/libavformat/swf.h
+++ b/libavformat/swf.h
@@ -25,6 +25,7 @@
 
 #include "libavutil/fifo.h"
 #include "avformat.h"
+#include "avio.h"
 #include "riff.h"    /* for CodecTag */
 
 /* should have a generic way to indicate probable size */