]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/msrle.c
Move arch check before OS check.
[ffmpeg] / libavcodec / msrle.c
index b318faa77f86f459921c7251828109bccc0029b9..a55b578b43db5686798ea1f5f989c55a97631f4d 100644 (file)
@@ -2,19 +2,21 @@
  * Micrsoft RLE Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
@@ -34,7 +36,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "common.h"
 #include "avcodec.h"
 #include "dsputil.h"
 
@@ -42,7 +43,7 @@ typedef struct MsrleContext {
     AVCodecContext *avctx;
     AVFrame frame;
 
-    unsigned char *buf;
+    const unsigned char *buf;
     int size;
 
 } MsrleContext;
@@ -235,14 +236,13 @@ static void msrle_decode_pal8(MsrleContext *s)
             stream_ptr, s->size);
 }
 
-static int msrle_decode_init(AVCodecContext *avctx)
+static av_cold int msrle_decode_init(AVCodecContext *avctx)
 {
-    MsrleContext *s = (MsrleContext *)avctx->priv_data;
+    MsrleContext *s = avctx->priv_data;
 
     s->avctx = avctx;
 
     avctx->pix_fmt = PIX_FMT_PAL8;
-    avctx->has_b_frames = 0;
     s->frame.data[0] = NULL;
 
     return 0;
@@ -250,13 +250,9 @@ static int msrle_decode_init(AVCodecContext *avctx)
 
 static int msrle_decode_frame(AVCodecContext *avctx,
                               void *data, int *data_size,
-                              uint8_t *buf, int buf_size)
+                              const uint8_t *buf, int buf_size)
 {
-    MsrleContext *s = (MsrleContext *)avctx->priv_data;
-
-    /* no supplementary picture */
-    if (buf_size == 0)
-        return 0;
+    MsrleContext *s = avctx->priv_data;
 
     s->buf = buf;
     s->size = buf_size;
@@ -287,9 +283,9 @@ static int msrle_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int msrle_decode_end(AVCodecContext *avctx)
+static av_cold int msrle_decode_end(AVCodecContext *avctx)
 {
-    MsrleContext *s = (MsrleContext *)avctx->priv_data;
+    MsrleContext *s = avctx->priv_data;
 
     /* release the last frame */
     if (s->frame.data[0])
@@ -308,4 +304,5 @@ AVCodec msrle_decoder = {
     msrle_decode_end,
     msrle_decode_frame,
     CODEC_CAP_DR1,
+    .long_name= "Microsoft RLE",
 };