Merge commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b' into release/0.10
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 12 Aug 2014 17:23:34 +0000 (19:23 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 12 Aug 2014 17:53:37 +0000 (19:53 +0200)
* commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b':
  avcodec: Introduce ff_get_buffer

Conflicts:
libavcodec/8svx.c
libavcodec/dpcm.c
libavcodec/utils.c
libavcodec/vmdav.c
libavcodec/yop.c

See: 668494acd8b20f974c7722895d4a6a14c1005f1e
Merged-by: Michael Niedermayer <michaelni@gmx.at>
68 files changed:
1  2 
ffplay.c
libavcodec/8svx.c
libavcodec/aacdec.c
libavcodec/ac3dec.c
libavcodec/adpcm.c
libavcodec/adxdec.c
libavcodec/alac.c
libavcodec/alsdec.c
libavcodec/amrnbdec.c
libavcodec/amrwbdec.c
libavcodec/ansi.c
libavcodec/apedec.c
libavcodec/atrac1.c
libavcodec/atrac3.c
libavcodec/binkaudio.c
libavcodec/bmv.c
libavcodec/cdgraphics.c
libavcodec/cook.c
libavcodec/dca.c
libavcodec/dfa.c
libavcodec/dpcm.c
libavcodec/dsicinav.c
libavcodec/flacdec.c
libavcodec/g726.c
libavcodec/gsmdec.c
libavcodec/iff.c
libavcodec/imc.c
libavcodec/indeo3.c
libavcodec/internal.h
libavcodec/ivi_common.c
libavcodec/kgv1dec.c
libavcodec/libgsm.c
libavcodec/libopencore-amr.c
libavcodec/libspeexdec.c
libavcodec/mace.c
libavcodec/mlpdec.c
libavcodec/mpc7.c
libavcodec/mpc8.c
libavcodec/mpegaudiodec.c
libavcodec/mxpegdec.c
libavcodec/nellymoserdec.c
libavcodec/pcm-mpeg.c
libavcodec/pcm.c
libavcodec/pthread.c
libavcodec/qcelpdec.c
libavcodec/qdm2.c
libavcodec/ra144dec.c
libavcodec/ra288.c
libavcodec/roqvideoenc.c
libavcodec/s302m.c
libavcodec/shorten.c
libavcodec/sipr.c
libavcodec/smacker.c
libavcodec/svq1enc.c
libavcodec/thread.h
libavcodec/truespeech.c
libavcodec/tta.c
libavcodec/twinvq.c
libavcodec/utils.c
libavcodec/vmdav.c
libavcodec/vorbisdec.c
libavcodec/wavpack.c
libavcodec/wmadec.c
libavcodec/wmaprodec.c
libavcodec/wmavoice.c
libavcodec/ws-snd1.c
libavcodec/xan.c
libavcodec/yop.c

diff --cc ffplay.c
Simple merge
@@@ -150,8 -141,8 +151,8 @@@ static int eightsvx_decode_frame(AVCode
      }
  
      /* get output buffer */
 -    esc->frame.nb_samples = buf_size * (is_compr + 1);
 +    esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1)  / avctx->channels;
-     if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) {
+     if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return ret;
      }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -20,8 -20,8 +20,9 @@@
   */
  
  #include "avcodec.h"
+ #include "internal.h"
  #include "bytestream.h"
 +#include "libavutil/avassert.h"
  
  enum BMVFlags{
      BMV_NOP = 0,
@@@ -268,13 -265,8 +269,13 @@@ static av_cold int decode_init(AVCodecC
      c->avctx = avctx;
      avctx->pix_fmt = PIX_FMT_PAL8;
  
 +    if (avctx->width != SCREEN_WIDE || avctx->height != SCREEN_HIGH) {
 +        av_log(avctx, AV_LOG_ERROR, "Invalid dimension %dx%d\n", avctx->width, avctx->height);
 +        return AVERROR_INVALIDDATA;
 +    }
 +
      c->pic.reference = 1;
-     if (avctx->get_buffer(avctx, &c->pic) < 0) {
+     if (ff_get_buffer(avctx, &c->pic) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return -1;
      }
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -210,13 -211,10 +211,13 @@@ static int dpcm_decode_frame(AVCodecCon
          av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
          return AVERROR(EINVAL);
      }
 +    if (out % s->channels) {
 +        av_log(avctx, AV_LOG_WARNING, "channels have differing number of samples\n");
 +    }
  
      /* get output buffer */
 -    s->frame.nb_samples = out / s->channels;
 +    s->frame.nb_samples = (out + s->channels - 1) / s->channels;
-     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+     if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return ret;
      }
Simple merge
Simple merge
Simple merge
Simple merge
  #include "libavutil/imgutils.h"
  #include "bytestream.h"
  #include "avcodec.h"
+ #include "internal.h"
  #include "get_bits.h"
  
 +// TODO: masking bits
 +typedef enum {
 +    MASK_NONE,
 +    MASK_HAS_MASK,
 +    MASK_HAS_TRANSPARENT_COLOR,
 +    MASK_LASSO
 +} mask_type;
 +
  typedef struct {
      AVFrame frame;
      int planesize;
@@@ -479,10 -261,10 +480,10 @@@ static int decode_frame_ilbm(AVCodecCon
              av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
              return res;
          }
-     } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) {
+     } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return res;
 -    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
 +    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt == PIX_FMT_PAL8) {
          if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
              return res;
      }
@@@ -579,15 -318,12 +580,15 @@@ static int decode_frame_byterun1(AVCode
              av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
              return res;
          }
-     } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) {
+     } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return res;
 -    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
 +    } else if (avctx->pix_fmt == PIX_FMT_PAL8) {
          if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
              return res;
 +    } else if (avctx->pix_fmt == PIX_FMT_RGB32 && avctx->bits_per_coded_sample <= 8) {
 +        if ((res = ff_cmap_read_palette(avctx, s->mask_palbuf)) < 0)
 +            return res;
      }
      s->init = 1;
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
   * MPEG Audio decoder
   */
  
 +#define UNCHECKED_BITSTREAM_READER 1
 +
  #include "libavutil/audioconvert.h"
  #include "avcodec.h"
+ #include "internal.h"
  #include "get_bits.h"
  #include "mathops.h"
  #include "mpegaudiodsp.h"
@@@ -25,6 -25,6 +25,7 @@@
   * MxPEG decoder
   */
  
++#include "internal.h"
  #include "mjpeg.h"
  #include "mjpegdec.h"
  
Simple merge
Simple merge
Simple merge
@@@ -589,7 -573,7 +589,7 @@@ static int submit_packet(PerThreadConte
                  pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
  
              if (p->state == STATE_GET_BUFFER) {
-                 p->result = p->avctx->get_buffer(p->avctx, p->requested_frame);
 -                p->result = p-ff_get_buffer(p->avctx, p->requested_frame);
++                p->result = ff_get_buffer(p->avctx, p->requested_frame);
                  p->state  = STATE_SETTING_UP;
                  pthread_cond_signal(&p->progress_cond);
              }
@@@ -942,11 -917,9 +942,11 @@@ int ff_thread_get_buffer(AVCodecContex
  
      f->owner = avctx;
  
 +    ff_init_buffer_info(avctx, f);
 +
      if (!(avctx->active_thread_type&FF_THREAD_FRAME)) {
          f->thread_opaque = NULL;
-         return avctx->get_buffer(avctx, f);
+         return ff_get_buffer(avctx, f);
      }
  
      if (p->state != STATE_SETTING_UP &&
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -59,6 -59,6 +59,7 @@@
  #include "roqvideo.h"
  #include "bytestream.h"
  #include "elbg.h"
++#include "internal.h"
  #include "mathops.h"
  
  #define CHROMA_BIAS 1
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1979,10 -1815,7 +1979,10 @@@ unsigned int avpriv_toupper4(unsigned i
  int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
  {
      f->owner = avctx;
-     return avctx->get_buffer(avctx, f);
 +
 +    ff_init_buffer_info(avctx, f);
 +
+     return ff_get_buffer(avctx, f);
  }
  
  void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
@@@ -397,8 -396,8 +398,8 @@@ static int vmdvideo_decode_frame(AVCode
      if (buf_size < 16)
          return buf_size;
  
 -    s->frame.reference = 1;
 +    s->frame.reference = 3;
-     if (avctx->get_buffer(avctx, &s->frame)) {
+     if (ff_get_buffer(avctx, &s->frame)) {
          av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
          return -1;
      }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -204,12 -199,7 +205,12 @@@ static int yop_decode_frame(AVCodecCont
      if (s->frame.data[0])
          avctx->release_buffer(avctx, &s->frame);
  
-     ret = avctx->get_buffer(avctx, &s->frame);
 +    if (avpkt->size < 4 + 3*s->num_pal_colors) {
 +        av_log(avctx, AV_LOG_ERROR, "packet of size %d too small\n", avpkt->size);
 +        return AVERROR_INVALIDDATA;
 +    }
 +
+     ret = ff_get_buffer(avctx, &s->frame);
      if (ret < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return ret;