1 /*
2 * ISO Media common code
3 * copyright (c) 2001 Fabrice Bellard
4 * copyright (c) 2002 Francois Revol <revol@free.fr>
5 * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef AVFORMAT_ISOM_H
25 #define AVFORMAT_ISOM_H
26
27 #include <stddef.h>
28 #include <stdint.h>
29
35
39
40 /* isom.c */
46
49
51
52 /* the QuickTime file format is quite convoluted...
53 * it has lots of index tables, each indexing something in another one...
54 * Here we just use what is needed to read the chunks
55 */
56
62
67
72
78
84
93
96 int64_t size;
/* total size (excluding the size and type fields) */
98
100
112
120
125
127 // Individual encrypted samples. If there are no elements, then the default
128 // settings will be used.
131
138
145 // Index of the first sample/trun in the fragment.
151
159
167
172
177 int id;
///< AVStream id
198 unsigned *
stps_data;
///< partial sync sample for mpeg-2 open gop
203 unsigned int sample_size;
///< may contain value calculated from stsd or value from stsz atom
239 int start_pad;
///< amount of samples to skip due to enc-dec delay
251
254
255 /** extradata array (and size) for multiple stsd */
261
273
275
276 int has_sidx;
// If there is an sidx entry for this stream.
277 struct {
284
288
293
312
320
322 const AVClass *
class;
///< class for private options
336 int isom;
///< 1 if file is ISO Media (mp4/3gp)
353 int *
bitrates;
///< bitrates read before streams creation
361 unsigned int aax_mode;
///< 'aax' file has been detected
389
394
395 #define MP4ODescrTag 0x01
396 #define MP4IODescrTag 0x02
397 #define MP4ESDescrTag 0x03
398 #define MP4DecConfigDescrTag 0x04
399 #define MP4DecSpecificDescrTag 0x05
400 #define MP4SLDescrTag 0x06
401
402 #define MOV_TFHD_BASE_DATA_OFFSET 0x01
403 #define MOV_TFHD_STSD_ID 0x02
404 #define MOV_TFHD_DEFAULT_DURATION 0x08
405 #define MOV_TFHD_DEFAULT_SIZE 0x10
406 #define MOV_TFHD_DEFAULT_FLAGS 0x20
407 #define MOV_TFHD_DURATION_IS_EMPTY 0x010000
408 #define MOV_TFHD_DEFAULT_BASE_IS_MOOF 0x020000
409
410 #define MOV_TRUN_DATA_OFFSET 0x01
411 #define MOV_TRUN_FIRST_SAMPLE_FLAGS 0x04
412 #define MOV_TRUN_SAMPLE_DURATION 0x100
413 #define MOV_TRUN_SAMPLE_SIZE 0x200
414 #define MOV_TRUN_SAMPLE_FLAGS 0x400
415 #define MOV_TRUN_SAMPLE_CTS 0x800
416
417 #define MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK 0x0000ffff
418 #define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC 0x00010000
419 #define MOV_FRAG_SAMPLE_FLAG_PADDING_MASK 0x000e0000
420 #define MOV_FRAG_SAMPLE_FLAG_REDUNDANCY_MASK 0x00300000
421 #define MOV_FRAG_SAMPLE_FLAG_DEPENDED_MASK 0x00c00000
422 #define MOV_FRAG_SAMPLE_FLAG_DEPENDS_MASK 0x03000000
423
424 #define MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO 0x02000000
425 #define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES 0x01000000
426
427 #define MOV_TKHD_FLAG_ENABLED 0x0001
428 #define MOV_TKHD_FLAG_IN_MOVIE 0x0002
429 #define MOV_TKHD_FLAG_IN_PREVIEW 0x0004
430 #define MOV_TKHD_FLAG_IN_POSTER 0x0008
431
432 #define MOV_SAMPLE_DEPENDENCY_UNKNOWN 0x0
433 #define MOV_SAMPLE_DEPENDENCY_YES 0x1
434 #define MOV_SAMPLE_DEPENDENCY_NO 0x2
435
436 #define MOV_TREF_FLAG_ENHANCEMENT 0x1
437
438 #define TAG_IS_AVCI(tag) \
439 ((tag) == MKTAG('a', 'i', '5', 'p') || \
440 (tag) == MKTAG('a', 'i', '5', 'q') || \
441 (tag) == MKTAG('a', 'i', '5', '2') || \
442 (tag) == MKTAG('a', 'i', '5', '3') || \
443 (tag) == MKTAG('a', 'i', '5', '5') || \
444 (tag) == MKTAG('a', 'i', '5', '6') || \
445 (tag) == MKTAG('a', 'i', '1', 'p') || \
446 (tag) == MKTAG('a', 'i', '1', 'q') || \
447 (tag) == MKTAG('a', 'i', '1', '2') || \
448 (tag) == MKTAG('a', 'i', '1', '3') || \
449 (tag) == MKTAG('a', 'i', '1', '5') || \
450 (tag) == MKTAG('a', 'i', '1', '6') || \
451 (tag) == MKTAG('a', 'i', 'v', 'x') || \
452 (tag) == MKTAG('A', 'V', 'i', 'n'))
453
454
456
459
460 #define FF_MOV_FLAG_MFRA_AUTO -1
461 #define FF_MOV_FLAG_MFRA_DTS 1
462 #define FF_MOV_FLAG_MFRA_PTS 2
463
464 /**
465 * Compute codec id for 'lpcm' tag.
466 * See CoreAudioTypes and AudioStreamBasicDescription at Apple.
467 */
469 {
470 /* lpcm flags:
471 * 0x1 = float
472 * 0x2 = big-endian
473 * 0x4 = signed
474 */
476 }
477
478 #define MOV_ISMV_TTML_TAG MKTAG('d', 'f', 'x', 'p')
479 #define MOV_MP4_TTML_TAG MKTAG('s', 't', 'p', 'p')
480 #define MOV_MP4_FPCM_TAG MKTAG('f', 'p', 'c', 'm')
481 #define MOV_MP4_IPCM_TAG MKTAG('i', 'p', 'c', 'm')
482
486 };
487
491 };
492
494
495 #endif /* AVFORMAT_ISOM_H */