| 1 | diff -ur bob/io/video.orig/cpp/reader.cpp bob/io/video/cpp/reader.cpp |
| 2 | --- bob/io/video.orig/cpp/reader.cpp 2016-01-20 01:20:33.000000000 -0800 |
| 3 | +++ bob/io/video/cpp/reader.cpp 2016-04-24 06:00:47.000000000 -0700 |
| 4 | @@ -18,9 +18,11 @@ |
| 5 | |
| 6 | #include <bob.io.base/blitz_array.h> |
| 7 | |
| 8 | +#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0 |
| 9 | #ifndef AV_PIX_FMT_RGB24 |
| 10 | #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 |
| 11 | #endif |
| 12 | +#endif |
| 13 | |
| 14 | namespace bob { namespace io { namespace video { |
| 15 | |
| 16 | @@ -217,7 +219,7 @@ |
| 17 | m_codec_context = make_codec_context(filename, |
| 18 | m_format_context->streams[m_stream_index], m_codec); |
| 19 | m_swscaler = make_scaler(filename, m_codec_context, |
| 20 | - m_codec_context->pix_fmt, PIX_FMT_RGB24); |
| 21 | + m_codec_context->pix_fmt, AV_PIX_FMT_RGB24); |
| 22 | m_context_frame = make_empty_frame(filename); |
| 23 | m_rgb_array.reference(blitz::Array<uint8_t,3>(m_codec_context->height, |
| 24 | m_codec_context->width, 3)); |
| 25 | diff -ur bob/io/video.orig/cpp/utils.cpp bob/io/video/cpp/utils.cpp |
| 26 | --- bob/io/video.orig/cpp/utils.cpp 2016-01-20 01:20:33.000000000 -0800 |
| 27 | +++ bob/io/video/cpp/utils.cpp 2016-04-24 06:00:47.000000000 -0700 |
| 28 | @@ -37,6 +37,7 @@ |
| 29 | # define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG |
| 30 | #endif |
| 31 | |
| 32 | +#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0 |
| 33 | #ifndef AV_PKT_FLAG_KEY |
| 34 | #define AV_PKT_FLAG_KEY PKT_FLAG_KEY |
| 35 | #endif |
| 36 | @@ -44,6 +45,7 @@ |
| 37 | #ifndef AV_PIX_FMT_YUV420P |
| 38 | #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P |
| 39 | #endif |
| 40 | +#endif |
| 41 | |
| 42 | #if LIBAVCODEC_VERSION_INT < 0x347a00 //52.122.0 @ ffmpeg-0.7 |
| 43 | #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO |
| 44 | @@ -752,9 +754,15 @@ |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | +#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0 |
| 49 | +boost::shared_ptr<AVFrame> |
| 50 | +bob::io::video::make_frame(const std::string& filename, |
| 51 | + boost::shared_ptr<AVCodecContext> codec, AVPixelFormat pixfmt) { |
| 52 | +#else |
| 53 | boost::shared_ptr<AVFrame> |
| 54 | bob::io::video::make_frame(const std::string& filename, |
| 55 | boost::shared_ptr<AVCodecContext> codec, PixelFormat pixfmt) { |
| 56 | +#endif |
| 57 | |
| 58 | /* allocate and init a re-usable frame */ |
| 59 | #if LIBAVCODEC_VERSION_INT < 0x373466 //55.52.102 @ ffmpeg-2.2 |
| 60 | @@ -857,9 +865,15 @@ |
| 61 | if (s) sws_freeContext(s); |
| 62 | } |
| 63 | |
| 64 | +#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0 |
| 65 | +boost::shared_ptr<SwsContext> bob::io::video::make_scaler |
| 66 | +(const std::string& filename, boost::shared_ptr<AVCodecContext> ctxt, |
| 67 | + AVPixelFormat source_pixel_format, AVPixelFormat dest_pixel_format) { |
| 68 | +#else |
| 69 | boost::shared_ptr<SwsContext> bob::io::video::make_scaler |
| 70 | (const std::string& filename, boost::shared_ptr<AVCodecContext> ctxt, |
| 71 | PixelFormat source_pixel_format, PixelFormat dest_pixel_format) { |
| 72 | +#endif |
| 73 | |
| 74 | /** |
| 75 | * Initializes the software scaler (SWScale) so we can convert images to |
| 76 | diff -ur bob/io/video.orig/cpp/writer.cpp bob/io/video/cpp/writer.cpp |
| 77 | --- bob/io/video.orig/cpp/writer.cpp 2016-01-20 01:20:33.000000000 -0800 |
| 78 | +++ bob/io/video/cpp/writer.cpp 2016-04-24 06:03:33.000000000 -0700 |
| 79 | @@ -20,9 +20,11 @@ |
| 80 | #define FFMPEG_VIDEO_BUFFER_SIZE 0 |
| 81 | #endif |
| 82 | |
| 83 | +#if LIBAVUTIL_VERSION_INT < 0x371167 //55.17.103 @ ffmpeg-3.0 |
| 84 | #ifndef AV_PIX_FMT_RGB24 |
| 85 | #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 |
| 86 | #endif |
| 87 | +#endif |
| 88 | |
| 89 | namespace bob { namespace io { namespace video { |
| 90 | |
| 91 | @@ -45,7 +47,7 @@ |
| 92 | m_codec_context(make_codec_context(filename, m_stream.get(), m_codec)), |
| 93 | m_context_frame(make_frame(filename, m_codec_context, m_stream->codec->pix_fmt)), |
| 94 | #if LIBAVCODEC_VERSION_INT >= 0x352a00 //53.42.0 @ ffmpeg-0.9 |
| 95 | - m_swscaler(make_scaler(filename, m_codec_context, PIX_FMT_GBRP, m_stream->codec->pix_fmt)), |
| 96 | + m_swscaler(make_scaler(filename, m_codec_context, AV_PIX_FMT_GBRP, m_stream->codec->pix_fmt)), |
| 97 | #else |
| 98 | m_rgb24_frame(make_frame(filename, m_codec_context, AV_PIX_FMT_RGB24)), |
| 99 | m_swscaler(make_scaler(filename, m_codec_context, AV_PIX_FMT_RGB24, m_stream->codec->pix_fmt)), |
| 100 | diff -ur bob/io/video.orig/include/bob.io.video/utils.h bob/io/video/include/bob.io.video/utils.h |
| 101 | --- bob/io/video.orig/include/bob.io.video/utils.h 2016-01-20 01:20:33.000000000 -0800 |
| 102 | +++ bob/io/video/include/bob.io.video/utils.h 2016-04-24 06:00:47.000000000 -0700 |
| 103 | @@ -120,9 +120,15 @@ |
| 104 | * conjunction with other objects required for file encoding, order must be |
| 105 | * respected. |
| 106 | */ |
| 107 | +#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0 |
| 108 | + boost::shared_ptr<SwsContext> make_scaler(const std::string& filename, |
| 109 | + boost::shared_ptr<AVCodecContext> stream, |
| 110 | + AVPixelFormat source_pixel_format, AVPixelFormat dest_pixel_format); |
| 111 | +#else |
| 112 | boost::shared_ptr<SwsContext> make_scaler(const std::string& filename, |
| 113 | boost::shared_ptr<AVCodecContext> stream, |
| 114 | PixelFormat source_pixel_format, PixelFormat dest_pixel_format); |
| 115 | +#endif |
| 116 | |
| 117 | /** |
| 118 | * Allocates a frame for a particular context. The frame space will be |
| 119 | @@ -134,8 +140,13 @@ |
| 120 | * conjunction with other objects required for file encoding, order must be |
| 121 | * respected. |
| 122 | */ |
| 123 | +#if LIBAVUTIL_VERSION_INT >= 0x334A64 //51.74.100 @ ffmpeg-1.0 |
| 124 | + boost::shared_ptr<AVFrame> make_frame(const std::string& filename, |
| 125 | + boost::shared_ptr<AVCodecContext> stream, AVPixelFormat pixfmt); |
| 126 | +#else |
| 127 | boost::shared_ptr<AVFrame> make_frame(const std::string& filename, |
| 128 | boost::shared_ptr<AVCodecContext> stream, PixelFormat pixfmt); |
| 129 | +#endif |
| 130 | |
| 131 | /************************************************************************ |
| 132 | * Video reading specific utilities |