[arch-commits] Commit in opencv/repos (6 files)

Antonio Rojas arojas at archlinux.org
Wed Feb 17 09:11:03 UTC 2016


    Date: Wednesday, February 17, 2016 @ 10:11:03
  Author: arojas
Revision: 259891

archrelease: copy trunk to staging-i686, staging-x86_64

Added:
  opencv/repos/staging-i686/
  opencv/repos/staging-i686/PKGBUILD
    (from rev 259890, opencv/trunk/PKGBUILD)
  opencv/repos/staging-i686/opencv-ffmpeg3.patch
    (from rev 259890, opencv/trunk/opencv-ffmpeg3.patch)
  opencv/repos/staging-x86_64/
  opencv/repos/staging-x86_64/PKGBUILD
    (from rev 259890, opencv/trunk/PKGBUILD)
  opencv/repos/staging-x86_64/opencv-ffmpeg3.patch
    (from rev 259890, opencv/trunk/opencv-ffmpeg3.patch)

-------------------------------------+
 staging-i686/PKGBUILD               |   97 +++++++++++++++
 staging-i686/opencv-ffmpeg3.patch   |  217 ++++++++++++++++++++++++++++++++++
 staging-x86_64/PKGBUILD             |   97 +++++++++++++++
 staging-x86_64/opencv-ffmpeg3.patch |  217 ++++++++++++++++++++++++++++++++++
 4 files changed, 628 insertions(+)

Copied: opencv/repos/staging-i686/PKGBUILD (from rev 259890, opencv/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2016-02-17 09:11:03 UTC (rev 259891)
@@ -0,0 +1,97 @@
+# $Id$
+# Maintainer: Ray Rashif <schiv at archlinux.org>
+# Contributor: Tobias Powalowski <tpowa at archlinux.org>
+
+pkgbase=opencv
+pkgname=('opencv' 'opencv-samples')
+pkgver=2.4.12.2
+pkgrel=3
+pkgdesc="Open Source Computer Vision Library"
+arch=('i686' 'x86_64')
+license=('BSD')
+url="http://opencv.org/"
+depends=('intel-tbb' 'openexr' 'xine-lib' 'libdc1394' 'gtkglext')
+makedepends=('cmake' 'python2-numpy' 'mesa' 'eigen2')
+optdepends=('opencv-samples'
+            'eigen2'
+            'libcl: For coding with OpenCL'
+            'python2-numpy: Python 2.x interface')
+#source=("http://downloads.sourceforge.net/opencvlibrary/$pkgname-$pkgver.zip")
+source=("$pkgbase-$pkgver::https://github.com/Itseez/opencv/archive/$pkgver.zip" opencv-ffmpeg3.patch)
+md5sums=('5f7cde7f0bccd90542805ea20687fc8d'
+         'c752f3e83ebb021171fdd04aa7fb2e5a')
+
+_cmakeopts=('-D WITH_OPENCL=ON'
+            '-D WITH_OPENGL=ON'
+            '-D WITH_TBB=ON'
+            '-D WITH_XINE=ON'
+            '-D WITH_GSTREAMER=OFF'
+            '-D BUILD_WITH_DEBUG_INFO=OFF'
+            '-D BUILD_TESTS=OFF'
+            '-D BUILD_PERF_TESTS=OFF'
+            '-D BUILD_EXAMPLES=ON'
+            '-D INSTALL_C_EXAMPLES=ON'
+            '-D INSTALL_PYTHON_EXAMPLES=ON'
+            '-D CMAKE_BUILD_TYPE=Release'
+            '-D CMAKE_INSTALL_PREFIX=/usr'
+            '-D CMAKE_SKIP_RPATH=ON')
+
+# SSE only available from Pentium 3 onwards (i686 is way older)
+[[ "$CARCH" = 'i686' ]] && \
+  _cmakeopts+=('-D ENABLE_SSE=OFF'
+               '-D ENABLE_SSE2=OFF'
+               '-D ENABLE_SSE3=OFF')
+
+# all x64 CPUs support SSE2 but not SSE3
+[[ "$CARCH" = 'x86_64' ]] && _cmakeopts+=('-D ENABLE_SSE3=OFF')
+
+prepare() {
+  cd $pkgname-$pkgver
+# Fix build with ffmpeg 3.0 (Debian)
+  patch -p1 -i ../opencv-ffmpeg3.patch
+}
+
+build() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  cmake ${_cmakeopts[@]} .
+
+  make
+}
+
+package_opencv() {
+  options=('staticlibs')
+
+  cd "$srcdir/$pkgname-$pkgver"
+
+  make DESTDIR="$pkgdir" install
+
+  # install license file
+  install -Dm644 "$srcdir/$pkgname-$pkgver/LICENSE" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+  cd "$pkgdir/usr/share"
+
+  # separate samples package; also be -R friendly
+  if [[ -d OpenCV/samples ]]; then
+    mv OpenCV/samples "$srcdir/$pkgname-samples"
+    mv OpenCV $pkgname # otherwise folder naming is inconsistent
+  elif [[ ! -d OpenCV ]]; then
+    warning "Directory naming issue; samples package may not be built!"
+  fi
+}
+
+package_opencv-samples() {
+  pkgdesc+=" (samples)"
+  depends=("opencv=$pkgver") # sample codes change with lib/API
+  unset optdepends
+
+  mkdir -p "$pkgdir/usr/share/opencv"
+  cp -r "$srcdir/opencv-samples" "$pkgdir/usr/share/opencv/samples"
+
+  # install license file
+  install -Dm644 "$srcdir/opencv-$pkgver/LICENSE" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:

Copied: opencv/repos/staging-i686/opencv-ffmpeg3.patch (from rev 259890, opencv/trunk/opencv-ffmpeg3.patch)
===================================================================
--- staging-i686/opencv-ffmpeg3.patch	                        (rev 0)
+++ staging-i686/opencv-ffmpeg3.patch	2016-02-17 09:11:03 UTC (rev 259891)
@@ -0,0 +1,217 @@
+--- opencv-2.4.9.1+dfsg.orig/modules/highgui/src/cap_ffmpeg_impl.hpp
++++ opencv-2.4.9.1+dfsg/modules/highgui/src/cap_ffmpeg_impl.hpp
+@@ -136,9 +136,9 @@ extern "C" {
+ #define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__)
+ #endif
+ 
+-/* PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
+-#ifndef PIX_FMT_RGBA32
+-#define PIX_FMT_RGBA32 PIX_FMT_RGB32
++/* AV_PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
++#ifndef AV_PIX_FMT_RGBA32
++#define AV_PIX_FMT_RGBA32 AV_PIX_FMT_RGB32
+ #endif
+ 
+ #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
+@@ -304,7 +304,7 @@     {
+         // FFmpeg and Libav added avcodec_free_frame in different versions.
+ #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
+     ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
+-        avcodec_free_frame(&picture);
++        av_frame_free(&picture);
+ #else
+         av_free(picture);
+ #endif
+@@ -572,13 +572,13 @@ bool CvCapture_FFMPEG::open( const char*
+ 
+             video_stream = i;
+             video_st = ic->streams[i];
+-            picture = avcodec_alloc_frame();
++            picture = av_frame_alloc();
+ 
+             rgb_picture.data[0] = (uint8_t*)malloc(
+-                    avpicture_get_size( PIX_FMT_BGR24,
++                    avpicture_get_size( AV_PIX_FMT_BGR24,
+                                         enc->width, enc->height ));
+             avpicture_fill( (AVPicture*)&rgb_picture, rgb_picture.data[0],
+-                            PIX_FMT_BGR24, enc->width, enc->height );
++                            AV_PIX_FMT_BGR24, enc->width, enc->height );
+ 
+             frame.width = enc->width;
+             frame.height = enc->height;
+@@ -670,7 +670,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
+     if( !video_st || !picture->data[0] )
+         return false;
+ 
+-    avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24,
++    avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_RGB24,
+                    video_st->codec->width, video_st->codec->height);
+ 
+     if( img_convert_ctx == NULL ||
+@@ -688,7 +688,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
+                 video_st->codec->width, video_st->codec->height,
+                 video_st->codec->pix_fmt,
+                 video_st->codec->width, video_st->codec->height,
+-                PIX_FMT_BGR24,
++                AV_PIX_FMT_BGR24,
+                 SWS_BICUBIC,
+                 NULL, NULL, NULL
+                 );
+@@ -1001,10 +1001,10 @@ static AVFrame * icv_alloc_picture_FFMPE
+     uint8_t * picture_buf;
+     int size;
+ 
+-    picture = avcodec_alloc_frame();
++    picture = av_frame_alloc();
+     if (!picture)
+         return NULL;
+-    size = avpicture_get_size( (PixelFormat) pix_fmt, width, height);
++    size = avpicture_get_size( (AVPixelFormat) pix_fmt, width, height);
+     if(alloc){
+         picture_buf = (uint8_t *) malloc(size);
+         if (!picture_buf)
+@@ -1013,7 +1013,7 @@ static AVFrame * icv_alloc_picture_FFMPE
+             return NULL;
+         }
+         avpicture_fill((AVPicture *)picture, picture_buf,
+-                       (PixelFormat) pix_fmt, width, height);
++                       (AVPixelFormat) pix_fmt, width, height);
+     }
+     else {
+     }
+@@ -1096,7 +1096,7 @@ static AVStream *icv_add_video_stream_FF
+     }
+ 
+     c->gop_size = 12; /* emit one intra frame every twelve frames at most */
+-    c->pix_fmt = (PixelFormat) pixel_format;
++    c->pix_fmt = (AVPixelFormat) pixel_format;
+ 
+     if (c->codec_id == CV_CODEC(CODEC_ID_MPEG2VIDEO)) {
+         c->max_b_frames = 2;
+@@ -1220,12 +1220,12 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+     }
+ 
+     // check parameters
+-    if (input_pix_fmt == PIX_FMT_BGR24) {
++    if (input_pix_fmt == AV_PIX_FMT_BGR24) {
+         if (cn != 3) {
+             return false;
+         }
+     }
+-    else if (input_pix_fmt == PIX_FMT_GRAY8) {
++    else if (input_pix_fmt == AV_PIX_FMT_GRAY8) {
+         if (cn != 1) {
+             return false;
+         }
+@@ -1238,13 +1238,13 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+         assert( input_picture );
+         // let input_picture point to the raw data buffer of 'image'
+         avpicture_fill((AVPicture *)input_picture, (uint8_t *) data,
+-                       (PixelFormat)input_pix_fmt, width, height);
++                       (AVPixelFormat)input_pix_fmt, width, height);
+ 
+         if( !img_convert_ctx )
+         {
+             img_convert_ctx = sws_getContext(width,
+                                              height,
+-                                             (PixelFormat)input_pix_fmt,
++                                             (AVPixelFormat)input_pix_fmt,
+                                              c->width,
+                                              c->height,
+                                              c->pix_fmt,
+@@ -1262,7 +1262,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+     }
+     else{
+         avpicture_fill((AVPicture *)picture, (uint8_t *) data,
+-                       (PixelFormat)input_pix_fmt, width, height);
++                       (AVPixelFormat)input_pix_fmt, width, height);
+     }
+ 
+     ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, picture) >= 0;
+@@ -1373,10 +1373,10 @@ bool CvVideoWriter_FFMPEG::open( const c
+ 
+     /* determine optimal pixel format */
+     if (is_color) {
+-        input_pix_fmt = PIX_FMT_BGR24;
++        input_pix_fmt = AV_PIX_FMT_BGR24;
+     }
+     else {
+-        input_pix_fmt = PIX_FMT_GRAY8;
++        input_pix_fmt = AV_PIX_FMT_GRAY8;
+     }
+ 
+     /* Lookup codec_id for given fourcc */
+@@ -1402,21 +1402,21 @@ bool CvVideoWriter_FFMPEG::open( const c
+         codec_pix_fmt = input_pix_fmt;
+         break;
+     case CV_CODEC(CODEC_ID_HUFFYUV):
+-        codec_pix_fmt = PIX_FMT_YUV422P;
++        codec_pix_fmt = AV_PIX_FMT_YUV422P;
+         break;
+     case CV_CODEC(CODEC_ID_MJPEG):
+     case CV_CODEC(CODEC_ID_LJPEG):
+-        codec_pix_fmt = PIX_FMT_YUVJ420P;
++        codec_pix_fmt = AV_PIX_FMT_YUVJ420P;
+         bitrate_scale = 3;
+         break;
+     case CV_CODEC(CODEC_ID_RAWVIDEO):
+-        codec_pix_fmt = input_pix_fmt == PIX_FMT_GRAY8 ||
+-                        input_pix_fmt == PIX_FMT_GRAY16LE ||
+-                        input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P;
++        codec_pix_fmt = input_pix_fmt == AV_PIX_FMT_GRAY8 ||
++                        input_pix_fmt == AV_PIX_FMT_GRAY16LE ||
++                        input_pix_fmt == AV_PIX_FMT_GRAY16BE ? input_pix_fmt : AV_PIX_FMT_YUV420P;
+         break;
+     default:
+         // good for lossy formats, MPEG, etc.
+-        codec_pix_fmt = PIX_FMT_YUV420P;
++        codec_pix_fmt = AV_PIX_FMT_YUV420P;
+         break;
+     }
+ 
+@@ -1609,7 +1609,7 @@ struct OutputMediaStream_FFMPEG
+     void write(unsigned char* data, int size, int keyFrame);
+ 
+     // add a video output stream to the container
+-    static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format);
++    static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format);
+ 
+     AVOutputFormat* fmt_;
+     AVFormatContext* oc_;
+@@ -1648,7 +1648,7 @@ void OutputMediaStream_FFMPEG::close()
+     }
+ }
+ 
+-AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
++AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format)
+ {
+         AVStream* st = avformat_new_stream(oc, 0);
+     if (!st)
+@@ -1766,7 +1766,7 @@ bool OutputMediaStream_FFMPEG::open(cons
+     oc_->max_delay = (int)(0.7 * AV_TIME_BASE); // This reduces buffer underrun warnings with MPEG
+ 
+     // set a few optimal pixel formats for lossless codecs of interest..
+-    PixelFormat codec_pix_fmt = PIX_FMT_YUV420P;
++    AVPixelFormat codec_pix_fmt = AV_PIX_FMT_YUV420P;
+     int bitrate_scale = 64;
+ 
+     // TODO -- safe to ignore output audio stream?
+@@ -1943,15 +1943,15 @@ bool InputMediaStream_FFMPEG::open(const
+ 
+             switch (enc->pix_fmt)
+             {
+-            case PIX_FMT_YUV420P:
++            case AV_PIX_FMT_YUV420P:
+                 *chroma_format = ::VideoChromaFormat_YUV420;
+                 break;
+ 
+-            case PIX_FMT_YUV422P:
++            case AV_PIX_FMT_YUV422P:
+                 *chroma_format = ::VideoChromaFormat_YUV422;
+                 break;
+ 
+-            case PIX_FMT_YUV444P:
++            case AV_PIX_FMT_YUV444P:
+                 *chroma_format = ::VideoChromaFormat_YUV444;
+                 break;
+ 

Copied: opencv/repos/staging-x86_64/PKGBUILD (from rev 259890, opencv/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2016-02-17 09:11:03 UTC (rev 259891)
@@ -0,0 +1,97 @@
+# $Id$
+# Maintainer: Ray Rashif <schiv at archlinux.org>
+# Contributor: Tobias Powalowski <tpowa at archlinux.org>
+
+pkgbase=opencv
+pkgname=('opencv' 'opencv-samples')
+pkgver=2.4.12.2
+pkgrel=3
+pkgdesc="Open Source Computer Vision Library"
+arch=('i686' 'x86_64')
+license=('BSD')
+url="http://opencv.org/"
+depends=('intel-tbb' 'openexr' 'xine-lib' 'libdc1394' 'gtkglext')
+makedepends=('cmake' 'python2-numpy' 'mesa' 'eigen2')
+optdepends=('opencv-samples'
+            'eigen2'
+            'libcl: For coding with OpenCL'
+            'python2-numpy: Python 2.x interface')
+#source=("http://downloads.sourceforge.net/opencvlibrary/$pkgname-$pkgver.zip")
+source=("$pkgbase-$pkgver::https://github.com/Itseez/opencv/archive/$pkgver.zip" opencv-ffmpeg3.patch)
+md5sums=('5f7cde7f0bccd90542805ea20687fc8d'
+         'c752f3e83ebb021171fdd04aa7fb2e5a')
+
+_cmakeopts=('-D WITH_OPENCL=ON'
+            '-D WITH_OPENGL=ON'
+            '-D WITH_TBB=ON'
+            '-D WITH_XINE=ON'
+            '-D WITH_GSTREAMER=OFF'
+            '-D BUILD_WITH_DEBUG_INFO=OFF'
+            '-D BUILD_TESTS=OFF'
+            '-D BUILD_PERF_TESTS=OFF'
+            '-D BUILD_EXAMPLES=ON'
+            '-D INSTALL_C_EXAMPLES=ON'
+            '-D INSTALL_PYTHON_EXAMPLES=ON'
+            '-D CMAKE_BUILD_TYPE=Release'
+            '-D CMAKE_INSTALL_PREFIX=/usr'
+            '-D CMAKE_SKIP_RPATH=ON')
+
+# SSE only available from Pentium 3 onwards (i686 is way older)
+[[ "$CARCH" = 'i686' ]] && \
+  _cmakeopts+=('-D ENABLE_SSE=OFF'
+               '-D ENABLE_SSE2=OFF'
+               '-D ENABLE_SSE3=OFF')
+
+# all x64 CPUs support SSE2 but not SSE3
+[[ "$CARCH" = 'x86_64' ]] && _cmakeopts+=('-D ENABLE_SSE3=OFF')
+
+prepare() {
+  cd $pkgname-$pkgver
+# Fix build with ffmpeg 3.0 (Debian)
+  patch -p1 -i ../opencv-ffmpeg3.patch
+}
+
+build() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  cmake ${_cmakeopts[@]} .
+
+  make
+}
+
+package_opencv() {
+  options=('staticlibs')
+
+  cd "$srcdir/$pkgname-$pkgver"
+
+  make DESTDIR="$pkgdir" install
+
+  # install license file
+  install -Dm644 "$srcdir/$pkgname-$pkgver/LICENSE" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+  cd "$pkgdir/usr/share"
+
+  # separate samples package; also be -R friendly
+  if [[ -d OpenCV/samples ]]; then
+    mv OpenCV/samples "$srcdir/$pkgname-samples"
+    mv OpenCV $pkgname # otherwise folder naming is inconsistent
+  elif [[ ! -d OpenCV ]]; then
+    warning "Directory naming issue; samples package may not be built!"
+  fi
+}
+
+package_opencv-samples() {
+  pkgdesc+=" (samples)"
+  depends=("opencv=$pkgver") # sample codes change with lib/API
+  unset optdepends
+
+  mkdir -p "$pkgdir/usr/share/opencv"
+  cp -r "$srcdir/opencv-samples" "$pkgdir/usr/share/opencv/samples"
+
+  # install license file
+  install -Dm644 "$srcdir/opencv-$pkgver/LICENSE" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:

Copied: opencv/repos/staging-x86_64/opencv-ffmpeg3.patch (from rev 259890, opencv/trunk/opencv-ffmpeg3.patch)
===================================================================
--- staging-x86_64/opencv-ffmpeg3.patch	                        (rev 0)
+++ staging-x86_64/opencv-ffmpeg3.patch	2016-02-17 09:11:03 UTC (rev 259891)
@@ -0,0 +1,217 @@
+--- opencv-2.4.9.1+dfsg.orig/modules/highgui/src/cap_ffmpeg_impl.hpp
++++ opencv-2.4.9.1+dfsg/modules/highgui/src/cap_ffmpeg_impl.hpp
+@@ -136,9 +136,9 @@ extern "C" {
+ #define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__)
+ #endif
+ 
+-/* PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
+-#ifndef PIX_FMT_RGBA32
+-#define PIX_FMT_RGBA32 PIX_FMT_RGB32
++/* AV_PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
++#ifndef AV_PIX_FMT_RGBA32
++#define AV_PIX_FMT_RGBA32 AV_PIX_FMT_RGB32
+ #endif
+ 
+ #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
+@@ -304,7 +304,7 @@     {
+         // FFmpeg and Libav added avcodec_free_frame in different versions.
+ #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
+     ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
+-        avcodec_free_frame(&picture);
++        av_frame_free(&picture);
+ #else
+         av_free(picture);
+ #endif
+@@ -572,13 +572,13 @@ bool CvCapture_FFMPEG::open( const char*
+ 
+             video_stream = i;
+             video_st = ic->streams[i];
+-            picture = avcodec_alloc_frame();
++            picture = av_frame_alloc();
+ 
+             rgb_picture.data[0] = (uint8_t*)malloc(
+-                    avpicture_get_size( PIX_FMT_BGR24,
++                    avpicture_get_size( AV_PIX_FMT_BGR24,
+                                         enc->width, enc->height ));
+             avpicture_fill( (AVPicture*)&rgb_picture, rgb_picture.data[0],
+-                            PIX_FMT_BGR24, enc->width, enc->height );
++                            AV_PIX_FMT_BGR24, enc->width, enc->height );
+ 
+             frame.width = enc->width;
+             frame.height = enc->height;
+@@ -670,7 +670,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
+     if( !video_st || !picture->data[0] )
+         return false;
+ 
+-    avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24,
++    avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_RGB24,
+                    video_st->codec->width, video_st->codec->height);
+ 
+     if( img_convert_ctx == NULL ||
+@@ -688,7 +688,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
+                 video_st->codec->width, video_st->codec->height,
+                 video_st->codec->pix_fmt,
+                 video_st->codec->width, video_st->codec->height,
+-                PIX_FMT_BGR24,
++                AV_PIX_FMT_BGR24,
+                 SWS_BICUBIC,
+                 NULL, NULL, NULL
+                 );
+@@ -1001,10 +1001,10 @@ static AVFrame * icv_alloc_picture_FFMPE
+     uint8_t * picture_buf;
+     int size;
+ 
+-    picture = avcodec_alloc_frame();
++    picture = av_frame_alloc();
+     if (!picture)
+         return NULL;
+-    size = avpicture_get_size( (PixelFormat) pix_fmt, width, height);
++    size = avpicture_get_size( (AVPixelFormat) pix_fmt, width, height);
+     if(alloc){
+         picture_buf = (uint8_t *) malloc(size);
+         if (!picture_buf)
+@@ -1013,7 +1013,7 @@ static AVFrame * icv_alloc_picture_FFMPE
+             return NULL;
+         }
+         avpicture_fill((AVPicture *)picture, picture_buf,
+-                       (PixelFormat) pix_fmt, width, height);
++                       (AVPixelFormat) pix_fmt, width, height);
+     }
+     else {
+     }
+@@ -1096,7 +1096,7 @@ static AVStream *icv_add_video_stream_FF
+     }
+ 
+     c->gop_size = 12; /* emit one intra frame every twelve frames at most */
+-    c->pix_fmt = (PixelFormat) pixel_format;
++    c->pix_fmt = (AVPixelFormat) pixel_format;
+ 
+     if (c->codec_id == CV_CODEC(CODEC_ID_MPEG2VIDEO)) {
+         c->max_b_frames = 2;
+@@ -1220,12 +1220,12 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+     }
+ 
+     // check parameters
+-    if (input_pix_fmt == PIX_FMT_BGR24) {
++    if (input_pix_fmt == AV_PIX_FMT_BGR24) {
+         if (cn != 3) {
+             return false;
+         }
+     }
+-    else if (input_pix_fmt == PIX_FMT_GRAY8) {
++    else if (input_pix_fmt == AV_PIX_FMT_GRAY8) {
+         if (cn != 1) {
+             return false;
+         }
+@@ -1238,13 +1238,13 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+         assert( input_picture );
+         // let input_picture point to the raw data buffer of 'image'
+         avpicture_fill((AVPicture *)input_picture, (uint8_t *) data,
+-                       (PixelFormat)input_pix_fmt, width, height);
++                       (AVPixelFormat)input_pix_fmt, width, height);
+ 
+         if( !img_convert_ctx )
+         {
+             img_convert_ctx = sws_getContext(width,
+                                              height,
+-                                             (PixelFormat)input_pix_fmt,
++                                             (AVPixelFormat)input_pix_fmt,
+                                              c->width,
+                                              c->height,
+                                              c->pix_fmt,
+@@ -1262,7 +1262,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+     }
+     else{
+         avpicture_fill((AVPicture *)picture, (uint8_t *) data,
+-                       (PixelFormat)input_pix_fmt, width, height);
++                       (AVPixelFormat)input_pix_fmt, width, height);
+     }
+ 
+     ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, picture) >= 0;
+@@ -1373,10 +1373,10 @@ bool CvVideoWriter_FFMPEG::open( const c
+ 
+     /* determine optimal pixel format */
+     if (is_color) {
+-        input_pix_fmt = PIX_FMT_BGR24;
++        input_pix_fmt = AV_PIX_FMT_BGR24;
+     }
+     else {
+-        input_pix_fmt = PIX_FMT_GRAY8;
++        input_pix_fmt = AV_PIX_FMT_GRAY8;
+     }
+ 
+     /* Lookup codec_id for given fourcc */
+@@ -1402,21 +1402,21 @@ bool CvVideoWriter_FFMPEG::open( const c
+         codec_pix_fmt = input_pix_fmt;
+         break;
+     case CV_CODEC(CODEC_ID_HUFFYUV):
+-        codec_pix_fmt = PIX_FMT_YUV422P;
++        codec_pix_fmt = AV_PIX_FMT_YUV422P;
+         break;
+     case CV_CODEC(CODEC_ID_MJPEG):
+     case CV_CODEC(CODEC_ID_LJPEG):
+-        codec_pix_fmt = PIX_FMT_YUVJ420P;
++        codec_pix_fmt = AV_PIX_FMT_YUVJ420P;
+         bitrate_scale = 3;
+         break;
+     case CV_CODEC(CODEC_ID_RAWVIDEO):
+-        codec_pix_fmt = input_pix_fmt == PIX_FMT_GRAY8 ||
+-                        input_pix_fmt == PIX_FMT_GRAY16LE ||
+-                        input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P;
++        codec_pix_fmt = input_pix_fmt == AV_PIX_FMT_GRAY8 ||
++                        input_pix_fmt == AV_PIX_FMT_GRAY16LE ||
++                        input_pix_fmt == AV_PIX_FMT_GRAY16BE ? input_pix_fmt : AV_PIX_FMT_YUV420P;
+         break;
+     default:
+         // good for lossy formats, MPEG, etc.
+-        codec_pix_fmt = PIX_FMT_YUV420P;
++        codec_pix_fmt = AV_PIX_FMT_YUV420P;
+         break;
+     }
+ 
+@@ -1609,7 +1609,7 @@ struct OutputMediaStream_FFMPEG
+     void write(unsigned char* data, int size, int keyFrame);
+ 
+     // add a video output stream to the container
+-    static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format);
++    static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format);
+ 
+     AVOutputFormat* fmt_;
+     AVFormatContext* oc_;
+@@ -1648,7 +1648,7 @@ void OutputMediaStream_FFMPEG::close()
+     }
+ }
+ 
+-AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
++AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format)
+ {
+         AVStream* st = avformat_new_stream(oc, 0);
+     if (!st)
+@@ -1766,7 +1766,7 @@ bool OutputMediaStream_FFMPEG::open(cons
+     oc_->max_delay = (int)(0.7 * AV_TIME_BASE); // This reduces buffer underrun warnings with MPEG
+ 
+     // set a few optimal pixel formats for lossless codecs of interest..
+-    PixelFormat codec_pix_fmt = PIX_FMT_YUV420P;
++    AVPixelFormat codec_pix_fmt = AV_PIX_FMT_YUV420P;
+     int bitrate_scale = 64;
+ 
+     // TODO -- safe to ignore output audio stream?
+@@ -1943,15 +1943,15 @@ bool InputMediaStream_FFMPEG::open(const
+ 
+             switch (enc->pix_fmt)
+             {
+-            case PIX_FMT_YUV420P:
++            case AV_PIX_FMT_YUV420P:
+                 *chroma_format = ::VideoChromaFormat_YUV420;
+                 break;
+ 
+-            case PIX_FMT_YUV422P:
++            case AV_PIX_FMT_YUV422P:
+                 *chroma_format = ::VideoChromaFormat_YUV422;
+                 break;
+ 
+-            case PIX_FMT_YUV444P:
++            case AV_PIX_FMT_YUV444P:
+                 *chroma_format = ::VideoChromaFormat_YUV444;
+                 break;
+ 



More information about the arch-commits mailing list