OSDN Git Service

Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Nov 2013 00:36:26 +0000 (01:36 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Nov 2013 00:38:41 +0000 (01:38 +0100)
* commit '2e09096da912f563c4dd889a8f25c314529bbaa6':
  kgv1: use the AVFrame API properly.
  indeo2: use the AVFrame API properly.
  iff: use the AVFrame API properly.
  msrle: use the AVFrame API properly.

Conflicts:
libavcodec/iff.c
libavcodec/indeo2.c
libavcodec/kgv1dec.c
libavcodec/msrle.c

See: 451b2ca1b4349f9b60416cc057eaf5518d81025c
See: 80e9e63c946660304fc65fa8141ccfdbe4d196d1
See: 057dce5f21cd70db1ef6e3b67644a39f0d51aba5
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/iff.c
libavcodec/indeo2.c
libavcodec/kgv1dec.c
libavcodec/msrle.c

@@@ -318,6 -144,14 +318,16 @@@ static int extract_header(AVCodecContex
      return 0;
  }
  
+ static av_cold int decode_end(AVCodecContext *avctx)
+ {
+     IffContext *s = avctx->priv_data;
+     av_frame_free(&s->frame);
+     av_freep(&s->planebuf);
++    av_freep(&s->ham_buf);
++    av_freep(&s->ham_palbuf);
+     return 0;
+ }
  static av_cold int decode_init(AVCodecContext *avctx)
  {
      IffContext *s = avctx->priv_data;
      if (!s->planebuf)
          return AVERROR(ENOMEM);
  
 +    s->bpp = avctx->bits_per_coded_sample;
      s->frame = av_frame_alloc();
-     if (!s->frame)
+     if (!s->frame) {
+         decode_end(avctx);
          return AVERROR(ENOMEM);
+     }
  
 +    if ((err = extract_header(avctx, NULL)) < 0)
 +        return err;
 +
      return 0;
  }
  
@@@ -858,20 -371,9 +870,10 @@@ static int decode_frame(AVCodecContext 
      return buf_size;
  }
  
- static av_cold int decode_end(AVCodecContext *avctx)
- {
-     IffContext *s = avctx->priv_data;
-     av_frame_free(&s->frame);
-     av_freep(&s->planebuf);
-     av_freep(&s->ham_buf);
-     av_freep(&s->ham_palbuf);
-     return 0;
- }
 +#if CONFIG_IFF_ILBM_DECODER
  AVCodec ff_iff_ilbm_decoder = {
 -    .name           = "iff_ilbm",
 -    .long_name      = NULL_IF_CONFIG_SMALL("IFF ILBM"),
 +    .name           = "iff",
 +    .long_name      = NULL_IF_CONFIG_SMALL("IFF"),
      .type           = AVMEDIA_TYPE_VIDEO,
      .id             = AV_CODEC_ID_IFF_ILBM,
      .priv_data_size = sizeof(IffContext),
Simple merge
@@@ -162,6 -169,10 +159,9 @@@ static av_cold int decode_init(AVCodecC
      if (!c->prev)
          return AVERROR(ENOMEM);
  
 -    c->avctx = avctx;
+     avctx->pix_fmt = AV_PIX_FMT_RGB555;
+     avctx->flags  |= CODEC_FLAG_EMU_EDGE;
      return 0;
  }
  
@@@ -70,12 -66,10 +70,14 @@@ static av_cold int msrle_decode_init(AV
          return AVERROR_INVALIDDATA;
      }
  
-     avcodec_get_frame_defaults(&s->frame);
+     s->frame = av_frame_alloc();
+     if (!s->frame)
+         return AVERROR(ENOMEM);
  
 +    if (avctx->extradata_size >= 4)
 +        for (i = 0; i < FFMIN(avctx->extradata_size, AVPALETTE_SIZE)/4; i++)
 +            s->pal[i] = 0xFFU<<24 | AV_RL32(avctx->extradata+4*i);
 +
      return 0;
  }
  
@@@ -92,24 -86,27 +94,24 @@@ static int msrle_decode_frame(AVCodecCo
      s->buf = buf;
      s->size = buf_size;
  
-     if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0)
 -    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) {
 -        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
++    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
          return ret;
 -    }
  
 -    if (avctx->bits_per_coded_sample <= 8) {
 +    if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
          const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
  
          if (pal) {
-             s->frame.palette_has_changed = 1;
+             s->frame->palette_has_changed = 1;
              memcpy(s->pal, pal, AVPALETTE_SIZE);
          }
 -
          /* make the palette available */
-         memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
+         memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
      }
  
      /* FIXME how to correctly detect RLE ??? */
      if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
 -        int linesize = avctx->width * avctx->bits_per_coded_sample / 8;
 +        int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
-         uint8_t *ptr = s->frame.data[0];
+         uint8_t *ptr = s->frame->data[0];
          uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
          int i, j;