forked from l-smash/l-smash
-
Notifications
You must be signed in to change notification settings - Fork 4
/
lsmash.h
4456 lines (4072 loc) · 246 KB
/
lsmash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************
* lsmash.h
*****************************************************************************
* Copyright (C) 2010-2017 L-SMASH project
*
* Authors: Yusuke Nakamura <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*****************************************************************************/
/* This file is available under an ISC license. */
#ifndef LSMASH_H
#define LSMASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#define PRIVATE /* If this declaration is placed at a variable, any user shall NOT use it. */
/**************************************************************************************
* Handle windows dll imports. The user must define this before including this header.
**************************************************************************************/
#ifdef LSMASH_API_IMPORTS
#define LSMASH_API __declspec(dllimport)
#else
#define LSMASH_API
#endif
#define LSMASH_4CC( a, b, c, d ) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d))
/****************************************************************************
* Version
****************************************************************************/
#define LSMASH_VERSION_MAJOR 2
#define LSMASH_VERSION_MINOR 20
#define LSMASH_VERSION_MICRO 0
#define LSMASH_VERSION_INT( a, b, c ) (((a) << 16) | ((b) << 8) | (c))
#define LIBLSMASH_VERSION_INT LSMASH_VERSION_INT( LSMASH_VERSION_MAJOR, \
LSMASH_VERSION_MINOR, \
LSMASH_VERSION_MICRO )
/****************************************************************************
* Error Values
****************************************************************************/
enum
{
LSMASH_ERR_NAMELESS = -1, /* An error but not assigned to any following errors */
LSMASH_ERR_MEMORY_ALLOC = -2, /* There is not enough room in the heap. */
LSMASH_ERR_INVALID_DATA = -3, /* Invalid data was found. */
LSMASH_ERR_FUNCTION_PARAM = -4, /* An error in the parameter list of the function */
LSMASH_ERR_PATCH_WELCOME = -5, /* Not implemented yet, so patches welcome. */
LSMASH_ERR_UNKNOWN = -6, /* Unknown error occured. */
LSMASH_ERR_IO = -7, /* I/O error occurred. */
};
/****************************************************************************
* ROOT
* The top-level opaque handler for whole file handling.
****************************************************************************/
typedef struct lsmash_root_tag lsmash_root_t;
/* Allocate a ROOT.
* The allocated ROOT can be deallocate by lsmash_destroy_root().
*
* Return the address of an allocated ROOT if successful.
* Return NULL otherwise. */
lsmash_root_t *lsmash_create_root
(
void
);
/* Deallocate a given ROOT. */
void lsmash_destroy_root
(
lsmash_root_t *root /* the address of a ROOT you want to deallocate */
);
/****************************************************************************
* File Layer
****************************************************************************/
typedef struct lsmash_file_tag lsmash_file_t;
typedef enum
{
LSMASH_FILE_MODE_WRITE = 1, /* output/muxing */
LSMASH_FILE_MODE_READ = 1<<1, /* input/demuxing */
LSMASH_FILE_MODE_FRAGMENTED = 1<<2, /* movie fragments */
LSMASH_FILE_MODE_DUMP = 1<<3,
LSMASH_FILE_MODE_BOX = 1<<4, /* box structure */
LSMASH_FILE_MODE_INITIALIZATION = 1<<5, /* movie sample table */
LSMASH_FILE_MODE_MEDIA = 1<<6, /* media data */
LSMASH_FILE_MODE_INDEX = 1<<7,
LSMASH_FILE_MODE_SEGMENT = 1<<8, /* segment */
LSMASH_FILE_MODE_WRITE_FRAGMENTED = LSMASH_FILE_MODE_WRITE | LSMASH_FILE_MODE_FRAGMENTED, /* deprecated */
} lsmash_file_mode;
typedef enum
{
ISOM_BRAND_TYPE_3G2A = LSMASH_4CC( '3', 'g', '2', 'a' ), /* 3GPP2 */
ISOM_BRAND_TYPE_3GE6 = LSMASH_4CC( '3', 'g', 'e', '6' ), /* 3GPP Release 6 Extended Presentation Profile */
ISOM_BRAND_TYPE_3GE9 = LSMASH_4CC( '3', 'g', 'e', '9' ), /* 3GPP Release 9 Extended Presentation Profile */
ISOM_BRAND_TYPE_3GF9 = LSMASH_4CC( '3', 'g', 'f', '9' ), /* 3GPP Release 9 File-delivery Server Profile */
ISOM_BRAND_TYPE_3GG6 = LSMASH_4CC( '3', 'g', 'g', '6' ), /* 3GPP Release 6 General Profile */
ISOM_BRAND_TYPE_3GG9 = LSMASH_4CC( '3', 'g', 'g', '9' ), /* 3GPP Release 9 General Profile */
ISOM_BRAND_TYPE_3GH9 = LSMASH_4CC( '3', 'g', 'h', '9' ), /* 3GPP Release 9 Adaptive Streaming Profile */
ISOM_BRAND_TYPE_3GM9 = LSMASH_4CC( '3', 'g', 'm', '9' ), /* 3GPP Release 9 Media Segment Profile */
ISOM_BRAND_TYPE_3GP4 = LSMASH_4CC( '3', 'g', 'p', '4' ), /* 3GPP Release 4 */
ISOM_BRAND_TYPE_3GP5 = LSMASH_4CC( '3', 'g', 'p', '5' ), /* 3GPP Release 5 */
ISOM_BRAND_TYPE_3GP6 = LSMASH_4CC( '3', 'g', 'p', '6' ), /* 3GPP Release 6 Basic Profile */
ISOM_BRAND_TYPE_3GP7 = LSMASH_4CC( '3', 'g', 'p', '7' ), /* 3GPP Release 7 */
ISOM_BRAND_TYPE_3GP8 = LSMASH_4CC( '3', 'g', 'p', '8' ), /* 3GPP Release 8 */
ISOM_BRAND_TYPE_3GP9 = LSMASH_4CC( '3', 'g', 'p', '9' ), /* 3GPP Release 9 Basic Profile */
ISOM_BRAND_TYPE_3GR6 = LSMASH_4CC( '3', 'g', 'r', '6' ), /* 3GPP Release 6 Progressive Download Profile */
ISOM_BRAND_TYPE_3GR9 = LSMASH_4CC( '3', 'g', 'r', '9' ), /* 3GPP Release 9 Progressive Download Profile */
ISOM_BRAND_TYPE_3GS6 = LSMASH_4CC( '3', 'g', 's', '6' ), /* 3GPP Release 6 Streaming Server Profile */
ISOM_BRAND_TYPE_3GS9 = LSMASH_4CC( '3', 'g', 's', '9' ), /* 3GPP Release 9 Streaming Server Profile */
ISOM_BRAND_TYPE_3GT9 = LSMASH_4CC( '3', 'g', 't', '9' ), /* 3GPP Release 9 Media Stream Recording Profile */
ISOM_BRAND_TYPE_ARRI = LSMASH_4CC( 'A', 'R', 'R', 'I' ), /* ARRI Digital Camera */
ISOM_BRAND_TYPE_CAEP = LSMASH_4CC( 'C', 'A', 'E', 'P' ), /* Canon Digital Camera */
ISOM_BRAND_TYPE_CDES = LSMASH_4CC( 'C', 'D', 'e', 's' ), /* Convergent Designs */
ISOM_BRAND_TYPE_CDM4 = LSMASH_4CC( 'c', 'd', 'm', '4' ), /* CMAF Media Profile with HDR10+ dynamic metadata */
ISOM_BRAND_TYPE_LCAG = LSMASH_4CC( 'L', 'C', 'A', 'G' ), /* Leica digital camera */
ISOM_BRAND_TYPE_M4A = LSMASH_4CC( 'M', '4', 'A', ' ' ), /* iTunes MPEG-4 audio protected or not */
ISOM_BRAND_TYPE_M4B = LSMASH_4CC( 'M', '4', 'B', ' ' ), /* iTunes AudioBook protected or not */
ISOM_BRAND_TYPE_M4P = LSMASH_4CC( 'M', '4', 'P', ' ' ), /* MPEG-4 protected audio */
ISOM_BRAND_TYPE_M4V = LSMASH_4CC( 'M', '4', 'V', ' ' ), /* MPEG-4 protected audio+video */
ISOM_BRAND_TYPE_MFSM = LSMASH_4CC( 'M', 'F', 'S', 'M' ), /* Media File for Samsung video Metadata */
ISOM_BRAND_TYPE_MPPI = LSMASH_4CC( 'M', 'P', 'P', 'I' ), /* Photo Player Multimedia Application Format */
ISOM_BRAND_TYPE_OPUS = LSMASH_4CC( 'O', 'p', 'u', 's' ), /* Opus */
ISOM_BRAND_TYPE_ROSS = LSMASH_4CC( 'R', 'O', 'S', 'S' ), /* Ross Video */
ISOM_BRAND_TYPE_AID3 = LSMASH_4CC( 'a', 'i', 'd', '3' ), /* AOM Timed ID3 Metadata */
ISOM_BRAND_TYPE_AV01 = LSMASH_4CC( 'a', 'v', '0', '1' ), /* AV1 */
ISOM_BRAND_TYPE_AVC1 = LSMASH_4CC( 'a', 'v', 'c', '1' ), /* Advanced Video Coding extensions */
ISOM_BRAND_TYPE_BBXM = LSMASH_4CC( 'b', 'b', 'x', 'm' ), /* Blinkbox Master File */
ISOM_BRAND_TYPE_CAQV = LSMASH_4CC( 'c', 'a', 'q', 'v' ), /* Casio Digital Camera */
ISOM_BRAND_TYPE_CCFF = LSMASH_4CC( 'c', 'c', 'f', 'f' ), /* Common container file format */
ISOM_BRAND_TYPE_DA0A = LSMASH_4CC( 'd', 'a', '0', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DA0B = LSMASH_4CC( 'd', 'a', '0', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DA1A = LSMASH_4CC( 'd', 'a', '1', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DA1B = LSMASH_4CC( 'd', 'a', '1', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DA2A = LSMASH_4CC( 'd', 'a', '2', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DA2B = LSMASH_4CC( 'd', 'a', '2', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DA3A = LSMASH_4CC( 'd', 'a', '3', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DA3B = LSMASH_4CC( 'd', 'a', '3', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DASH = LSMASH_4CC( 'd', 'a', 's', 'h' ), /* Indexed self-initializing Media Segment */
ISOM_BRAND_TYPE_DBY1 = LSMASH_4CC( 'd', 'b', 'y', '1' ), /* MP4 files with Dolby content */
ISOM_BRAND_TYPE_DMB1 = LSMASH_4CC( 'd', 'm', 'b', '1' ), /* DMB AF */
ISOM_BRAND_TYPE_DSMS = LSMASH_4CC( 'd', 's', 'm', 's' ), /* Self-initializing Media Segment */
ISOM_BRAND_TYPE_DV1A = LSMASH_4CC( 'd', 'v', '1', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DV1B = LSMASH_4CC( 'd', 'v', '1', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DV2A = LSMASH_4CC( 'd', 'v', '2', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DV2B = LSMASH_4CC( 'd', 'v', '2', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DV3A = LSMASH_4CC( 'd', 'v', '3', 'a' ), /* DMB AF */
ISOM_BRAND_TYPE_DV3B = LSMASH_4CC( 'd', 'v', '3', 'b' ), /* DMB AF */
ISOM_BRAND_TYPE_DVR1 = LSMASH_4CC( 'd', 'v', 'r', '1' ), /* DVB RTP */
ISOM_BRAND_TYPE_DVT1 = LSMASH_4CC( 'd', 'v', 't', '1' ), /* DVB Transport Stream */
ISOM_BRAND_TYPE_IFRM = LSMASH_4CC( 'i', 'f', 'r', 'm' ), /* Apple iFrame */
ISOM_BRAND_TYPE_ISC2 = LSMASH_4CC( 'i', 's', 'c', '2' ), /* Files encrypted according to ISMACryp 2.0 */
ISOM_BRAND_TYPE_ISO2 = LSMASH_4CC( 'i', 's', 'o', '2' ), /* ISO Base Media file format version 2 */
ISOM_BRAND_TYPE_ISO3 = LSMASH_4CC( 'i', 's', 'o', '3' ), /* ISO Base Media file format version 3 */
ISOM_BRAND_TYPE_ISO4 = LSMASH_4CC( 'i', 's', 'o', '4' ), /* ISO Base Media file format version 4 */
ISOM_BRAND_TYPE_ISO5 = LSMASH_4CC( 'i', 's', 'o', '5' ), /* ISO Base Media file format version 5 */
ISOM_BRAND_TYPE_ISO6 = LSMASH_4CC( 'i', 's', 'o', '6' ), /* ISO Base Media file format version 6 */
ISOM_BRAND_TYPE_ISO7 = LSMASH_4CC( 'i', 's', 'o', '7' ), /* ISO Base Media file format version 7 */
ISOM_BRAND_TYPE_ISOM = LSMASH_4CC( 'i', 's', 'o', 'm' ), /* ISO Base Media file format version 1 */
ISOM_BRAND_TYPE_JPSI = LSMASH_4CC( 'j', 'p', 's', 'i' ), /* The JPSearch data interchange format */
ISOM_BRAND_TYPE_LMSG = LSMASH_4CC( 'l', 'm', 's', 'g' ), /* last Media Segment indicator */
ISOM_BRAND_TYPE_MJ2S = LSMASH_4CC( 'm', 'j', '2', 's' ), /* Motion JPEG 2000 simple profile */
ISOM_BRAND_TYPE_MJP2 = LSMASH_4CC( 'm', 'j', 'p', '2' ), /* Motion JPEG 2000, general profile */
ISOM_BRAND_TYPE_MP21 = LSMASH_4CC( 'm', 'p', '2', '1' ), /* MPEG-21 */
ISOM_BRAND_TYPE_MP41 = LSMASH_4CC( 'm', 'p', '4', '1' ), /* MP4 version 1 */
ISOM_BRAND_TYPE_MP42 = LSMASH_4CC( 'm', 'p', '4', '2' ), /* MP4 version 2 */
ISOM_BRAND_TYPE_MP71 = LSMASH_4CC( 'm', 'p', '7', '1' ), /* MPEG-7 file-level metadata */
ISOM_BRAND_TYPE_MSDH = LSMASH_4CC( 'm', 's', 'd', 'h' ), /* Media Segment */
ISOM_BRAND_TYPE_MSIX = LSMASH_4CC( 'm', 's', 'i', 'x' ), /* Indexed Media Segment */
ISOM_BRAND_TYPE_NIKO = LSMASH_4CC( 'n', 'i', 'k', 'o' ), /* Nikon Digital Camera */
ISOM_BRAND_TYPE_ODCF = LSMASH_4CC( 'o', 'd', 'c', 'f' ), /* OMA DCF */
ISOM_BRAND_TYPE_OPF2 = LSMASH_4CC( 'o', 'p', 'f', '2' ), /* OMA PDCF */
ISOM_BRAND_TYPE_OPX2 = LSMASH_4CC( 'o', 'p', 'x', '2' ), /* OMA Adapted PDCF */
ISOM_BRAND_TYPE_PANA = LSMASH_4CC( 'p', 'a', 'n', 'a' ), /* Panasonic Digital Camera */
ISOM_BRAND_TYPE_PIFF = LSMASH_4CC( 'p', 'i', 'f', 'f' ), /* Protected Interoperable File Format */
ISOM_BRAND_TYPE_PNVI = LSMASH_4CC( 'p', 'n', 'v', 'i' ), /* Panasonic Video Intercom */
ISOM_BRAND_TYPE_QT = LSMASH_4CC( 'q', 't', ' ', ' ' ), /* QuickTime file format */
ISOM_BRAND_TYPE_RISX = LSMASH_4CC( 'r', 'i', 's', 'x' ), /* Representation Index Segment */
ISOM_BRAND_TYPE_SDV = LSMASH_4CC( 's', 'd', 'v', ' ' ), /* SD Video */
ISOM_BRAND_TYPE_SIMS = LSMASH_4CC( 's', 'i', 'm', 's' ), /* Sub-Indexed Media Segment */
ISOM_BRAND_TYPE_SISX = LSMASH_4CC( 's', 'i', 's', 'x' ), /* Single Index Segment */
ISOM_BRAND_TYPE_SSSS = LSMASH_4CC( 's', 's', 's', 's' ), /* Subsegment Index Segment */
} lsmash_brand_type;
typedef struct
{
lsmash_file_mode mode; /* file modes */
/** custom I/O stuff **/
void *opaque; /* custom I/O opaque handler used for the following callback functions */
/* Attempt to read up to 'size' bytes from the file referenced by 'opaque' into the buffer starting at 'buf'.
*
* Return the number of bytes read if successful.
* Return 0 if no more read.
* Return a negative value otherwise. */
int (*read)
(
void *opaque,
uint8_t *buf,
int size
);
/* Write up to 'size' bytes to the file referenced by 'opaque' from the buffer starting at 'buf'.
*
* Return the number of bytes written if successful.
* Return a negative value otherwise. */
int (*write)
(
void *opaque,
uint8_t *buf,
int size
);
/* Change the location of the read/write pointer of 'opaque'.
* The offset of the pointer is determined according to the directive 'whence' as follows:
* If 'whence' is set to SEEK_SET, the offset is set to 'offset' bytes.
* If 'whence' is set to SEEK_CUR, the offset is set to its current location plus 'offset' bytes.
* If 'whence' is set to SEEK_END, the offset is set to the size of the file plus 'offset' bytes.
*
* Return the resulting offset of the location in bytes from the beginning of the file if successful.
* Return a negative value otherwise. */
int64_t (*seek)
(
void *opaque,
int64_t offset,
int whence
);
/** file types or segment types **/
lsmash_brand_type major_brand; /* the best used brand */
lsmash_brand_type *brands; /* the list of compatible brands */
uint32_t brand_count; /* the number of compatible brands used in the file */
uint32_t minor_version; /* minor version of the best used brand
* minor_version is informative only i.e. not specifying requirements but merely providing information.
* It must not be used to determine the conformance of a file to a standard. */
/** muxing only **/
double max_chunk_duration; /* max duration per chunk in seconds. 0.5 is default value. */
double max_async_tolerance; /* max tolerance, in seconds, for amount of interleaving asynchronization between tracks.
* 2.0 is default value. At least twice of max_chunk_duration is used. */
uint64_t max_chunk_size; /* max size per chunk in bytes. 4*1024*1024 (4MiB) is default value. */
/** demuxing only **/
uint64_t max_read_size; /* max size of reading from the file at a time. 4*1024*1024 (4MiB) is default value. */
} lsmash_file_parameters_t;
typedef int (*lsmash_adhoc_remux_callback)( void *param, uint64_t done, uint64_t total );
typedef struct
{
uint64_t buffer_size;
lsmash_adhoc_remux_callback func;
void *param;
} lsmash_adhoc_remux_t;
/* Open a file where the path is given.
* And if successful, set up the parameters by 'open_mode'.
* Here, the 'open_mode' parameter is either 0 or 1 as follows:
* 0: Create a file for output/muxing operations.
* If a file with the same name already exists, its contents are discarded and the file is treated as a new file.
* If user specifies "-" for 'filename', operations are done on stdout.
* The file types or segment types are set up as specified in 'param'.
* 1: Open a file for input/demuxing operations. The file must exist.
* If user specifies "-" for 'filename', operations are done on stdin.
*
* This function sets up file modes minimally.
* User can add additional modes and/or remove modes already set later.
* The other parameters except for the custom I/O stuff are set to a default.
* User shall not touch the custom I/O stuff for the opened file if using this function.
*
* The opened file can be closed by lsmash_close_file().
*
* Note:
* 'filename' must be encoded by UTF-8 if 'open_mode' is equal to 0.
* On Windows, lsmash_convert_ansi_to_utf8() may help you.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_open_file
(
const char *filename,
int open_mode,
lsmash_file_parameters_t *param
);
/* Close a file opened by lsmash_open_file().
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_close_file
(
lsmash_file_parameters_t *param
);
/* Associate a file with a ROOT and allocate the handle of that file.
* The all allocated handles can be deallocated by lsmash_destroy_root().
* If the ROOT has no associated file yet, the first associated file is activated.
*
* Return the address of the allocated handle of the added file if successful.
* Return NULL otherwise. */
lsmash_file_t *lsmash_set_file
(
lsmash_root_t *root,
lsmash_file_parameters_t *param
);
/* Read whole boxes in a given file.
* You can also get file modes and file types or segment types by this function.
*
* Return the file size (if seekable) or 0 if successful.
* Return a negative value otherwise. */
int64_t lsmash_read_file
(
lsmash_file_t *file,
lsmash_file_parameters_t *param
);
/* Deallocate all boxes within the current active file in a given ROOT. */
void lsmash_discard_boxes
(
lsmash_root_t *root /* the address of a ROOT you want to deallocate all boxes within the active file in it */
);
/* Activate a file associated with a ROOT.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_activate_file
(
lsmash_root_t *root,
lsmash_file_t *file
);
/* Switch from the current segment file to the following media segment file.
* After switching, the followed segment file can be closed unless that file is an initialization segment.
*
* The first followed segment file must be also an initialization segment.
* The second or later segment files must not be an initialization segment.
* For media segment files flagging LSMASH_FILE_MODE_INDEX, 'remux' must be set.
*
* Users shall call lsmash_flush_pooled_samples() for each track before calling this function.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_switch_media_segment
(
lsmash_root_t *root,
lsmash_file_t *successor,
lsmash_adhoc_remux_t *remux
);
/****************************************************************************
* Basic Types
****************************************************************************/
/* rational types */
typedef struct
{
uint32_t n; /* numerator */
uint32_t d; /* denominator */
} lsmash_rational_u32_t;
typedef struct
{
int32_t n; /* numerator */
uint32_t d; /* denominator */
} lsmash_rational_s32_t;
typedef enum
{
LSMASH_BOOLEAN_FALSE = 0,
LSMASH_BOOLEAN_TRUE = 1
} lsmash_boolean_t;
/****************************************************************************
* Allocation
****************************************************************************/
/* Allocate a memory block.
* The allocated memory block can be deallocate by lsmash_free().
*
* Return the address to the beginning of a memory block if successful.
* Return NULL otherwise. */
void *lsmash_malloc
(
size_t size /* size of a memory block, in bytes */
);
/* Allocate a memory block.
* The allocated memory block shall be initialized to all bits 0.
* The allocated memory block can be deallocate by lsmash_free().
*
* Return the address to the beginning of a memory block if successful.
* Return NULL otherwise. */
void *lsmash_malloc_zero
(
size_t size /* size of a memory block, in bytes */
);
/* Reallocate a memory block.
* The reallocated memory block can be deallocate by lsmash_free().
* If this function succeed, the given memory block is deallocated and the address is invalid.
* If this function fails, the address to the given memory block is still valid and the memory block is unchanged.
*
* Return the address to the beginning of a memory block if successful.
* Return NULL otherwise. */
void *lsmash_realloc
(
void *ptr, /* an address to a memory block previously allocated with
* lsmash_malloc(), lsmash_malloc_zero(), lsmash_realloc() or lsmash_memdup()
* Alternatively, NULL makes this function to allocate a new memory block. */
size_t size /* size of a memory block, in bytes */
);
/* Allocate a memory block and copy all bits from a given memory block.
* The allocated memory block can be deallocate by lsmash_free().
*
* Return the address to the beginning of an allocated memory block if successful.
* Return NULL otherwise. */
void *lsmash_memdup
(
const void *ptr, /* an address to the source of data to be copied */
size_t size /* number of bytes to copy */
);
/* Deallocate a given memory block.
* If the given address to a memory block is NULL, this function does nothing. */
void lsmash_free
(
void *ptr /* an address to a memory block previously allocated with
* lsmash_malloc(), lsmash_malloc_zero(), lsmash_realloc() or lsmash_memdup() */
);
/* Deallocate a given memory block.
* If the given address to a memory block is NULL, this function does nothing.
* Set NULL to the pointer to the memory block after deallocating.
*
* As an example of usage.
* Let's say you allocate a memory block and set the address to the beginning of it to the pointer 'ptr'.
* You can deallocate the memory block and set NULL to 'ptr' by lsmash_freep( &ptr ).
*/
void lsmash_freep
(
void *ptrptr /* the address to a pointer to a memory block previously allocated with
* lsmash_malloc(), lsmash_malloc_zero(), lsmash_realloc() or lsmash_memdup() */
);
/****************************************************************************
* Box
****************************************************************************/
typedef struct lsmash_box_tag lsmash_box_t;
typedef uint32_t lsmash_compact_box_type_t;
/* An UUID structure for extended box type */
typedef struct
{
uint32_t fourcc; /* four characters codes that identify extended box type partially
* If the box is not a UUID box, this field shall be the same as the box type.
* Note: characters in this field aren't always printable. */
uint8_t id[12]; /* If the box is not a UUID box, this field shall be set to 12-byte ISO reserved value
* { 0x00, 0x11, 0x00, 0x10, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 }
* and shall not be written into the stream together with above-defined four characters codes.
* As an exception, we could set the value
* { 0x0F, 0x11, 0x4D, 0xA5, 0xBF, 0x4E, 0xF2, 0xC4, 0x8C, 0x6A, 0xA1, 0x1E }
* to indicate the box is derived from QuickTime file format. */
} lsmash_extended_box_type_t;
typedef struct
{
lsmash_compact_box_type_t fourcc; /* four characters codes that identify box type
* Note: characters in this field aren't always printable. */
lsmash_extended_box_type_t user; /* Universal Unique IDentifier, i.e. UUID */
/* If 'fourcc' doesn't equal 'uuid', ignore this field. */
} lsmash_box_type_t;
typedef struct
{
lsmash_box_type_t type; /* box type */
uint32_t number; /* the number of box in ascending order excluding boxes unspecified by 'type' within
* the same level of the box nested structure. */
} lsmash_box_path_t;
#define LSMASH_BOX_TYPE_INITIALIZER { 0x00000000, { 0x00000000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }
#define LSMASH_BOX_TYPE_UNSPECIFIED static_lsmash_box_type_unspecified
LSMASH_API extern const lsmash_box_type_t static_lsmash_box_type_unspecified;
/* Return extended box type that consists of combination of given FourCC and 12-byte ID. */
lsmash_extended_box_type_t lsmash_form_extended_box_type
(
uint32_t fourcc,
const uint8_t id[12]
);
/* Return box type that consists of combination of given compact and extended box type. */
lsmash_box_type_t lsmash_form_box_type
(
lsmash_compact_box_type_t type,
lsmash_extended_box_type_t user
);
#define LSMASH_ISO_BOX_TYPE_INITIALIZER( x ) { x, { x, { 0x00, 0x11, 0x00, 0x10, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 } } }
#define LSMASH_QTFF_BOX_TYPE_INITIALIZER( x ) { x, { x, { 0x0F, 0x11, 0x4D, 0xA5, 0xBF, 0x4E, 0xF2, 0xC4, 0x8C, 0x6A, 0xA1, 0x1E } } }
lsmash_box_type_t lsmash_form_iso_box_type
(
lsmash_compact_box_type_t type
);
lsmash_box_type_t lsmash_form_qtff_box_type
(
lsmash_compact_box_type_t type
);
/* precedence of the box position
* Box with higher value will precede physically other boxes with lower one.
* The lower 32-bits are intended to determine order of boxes with the same box type. */
#define LSMASH_BOX_PRECEDENCE_L 0x0000000000800000ULL /* Lowest */
#define LSMASH_BOX_PRECEDENCE_LP 0x000FFFFF00000000ULL /* Lowest+ */
#define LSMASH_BOX_PRECEDENCE_N 0x0080000000000000ULL /* Normal */
#define LSMASH_BOX_PRECEDENCE_HM 0xFFEEEEEE00000000ULL /* Highest- */
#define LSMASH_BOX_PRECEDENCE_H 0xFFFFFFFF00800000ULL /* Highest */
#define LSMASH_BOX_PRECEDENCE_S 0x0000010000000000ULL /* Step */
/* Check if the type of two boxes is identical or not.
*
* Return 1 if the both box types are identical.
* Return 0 otherwise. */
int lsmash_check_box_type_identical
(
lsmash_box_type_t a,
lsmash_box_type_t b
);
/* Check if the type of a given box is already specified or not.
*
* Return 1 if the box type is specified.
* Return 0 otherwise, i.e. LSMASH_BOX_TYPE_UNSPECIFIED. */
int lsmash_check_box_type_specified
(
const lsmash_box_type_t *box_type
);
/* Allocate a box.
* The allocated box can be deallocated by lsmash_destroy_box().
*
* Return the address of an allocated box if successful.
* Return NULL otherwise. */
lsmash_box_t *lsmash_create_box
(
lsmash_box_type_t type,
uint8_t *data,
uint32_t size,
uint64_t precedence
);
/* Get a box under a given 'parent' box.
* The path of a box must be terminated by LSMASH_BOX_TYPE_UNSPECIFIED.
*
* Return the address of the box specified by 'box_path'.
* Return NULL otherwise. */
lsmash_box_t *lsmash_get_box
(
lsmash_box_t *parent,
const lsmash_box_path_t box_path[]
);
/* Add a box into 'parent' box as a child box.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_add_box
(
lsmash_box_t *parent,
lsmash_box_t *box
);
/* Add a box into 'parent' box as a child box.
* If the adding child box is known and its children (if any) are known, expand them into known
* struct formats for the internal references within the L-SMASH library.
* If this function succeed, the adding child box is deallocated and the address is invalid.
* Instead of that, this function replaces the invalid address with the valid one of the new
* allocated memory block representing the added and expanded child box.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_add_box_ex
(
lsmash_box_t *parent,
lsmash_box_t **box
);
/* Deallocate a given box and its children. */
void lsmash_destroy_box
(
lsmash_box_t *box
);
/* Deallocate all children of a given box. */
void lsmash_destroy_children
(
lsmash_box_t *box
);
/* Get the precedence of a given box.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_get_box_precedence
(
lsmash_box_t *box,
uint64_t *precedence
);
/* This function allows you to handle a ROOT as if it is a box.
* Of course, you can deallocate the ROOT by lsmash_destroy_box().
*
* Return the address of a given ROOT as a box. */
lsmash_box_t *lsmash_root_as_box
(
lsmash_root_t *root
);
/* This function allows you to handle the handle of a file as if it is a box.
* Of course, you can deallocate the handle of the file by lsmash_destroy_box().
*
* Return the address of the handle of a given file as a box. */
lsmash_box_t *lsmash_file_as_box
(
lsmash_file_t *file
);
/* Write a top level box and its children already added to a file.
* WARNING:
* You should not use this function as long as media data is incompletely written.
* That is before starting to write a media data or after finishing of writing that.
*
* Return 0 if successful.
* Return a negative value otherwise. */
int lsmash_write_top_level_box
(
lsmash_box_t *box
);
/* Export the data of a given box and its children as the binary string.
* The returned address is of the beginning of an allocated memory block.
* You can deallocate the memory block by lsmash_free().
*
* Note that some boxes cannot be exported since L-SMASH might skip the cache for them.
* Media Data Box is an unexportable example.
*
* Return the address to the beginning of the binary string if successful.
* Return NULL otherwise. */
uint8_t *lsmash_export_box
(
lsmash_box_t *box,
uint32_t *size
);
/****************************************************************************
* CODEC identifiers
****************************************************************************/
typedef lsmash_box_type_t lsmash_codec_type_t;
#define LSMASH_CODEC_TYPE_INITIALIZER LSMASH_BOX_TYPE_INITIALIZER
#define LSMASH_CODEC_TYPE_UNSPECIFIED LSMASH_BOX_TYPE_UNSPECIFIED
#ifndef LSMASH_INITIALIZE_CODEC_ID_HERE
#define DEFINE_ISOM_CODEC_TYPE( BOX_TYPE_NAME, BOX_TYPE_FOURCC ) \
LSMASH_API extern const lsmash_codec_type_t BOX_TYPE_NAME
#define DEFINE_QTFF_CODEC_TYPE( BOX_TYPE_NAME, BOX_TYPE_FOURCC ) \
LSMASH_API extern const lsmash_codec_type_t BOX_TYPE_NAME
#else
#define DEFINE_ISOM_CODEC_TYPE( BOX_TYPE_NAME, BOX_TYPE_FOURCC ) \
const lsmash_codec_type_t BOX_TYPE_NAME = LSMASH_ISO_BOX_TYPE_INITIALIZER( BOX_TYPE_FOURCC )
#define DEFINE_QTFF_CODEC_TYPE( BOX_TYPE_NAME, BOX_TYPE_FOURCC ) \
const lsmash_codec_type_t BOX_TYPE_NAME = LSMASH_QTFF_BOX_TYPE_INITIALIZER( BOX_TYPE_FOURCC )
#endif
/* Audio CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AC_3_AUDIO, LSMASH_4CC( 'a', 'c', '-', '3' ) ); /* AC-3 audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_ALAC_AUDIO, LSMASH_4CC( 'a', 'l', 'a', 'c' ) ); /* Apple lossless audio codec */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DRA1_AUDIO, LSMASH_4CC( 'd', 'r', 'a', '1' ) ); /* DRA Audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSEL_AUDIO, LSMASH_4CC( 'd', 't', 's', '+' ) ); /* Enhancement layer for DTS layered audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSDL_AUDIO, LSMASH_4CC( 'd', 't', 's', '-' ) ); /* Dependent base layer for DTS layered audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSC_AUDIO, LSMASH_4CC( 'd', 't', 's', 'c' ) ); /* DTS Coherent Acoustics audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSE_AUDIO, LSMASH_4CC( 'd', 't', 's', 'e' ) ); /* DTS Express low bit rate audio, also known as DTS LBR */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSH_AUDIO, LSMASH_4CC( 'd', 't', 's', 'h' ) ); /* DTS-HD High Resolution Audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSL_AUDIO, LSMASH_4CC( 'd', 't', 's', 'l' ) ); /* DTS-HD Master Audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DTSX_AUDIO, LSMASH_4CC( 'd', 't', 's', 'x' ) ); /* DTS:X */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_EC_3_AUDIO, LSMASH_4CC( 'e', 'c', '-', '3' ) ); /* Enhanced AC-3 audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_ENCA_AUDIO, LSMASH_4CC( 'e', 'n', 'c', 'a' ) ); /* Encrypted/Protected audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_G719_AUDIO, LSMASH_4CC( 'g', '7', '1', '9' ) ); /* ITU-T Recommendation G.719 (2008) ); */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_G726_AUDIO, LSMASH_4CC( 'g', '7', '2', '6' ) ); /* ITU-T Recommendation G.726 (1990) ); */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_M4AE_AUDIO, LSMASH_4CC( 'm', '4', 'a', 'e' ) ); /* MPEG-4 Audio Enhancement */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MLPA_AUDIO, LSMASH_4CC( 'm', 'l', 'p', 'a' ) ); /* MLP Audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MP4A_AUDIO, LSMASH_4CC( 'm', 'p', '4', 'a' ) ); /* MPEG-4 Audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_OPUS_AUDIO, LSMASH_4CC( 'O', 'p', 'u', 's' ) ); /* Opus */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_RAW_AUDIO, LSMASH_4CC( 'r', 'a', 'w', ' ' ) ); /* Uncompressed audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SAMR_AUDIO, LSMASH_4CC( 's', 'a', 'm', 'r' ) ); /* Narrowband AMR voice */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SAWB_AUDIO, LSMASH_4CC( 's', 'a', 'w', 'b' ) ); /* Wideband AMR voice */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SAWP_AUDIO, LSMASH_4CC( 's', 'a', 'w', 'p' ) ); /* Extended AMR-WB (AMR-WB+) ); */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SEVC_AUDIO, LSMASH_4CC( 's', 'e', 'v', 'c' ) ); /* EVRC Voice */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SQCP_AUDIO, LSMASH_4CC( 's', 'q', 'c', 'p' ) ); /* 13K Voice */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SSMV_AUDIO, LSMASH_4CC( 's', 's', 'm', 'v' ) ); /* SMV Voice */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_TWOS_AUDIO, LSMASH_4CC( 't', 'w', 'o', 's' ) ); /* Uncompressed 16-bit audio */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_WMA_AUDIO, LSMASH_4CC( 'w', 'm', 'a', ' ' ) ); /* Windows Media Audio V2 or V3 (not registered at MP4RA) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_23NI_AUDIO, LSMASH_4CC( '2', '3', 'n', 'i' ) ); /* 32-bit little endian integer uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MAC3_AUDIO, LSMASH_4CC( 'M', 'A', 'C', '3' ) ); /* MACE 3:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MAC6_AUDIO, LSMASH_4CC( 'M', 'A', 'C', '6' ) ); /* MACE 6:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_NONE_AUDIO, LSMASH_4CC( 'N', 'O', 'N', 'E' ) ); /* either 'raw ' or 'twos' */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_QDM2_AUDIO, LSMASH_4CC( 'Q', 'D', 'M', '2' ) ); /* Qdesign music 2 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_QDMC_AUDIO, LSMASH_4CC( 'Q', 'D', 'M', 'C' ) ); /* Qdesign music 1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_QCLP_AUDIO, LSMASH_4CC( 'Q', 'c', 'l', 'p' ) ); /* Qualcomm PureVoice */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_AC_3_AUDIO, LSMASH_4CC( 'a', 'c', '-', '3' ) ); /* Digital Audio Compression Standard (AC-3, Enhanced AC-3) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_AGSM_AUDIO, LSMASH_4CC( 'a', 'g', 's', 'm' ) ); /* GSM */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ALAC_AUDIO, LSMASH_4CC( 'a', 'l', 'a', 'c' ) ); /* Apple lossless audio codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ALAW_AUDIO, LSMASH_4CC( 'a', 'l', 'a', 'w' ) ); /* a-Law 2:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_CDX2_AUDIO, LSMASH_4CC( 'c', 'd', 'x', '2' ) ); /* CD/XA 2:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_CDX4_AUDIO, LSMASH_4CC( 'c', 'd', 'x', '4' ) ); /* CD/XA 4:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVCA_AUDIO, LSMASH_4CC( 'd', 'v', 'c', 'a' ) ); /* DV Audio */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVI_AUDIO, LSMASH_4CC( 'd', 'v', 'i', ' ' ) ); /* DVI (as used in RTP, 4:1 compression) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_FL32_AUDIO, LSMASH_4CC( 'f', 'l', '3', '2' ) ); /* 32-bit float */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_FL64_AUDIO, LSMASH_4CC( 'f', 'l', '6', '4' ) ); /* 64-bit float */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_IMA4_AUDIO, LSMASH_4CC( 'i', 'm', 'a', '4' ) ); /* IMA (International Multimedia Assocation, defunct, 4:1) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_IN24_AUDIO, LSMASH_4CC( 'i', 'n', '2', '4' ) ); /* 24-bit integer uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_IN32_AUDIO, LSMASH_4CC( 'i', 'n', '3', '2' ) ); /* 32-bit integer uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_LPCM_AUDIO, LSMASH_4CC( 'l', 'p', 'c', 'm' ) ); /* Uncompressed audio (various integer and float formats) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MP4A_AUDIO, LSMASH_4CC( 'm', 'p', '4', 'a' ) ); /* MPEG-4 Audio */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_RAW_AUDIO, LSMASH_4CC( 'r', 'a', 'w', ' ' ) ); /* 8-bit offset-binary uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SOWT_AUDIO, LSMASH_4CC( 's', 'o', 'w', 't' ) ); /* 16-bit little endian uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_TWOS_AUDIO, LSMASH_4CC( 't', 'w', 'o', 's' ) ); /* 8-bit or 16-bit big endian uncompressed */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULAW_AUDIO, LSMASH_4CC( 'u', 'l', 'a', 'w' ) ); /* uLaw 2:1 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_VDVA_AUDIO, LSMASH_4CC( 'v', 'd', 'v', 'a' ) ); /* DV audio (variable duration per video frame) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_FULLMP3_AUDIO, LSMASH_4CC( '.', 'm', 'p', '3' ) ); /* MPEG-1 layer 3, CBR & VBR (QT4.1 and later) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MP3_AUDIO, 0x6D730055 ); /* MPEG-1 layer 3, CBR only (pre-QT4.1) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ADPCM2_AUDIO, 0x6D730002 ); /* Microsoft ADPCM - ACM code 2 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ADPCM17_AUDIO, 0x6D730011 ); /* DVI/Intel IMA ADPCM - ACM code 17 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_GSM49_AUDIO, 0x6D730031 ); /* Microsoft GSM 6.10 - ACM code 49 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_NOT_SPECIFIED, 0x00000000 ); /* either 'raw ' or 'twos' */
/* Video CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AV01_VIDEO, LSMASH_4CC( 'a', 'v', '0', '1' ) ); /* AV1 */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AVC1_VIDEO, LSMASH_4CC( 'a', 'v', 'c', '1' ) ); /* Advanced Video Coding
* Any sample must not contain any paramerter set and filler data. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AVC2_VIDEO, LSMASH_4CC( 'a', 'v', 'c', '2' ) ); /* Advanced Video Coding
* Any sample must not contain any paramerter set and filler data.
* May only be used when Extractors or Aggregators are required to be supported. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AVC3_VIDEO, LSMASH_4CC( 'a', 'v', 'c', '3' ) ); /* Advanced Video Coding
* It is allowed that sample contains parameter sets and filler data. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AVC4_VIDEO, LSMASH_4CC( 'a', 'v', 'c', '4' ) ); /* Advanced Video Coding
* It is allowed that sample contains parameter sets and filler data.
* May only be used when Extractors or Aggregators are required to be supported. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_AVCP_VIDEO, LSMASH_4CC( 'a', 'v', 'c', 'p' ) ); /* Advanced Video Coding Parameters */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_DRAC_VIDEO, LSMASH_4CC( 'd', 'r', 'a', 'c' ) ); /* Dirac Video Coder */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_ENCV_VIDEO, LSMASH_4CC( 'e', 'n', 'c', 'v' ) ); /* Encrypted/protected video */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_HVC1_VIDEO, LSMASH_4CC( 'h', 'v', 'c', '1' ) ); /* High Efficiency Video Coding
* The default and mandatory value of array_completeness is 1 for arrays of
* all types of parameter sets, and 0 for all other arrays.
* This means any sample must not contain any paramerter set and filler data. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_HEV1_VIDEO, LSMASH_4CC( 'h', 'e', 'v', '1' ) ); /* High Efficiency Video Coding
* The default value of array_completeness is 0 for all arrays.
* It is allowed that sample contains parameter sets and filler data. */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MJP2_VIDEO, LSMASH_4CC( 'm', 'j', 'p', '2' ) ); /* Motion JPEG 2000 */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MP4V_VIDEO, LSMASH_4CC( 'm', 'p', '4', 'v' ) ); /* MPEG-4 Visual */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MVC1_VIDEO, LSMASH_4CC( 'm', 'v', 'c', '1' ) ); /* Multiview coding */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MVC2_VIDEO, LSMASH_4CC( 'm', 'v', 'c', '2' ) ); /* Multiview coding */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_S263_VIDEO, LSMASH_4CC( 's', '2', '6', '3' ) ); /* ITU H.263 video (3GPP format) */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SVC1_VIDEO, LSMASH_4CC( 's', 'v', 'c', '1' ) ); /* Scalable Video Coding */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_VC_1_VIDEO, LSMASH_4CC( 'v', 'c', '-', '1' ) ); /* SMPTE VC-1 */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_VP08_VIDEO, LSMASH_4CC( 'v', 'p', '0', '8' ) ); /* VP8 video */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_VP09_VIDEO, LSMASH_4CC( 'v', 'p', '0', '9' ) ); /* VP9 video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_2VUY_VIDEO, LSMASH_4CC( '2', 'v', 'u', 'y' ) ); /* Uncompressed Y'CbCr, 8-bit-per-component 4:2:2
* |Cb(8)|Y'0(8)|Cr(8)|Y'1(8)| */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_CFHD_VIDEO, LSMASH_4CC( 'C', 'F', 'H', 'D' ) ); /* CineForm High-Definition (HD) wavelet codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DV10_VIDEO, LSMASH_4CC( 'D', 'V', '1', '0' ) ); /* Digital Voodoo 10 bit Uncompressed 4:2:2 codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVOO_VIDEO, LSMASH_4CC( 'D', 'V', 'O', 'O' ) ); /* Digital Voodoo 8 bit Uncompressed 4:2:2 codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVOR_VIDEO, LSMASH_4CC( 'D', 'V', 'O', 'R' ) ); /* Digital Voodoo intermediate raw */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVTV_VIDEO, LSMASH_4CC( 'D', 'V', 'T', 'V' ) ); /* Digital Voodoo intermediate 2vuy */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVVT_VIDEO, LSMASH_4CC( 'D', 'V', 'V', 'T' ) ); /* Digital Voodoo intermediate v210 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_HD10_VIDEO, LSMASH_4CC( 'H', 'D', '1', '0' ) ); /* Digital Voodoo 10 bit Uncompressed 4:2:2 HD codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_M105_VIDEO, LSMASH_4CC( 'M', '1', '0', '5' ) ); /* Internal format of video data supported by Matrox hardware; pixel organization is proprietary*/
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_PNTG_VIDEO, LSMASH_4CC( 'P', 'N', 'T', 'G' ) ); /* Apple MacPaint image format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SVQ1_VIDEO, LSMASH_4CC( 'S', 'V', 'Q', '1' ) ); /* Sorenson Video 1 video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SVQ3_VIDEO, LSMASH_4CC( 'S', 'V', 'Q', '3' ) ); /* Sorenson Video 3 video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SHR0_VIDEO, LSMASH_4CC( 'S', 'h', 'r', '0' ) ); /* Generic SheerVideo codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SHR1_VIDEO, LSMASH_4CC( 'S', 'h', 'r', '1' ) ); /* SheerVideo RGB[A] 8b - at 8 bits/channel */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SHR2_VIDEO, LSMASH_4CC( 'S', 'h', 'r', '2' ) ); /* SheerVideo Y'CbCr[A] 8bv 4:4:4[:4] - at 8 bits/channel, in ITU-R BT.601-4 video range */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SHR3_VIDEO, LSMASH_4CC( 'S', 'h', 'r', '3' ) ); /* SheerVideo Y'CbCr 8bv 4:2:2 - 2:1 chroma subsampling, at 8 bits/channel, in ITU-R BT.601-4 video range */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_SHR4_VIDEO, LSMASH_4CC( 'S', 'h', 'r', '4' ) ); /* SheerVideo Y'CbCr 8bw 4:2:2 - 2:1 chroma subsampling, at 8 bits/channel, with full-range luma and wide-range two's-complement chroma */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_WRLE_VIDEO, LSMASH_4CC( 'W', 'R', 'L', 'E' ) ); /* Windows BMP image format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_APCH_VIDEO, LSMASH_4CC( 'a', 'p', 'c', 'h' ) ); /* Apple ProRes 422 High Quality */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_APCN_VIDEO, LSMASH_4CC( 'a', 'p', 'c', 'n' ) ); /* Apple ProRes 422 Standard Definition */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_APCS_VIDEO, LSMASH_4CC( 'a', 'p', 'c', 's' ) ); /* Apple ProRes 422 LT */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_APCO_VIDEO, LSMASH_4CC( 'a', 'p', 'c', 'o' ) ); /* Apple ProRes 422 Proxy */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_AP4H_VIDEO, LSMASH_4CC( 'a', 'p', '4', 'h' ) ); /* Apple ProRes 4444 */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_AP4X_VIDEO, LSMASH_4CC( 'a', 'p', '4', 'x' ) ); /* Apple ProRes 4444 XQ */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_CIVD_VIDEO, LSMASH_4CC( 'c', 'i', 'v', 'd' ) ); /* Cinepak Video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DRAC_VIDEO, LSMASH_4CC( 'd', 'r', 'a', 'c' ) ); /* Dirac Video Coder */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVC_VIDEO, LSMASH_4CC( 'd', 'v', 'c', ' ' ) ); /* DV NTSC format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVCP_VIDEO, LSMASH_4CC( 'd', 'v', 'c', 'p' ) ); /* DV PAL format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVPP_VIDEO, LSMASH_4CC( 'd', 'v', 'p', 'p' ) ); /* Panasonic DVCPro PAL format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DV5N_VIDEO, LSMASH_4CC( 'd', 'v', '5', 'n' ) ); /* Panasonic DVCPro-50 NTSC format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DV5P_VIDEO, LSMASH_4CC( 'd', 'v', '5', 'p' ) ); /* Panasonic DVCPro-50 PAL format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVH2_VIDEO, LSMASH_4CC( 'd', 'v', 'h', '2' ) ); /* Panasonic DVCPro-HD 1080p25 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVH3_VIDEO, LSMASH_4CC( 'd', 'v', 'h', '3' ) ); /* Panasonic DVCPro-HD 1080p30 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVH5_VIDEO, LSMASH_4CC( 'd', 'v', 'h', '5' ) ); /* Panasonic DVCPro-HD 1080i50 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVH6_VIDEO, LSMASH_4CC( 'd', 'v', 'h', '6' ) ); /* Panasonic DVCPro-HD 1080i60 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVHP_VIDEO, LSMASH_4CC( 'd', 'v', 'h', 'p' ) ); /* Panasonic DVCPro-HD 720p60 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_DVHQ_VIDEO, LSMASH_4CC( 'd', 'v', 'h', 'q' ) ); /* Panasonic DVCPro-HD 720p50 format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_FLIC_VIDEO, LSMASH_4CC( 'f', 'l', 'i', 'c' ) ); /* Autodesk FLIC animation format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_GIF_VIDEO, LSMASH_4CC( 'g', 'i', 'f', ' ' ) ); /* GIF image format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_H261_VIDEO, LSMASH_4CC( 'h', '2', '6', '1' ) ); /* ITU H.261 video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_H263_VIDEO, LSMASH_4CC( 'h', '2', '6', '3' ) ); /* ITU H.263 video */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_JPEG_VIDEO, LSMASH_4CC( 'j', 'p', 'e', 'g' ) ); /* JPEG image format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MJPA_VIDEO, LSMASH_4CC( 'm', 'j', 'p', 'a' ) ); /* Motion-JPEG (format A) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_MJPB_VIDEO, LSMASH_4CC( 'm', 'j', 'p', 'b' ) ); /* Motion-JPEG (format B) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_PNG_VIDEO, LSMASH_4CC( 'p', 'n', 'g', ' ' ) ); /* W3C Portable Network Graphics (PNG) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_RAW_VIDEO, LSMASH_4CC( 'r', 'a', 'w', ' ' ) ); /* Uncompressed RGB */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_RLE_VIDEO, LSMASH_4CC( 'r', 'l', 'e', ' ' ) ); /* Apple animation codec */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_RPZA_VIDEO, LSMASH_4CC( 'r', 'p', 'z', 'a' ) ); /* Apple simple video 'road pizza' compression */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_TGA_VIDEO, LSMASH_4CC( 't', 'g', 'a', ' ' ) ); /* Truvision Targa video format */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_TIFF_VIDEO, LSMASH_4CC( 't', 'i', 'f', 'f' ) ); /* Tagged Image File Format (Adobe) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULRA_VIDEO, LSMASH_4CC( 'U', 'L', 'R', 'A' ) ); /* Ut Video RGBA 4:4:4:4 8bit full-range */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULRG_VIDEO, LSMASH_4CC( 'U', 'L', 'R', 'G' ) ); /* Ut Video RGB 4:4:4 8bit full-range */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULY0_VIDEO, LSMASH_4CC( 'U', 'L', 'Y', '0' ) ); /* Ut Video YCbCr (BT.601) 4:2:0 8bit limited */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULY2_VIDEO, LSMASH_4CC( 'U', 'L', 'Y', '2' ) ); /* Ut Video YCbCr (BT.601) 4:2:2 8bit limited */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULH0_VIDEO, LSMASH_4CC( 'U', 'L', 'H', '0' ) ); /* Ut Video YCbCr (BT.709) 4:2:0 8bit limited */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_ULH2_VIDEO, LSMASH_4CC( 'U', 'L', 'H', '2' ) ); /* Ut Video YCbCr (BT.709) 4:2:2 8bit limited */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_UQY2_VIDEO, LSMASH_4CC( 'U', 'Q', 'Y', '2' ) ); /* Ut Video Pro YCbCr 4:2:2 10bit */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_V210_VIDEO, LSMASH_4CC( 'v', '2', '1', '0' ) ); /* Uncompressed Y'CbCr, 10-bit-per-component 4:2:2
* |Cb0(10)|Y'0(10)|Cr0(10)|XX(2)|
* |Y'1(10)|Cb1(10)|Y'2(10)|XX(2)|
* |Cr1(10)|Y'3(10)|Cb2(10)|XX(2)|
* |Y'4(10)|Cr2(10)|Y'5(10)|XX(2)| (X is a zero bit) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_V216_VIDEO, LSMASH_4CC( 'v', '2', '1', '6' ) ); /* Uncompressed Y'CbCr, 10, 12, 14, or 16-bit-per-component 4:2:2
* |Cb(16 LE)|Y'0(16 LE)|Cr(16 LE)|Y'1(16 LE)| */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_V308_VIDEO, LSMASH_4CC( 'v', '3', '0', '8' ) ); /* Uncompressed Y'CbCr, 8-bit-per-component 4:4:4
* |Cr(8)|Y'(8)|Cb(8)| */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_V408_VIDEO, LSMASH_4CC( 'v', '4', '0', '8' ) ); /* Uncompressed Y'CbCrA, 8-bit-per-component 4:4:4:4
* |Cb(8)|Y'(8)|Cr(8)|A(8)| */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_V410_VIDEO, LSMASH_4CC( 'v', '4', '1', '0' ) ); /* Uncompressed Y'CbCr, 10-bit-per-component 4:4:4
* |XX(2)|Cb(10)|Y'(10)|Cr(10)| (X is a zero bit) */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_YUV2_VIDEO, LSMASH_4CC( 'y', 'u', 'v', '2' ) ); /* Uncompressed Y'CbCr, 8-bit-per-component 4:2:2
* |Y'0(8)|Cb(8)|Y'1(8)|Cr(8)| */
/* Text CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_ENCT_TEXT, LSMASH_4CC( 'e', 'n', 'c', 't' ) ); /* Encrypted Text */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_STPP_TEXT, LSMASH_4CC( 's', 't', 'p', 'p' ) ); /* Sub-titles (Timed Text) */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_TX3G_TEXT, LSMASH_4CC( 't', 'x', '3', 'g' ) ); /* 3GPP Timed Text stream */
DEFINE_QTFF_CODEC_TYPE( QT_CODEC_TYPE_TEXT_TEXT, LSMASH_4CC( 't', 'e', 'x', 't' ) ); /* QuickTime Text Media */
/* Hint CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_FDP_HINT, LSMASH_4CC( 'f', 'd', 'p', ' ' ) ); /* File delivery hints */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_M2TS_HINT, LSMASH_4CC( 'm', '2', 't', 's' ) ); /* MPEG-2 transport stream for DMB */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_PM2T_HINT, LSMASH_4CC( 'p', 'm', '2', 't' ) ); /* Protected MPEG-2 Transport */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_PRTP_HINT, LSMASH_4CC( 'p', 'r', 't', 'p' ) ); /* Protected RTP Reception */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_RM2T_HINT, LSMASH_4CC( 'r', 'm', '2', 't' ) ); /* MPEG-2 Transport Reception */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_RRTP_HINT, LSMASH_4CC( 'r', 'r', 't', 'p' ) ); /* RTP reception */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_RSRP_HINT, LSMASH_4CC( 'r', 's', 'r', 'p' ) ); /* SRTP Reception */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_RTP_HINT, LSMASH_4CC( 'r', 't', 'p', ' ' ) ); /* RTP Hints */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SM2T_HINT, LSMASH_4CC( 's', 'm', '2', 't' ) ); /* MPEG-2 Transport Server */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SRTP_HINT, LSMASH_4CC( 's', 'r', 't', 'p' ) ); /* SRTP Hints */
/* Metadata CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_IXSE_META, LSMASH_4CC( 'i', 'x', 's', 'e' ) ); /* DVB Track Level Index Track */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_METT_META, LSMASH_4CC( 'm', 'e', 't', 't' ) ); /* Text timed metadata */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_METX_META, LSMASH_4CC( 'm', 'e', 't', 'x' ) ); /* XML timed metadata */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MLIX_META, LSMASH_4CC( 'm', 'l', 'i', 'x' ) ); /* DVB Movie level index track */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_OKSD_META, LSMASH_4CC( 'o', 'k', 's', 'd' ) ); /* OMA Keys */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_SVCM_META, LSMASH_4CC( 's', 'v', 'c', 'M' ) ); /* SVC metadata */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_TEXT_META, LSMASH_4CC( 't', 'e', 'x', 't' ) ); /* Textual meta-data with MIME type */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_URIM_META, LSMASH_4CC( 'u', 'r', 'i', 'm' ) ); /* URI identified timed metadata */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_XML_META, LSMASH_4CC( 'x', 'm', 'l', ' ' ) ); /* XML-formatted meta-data */
/* Other CODEC identifiers */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_ENCS_SYSTEM, LSMASH_4CC( 'e', 'n', 'c', 's' ) ); /* Encrypted Systems stream */
DEFINE_ISOM_CODEC_TYPE( ISOM_CODEC_TYPE_MP4S_SYSTEM, LSMASH_4CC( 'm', 'p', '4', 's' ) ); /* MPEG-4 Systems */
DEFINE_QTFF_CODEC_TYPE( LSMASH_CODEC_TYPE_RAW, LSMASH_4CC( 'r', 'a', 'w', ' ' ) ); /* Either video or audio */
/* Check if the identifier of two CODECs is identical or not.
*
* Return 1 if the both CODEC identifiers are identical.
* Return 0 otherwise. */
int lsmash_check_codec_type_identical
(
lsmash_codec_type_t a,
lsmash_codec_type_t b
);
/****************************************************************************
* Summary of Stream Configuration
* This is L-SMASH's original structure.
****************************************************************************/
typedef enum
{
LSMASH_SUMMARY_TYPE_UNKNOWN = 0,
LSMASH_SUMMARY_TYPE_VIDEO,
LSMASH_SUMMARY_TYPE_AUDIO,
LSMASH_SUMMARY_TYPE_HINT,
} lsmash_summary_type;
typedef enum
{
LSMASH_CODEC_SPECIFIC_DATA_TYPE_UNSPECIFIED = -1, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_UNSPECIFIED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_UNKNOWN = 0, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_UNSTRUCTURED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_MP4SYS_DECODER_CONFIG,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_H264,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_HEVC,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_VC_1,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_AV1,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_AC_3,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_EC_3,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_DTS,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_ALAC,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_SA3D,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_ST3D,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_PRHD,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_EQUI,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_CBMP,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_HEVC_DOVI,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_HEVC_LHEVC,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_SAMPLE_SCALE,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_VIDEO_H264_BITRATE,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_RTP_HINT_COMMON,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_COMMON, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_STRUCTURED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_AUDIO_COMMON, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_STRUCTURED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_AUDIO_FORMAT_SPECIFIC_FLAGS, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_STRUCTURED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_AUDIO_DECOMPRESSION_PARAMETERS, /* must be LSMASH_CODEC_SPECIFIC_FORMAT_UNSTRUCTURED */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_FIELD_INFO,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_PIXEL_FORMAT,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_SIGNIFICANT_BITS,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_GAMMA_LEVEL,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_CONTENT_LIGHT_LEVEL_INFO,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_VIDEO_MASTERING_DISPLAY_COLOR_VOLUME,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_QT_AUDIO_CHANNEL_LAYOUT,
LSMASH_CODEC_SPECIFIC_DATA_TYPE_CODEC_GLOBAL_HEADER,
/* Added at the end because of the backward compatibility. */
LSMASH_CODEC_SPECIFIC_DATA_TYPE_ISOM_AUDIO_OPUS,
} lsmash_codec_specific_data_type;
typedef enum
{
LSMASH_CODEC_SPECIFIC_FORMAT_UNSPECIFIED = -1,
LSMASH_CODEC_SPECIFIC_FORMAT_STRUCTURED = 0,
LSMASH_CODEC_SPECIFIC_FORMAT_UNSTRUCTURED = 1
} lsmash_codec_specific_format;
typedef union
{
void *always_null; /* LSMASH_CODEC_SPECIFIC_FORMAT_UNSPECIFIED */
void *structured; /* LSMASH_CODEC_SPECIFIC_FORMAT_STRUCTURED */
uint8_t *unstructured; /* LSMASH_CODEC_SPECIFIC_FORMAT_UNSTRUCTURED */
} lsmash_codec_specific_data_t;
typedef void (*lsmash_codec_specific_destructor_t)( void * );
typedef struct
{
lsmash_codec_specific_data_type type;
lsmash_codec_specific_format format;
lsmash_codec_specific_data_t data;
uint32_t size;
lsmash_codec_specific_destructor_t destruct;
} lsmash_codec_specific_t;
typedef struct lsmash_codec_specific_list_tag lsmash_codec_specific_list_t;
typedef enum
{
LSMASH_CODEC_SUPPORT_FLAG_NONE = 0,
LSMASH_CODEC_SUPPORT_FLAG_MUX = 1 << 0, /* It's expected that L-SMASH can mux CODEC stream properly.
* If not flagged, L-SMASH may recognize and/or handle CODEC specific info incorrectly when muxing. */
LSMASH_CODEC_SUPPORT_FLAG_DEMUX = 1 << 1, /* It's expected that L-SMASH can demux CODEC stream properly.
* If not flagged, L-SMASH may recognize and/or handle CODEC specific info incorrectly when demuxing. */
LSMASH_CODEC_SUPPORT_FLAG_REMUX = LSMASH_CODEC_SUPPORT_FLAG_MUX | LSMASH_CODEC_SUPPORT_FLAG_DEMUX,