Merge commit '50a65e7a540ce6747f81d6dbf6a602ad35be77ff'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Nov 2012 13:15:28 +0000 (14:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Nov 2012 13:20:33 +0000 (14:20 +0100)
* commit '50a65e7a540ce6747f81d6dbf6a602ad35be77ff': (24 commits)
  vmdaudio: set channel layout
  twinvq: validate sample rate code
  twinvq: set channel layout
  twinvq: validate that channels is not <= 0
  truespeech: set channel layout
  sipr: set channel layout
  shorten: validate that the channel count in the header is not <= 0
  ra288dec: set channel layout
  ra144dec: set channel layout
  qdm2: remove unneeded checks for channel count
  qdm2: make sure channels is not <= 0 and set channel layout
  qcelpdec: set channel layout
  nellymoserdec: set channels to 1
  libopencore-amr: set channel layout for amr-nb or if not set by the user
  libilbc: set channel layout
  dpcm: use AVCodecContext.channels instead of keeping a private copy
  imc: set channels to 1 instead of validating it
  gsmdec: always set channel layout and sample rate at initialization
  libgsmdec: always set channel layout and sample rate at initialization
  g726dec: do not validate sample rate
  ...

Conflicts:
libavcodec/dpcm.c
libavcodec/qdm2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
21 files changed:
1  2 
libavcodec/dpcm.c
libavcodec/flac.c
libavcodec/flac.h
libavcodec/flac_parser.c
libavcodec/flacdec.c
libavcodec/g726.c
libavcodec/gsmdec.c
libavcodec/imc.c
libavcodec/libgsm.c
libavcodec/libilbc.c
libavcodec/libopencore-amr.c
libavcodec/nellymoserdec.c
libavcodec/qcelpdec.c
libavcodec/qdm2.c
libavcodec/ra144dec.c
libavcodec/ra288.c
libavcodec/shorten.c
libavcodec/sipr.c
libavcodec/truespeech.c
libavcodec/twinvq.c
libavcodec/vmdav.c

@@@ -209,12 -207,9 +207,12 @@@ static int dpcm_decode_frame(AVCodecCon
          av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
          return AVERROR(EINVAL);
      }
-     if (out % s->channels) {
++    if (out % avctx->channels) {
 +        av_log(avctx, AV_LOG_WARNING, "channels have differing number of samples\n");
 +    }
  
      /* get output buffer */
-     s->frame.nb_samples = (out + s->channels - 1) / s->channels;
 -    s->frame.nb_samples = out / avctx->channels;
++    s->frame.nb_samples = (out + avctx->channels - 1) / avctx->channels;
      if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
          return ret;
@@@ -205,8 -223,10 +223,9 @@@ void avpriv_flac_parse_streaminfo(AVCod
      avctx->channels = s->channels;
      avctx->sample_rate = s->samplerate;
      avctx->bits_per_raw_sample = s->bps;
+     ff_flac_set_channel_layout(avctx);
  
 -    s->samples  = get_bits_long(&gb, 32) << 4;
 -    s->samples |= get_bits(&gb, 4);
 +    s->samples = get_bits_longlong(&gb, 36);
  
      skip_bits_long(&gb, 64); /* md5 sum */
      skip_bits_long(&gb, 64); /* md5 sum */
Simple merge
Simple merge
@@@ -135,15 -130,24 +128,24 @@@ static void dump_headers(AVCodecContex
      av_log(avctx, AV_LOG_DEBUG, "  Bits: %d\n", s->bps);
  }
  
- static void allocate_buffers(FLACContext *s)
+ static int allocate_buffers(FLACContext *s)
  {
-     int i;
+     int buf_size;
  
 -    assert(s->max_blocksize);
 +    av_assert0(s->max_blocksize);
  
-     for (i = 0; i < s->channels; i++) {
-         s->decoded[i] = av_malloc(sizeof(int32_t)*s->max_blocksize);
-     }
+     buf_size = av_samples_get_buffer_size(NULL, s->channels, s->max_blocksize,
+                                           AV_SAMPLE_FMT_S32P, 0);
+     if (buf_size < 0)
+         return buf_size;
+     av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size);
+     if (!s->decoded_buffer)
+         return AVERROR(ENOMEM);
+     return av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
+                                   s->decoded_buffer, s->channels,
+                                   s->max_blocksize, AV_SAMPLE_FMT_S32P, 0);
  }
  
  /**
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1792,10 -1761,10 +1785,12 @@@ static av_cold int qdm2_decode_init(AVC
  
      avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
      extradata += 4;
-     if (s->channels > MPA_MAX_CHANNELS) {
-         av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
 -    if (s->channels <= 0 || s->channels > MPA_MAX_CHANNELS)
++    if (s->channels <= 0 || s->channels > MPA_MAX_CHANNELS) {
++        av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
          return AVERROR_INVALIDDATA;
 +    }
+     avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
+                                                    AV_CH_LAYOUT_MONO;
  
      avctx->sample_rate = AV_RB32(extradata);
      extradata += 4;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge