Date: Friday, February 19, 2016 @ 20:54:12
  Author: arojas
Revision: 162598

Update to 2.3, update patches for ffmpeg 3.0

Added:
  cinelerra-cv/trunk/cinelerra-cv-ffmpeg3.patch
  cinelerra-cv/trunk/ffmpeg-link.patch
Modified:
  cinelerra-cv/trunk/PKGBUILD
Deleted:
  cinelerra-cv/trunk/cinelerra-std_and_str_h.patch

-------------------------------+
 PKGBUILD                      |   28 -
 cinelerra-cv-ffmpeg3.patch    |  681 ++++++++++++++++++++++++++++++++++++++++
 cinelerra-std_and_str_h.patch |   81 ----
 ffmpeg-link.patch             |   24 +
 4 files changed, 719 insertions(+), 95 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2016-02-19 19:32:01 UTC (rev 162597)
+++ PKGBUILD    2016-02-19 19:54:12 UTC (rev 162598)
@@ -5,9 +5,9 @@
 # Contributor: Alexander Rødseth <rods...@gmail.com>
 
 pkgname=cinelerra-cv
-pkgver=2.2
-_gitrel=2.2.0
-pkgrel=27
+pkgver=2.3
+_gitrel=2.3.0
+pkgrel=1
 epoch=1
 pkgdesc="Professional video editing and compositing environment"
 arch=('x86_64' 'i686')
@@ -15,7 +15,7 @@
 license=('GPL')
 depends=('e2fsprogs' 'libavc1394' 'libiec61883' 'libxv'
          'libtiff' 'mjpegtools' 'fftw' 'a52dec' 'glu'
-         'ffmpeg' 'faad2' 'faac' 'openexr>=2.0.0')
+         'ffmpeg' 'faad2' 'faac' 'openexr>=2.0.0' 'libxft')
 makedepends=('git' 'nasm' 'mesa')
 
source=("$pkgname::git+git://git.cinelerra-cv.org/CinelerraCV.git#branch=rel$_gitrel"
         'v4l1_removal.patch'
@@ -22,13 +22,17 @@
         'ffmpeg_api.patch'
         'ffmpeg2.0.patch'
         'cinelerra-std_and_str_h.patch'
-        'gcc5fix.patch')
+        'gcc5fix.patch'
+       'cinelerra-cv-ffmpeg3.patch'
+       'ffmpeg-link.patch')
 md5sums=('SKIP'
          'bfa85e20809429d88eba4ab83e569612'
          'b05ec2fb54e7d02f6167525417802111'
          '14dd897084d64cd0b5e9caa8a69818bd'
          '02d8222e596133bbc05eaad15bef242c'
-         '7bf8fe04ce242d8aa76dba94897eac4e')
+         '7bf8fe04ce242d8aa76dba94897eac4e'
+         '4d45860f1780b5e42fbbfc0e35614cdd'
+         '0338a22d2785ef52c908574bb323ab02')
 
 prepare() {
   cd "$srcdir/$pkgname"
@@ -41,9 +45,6 @@
   # ffmpeg api patch update for 0.11
   patch -Np1 -i "$srcdir/ffmpeg_api.patch"
 
-  # fix some missing headers
-  patch -Np0 -i "$srcdir/cinelerra-std_and_str_h.patch"
-
   # fix avcodec_alloc_context and alloc_open
   patch -Np1 -i "$srcdir/ffmpeg2.0.patch"
 
@@ -56,13 +57,12 @@
   # TODO: check if this is still needed (old commit; r29539 by ibiru) --schiv
   #sed -i -e '/Debian/d' admin/nasm
 
-  # ffmpeg 2.0 related replacements
-  # TODO: super slow on HDDs, but proper patch requires merging with others
-  find -type f -exec sed -i 's/AVCODEC_MAX_AUDIO_FRAME_SIZE/192000/' {} \;
-  find -type f -exec sed -i 's/CodecID/AVCodecID/' {} \;
-
   # gcc 5.x fix
   patch -Np1 -i "$srcdir/gcc5fix.patch"
+
+  # fix build with ffmpeg 3.0
+  patch -p1 -i ../cinelerra-cv-ffmpeg3.patch
+  patch -p0 -i ../ffmpeg-link.patch
 }
 
 build() {

Added: cinelerra-cv-ffmpeg3.patch
===================================================================
--- cinelerra-cv-ffmpeg3.patch                          (rev 0)
+++ cinelerra-cv-ffmpeg3.patch  2016-02-19 19:54:12 UTC (rev 162598)
@@ -0,0 +1,681 @@
+Index: cinelerra-20140710/cinelerra/ffmpeg.C
+===================================================================
+--- ffmpeg.C.orig      2016-02-19 19:37:33.634278174 +0000
++++ ffmpeg.C   2016-02-19 19:39:37.540403052 +0000
+@@ -25,20 +25,20 @@
+ 
+       avcodec_register_all();
+ 
+-      CodecID id = codec_id(codec_string);
++      AVCodecID id = codec_id(codec_string);
+       codec = avcodec_find_decoder(id);
+       if (codec == NULL) {
+               printf("FFMPEG::init no decoder for '%s'", codec_string);
+               return 1;
+       }
+ 
+       context = avcodec_alloc_context3(codec);
+ 
+       if (avcodec_open2(context, codec,NULL)) {
+               printf("FFMPEG::init avcodec_open() failed\n");
+       }
+ 
+-      picture = avcodec_alloc_frame();
++      picture = av_frame_alloc();
+ 
+ 
+       return 0;
+@@ -51,66 +51,66 @@
+ }
+ 
+ 
+-CodecID FFMPEG::codec_id(char *codec_string) {
++AVCodecID FFMPEG::codec_id(char *codec_string) {
+ #define CODEC_IS(x) (! strncmp(codec_string, x, 4))
+ 
+       if (CODEC_IS(QUICKTIME_DV) ||
+-          CODEC_IS(QUICKTIME_DVSD)) return CODEC_ID_DVVIDEO;
++          CODEC_IS(QUICKTIME_DVSD)) return AV_CODEC_ID_DVVIDEO;
+       
+       if (CODEC_IS(QUICKTIME_MP4V) ||
+-          CODEC_IS(QUICKTIME_DIVX)) return CODEC_ID_MPEG4;
++          CODEC_IS(QUICKTIME_DIVX)) return AV_CODEC_ID_MPEG4;
+ 
+-      return CODEC_ID_NONE;
++      return AV_CODEC_ID_NONE;
+ 
+ #undef CODEC_IS
+ }
+ 
+-PixelFormat FFMPEG::color_model_to_pix_fmt(int color_model) {
++AVPixelFormat FFMPEG::color_model_to_pix_fmt(int color_model) {
+       switch (color_model) 
+               { 
+               case BC_YUV422: 
+-                        return PIX_FMT_YUYV422;
++                        return AV_PIX_FMT_YUYV422;
+               case BC_RGB888:
+-                      return PIX_FMT_RGB24;
++                      return AV_PIX_FMT_RGB24;
+               case BC_BGR8888:  // NOTE: order flipped
+-                      return PIX_FMT_RGB32;
++                      return AV_PIX_FMT_RGB32;
+               case BC_BGR888:
+-                      return PIX_FMT_BGR24;
++                      return AV_PIX_FMT_BGR24;
+               case BC_YUV420P: 
+-                      return PIX_FMT_YUV420P;
++                      return AV_PIX_FMT_YUV420P;
+               case BC_YUV422P:
+-                      return PIX_FMT_YUV422P;
++                      return AV_PIX_FMT_YUV422P;
+               case BC_YUV444P:
+-                      return PIX_FMT_YUV444P;
++                      return AV_PIX_FMT_YUV444P;
+               case BC_YUV411P:
+-                      return PIX_FMT_YUV411P;
++                      return AV_PIX_FMT_YUV411P;
+               case BC_RGB565:
+-                      return PIX_FMT_RGB565;
++                      return AV_PIX_FMT_RGB565;
+               };
+ 
+-      return PIX_FMT_NB;
++      return AV_PIX_FMT_NB;
+ }
+ 
+-int FFMPEG::pix_fmt_to_color_model(PixelFormat pix_fmt) {
++int FFMPEG::pix_fmt_to_color_model(AVPixelFormat pix_fmt) {
+       switch (pix_fmt) 
+               { 
+-              case PIX_FMT_YUYV422:
++              case AV_PIX_FMT_YUYV422:
+                       return BC_YUV422;
+-              case PIX_FMT_RGB24:
++              case AV_PIX_FMT_RGB24:
+                       return BC_RGB888;
+-              case PIX_FMT_RGB32:
++              case AV_PIX_FMT_RGB32:
+                       return BC_BGR8888;
+-              case PIX_FMT_BGR24:
++              case AV_PIX_FMT_BGR24:
+                       return BC_BGR888;
+-              case PIX_FMT_YUV420P:
++              case AV_PIX_FMT_YUV420P:
+                       return BC_YUV420P;
+-              case PIX_FMT_YUV422P:
++              case AV_PIX_FMT_YUV422P:
+                       return BC_YUV422P;
+-              case PIX_FMT_YUV444P:
++              case AV_PIX_FMT_YUV444P:
+                       return BC_YUV444P;
+-              case PIX_FMT_YUV411P:
++              case AV_PIX_FMT_YUV411P:
+                       return BC_YUV411P;
+-              case PIX_FMT_RGB565:
++              case AV_PIX_FMT_RGB565:
+                       return BC_RGB565;
+               };
+ 
+@@ -119,7 +119,7 @@
+ 
+ int FFMPEG::init_picture_from_frame(AVPicture *picture, VFrame *frame) {
+       int cmodel = frame->get_color_model();
+-      PixelFormat pix_fmt = color_model_to_pix_fmt(cmodel);
++      AVPixelFormat pix_fmt = color_model_to_pix_fmt(cmodel);
+ 
+       int size = avpicture_fill(picture, frame->get_data(), pix_fmt, 
+                                 frame->get_w(), frame->get_h());
+@@ -142,16 +142,16 @@
+ 
+ int FFMPEG::convert_cmodel(VFrame *frame_in,  VFrame *frame_out) {
+   
+-      PixelFormat pix_fmt_in = 
++      AVPixelFormat pix_fmt_in = 
+               color_model_to_pix_fmt(frame_in->get_color_model());
+-      PixelFormat pix_fmt_out = 
++      AVPixelFormat pix_fmt_out = 
+               color_model_to_pix_fmt(frame_out->get_color_model());
+ #ifdef HAVE_SWSCALER
+       // We need a context for swscale
+       struct SwsContext *convert_ctx;
+ #endif
+       // do conversion within libavcodec if possible
+-      if (pix_fmt_in != PIX_FMT_NB && pix_fmt_out != PIX_FMT_NB) {
++      if (pix_fmt_in != AV_PIX_FMT_NB && pix_fmt_out != AV_PIX_FMT_NB) {
+               // set up a temporary pictures from frame_in and frame_out
+               AVPicture picture_in, picture_out;
+               init_picture_from_frame(&picture_in, frame_in);
+@@ -226,14 +226,14 @@
+ }
+ 
+ 
+-int FFMPEG::convert_cmodel(AVPicture *picture_in, PixelFormat pix_fmt_in,
++int FFMPEG::convert_cmodel(AVPicture *picture_in, AVPixelFormat pix_fmt_in,
+                         int width_in, int height_in, VFrame *frame_out) {
+ 
+       // set up a temporary picture_out from frame_out
+       AVPicture picture_out;
+       init_picture_from_frame(&picture_out, frame_out);
+       int cmodel_out = frame_out->get_color_model();
+-      PixelFormat pix_fmt_out = color_model_to_pix_fmt(cmodel_out);
++      AVPixelFormat pix_fmt_out = color_model_to_pix_fmt(cmodel_out);
+ 
+ #ifdef HAVE_SWSCALER
+       // We need a context for swscale
+@@ -242,7 +242,7 @@
+       int result;
+ #ifndef HAVE_SWSCALER
+       // do conversion within libavcodec if possible
+-      if (pix_fmt_out != PIX_FMT_NB) {
++      if (pix_fmt_out != AV_PIX_FMT_NB) {
+               result = img_convert(&picture_out,
+                                    pix_fmt_out,
+                                    picture_in,
+@@ -280,7 +280,7 @@
+       // make an intermediate temp frame only if necessary
+       int cmodel_in = pix_fmt_to_color_model(pix_fmt_in);
+       if (cmodel_in == BC_TRANSPARENCY) {
+-              if (pix_fmt_in == PIX_FMT_RGB32) {
++              if (pix_fmt_in == AV_PIX_FMT_RGB32) {
+                       // avoid infinite recursion if things are broken
+                       printf("FFMPEG::convert_cmodel pix_fmt_in broken!\n");
+                       return 1;
+Index: cinelerra-20140710/cinelerra/ffmpeg.h
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/ffmpeg.h
++++ cinelerra-20140710/cinelerra/ffmpeg.h
+@@ -18,7 +18,7 @@
+       int init(char *codec_string);
+       int decode(uint8_t *data, long data_size, VFrame *frame_out);
+ 
+-      static int convert_cmodel(AVPicture *picture_in, PixelFormat pix_fmt,
++      static int convert_cmodel(AVPicture *picture_in, AVPixelFormat pix_fmt,
+                                 int width_in, int height_in, 
+                                 VFrame *frame_out);
+       static int convert_cmodel(VFrame *frame_in, VFrame *frame_out);
+@@ -26,11 +26,11 @@
+       static int convert_cmodel_transfer(VFrame *frame_in,VFrame *frame_out);
+       static int init_picture_from_frame(AVPicture *picture, VFrame *frame);
+ 
+-      static CodecID codec_id(char *codec_string);
++      static AVCodecID codec_id(char *codec_string);
+ 
+  private:
+-      static PixelFormat color_model_to_pix_fmt(int color_model);
+-      static int pix_fmt_to_color_model(PixelFormat pix_fmt);
++      static AVPixelFormat color_model_to_pix_fmt(int color_model);
++      static int pix_fmt_to_color_model(AVPixelFormat pix_fmt);
+ 
+       int got_picture;
+       Asset *asset;
+Index: cinelerra-20140710/cinelerra/fileac3.C
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/fileac3.C
++++ cinelerra-20140710/cinelerra/fileac3.C
+@@ -85,7 +85,7 @@ int FileAC3::open_file(int rd, int wr)
+       if(wr)
+       {
+               avcodec_register_all();
+-              codec = avcodec_find_encoder(CODEC_ID_AC3);
++              codec = avcodec_find_encoder(AV_CODEC_ID_AC3);
+               if(!codec)
+               {
+                       eprintf("codec not found.\n");
+@@ -211,12 +211,56 @@ int FileAC3::write_samples(double **buff
+               current_sample + frame_size <= temp_raw_size; 
+               current_sample += frame_size)
+       {
+-              int compressed_size = avcodec_encode_audio(
+-                      codec_context, 
+-                      temp_compressed + output_size, 
+-                      compressed_allocated - output_size, 
+-            temp_raw + current_sample * asset->channels);
+-              output_size += compressed_size;
++              AVPacket pkt;
++              AVFrame *frame;
++              int ret, samples_size, got_packet;
++              av_init_packet(&pkt);
++              pkt.data = temp_compressed + output_size;
++              pkt.size = compressed_allocated - output_size;
++              frame = av_frame_alloc();
++              if(!frame) return AVERROR(ENOMEM);
++              if(codec_context->frame_size) {
++                      frame->nb_samples = codec_context->frame_size;
++              } else {
++                      /* if frame_size is not set, the number of samples must 
be
++                       *              * calculated from the buffer size */
++                      int64_t nb_samples;
++                      if (!av_get_bits_per_sample(codec_context->codec_id)) {
++                              av_frame_free(&frame);
++                              return AVERROR(EINVAL);
++                      }
++                      nb_samples = (int64_t)(compressed_allocated - 
output_size) * 8 /
++                              
(av_get_bits_per_sample(codec_context->codec_id) *
++                               codec_context->channels);
++                      if (nb_samples >= INT_MAX) {
++                              av_frame_free(&frame);
++                              return AVERROR(EINVAL);
++                      }
++                      frame->nb_samples = nb_samples;
++              }
++
++              /* it is assumed that the samples buffer is large enough based 
on the
++               *          * relevant parameters */
++              samples_size = av_samples_get_buffer_size(NULL, 
codec_context->channels,
++                              frame->nb_samples,
++                              codec_context->sample_fmt, 1);
++              if ((ret = avcodec_fill_audio_frame(frame, 
codec_context->channels,
++                                              codec_context->sample_fmt,
++                                              (const uint8_t *)(temp_raw + 
current_sample * asset->channels),
++                                              samples_size, 1)) < 0) {
++                      av_frame_free(&frame);
++                      return ret;
++              }
++
++              ret = avcodec_encode_audio2(codec_context, &pkt, frame, 
&got_packet);
++              output_size += pkt.size;
++              /* free any side data since we cannot return it */
++              av_packet_free_side_data(&pkt);
++
++              if (frame && frame->extended_data != frame->data)
++                      av_freep(&frame->extended_data);
++
++              av_frame_free(&frame);
+       }
+ 
+ // Shift buffer back
+Index: cinelerra-20140710/quicktime/mpeg4.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/mpeg4.c
++++ cinelerra-20140710/quicktime/mpeg4.c
+@@ -595,7 +595,7 @@ static int encode(quicktime_t *file, uns
+       if(!codec->encode_initialized[current_field])
+       {
+ // Encore section
+-              if(codec->ffmpeg_id == CODEC_ID_MPEG4 && codec->use_encore)
++              if(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 && codec->use_encore)
+               {
+                       codec->encode_initialized[current_field] = 1;
+                       codec->encode_handle[current_field] = encode_handle++;
+@@ -647,7 +647,7 @@ static int encode(quicktime_t *file, uns
+                       context->width = width_i;
+                       context->height = height_i;
+                       context->gop_size = codec->gop_size;
+-                      context->pix_fmt = PIX_FMT_YUV420P;
++                      context->pix_fmt = AV_PIX_FMT_YUV420P;
+                       context->bit_rate = codec->bitrate / 
codec->total_fields;
+                       context->bit_rate_tolerance = codec->bitrate_tolerance;
+                       context->rc_eq = video_rc_eq;
+@@ -703,19 +703,19 @@
+ // All the forbidden settings can be extracted from libavcodec/mpegvideo.c of 
ffmpeg...
+                       
+ // Copyed from ffmpeg's mpegvideo.c... set 4MV only where it is supported
+-                      if(codec->ffmpeg_id == CODEC_ID_MPEG4 ||
+-                         codec->ffmpeg_id == CODEC_ID_H263 ||
+-                         codec->ffmpeg_id == CODEC_ID_H263P ||
+-                         codec->ffmpeg_id == CODEC_ID_FLV1)
++                      if(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++                         codec->ffmpeg_id == AV_CODEC_ID_H263 ||
++                         codec->ffmpeg_id == AV_CODEC_ID_H263P ||
++                         codec->ffmpeg_id == AV_CODEC_ID_FLV1)
+                               context->flags |= CODEC_FLAG_4MV;
+ // Not compatible with Win
+ //                    context->flags |= CODEC_FLAG_QPEL;
+ 
+                       if(file->cpus > 1 && 
+-                              (codec->ffmpeg_id == CODEC_ID_MPEG4 ||
+-                               codec->ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+-                               codec->ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-                               codec->ffmpeg_id == CODEC_ID_H263P))
++                              (codec->ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++                               codec->ffmpeg_id == AV_CODEC_ID_MPEG1VIDEO ||
++                               codec->ffmpeg_id == AV_CODEC_ID_MPEG2VIDEO ||
++                               codec->ffmpeg_id == AV_CODEC_ID_H263P))
+                       {
+                               context->thread_count = file->cpus;
+                       }
+@@ -740,7 +740,7 @@ static int encode(quicktime_t *file, uns
+  */
+                       avcodec_open2(context, codec->encoder[current_field], 
opts);
+ 
+-                      
avcodec_get_frame_defaults(&codec->picture[current_field]);
++                      av_frame_unref(&codec->picture[current_field]);
+ 
+               }
+       }
+@@ -891,10 +891,18 @@ static int encode(quicktime_t *file, uns
+               picture->quality = 0;
+               picture->pts = vtrack->current_position * 
quicktime_frame_rate_d(file, track);
+               picture->key_frame = 0;
+-              bytes = avcodec_encode_video(context, 
+-                      codec->work_buffer, 
+-              codec->buffer_size, 
+-              picture);
++
++              AVPacket pkt;
++              int ret, got_pkt;
++              av_init_packet(&pkt);
++              pkt.data = codec->work_buffer;
++              pkt.size = codec->buffer_size;
++              ret = avcodec_encode_video2(context, 
++                      &pkt,
++                      picture, &got_pkt);
++              bytes = pkt.size;
++              if(ret < 0 || !got_pkt) return 1;
++
+               is_keyframe = context->coded_frame && 
context->coded_frame->key_frame;
+ /*
+  * printf("encode current_position=%d is_keyframe=%d\n", 
+@@ -1161,7 +1169,7 @@ void quicktime_init_codec_div3(quicktime
+               QUICKTIME_DIV3,
+               "DIVX",
+               "Mike Row Soft MPEG4 Version 3");
+-      result->ffmpeg_id = CODEC_ID_MSMPEG4V3;
++      result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3;
+ }
+ 
+ void quicktime_init_codec_div5(quicktime_video_map_t *vtrack)
+@@ -1170,7 +1178,7 @@ void quicktime_init_codec_div5(quicktime
+               QUICKTIME_DX50,
+               "DIVX",
+               "Mike Row Soft MPEG4 Version 5");
+-      result->ffmpeg_id = CODEC_ID_MPEG4;
++      result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ // Mike Rowe Soft MPEG-4
+@@ -1180,7 +1188,7 @@ void quicktime_init_codec_div3lower(quic
+               QUICKTIME_DIV3_LOWER,
+               "DIVX",
+               "Mike Row Soft MPEG4 Version 3");
+-      result->ffmpeg_id = CODEC_ID_MSMPEG4V3;
++      result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3;
+ }
+ 
+ void quicktime_init_codec_div3v2(quicktime_video_map_t *vtrack)
+@@ -1189,7 +1197,7 @@ void quicktime_init_codec_div3v2(quickti
+               QUICKTIME_MP42,
+               "MP42",
+               "Mike Row Soft MPEG4 Version 2");
+-      result->ffmpeg_id = CODEC_ID_MSMPEG4V2;
++      result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V2;
+ }
+ 
+ // Generic MPEG-4
+@@ -1199,7 +1207,7 @@ void quicktime_init_codec_divx(quicktime
+               QUICKTIME_DIVX,
+               "MPEG-4",
+               "Generic MPEG Four");
+-      result->ffmpeg_id = CODEC_ID_MPEG4;
++      result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+       result->use_encore = 1;
+ }
+ 
+@@ -1209,7 +1217,7 @@ void quicktime_init_codec_mpg4(quicktime
+               QUICKTIME_MPG4,
+               "MPEG-4",
+               "FFMPEG (msmpeg4)");
+-      result->ffmpeg_id = CODEC_ID_MSMPEG4V1;
++      result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V1;
+ }
+ 
+ void quicktime_init_codec_dx50(quicktime_video_map_t *vtrack)
+@@ -1218,7 +1226,7 @@ void quicktime_init_codec_dx50(quicktime
+               QUICKTIME_DX50,
+               "MPEG-4",
+               "FFMPEG (mpeg4)");
+-      result->ffmpeg_id = CODEC_ID_MPEG4;
++      result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ // Generic MPEG-4
+@@ -1228,7 +1236,7 @@ void quicktime_init_codec_mp4v(quicktime
+               QUICKTIME_MP4V,
+               "MPEG4",
+               "Generic MPEG Four");
+-      result->ffmpeg_id = CODEC_ID_MPEG4;
++      result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ //    result->use_encore = 1;
+ }
+ 
+@@ -1240,7 +1248,7 @@ void quicktime_init_codec_svq1(quicktime
+               QUICKTIME_SVQ1,
+               "Sorenson Version 1",
+               "From the chearch of codecs of yesterday's sights");
+-      result->ffmpeg_id = CODEC_ID_SVQ1;
++      result->ffmpeg_id = AV_CODEC_ID_SVQ1;
+ }
+ 
+ void quicktime_init_codec_svq3(quicktime_video_map_t *vtrack)
+@@ -1249,7 +1257,7 @@ void quicktime_init_codec_svq3(quicktime
+               QUICKTIME_SVQ3,
+               "Sorenson Version 3",
+               "From the chearch of codecs of yesterday's sights");
+-      result->ffmpeg_id = CODEC_ID_SVQ3;
++      result->ffmpeg_id = AV_CODEC_ID_SVQ3;
+ }
+ 
+ void quicktime_init_codec_h263(quicktime_video_map_t *vtrack)
+@@ -1258,7 +1266,7 @@ void quicktime_init_codec_h263(quicktime
+         QUICKTIME_H263,
+         "H.263",
+         "H.263");
+-    result->ffmpeg_id = CODEC_ID_H263;
++    result->ffmpeg_id = AV_CODEC_ID_H263;
+ }
+ 
+ void quicktime_init_codec_xvid(quicktime_video_map_t *vtrack)
+@@ -1267,7 +1275,7 @@ void quicktime_init_codec_xvid(quicktime
+         QUICKTIME_XVID,
+         "XVID",
+         "FFmpeg MPEG-4");
+-    result->ffmpeg_id = CODEC_ID_MPEG4;
++    result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ void quicktime_init_codec_dnxhd(quicktime_video_map_t *vtrack)
+@@ -1276,7 +1284,7 @@ void quicktime_init_codec_dnxhd(quicktim
+         QUICKTIME_DNXHD,
+         "DNXHD",
+         "DNXHD");
+-    result->ffmpeg_id = CODEC_ID_DNXHD;
++    result->ffmpeg_id = AV_CODEC_ID_DNXHD;
+ }
+ 
+ // field based MPEG-4
+@@ -1287,7 +1295,7 @@ void quicktime_init_codec_hv60(quicktime
+               "Dual MPEG-4",
+               "MPEG 4 with alternating streams every other frame.  (Not 
standardized)");
+       result->total_fields = 2;
+-      result->ffmpeg_id = CODEC_ID_MPEG4;
++      result->ffmpeg_id = AV_CODEC_ID_MPEG4;
+ }
+ 
+ 
+Index: cinelerra-20140710/quicktime/qtffmpeg.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/qtffmpeg.c
++++ cinelerra-20140710/quicktime/qtffmpeg.c
+@@ -39,7 +39,7 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg
+       ptr->height = h;
+       ptr->ffmpeg_id = ffmpeg_id;
+ //printf("quicktime_new_ffmpeg 1 %d\n", ptr->ffmpeg_id);
+-      if(ffmpeg_id == CODEC_ID_SVQ1)
++      if(ffmpeg_id == AV_CODEC_ID_SVQ1)
+       {
+               ptr->width_i = quicktime_quantize32(ptr->width);
+               ptr->height_i = quicktime_quantize32(ptr->height);
+@@ -88,10 +88,10 @@
+                       context->extradata_size = avcc->data_size;
+               }
+               if(cpus > 1 && 
+-                              (ffmpeg_id == CODEC_ID_MPEG4 ||
+-                               ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
+-                               ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
+-                               ffmpeg_id == CODEC_ID_H263P))
++                              (ffmpeg_id == AV_CODEC_ID_MPEG4 ||
++                               ffmpeg_id == AV_CODEC_ID_MPEG1VIDEO ||
++                               ffmpeg_id == AV_CODEC_ID_MPEG2VIDEO ||
++                               ffmpeg_id == AV_CODEC_ID_H263P))
+               {
+                       context->thread_count = cpus;
+               }
+@@ -224,16 +224,16 @@ static int get_chroma_factor(quicktime_f
+ {
+       switch(ffmpeg->decoder_context[current_field]->pix_fmt)
+       {
+-              case PIX_FMT_YUV420P:
++              case AV_PIX_FMT_YUV420P:
+                       return 4;
+                       break;
+-              case PIX_FMT_YUYV422:
++              case AV_PIX_FMT_YUYV422:
+                       return 2;
+                       break;
+-              case PIX_FMT_YUV422P:
++              case AV_PIX_FMT_YUV422P:
+                       return 2;
+                       break;
+-              case PIX_FMT_YUV410P:
++              case AV_PIX_FMT_YUV410P:
+                       return 9;
+                       break;
+               default:
+@@ -277,7 +277,7 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ //printf("quicktime_ffmpeg_decode 1 %d\n", ffmpeg->last_frame[current_field]);
+ 
+               if(ffmpeg->last_frame[current_field] == -1 &&
+-                      ffmpeg->ffmpeg_id != CODEC_ID_H264)
++                      ffmpeg->ffmpeg_id != AV_CODEC_ID_H264)
+               {
+                       int current_frame = vtrack->current_position;
+ // For certain codecs,
+@@ -328,7 +328,7 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ // For MPEG-4, get another keyframe before first keyframe.
+ // The Sanyo tends to glitch with only 1 keyframe.
+ // Not enough memory.
+-                      if( 0 /* frame1 > 0 && ffmpeg->ffmpeg_id == 
CODEC_ID_MPEG4 */)
++                      if( 0 /* frame1 > 0 && ffmpeg->ffmpeg_id == 
AV_CODEC_ID_MPEG4 */)
+                       {
+                               do
+                               {
+@@ -423,16 +423,16 @@ int quicktime_ffmpeg_decode(quicktime_ff
+ // Hopefully this setting will be left over if the cache was used.
+       switch(ffmpeg->decoder_context[current_field]->pix_fmt)
+       {
+-              case PIX_FMT_YUV420P:
++              case AV_PIX_FMT_YUV420P:
+                       input_cmodel = BC_YUV420P;
+                       break;
+-              case PIX_FMT_YUYV422:
++              case AV_PIX_FMT_YUYV422:
+                       input_cmodel = BC_YUV422;
+                       break;
+-              case PIX_FMT_YUV422P:
++              case AV_PIX_FMT_YUV422P:
+                       input_cmodel = BC_YUV422P;
+                       break;
+-              case PIX_FMT_YUV410P:
++              case AV_PIX_FMT_YUV410P:
+                       input_cmodel = BC_YUV9P;
+                       break;
+               default:
+Index: cinelerra-20140710/quicktime/qth264.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/qth264.c
++++ cinelerra-20140710/quicktime/qth264.c
+@@ -370,7 +370,7 @@ static int decode(quicktime_t *file, uns
+       if(!codec->decoder) codec->decoder = quicktime_new_ffmpeg(
+               file->cpus,
+               codec->total_fields,
+-              CODEC_ID_H264,
++              AV_CODEC_ID_H264,
+               width,
+               height,
+               stsd_table);
+Index: cinelerra-20140710/quicktime/wma.c
+===================================================================
+--- cinelerra-20140710.orig/quicktime/wma.c
++++ cinelerra-20140710/quicktime/wma.c
+@@ -193,15 +193,38 @@ printf("decode 2 %x %llx %llx\n", chunk_
+                       codec->packet_buffer,
+                       chunk_size);
+ #else
+-              bytes_decoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+               AVPacket pkt;
+               av_init_packet( &pkt );
+               pkt.data = codec->packet_buffer;
+               pkt.size = chunk_size;
+-              result = avcodec_decode_audio3(codec->decoder_context,
+-                      (int16_t*)(codec->work_buffer + codec->output_size * 
sample_size),
+-                      &bytes_decoded,
++              AVFrame *frame = av_frame_alloc();
++              int got_frame = 0;
++
++              result = avcodec_decode_audio4(codec->decoder_context,
++                      frame, &got_frame, 
+                       &pkt);
++
++              if(result >= 0 && got_frame)
++              {
++                      int ch, plane_size;
++                      int planar    = 
av_sample_fmt_is_planar(codec->decoder_context->sample_fmt);
++                      int data_size = av_samples_get_buffer_size(&plane_size, 
codec->decoder_context->channels,
++                                      frame->nb_samples,
++                                      codec->decoder_context->sample_fmt, 1);
++                      memcpy(codec->work_buffer + codec->output_size * 
sample_size, frame->extended_data[0], plane_size);
++
++                      if (planar && codec->decoder_context->channels > 1) {
++                              uint8_t *out = ((uint8_t *)(codec->work_buffer 
+ codec->output_size * sample_size)) + plane_size;
++                              for (ch = 1; ch < 
codec->decoder_context->channels; ch++) {
++                                      memcpy(out, frame->extended_data[ch], 
plane_size);
++                                      out += plane_size;
++                              }
++                      }
++                      bytes_decoded = data_size;
++              } else {
++                      bytes_decoded = 0;
++              }
++              av_frame_free(&frame);
+ #endif
+ 
+               pthread_mutex_unlock(&ffmpeg_lock);
+@@ -298,7 +321,7 @@ void quicktime_init_codec_wmav1(quicktim
+       codec_base->title = "Win Media Audio 1";
+       codec_base->desc = "Win Media Audio 1";
+       codec_base->wav_id = 0x160;
+-      codec->ffmpeg_id = CODEC_ID_WMAV1;
++      codec->ffmpeg_id = AV_CODEC_ID_WMAV1;
+ }
+ 
+ 
+@@ -313,5 +336,5 @@ void quicktime_init_codec_wmav2(quicktim
+       codec_base->title = "Win Media Audio 2";
+       codec_base->desc = "Win Media Audio 2";
+       codec_base->wav_id = 0x161;
+-      codec->ffmpeg_id = CODEC_ID_WMAV2;
++      codec->ffmpeg_id = AV_CODEC_ID_WMAV2;
+ }
+Index: cinelerra-20140710/cinelerra/fileyuv.C
+===================================================================
+--- cinelerra-20140710.orig/cinelerra/fileyuv.C
++++ cinelerra-20140710/cinelerra/fileyuv.C
+@@ -196,7 +196,7 @@ int FileYUV::write_frames(VFrame ***laye
+                               return 
stream->write_frame_raw(frame->get_data(), frame_size);
+ 
+                       // decode and write an encoded frame
+-                      if (FFMPEG::codec_id(incoming_asset->vcodec) != 
CODEC_ID_NONE) 
++                      if (FFMPEG::codec_id(incoming_asset->vcodec) != 
AV_CODEC_ID_NONE) 
+                       {
+                               if (! ffmpeg) 
+                               {
+@@ -306,7 +306,7 @@ int FileYUV::can_copy_from(Edit *edit, i
+       if (edit->asset->format == FILE_YUV) return 1;
+ 
+       // if FFMPEG can decode it, we'll accept it
+-      if (FFMPEG::codec_id(edit->asset->vcodec) != CODEC_ID_NONE) return 1;
++      if (FFMPEG::codec_id(edit->asset->vcodec) != AV_CODEC_ID_NONE) return 1;
+ 
+       incoming_asset = 0;
+ 

Deleted: cinelerra-std_and_str_h.patch
===================================================================
--- cinelerra-std_and_str_h.patch       2016-02-19 19:32:01 UTC (rev 162597)
+++ cinelerra-std_and_str_h.patch       2016-02-19 19:54:12 UTC (rev 162598)
@@ -1,81 +0,0 @@
-Include required headers for free(), memcpy(), strcpy(), bcopy(), and more
-Thanks to Martin von Gagern for reporting and initial patch
-See, http://bugs.gentoo.org/show_bug.cgi?id=465478
-
---- cinelerra/vdevicebuz.C
-+++ cinelerra/vdevicebuz.C
-@@ -49,6 +49,8 @@
- #include <sys/ioctl.h>
- #include <sys/mman.h>
- #include <unistd.h>
-+#include <string.h>
-+#include <strings.h>
- 
- #define BASE_VIDIOCPRIVATE    192     
- 
---- cinelerra/videodevice.C
-+++ cinelerra/videodevice.C
-@@ -53,6 +53,7 @@
- 
- #include <unistd.h>
- #include <fcntl.h>
-+#include <string.h>
- 
- KeepaliveThread::KeepaliveThread(VideoDevice *device)
-  : Thread()
---- libmpeg3/audio/ac3.c
-+++ libmpeg3/audio/ac3.c
-@@ -1,3 +1,4 @@
-+#include <stdlib.h>
- #include <stdint.h>
- #include <stdio.h>
- 
---- libmpeg3/audio/layer3.c
-+++ libmpeg3/audio/layer3.c
-@@ -4,6 +4,7 @@
- #include "tables.h"
- 
- #include <stdio.h>
-+#include <stdlib.h>
- #include <string.h>
- 
- struct gr_info_s 
---- mplexlo/mplex.c
-+++ mplexlo/mplex.c
-@@ -1,6 +1,6 @@
- #include <stdio.h>
- #include <stdlib.h>
--
-+#include <string.h>
- 
- #include "libmpeg3.h"
- #include "mpeg3protos.h"
---- quicktime/graphics.c
-+++ quicktime/graphics.c
-@@ -1,5 +1,6 @@
- #include "graphics.h"
- 
-+#include <stdlib.h>
- #include <string.h>
- 
- /* Graphics acceleration routines */
---- quicktime/libmjpeg.c
-+++ quicktime/libmjpeg.c
-@@ -17,6 +17,7 @@
-  
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
- #include "colormodels.h"
- #include "libmjpeg.h"
- 
---- quicktime/qtpng.c
-+++ quicktime/qtpng.c
-@@ -1,6 +1,7 @@
- #include "colormodels.h"
- #include "funcprotos.h"
- #include <png.h>
-+#include <string.h>
- #include "quicktime.h"
- #include "qtpng.h"
- 

Added: ffmpeg-link.patch
===================================================================
--- ffmpeg-link.patch                           (rev 0)
+++ ffmpeg-link.patch   2016-02-19 19:54:12 UTC (rev 162598)
@@ -0,0 +1,24 @@
+--- configure.ac
++++ configure.ac
+@@ -497,7 +497,7 @@
+ AC_ARG_WITH([external-ffmpeg], AC_HELP_STRING([--with-external-ffmpeg], [use 
external ffmpeg library]))
+ 
+ if test "x$with_external_ffmpeg" = "xyes"; then
+-     PKG_CHECK_MODULES([FFMPEG_TEMP], [libavcodec libpostproc])
++     PKG_CHECK_MODULES([FFMPEG_TEMP], [libavcodec libpostproc libavutil])
+      FFMPEG_FOLDER=""
+      FFMPEG_EXTERNALTEXT="External ffmpeg"
+                  
+@@ -515,10 +515,10 @@
+      AC_MSG_RESULT($enable_ffmpeg_swscale)
+      if test x"$enable_ffmpeg_swscale" = xyes; then
+            dnl AC_DEFINE(HAVE_SWSCALER)
+-           PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libswscale])
++           PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libswscale 
libavutil])
+            FFMPEG_CFLAGS="$FFMPEG_CFLAGS -I/usr/include/libavcodec 
-I/usr/include/libswscale -DHAVE_SWSCALER"
+      else
+-           PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc])
++           PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libavutil])
+      fi
+      FFMPEG_EXTERNALTEXT="External ffmpeg"
+ else

Reply via email to