1 /*
2 * Various utility demuxing functions
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
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
23
31
33 {
35 }
36
38 {
40 }
41
44 {
48
52 }
53
54 if (!
s->nb_chapters) {
57 for (
unsigned i = 0;
i <
s->nb_chapters;
i++)
58 if (
s->chapters[
i]->id ==
id)
59 chapter =
s->chapters[
i];
60 if (!chapter)
62 }
63
64 if (!chapter) {
66 if (!chapter)
72 }
73 }
77 chapter->
start = start;
79
80 return chapter;
81 }
82
84 {
86 si->inject_global_side_data = 1;
87 for (
unsigned i = 0;
i <
s->nb_streams;
i++) {
89 ffstream(st)->inject_global_side_data = 1;
90 }
91 }
92
94 {
97 for (
unsigned i = 0;
i <
s->nb_streams;
i++)
100 if (
s->streams[
i]->attached_pic.size <= 0) {
102 "Attached picture on stream %d has invalid size, "
104 continue;
105 }
106
108 &
s->streams[
i]->attached_pic,
112 }
113 return 0;
114 }
115
118 {
122
126 if (buf) {
133 } else {
137 }
140
143
144 return 0;
146 if (!st0)
149 }
150
152 uint64_t channel_layout,
int32_t sample_rate,
154 {
160
161 if (sample_rate) {
164 }
168 }
173 if (sample_rate)
174 bytestream_put_le32(&
data, sample_rate);
178 }
179 return 0;
180 }
181
183 {
189 }
190
192 {
198 }
199
201 {
202 static const uint8_t avci100_1080p_extradata[] = {
203 // SPS
204 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
205 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
206 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
207 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
208 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
209 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
210 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
211 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
212 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 // PPS
214 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
215 0xd0
216 };
217 static const uint8_t avci100_1080i_extradata[] = {
218 // SPS
219 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
220 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
221 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
222 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
223 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
224 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
225 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
226 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
227 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
228 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
229 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20,
230 // PPS
231 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
232 0xd0
233 };
234 static const uint8_t avci50_1080p_extradata[] = {
235 // SPS
236 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
237 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
238 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
239 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
240 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
241 0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
242 0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
243 0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
244 0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
245 // PPS
246 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
247 0x11
248 };
249 static const uint8_t avci50_1080i_extradata[] = {
250 // SPS
251 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
252 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
253 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
254 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
255 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
256 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
257 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
258 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
259 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
260 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
261 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
262 // PPS
263 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
264 0x11
265 };
266 static const uint8_t avci100_720p_extradata[] = {
267 // SPS
268 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
269 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
270 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
271 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
272 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
273 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
274 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
275 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
276 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
277 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
278 // PPS
279 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
280 0x11
281 };
282 static const uint8_t avci50_720p_extradata[] = {
283 // SPS
284 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
285 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
286 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
287 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
288 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
289 0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
290 0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
291 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
292 0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
293 // PPS
294 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
295 0x11
296 };
297
300
303 data = avci100_1080p_extradata;
304 size =
sizeof(avci100_1080p_extradata);
305 } else {
306 data = avci100_1080i_extradata;
307 size =
sizeof(avci100_1080i_extradata);
308 }
311 data = avci50_1080p_extradata;
312 size =
sizeof(avci50_1080p_extradata);
313 } else {
314 data = avci50_1080i_extradata;
315 size =
sizeof(avci50_1080i_extradata);
316 }
318 data = avci100_720p_extradata;
319 size =
sizeof(avci100_720p_extradata);
321 data = avci50_720p_extradata;
322 size =
sizeof(avci50_720p_extradata);
323 }
324
326 return 0;
327
331
332 return 0;
333 }
334
336 {
346 }
347
349 }
350
352 {
353 for (
unsigned i = 0;
i <
s->nb_streams;
i++)
354 if (
s->streams[
i]->id ==
id)
356 return -1;
357 }