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 {
67 }
68
73 }
74
75 return 0;
76 }
77
79 {
83 int i;
84
88 }
89
92
95 avio_skip(pb, 2);
// skip the number of images
96
100
101 // Fill in later when writing trailer...
103 }
104
108
110
111 return 0;
112 }
113
115 {
120 int i;
121
125 }
126
128
132
136
138 } else { // BMP
139 if (
AV_RL32(pkt->
data + 14) != 40) {
// must be BITMAPINFOHEADER
142 }
143
144 image->
bits =
AV_RL16(pkt->
data + 28);
// allows things like 1bit and 4bit images to be preserved
146
147 avio_write(pb, pkt->
data + 14, 8);
// Skip the BITMAPFILEHEADER header
150
151 for (i = 0; i < c->
height * (c->
width + 7) / 8; ++i)
152 avio_w8(pb, 0x00);
// Write bitmask (opaque)
153 }
154
155 return 0;
156 }
157
159 {
162 int i;
163
165
167
171
175 } else {
177 }
178
184 }
185
187
188 return 0;
189 }
190
195 .mime_type = "image/vnd.microsoft.icon",
196 .extensions = "ico",
203 };