[FFmpeg-cvslog] Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6'

Michael Niedermayer git at videolan.org
Tue Jan 7 03:47:24 CET 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 17 01:36:26 2013 +0100| [1dcf9de6e995fb58a2514ab6fae9627a5e3481a3] | committer: Michael Niedermayer

Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6'

* 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 at gmx.at>
(cherry picked from commit 9f890a165666a73376c73b3c2bd920345b5c3b79)

Author of the merged code: Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1dcf9de6e995fb58a2514ab6fae9627a5e3481a3
---

 libavcodec/iff.c     |   24 +++++++++++++-----------
 libavcodec/indeo2.c  |   14 +++++++-------
 libavcodec/kgv1dec.c |    8 ++++----
 libavcodec/msrle.c   |   22 ++++++++++++----------
 4 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index a4b90fa..5d69539 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -318,6 +318,16 @@ static int extract_header(AVCodecContext *const avctx,
     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;
@@ -360,8 +370,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     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;
@@ -858,16 +870,6 @@ static int decode_frame(AVCodecContext *avctx,
     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",
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index d3bbc6d..aabe348 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -171,36 +171,36 @@ static int ir2_decode_frame(AVCodecContext *avctx,
 
     if (s->decode_delta) { /* intraframe */
         if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
-                                    s->picture->data[0], s->picture->linesize[0],
+                                    p->data[0], p->linesize[0],
                                     ir2_luma_table)) < 0)
             return ret;
 
         /* swapped U and V */
         if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
-                                    s->picture->data[2], s->picture->linesize[2],
+                                    p->data[2], p->linesize[2],
                                     ir2_luma_table)) < 0)
             return ret;
         if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
-                                    s->picture->data[1], s->picture->linesize[1],
+                                    p->data[1], p->linesize[1],
                                     ir2_luma_table)) < 0)
             return ret;
     } else { /* interframe */
         if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height,
-                                          s->picture->data[0], s->picture->linesize[0],
+                                          p->data[0], p->linesize[0],
                                           ir2_luma_table)) < 0)
             return ret;
         /* swapped U and V */
         if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
-                                          s->picture->data[2], s->picture->linesize[2],
+                                          p->data[2], p->linesize[2],
                                           ir2_luma_table)) < 0)
             return ret;
         if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
-                                          s->picture->data[1], s->picture->linesize[1],
+                                          p->data[1], p->linesize[1],
                                           ir2_luma_table)) < 0)
             return ret;
     }
 
-    if ((ret = av_frame_ref(picture, s->picture)) < 0)
+    if ((ret = av_frame_ref(picture, p)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index f793137..d4f8356 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -38,7 +38,7 @@ static void decode_flush(AVCodecContext *avctx)
 {
     KgvContext * const c = avctx->priv_data;
 
-    av_frame_unref(c->prev);
+    av_frame_free(&c->prev);
 }
 
 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
@@ -157,13 +157,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
 {
     KgvContext * const c = avctx->priv_data;
 
-    avctx->pix_fmt = AV_PIX_FMT_RGB555;
-    avctx->flags  |= CODEC_FLAG_EMU_EDGE;
-
     c->prev = av_frame_alloc();
     if (!c->prev)
         return AVERROR(ENOMEM);
 
+    avctx->pix_fmt = AV_PIX_FMT_RGB555;
+    avctx->flags  |= CODEC_FLAG_EMU_EDGE;
+
     return 0;
 }
 
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index 2b4ab1a..2836fec 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -38,7 +38,7 @@
 
 typedef struct MsrleContext {
     AVCodecContext *avctx;
-    AVFrame frame;
+    AVFrame *frame;
 
     GetByteContext gb;
     const unsigned char *buf;
@@ -70,7 +70,9 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
         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++)
@@ -92,24 +94,24 @@ static int msrle_decode_frame(AVCodecContext *avctx,
     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)
         return ret;
 
     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 + 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;
 
@@ -125,14 +127,14 @@ static int msrle_decode_frame(AVCodecContext *avctx,
                 memcpy(ptr, buf, linesize);
             }
             buf -= istride;
-            ptr += s->frame.linesize[0];
+            ptr += s->frame->linesize[0];
         }
     } else {
         bytestream2_init(&s->gb, buf, buf_size);
-        ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, &s->gb);
+        ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb);
     }
 
-    if ((ret = av_frame_ref(data, &s->frame)) < 0)
+    if ((ret = av_frame_ref(data, s->frame)) < 0)
         return ret;
 
     *got_frame      = 1;
@@ -146,7 +148,7 @@ static av_cold int msrle_decode_end(AVCodecContext *avctx)
     MsrleContext *s = avctx->priv_data;
 
     /* release the last frame */
-    av_frame_unref(&s->frame);
+    av_frame_free(&s->frame);
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list