Merge commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Dec 2012 14:09:58 +0000 (15:09 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Dec 2012 14:09:58 +0000 (15:09 +0100)
* commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a':
  Return proper error code after av_log_ask_for_sample()
  configure: cosmetics: Separate hwaccel dependencies from decoders/encoders
  oggdec: check memory allocation

Conflicts:
configure
libavcodec/pictordec.c
libavformat/anm.c
libavformat/oggdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
18 files changed:
1  2 
configure
libavcodec/anm.c
libavcodec/cinepak.c
libavcodec/h264.c
libavcodec/pictordec.c
libavcodec/ptx.c
libavcodec/truemotion1.c
libavcodec/truespeech.c
libavcodec/wmalosslessdec.c
libavcodec/wmaprodec.c
libavformat/anm.c
libavformat/au.c
libavformat/filmstripdec.c
libavformat/mtv.c
libavformat/oggdec.c
libavformat/rsodec.c
libavformat/smjpegdec.c
libavformat/spdifenc.c

diff --cc configure
+++ b/configure
@@@ -1807,11 -1598,32 +1777,43 @@@ zlib_encoder_select="zlib
  zmbv_decoder_select="zlib"
  zmbv_encoder_select="zlib"
  
+ # hardware accelerators
 +crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  vaapi_deps="va_va_h"
  vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  
+ h263_vaapi_hwaccel_select="vaapi h263_decoder"
++h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
+ h264_dxva2_hwaccel_deps="dxva2api_h"
+ h264_dxva2_hwaccel_select="dxva2 h264_decoder"
+ h264_vaapi_hwaccel_select="vaapi h264_decoder"
++h264_vda_decoder_select="vda h264_parser h264_decoder"
++h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
+ h264_vda_hwaccel_select="vda h264_decoder"
+ h264_vdpau_decoder_select="vdpau h264_decoder"
+ mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
+ mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
++mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
++mpeg2_crystalhd_decoder_select="crystalhd"
+ mpeg2_dxva2_hwaccel_deps="dxva2api_h"
+ mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
++mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
+ mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
++mpeg4_crystalhd_decoder_select="crystalhd"
+ mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
+ mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
++msmpeg4_crystalhd_decoder_select="crystalhd"
++vc1_crystalhd_decoder_select="crystalhd"
+ vc1_dxva2_hwaccel_deps="dxva2api_h"
+ vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
+ vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
+ vc1_vdpau_decoder_select="vdpau vc1_decoder"
++wmv3_crystalhd_decoder_select="crystalhd"
+ wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
+ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
+ wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  # parsers
  h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
  mpeg4video_parser_select="error_resilience mpegvideo"
Simple merge
Simple merge
Simple merge
@@@ -130,11 -122,11 +130,11 @@@ static int decode_frame(AVCodecContext 
      s->nb_planes   = (tmp >> 4) + 1;
      bpp            = bits_per_plane * s->nb_planes;
      if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
 -        av_log_ask_for_sample(s, "unsupported bit depth\n");
 +        av_log_ask_for_sample(avctx, "unsupported bit depth\n");
-         return AVERROR_INVALIDDATA;
+         return AVERROR_PATCHWELCOME;
      }
  
 -    if (bytestream2_peek_byte(&s->g) == 0xFF) {
 +    if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {
          bytestream2_skip(&s->g, 2);
          etype = bytestream2_get_le16(&s->g);
          esize = bytestream2_get_le16(&s->g);
@@@ -57,10 -57,10 +57,10 @@@ static int ptx_decode_frame(AVCodecCont
  
      if (bytes_per_pixel != 2) {
          av_log_ask_for_sample(avctx, "Image format is not RGB15.\n");
-         return -1;
+         return AVERROR_PATCHWELCOME;
      }
  
 -    avctx->pix_fmt = AV_PIX_FMT_RGB555;
 +    avctx->pix_fmt = AV_PIX_FMT_BGR555LE;
  
      if (buf_end - buf < offset)
          return AVERROR_INVALIDDATA;
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -163,7 -166,10 +163,7 @@@ static int read_header(AVFormatContext 
  
  invalid:
      av_log_ask_for_sample(s, NULL);
-     return AVERROR_INVALIDDATA;
 -    ret = AVERROR_PATCHWELCOME;
 -
 -fail:
 -    return ret;
++    return AVERROR_PATCHWELCOME;
  }
  
  static int read_packet(AVFormatContext *s,
@@@ -91,9 -80,9 +91,9 @@@ static int au_read_header(AVFormatConte
  
      codec = ff_codec_get_id(codec_au_tags, id);
  
 -    if (!av_get_bits_per_sample(codec)) {
 +    if (!(bps = av_get_bits_per_sample(codec))) {
          av_log_ask_for_sample(s, "could not determine bits per sample\n");
-         return AVERROR_INVALIDDATA;
+         return AVERROR_PATCHWELCOME;
      }
  
      if (channels == 0 || channels > 64) {
Simple merge
Simple merge
@@@ -163,66 -153,23 +163,66 @@@ static const struct ogg_codec *ogg_find
      return NULL;
  }
  
 -static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
 +/**
 + * Replace the current stream with a new one. This is a typical webradio
 + * situation where a new audio stream spawn (identified with a new serial) and
 + * must replace the previous one (track switch).
 + */
 +static int ogg_replace_stream(AVFormatContext *s, uint32_t serial)
  {
      struct ogg *ogg = s->priv_data;
 -    int idx         = ogg->nstreams++;
 -    AVStream *st;
      struct ogg_stream *os;
 +    unsigned bufsize;
 +    uint8_t *buf;
 +    struct ogg_codec *codec;
  
 -    os = av_realloc(ogg->streams, ogg->nstreams * sizeof(*ogg->streams));
 +    if (ogg->nstreams != 1) {
 +        av_log_missing_feature(s, "Changing stream parameters in multistream ogg", 0);
 +        return AVERROR_PATCHWELCOME;
 +    }
  
 -    if (!os)
 -        return AVERROR(ENOMEM);
 +    os = &ogg->streams[0];
  
 -    ogg->streams = os;
 +    buf     = os->buf;
 +    bufsize = os->bufsize;
 +    codec   = os->codec;
 +
 +    if (!ogg->state || ogg->state->streams[0].private != os->private)
 +        av_freep(&ogg->streams[0].private);
  
 -    memset(ogg->streams + idx, 0, sizeof(*ogg->streams));
 +    /* Set Ogg stream settings similar to what is done in ogg_new_stream(). We
 +     * also re-use the ogg_stream allocated buffer */
 +    memset(os, 0, sizeof(*os));
 +    os->serial  = serial;
 +    os->bufsize = bufsize;
 +    os->buf     = buf;
 +    os->header  = -1;
 +    os->codec   = codec;
 +
 +    return 0;
 +}
  
 -    os                = ogg->streams + idx;
 +static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
 +{
 +    struct ogg *ogg = s->priv_data;
 +    int idx         = ogg->nstreams;
 +    AVStream *st;
 +    struct ogg_stream *os;
 +    size_t size;
 +
 +    if (ogg->state) {
 +        av_log(s, AV_LOG_ERROR, "New streams are not supposed to be added "
 +               "in between Ogg context save/restore operations.\n");
 +        return AVERROR_BUG;
 +    }
 +
 +    /* Allocate and init a new Ogg Stream */
 +    if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 ||
 +        !(os = av_realloc(ogg->streams, size)))
 +        return AVERROR(ENOMEM);
-     ogg->streams      = os;
-     os                = ogg->streams + idx;
++    ogg->streams = os;
++    os           = ogg->streams + idx;
 +    memset(os, 0, sizeof(*os));
      os->serial        = serial;
      os->bufsize       = DECODER_BUFFER_SIZE;
      os->buf           = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
Simple merge
Simple merge
Simple merge