1 /*
2 * Microsoft Windows ICO muxer
3 * Copyright (c) 2012 Michael Bradshaw <mjbshaw gmail com>
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 * Microsoft Windows ICO muxer
25 */
26
30
31 typedef struct {
38
44
46 {
57 }
62 }
63 } else {
66 }
67
72 }
73
74 return 0;
75 }
76
78 {
82 int i;
83
87 }
88
91
94 avio_skip(pb, 2);
// skip the number of images
95
99
100 // Fill in later when writing trailer...
102 }
103
107
109
110 return 0;
111 }
112
114 {
119 int i;
120
124 }
125
127
131
135
137 } else { // BMP
138 if (
AV_RL32(pkt->
data + 14) != 40) {
// must be BITMAPINFOHEADER
141 }
142
143 image->
bits =
AV_RL16(pkt->
data + 28);
// allows things like 1bit and 4bit images to be preserved
145
146 avio_write(pb, pkt->
data + 14, 8);
// Skip the BITMAPFILEHEADER header
149
150 for (i = 0; i < c->
height * (c->
width + 7) / 8; ++i)
151 avio_w8(pb, 0x00);
// Write bitmask (opaque)
152 }
153
154 return 0;
155 }
156
158 {
161 int i;
162
164
166
170
174 } else {
176 }
177
183 }
184
186
187 return 0;
188 }
189
194 .mime_type = "image/vnd.microsoft.icon",
195 .extensions = "ico",
202 };