1 /*
2 * CamStudio decoder
3 * Copyright (c) 2006 Reimar Doeffinger
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 #include <stdio.h>
22 #include <stdlib.h>
23
27
28 #if CONFIG_ZLIB
29 #include <zlib.h>
30 #endif
32
39
42 int i, src_stride =
FFALIGN(linelen, 4);
44 dst += (height - 1) * f->
linesize[0];
45 for (i = height; i; i--) {
46 memcpy(dst, src, linelen);
47 src += src_stride;
49 }
50 }
51
54 int i, j, src_stride =
FFALIGN(linelen, 4);
56 dst += (height - 1) * f->
linesize[0];
57 for (i = height; i; i--) {
58 for (j = linelen; j; j--)
59 *dst++ += *src++;
60 src += src_stride - linelen;
62 }
63 }
64
68 int buf_size = avpkt->
size;
71
72 if (buf_size < 2) {
75 }
76
79
80 // decompress data
81 switch ((buf[0] >> 1) & 7) {
82 case 0: { // lzo compression
86 break;
87 }
88 case 1: { // zlib compression
89 #if CONFIG_ZLIB
91 if (uncompress(c->
decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
93 break;
94 #else
97 #endif
98 }
99 default:
102 }
103
104 // flip upside down, add difference frame
105 if (buf[0] & 1) { // keyframe
110 } else {
115 }
116
117 *got_frame = 1;
120
121 return buf_size;
122 }
123
131 default:
133 "CamStudio codec error: invalid depth %i bpp\n",
136 }
146 }
150 return 0;
151 }
152
157 return 0;
158 }
159
170 };