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 if (buf_size < stride * avctx->
height)
112 for (i = avctx->
height - 1; i >= 0; i--) {
114 buf += stride;
115 buf_size -= stride;
116 }
117 break;
118 case 1:
121 break;
122 default:
125 }
126 break;
127 default:
129 return -1;
130 }
131
134
135 *got_frame = 1;
138
139 /* report that the buffer was completely consumed */
140 return buf_size;
141 }
142
144 {
146
148
149 return 0;
150 }
151
162 };