1 /*
2 * Autodesk RLE Decoder
3 * Copyright (C) 2005 the ffmpeg project
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Autodesk RLE Video Decoder by Konstantin Shishkov
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30
34
39
43
45 {
48 int i;
49
52 case 8:
54
59 ptr += 4;
60 }
61 break;
62 case 16:
64 break;
65 case 24:
67 break;
68 default:
70 return -1;
71 }
72
76
77 return 0;
78 }
79
81 void *
data,
int *got_frame,
83 {
85 int buf_size = avpkt->
size;
88
89 if (buf_size < 4) {
92 }
93
96
98 buf += 4;
99 buf_size -= 4;
102 case MKTAG(
'A',
'A',
'S',
'4'):
105 break;
106 case MKTAG(
'A',
'A',
'S',
'C'):
107 switch (compr) {
108 case 0:
109 stride = (avctx->
width * psize + psize) & ~psize;
110 for (i = avctx->
height - 1; i >= 0; i--) {
111 if (avctx->
width * psize > buf_size) {
113 break;
114 }
118 }
119 break;
120 case 1:
123 break;
124 default:
127 }
128 break;
129 default:
131 return -1;
132 }
133
136
137 *got_frame = 1;
140
141 /* report that the buffer was completely consumed */
142 return buf_size;
143 }
144
146 {
148
150
151 return 0;
152 }
153
164 };