annotate msrle.c @ 9763:d359d5ee74b9 libavcodec

Change buffer size checks to avoid the undefined overflow case.
author reimar
date Sun, 31 May 2009 10:23:38 +0000
parents 11839f0e3908
children 5da84f0d0a55
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
1 /*
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
2 * Micrsoft RLE Video Decoder
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
3 * Copyright (C) 2003 the ffmpeg project
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
15 * Lesser General Public License for more details.
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
16 *
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2453
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
20 */
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
21
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 7885
diff changeset
23 * @file libavcodec/msrle.c
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
24 * MS RLE Video Decoder by Mike Melanson (melanson@pcisys.net)
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
25 * For more information about the MS RLE format, visit:
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
26 * http://www.pcisys.net/~melanson/codecs/
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
27 *
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
28 * The MS RLE decoder outputs PAL8 colorspace data.
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
29 *
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
30 * Note that this decoder expects the palette colors from the end of the
1595
b2fecae88e84 Moved to new palette API
rtognimp
parents: 1592
diff changeset
31 * BITMAPINFO header passed through palctrl.
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
32 */
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
33
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
34 #include <stdio.h>
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
35 #include <stdlib.h>
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
36 #include <string.h>
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
37 #include <unistd.h>
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
38
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
39 #include "avcodec.h"
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
40 #include "dsputil.h"
7885
f874e1d5cf07 Factorize out code used for MS RLE format decoding in different decoders.
kostya
parents: 7823
diff changeset
41 #include "msrledec.h"
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
42
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
43 typedef struct MsrleContext {
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
44 AVCodecContext *avctx;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
45 AVFrame frame;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
46
6218
michael
parents: 4962
diff changeset
47 const unsigned char *buf;
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
48 int size;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
49
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
50 } MsrleContext;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
51
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6218
diff changeset
52 static av_cold int msrle_decode_init(AVCodecContext *avctx)
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
53 {
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
54 MsrleContext *s = avctx->priv_data;
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
55
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
56 s->avctx = avctx;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
57
9723
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
58 switch (avctx->bits_per_coded_sample) {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
59 case 4:
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
60 case 8:
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
61 avctx->pix_fmt = PIX_FMT_PAL8;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
62 break;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
63 case 24:
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
64 avctx->pix_fmt = PIX_FMT_BGR24;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
65 break;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
66 default:
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
67 av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
68 return -1;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
69 }
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
70
1630
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
71 s->frame.data[0] = NULL;
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
72
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
73 return 0;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
74 }
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
75
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
76 static int msrle_decode_frame(AVCodecContext *avctx,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
77 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8720
diff changeset
78 AVPacket *avpkt)
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
79 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8720
diff changeset
80 const uint8_t *buf = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8720
diff changeset
81 int buf_size = avpkt->size;
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
82 MsrleContext *s = avctx->priv_data;
9723
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
83 int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
84
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
85 s->buf = buf;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
86 s->size = buf_size;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
87
1592
63009885ca88 100l: free previous frame, not current one!
rtognimp
parents: 1591
diff changeset
88 s->frame.reference = 1;
1630
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
89 s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
90 if (avctx->reget_buffer(avctx, &s->frame)) {
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
91 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
92 return -1;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
93 }
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
94
9622
02715614161f check for palette presence, fix crash with QT-BMP.mov, issue #1074
bcoudurier
parents: 9355
diff changeset
95 if (s->avctx->palctrl) {
9623
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
96 /* make the palette available */
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
97 memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
98 if (s->avctx->palctrl->palette_changed) {
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
99 s->frame.palette_has_changed = 1;
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
100 s->avctx->palctrl->palette_changed = 0;
5083846ac1f3 reindent
bcoudurier
parents: 9622
diff changeset
101 }
9622
02715614161f check for palette presence, fix crash with QT-BMP.mov, issue #1074
bcoudurier
parents: 9355
diff changeset
102 }
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
103
9723
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
104 /* FIXME how to correctly detect RLE ??? */
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
105 if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
106 int linesize = avctx->width * avctx->bits_per_coded_sample / 8;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
107 uint8_t *ptr = s->frame.data[0];
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
108 uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
109 int i, j;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
110
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
111 for (i = 0; i < avctx->height; i++) {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
112 if (avctx->bits_per_coded_sample == 4) {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
113 for (j = 0; j < avctx->width - 1; j += 2) {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
114 ptr[j+0] = buf[j>>1] >> 4;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
115 ptr[j+1] = buf[j>>1] & 0xF;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
116 }
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
117 if (avctx->width & 1)
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
118 ptr[j+0] = buf[j>>1] >> 4;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
119 } else {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
120 memcpy(ptr, buf, linesize);
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
121 }
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
122 buf -= istride;
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
123 ptr += s->frame.linesize[0];
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
124 }
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
125 } else {
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
126 ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, buf, buf_size);
11839f0e3908 msrle uncompressed decoding, fix #1074 and many other samples under /RLE
bcoudurier
parents: 9623
diff changeset
127 }
7885
f874e1d5cf07 Factorize out code used for MS RLE format decoding in different decoders.
kostya
parents: 7823
diff changeset
128
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
129 *data_size = sizeof(AVFrame);
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
130 *(AVFrame*)data = s->frame;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
131
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
132 /* report that the buffer was completely consumed */
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
133 return buf_size;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
134 }
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
135
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6218
diff changeset
136 static av_cold int msrle_decode_end(AVCodecContext *avctx)
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
137 {
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
138 MsrleContext *s = avctx->priv_data;
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
139
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
140 /* release the last frame */
1630
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
141 if (s->frame.data[0])
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
142 avctx->release_buffer(avctx, &s->frame);
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
143
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
144 return 0;
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
145 }
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
146
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
147 AVCodec msrle_decoder = {
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
148 "msrle",
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
149 CODEC_TYPE_VIDEO,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
150 CODEC_ID_MSRLE,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
151 sizeof(MsrleContext),
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
152 msrle_decode_init,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
153 NULL,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
154 msrle_decode_end,
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
155 msrle_decode_frame,
1630
586b5c08863c - Add reget_buffer() function to AVCodecContext
rtognimp
parents: 1609
diff changeset
156 CODEC_CAP_DR1,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6717
diff changeset
157 .long_name= NULL_IF_CONFIG_SMALL("Microsoft RLE"),
1491
222643544cf1 New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE &
tmmm
parents:
diff changeset
158 };