1 /*
2 * MJPEG/AVI1 to JPEG/JFIF bitstream format filter
3 * Copyright (c) 2010 Adrian Daerr and Nicolas George
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 * Adapted from mjpeg2jpeg.c, with original copyright:
24 * Paris 2010 Adrian Daerr, public domain
25 */
26
27 #include <string.h>
28
31
36
38 0xff, 0xd8, // SOI
39 0xff, 0xe0, // APP0
40 0x00, 0x10, // APP0 header size (including
41 // this field, but excluding preceding)
42 0x4a, 0x46, 0x49, 0x46, 0x00, // ID string 'JFIF0円'
43 0x01, 0x01, // version
44 0x00, // bits per type
45 0x00, 0x00, // X density
46 0x00, 0x00, // Y density
47 0x00, // X thumbnail size
48 0x00, // Y thumbnail size
49 };
50
54 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
55 0x0a, 0x0b, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
56 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
57 };
58
60 {
63 }
64
66 {
71 *(buf++) = 0x10;
74 *(buf++) = 0x11;
77 return buf;
78 }
79
81 {
84 int input_skip, output_size;
86
90
95 }
100 }
102 input_skip = (in->
data[4] << 8) + in->
data[5] + 4;
103 } else {
104 input_skip = 2;
105 }
106 if (in->
size < input_skip) {
110 }
111 output_size = in->
size - input_skip +
116
118
122
126
132 }
133
136 };
137
139 .
p.
name =
"mjpeg2jpeg",
142 };