Index: Portfile
===================================================================
--- Portfile	(revision 148002)
+++ Portfile	(working copy)
@@ -9,7 +9,7 @@
 
 name                         py-bob-io-video
 version                      2.0.5
-revision                     2
+revision                     3
 license                      BSD
 homepage                     http://idiap.github.com/bob/
 
@@ -73,6 +73,7 @@
       port:py${python.version}-bob-core
 
 
+      patchfiles patch-ffmpeg-3.0.diff
 
 
           # blacklist older compilers that don't support -std=c++0x (10.6 and earlier)       
Index: files/patch-ffmpeg-3.0.diff
===================================================================
--- files/patch-ffmpeg-3.0.diff	(nonexistent)
+++ files/patch-ffmpeg-3.0.diff	(working copy)
@@ -0,0 +1,132 @@
+diff -ur bob/io/video.orig/cpp/reader.cpp bob/io/video/cpp/reader.cpp
+--- bob/io/video.orig/cpp/reader.cpp	2016-01-20 01:20:33.000000000 -0800
++++ bob/io/video/cpp/reader.cpp	2016-04-24 06:00:47.000000000 -0700
+@@ -18,9 +18,11 @@
+ 
+ #include <bob.io.base/blitz_array.h>
+ 
++#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0
+ #ifndef AV_PIX_FMT_RGB24
+ #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+ #endif
++#endif
+ 
+ namespace bob { namespace io { namespace video {
+ 
+@@ -217,7 +219,7 @@
+     m_codec_context = make_codec_context(filename,
+         m_format_context->streams[m_stream_index], m_codec);
+     m_swscaler = make_scaler(filename, m_codec_context,
+-        m_codec_context->pix_fmt, PIX_FMT_RGB24);
++        m_codec_context->pix_fmt, AV_PIX_FMT_RGB24);
+     m_context_frame = make_empty_frame(filename);
+     m_rgb_array.reference(blitz::Array<uint8_t,3>(m_codec_context->height,
+           m_codec_context->width, 3));
+diff -ur bob/io/video.orig/cpp/utils.cpp bob/io/video/cpp/utils.cpp
+--- bob/io/video.orig/cpp/utils.cpp	2016-01-20 01:20:33.000000000 -0800
++++ bob/io/video/cpp/utils.cpp	2016-04-24 06:00:47.000000000 -0700
+@@ -37,6 +37,7 @@
+ #  define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
+ #endif
+ 
++#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0
+ #ifndef AV_PKT_FLAG_KEY
+ #define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+ #endif
+@@ -44,6 +45,7 @@
+ #ifndef AV_PIX_FMT_YUV420P
+ #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
+ #endif
++#endif
+ 
+ #if LIBAVCODEC_VERSION_INT < 0x347a00 //52.122.0 @ ffmpeg-0.7
+ #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+@@ -752,9 +754,15 @@
+   }
+ }
+ 
++#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0
++boost::shared_ptr<AVFrame>
++bob::io::video::make_frame(const std::string& filename,
++    boost::shared_ptr<AVCodecContext> codec, AVPixelFormat pixfmt) {
++#else
+ boost::shared_ptr<AVFrame>
+ bob::io::video::make_frame(const std::string& filename,
+     boost::shared_ptr<AVCodecContext> codec, PixelFormat pixfmt) {
++#endif
+ 
+   /* allocate and init a re-usable frame */
+ #if LIBAVCODEC_VERSION_INT < 0x373466 //55.52.102 @ ffmpeg-2.2
+@@ -857,9 +865,15 @@
+   if (s) sws_freeContext(s);
+ }
+ 
++#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0
++boost::shared_ptr<SwsContext> bob::io::video::make_scaler
++(const std::string& filename, boost::shared_ptr<AVCodecContext> ctxt,
++ AVPixelFormat source_pixel_format, AVPixelFormat dest_pixel_format) {
++#else
+ boost::shared_ptr<SwsContext> bob::io::video::make_scaler
+ (const std::string& filename, boost::shared_ptr<AVCodecContext> ctxt,
+  PixelFormat source_pixel_format, PixelFormat dest_pixel_format) {
++#endif
+ 
+   /**
+    * Initializes the software scaler (SWScale) so we can convert images to
+diff -ur bob/io/video.orig/cpp/writer.cpp bob/io/video/cpp/writer.cpp
+--- bob/io/video.orig/cpp/writer.cpp	2016-01-20 01:20:33.000000000 -0800
++++ bob/io/video/cpp/writer.cpp	2016-04-24 06:03:33.000000000 -0700
+@@ -20,9 +20,11 @@
+ #define FFMPEG_VIDEO_BUFFER_SIZE 0
+ #endif
+ 
++#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0
+ #ifndef AV_PIX_FMT_RGB24
+ #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+ #endif
++#endif
+ 
+ namespace bob { namespace io { namespace video {
+ 
+@@ -45,7 +47,7 @@
+     m_codec_context(make_codec_context(filename, m_stream.get(), m_codec)),
+     m_context_frame(make_frame(filename, m_codec_context, m_stream->codec->pix_fmt)),
+ #if LIBAVCODEC_VERSION_INT >= 0x352a00 //53.42.0 @ ffmpeg-0.9
+-    m_swscaler(make_scaler(filename, m_codec_context, PIX_FMT_GBRP, m_stream->codec->pix_fmt)),
++    m_swscaler(make_scaler(filename, m_codec_context, AV_PIX_FMT_GBRP, m_stream->codec->pix_fmt)),
+ #else
+     m_rgb24_frame(make_frame(filename, m_codec_context, AV_PIX_FMT_RGB24)),
+     m_swscaler(make_scaler(filename, m_codec_context, AV_PIX_FMT_RGB24, m_stream->codec->pix_fmt)),
+diff -ur bob/io/video.orig/include/bob.io.video/utils.h bob/io/video/include/bob.io.video/utils.h
+--- bob/io/video.orig/include/bob.io.video/utils.h	2016-01-20 01:20:33.000000000 -0800
++++ bob/io/video/include/bob.io.video/utils.h	2016-04-24 06:00:47.000000000 -0700
+@@ -120,9 +120,15 @@
+    * conjunction with other objects required for file encoding, order must be
+    * respected.
+    */
++#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0
++  boost::shared_ptr<SwsContext> make_scaler(const std::string& filename,
++      boost::shared_ptr<AVCodecContext> stream,
++      AVPixelFormat source_pixel_format, AVPixelFormat dest_pixel_format);
++#else
+   boost::shared_ptr<SwsContext> make_scaler(const std::string& filename,
+       boost::shared_ptr<AVCodecContext> stream,
+       PixelFormat source_pixel_format, PixelFormat dest_pixel_format);
++#endif
+ 
+   /**
+    * Allocates a frame for a particular context. The frame space will be
+@@ -134,8 +140,13 @@
+    * conjunction with other objects required for file encoding, order must be
+    * respected.
+    */
++#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0
++  boost::shared_ptr<AVFrame> make_frame(const std::string& filename,
++      boost::shared_ptr<AVCodecContext> stream, AVPixelFormat pixfmt);
++#else
+   boost::shared_ptr<AVFrame> make_frame(const std::string& filename,
+       boost::shared_ptr<AVCodecContext> stream, PixelFormat pixfmt);
++#endif
+ 
+   /************************************************************************
+    * Video reading specific utilities
