- Allow linking against system libraries for almost everything
  b8a79cd0f61c0109b68a23a324c45891851bcc4c

- Fix building with newer FFmpeg
  https://github.com/stepmania/stepmania/pull/2247

Index: src/arch/MovieTexture/MovieTexture_FFMpeg.h
--- src/arch/MovieTexture/MovieTexture_FFMpeg.h.orig
+++ src/arch/MovieTexture/MovieTexture_FFMpeg.h
@@ -13,11 +13,31 @@ namespace avcodec
 		#include <libavformat/avformat.h>
 		#include <libswscale/swscale.h>
 		#include <libavutil/pixdesc.h>
+		#include <libavcodec/avcodec.h>
+
+		#if LIBAVCODEC_VERSION_MAJOR >= 58
+		#define av_free_packet av_packet_unref
+		#define PixelFormat AVPixelFormat
+		#define PIX_FMT_YUYV422 AV_PIX_FMT_YUYV422
+		#define PIX_FMT_BGRA    AV_PIX_FMT_BGRA
+		#define PIX_FMT_ARGB	AV_PIX_FMT_ARGB
+		#define PIX_FMT_ABGR	AV_PIX_FMT_ABGR
+		#define PIX_FMT_RGBA	AV_PIX_FMT_RGBA
+		#define PIX_FMT_RGB24	AV_PIX_FMT_RGB24
+		#define PIX_FMT_BGR24	AV_PIX_FMT_BGR24
+		#define PIX_FMT_RGB555	AV_PIX_FMT_RGB555
+		#define PIX_FMT_NB		AV_PIX_FMT_NB
+		#define CODEC_ID_NONE   AV_CODEC_ID_NONE
+		#endif
 	}
 };
 
 #define STEPMANIA_FFMPEG_BUFFER_SIZE 4096
+#ifdef SWS_BICUBIC
 static const int sws_flags = SWS_BICUBIC; // XXX: Reasonable default?
+#else
+static const int sws_flags = avcodec::SWS_BICUBIC; // XXX: Reasonable default?
+#endif
 
 class MovieTexture_FFMpeg: public MovieTexture_Generic
 {
@@ -48,8 +64,8 @@ class MovieDecoder_FFMpeg: public MovieDecoder (public
 	void GetFrame( RageSurface *pOut );
 	int DecodeFrame( float fTargetTime );
 
-	int GetWidth() const { return m_pStream->codec->width; }
-	int GetHeight() const { return m_pStream->codec->height; }
+	int GetWidth() const { return m_pStreamCodec->width; }
+	int GetHeight() const { return m_pStreamCodec->height; }
 
 	RageSurface *CreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, MovieDecoderPixelFormatYCbCr &fmtout );
 
@@ -66,6 +82,7 @@ class MovieDecoder_FFMpeg: public MovieDecoder (public
 	avcodec::AVFrame *m_Frame;
 	avcodec::PixelFormat m_AVTexfmt; /* PixelFormat of output surface */
 	avcodec::SwsContext *m_swsctx;
+	avcodec::AVCodecContext *m_pStreamCodec;
 
 	avcodec::AVFormatContext *m_fctx;
 	float m_fTimestamp;
