#ifdef SWSCALE
#include <libswscale/swscale.h>
#endif
-#include <libavcodec/opt.h>
#if LIBAVUTIL_VERSION_INT >= ((50<<16)+(8<<8)+0)
#include <libavutil/pixdesc.h>
#endif
#endif
#if LIBAVCODEC_VERSION_MAJOR > 52
+#include <libavutil/opt.h>
#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
+#else
+#include <libavcodec/opt.h>
#endif
#define MAX_AUDIO_STREAMS (8)
// ffmpeg Header files
#include <libavformat/avformat.h>
-#include <libavcodec/opt.h>
#ifdef AVDEVICE
#include <libavdevice/avdevice.h>
#endif
+#if LIBAVCODEC_VERSION_MAJOR > 52
+#include <libavutil/opt.h>
+#else
+#include <libavcodec/opt.h>
+#endif
// A static flag used to determine if avformat has been initialised
static int avformat_initialised = 0;
// ffmpeg Header files
#include <libavformat/avformat.h>
-#include <libavcodec/opt.h>
#ifdef SWSCALE
# include <libswscale/swscale.h>
#endif
#endif
#if LIBAVCODEC_VERSION_MAJOR > 52
+#include <libavutil/opt.h>
#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
+#else
+#include <libavcodec/opt.h>
#endif
#define POSITION_INITIAL (-2)