@svta/cml-iso-bmff 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +300 -183
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +165 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,14 @@ type AudioRenderingIndicationBox = FullBox & {
|
|
|
37
37
|
audioRenderingIndication: number;
|
|
38
38
|
};
|
|
39
39
|
//#endregion
|
|
40
|
+
//#region src/IsoBoxType.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Iso Box Type
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
type IsoBoxType = `${string}${string}${string}${string}`;
|
|
47
|
+
//#endregion
|
|
40
48
|
//#region src/boxes/AudioSampleEntryType.d.ts
|
|
41
49
|
/**
|
|
42
50
|
* The type of audio sample entry box.
|
|
@@ -68,7 +76,7 @@ type AudioSampleEntryBoxChild = any;
|
|
|
68
76
|
*
|
|
69
77
|
* @public
|
|
70
78
|
*/
|
|
71
|
-
type AudioSampleEntryBox<T$1 extends
|
|
79
|
+
type AudioSampleEntryBox<T$1 extends IsoBoxType = AudioSampleEntryType> = SampleEntryBox & {
|
|
72
80
|
type: T$1;
|
|
73
81
|
reserved2: number[];
|
|
74
82
|
channelcount: number;
|
|
@@ -79,6 +87,16 @@ type AudioSampleEntryBox<T$1 extends AudioSampleEntryType = AudioSampleEntryType
|
|
|
79
87
|
boxes: AudioSampleEntryBoxChild[];
|
|
80
88
|
};
|
|
81
89
|
//#endregion
|
|
90
|
+
//#region src/boxes/Box.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Base Box Type
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
type Box<T$1 extends IsoBoxType = never> = {
|
|
97
|
+
type: T$1;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
82
100
|
//#region src/boxes/ChunkLargeOffsetBox.d.ts
|
|
83
101
|
/**
|
|
84
102
|
* Chunk Large Offset Box - 'co64'
|
|
@@ -288,6 +306,39 @@ type EditBox = {
|
|
|
288
306
|
boxes: EditBoxChild[];
|
|
289
307
|
};
|
|
290
308
|
//#endregion
|
|
309
|
+
//#region src/boxes/SubsampleEncryption.d.ts
|
|
310
|
+
/**
|
|
311
|
+
* Subsample Encryption
|
|
312
|
+
*
|
|
313
|
+
* @public
|
|
314
|
+
*/
|
|
315
|
+
type SubsampleEncryption = {
|
|
316
|
+
bytesOfClearData: number;
|
|
317
|
+
bytesOfProtectedData: number;
|
|
318
|
+
};
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/boxes/EncryptedSample.d.ts
|
|
321
|
+
/**
|
|
322
|
+
* Encrypted Sample
|
|
323
|
+
*
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
type EncryptedSample = {
|
|
327
|
+
initializationVector?: Uint8Array;
|
|
328
|
+
subsampleEncryption?: SubsampleEncryption[];
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/boxes/Entity.d.ts
|
|
332
|
+
/**
|
|
333
|
+
* Entity
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
type Entity = {
|
|
338
|
+
/** Entity ID */
|
|
339
|
+
entityId: number;
|
|
340
|
+
};
|
|
341
|
+
//#endregion
|
|
291
342
|
//#region src/boxes/EventMessageBox.d.ts
|
|
292
343
|
/**
|
|
293
344
|
* ISO/IEC 23009-1:2014 - 5.10.3.3 Event Message Box
|
|
@@ -417,6 +468,18 @@ type IpmpInfoBox = FullBox & {
|
|
|
417
468
|
ipmpDescr: any[];
|
|
418
469
|
};
|
|
419
470
|
//#endregion
|
|
471
|
+
//#region src/boxes/ItemExtent.d.ts
|
|
472
|
+
/**
|
|
473
|
+
* Item Extent
|
|
474
|
+
*
|
|
475
|
+
* @public
|
|
476
|
+
*/
|
|
477
|
+
type ItemExtent = {
|
|
478
|
+
extentIndex?: number;
|
|
479
|
+
extentOffset: number;
|
|
480
|
+
extentLength: number;
|
|
481
|
+
};
|
|
482
|
+
//#endregion
|
|
420
483
|
//#region src/boxes/ItemInfoEntry.d.ts
|
|
421
484
|
/**
|
|
422
485
|
* Item Info Entry - 'infe'
|
|
@@ -451,18 +514,6 @@ type ItemInfoBox = {
|
|
|
451
514
|
entryCount: number;
|
|
452
515
|
};
|
|
453
516
|
//#endregion
|
|
454
|
-
//#region src/boxes/ItemExtent.d.ts
|
|
455
|
-
/**
|
|
456
|
-
* Item Extent
|
|
457
|
-
*
|
|
458
|
-
* @public
|
|
459
|
-
*/
|
|
460
|
-
type ItemExtent = {
|
|
461
|
-
extentIndex?: number;
|
|
462
|
-
extentOffset: number;
|
|
463
|
-
extentLength: number;
|
|
464
|
-
};
|
|
465
|
-
//#endregion
|
|
466
517
|
//#region src/boxes/ItemLocation.d.ts
|
|
467
518
|
/**
|
|
468
519
|
* Item Location
|
|
@@ -688,7 +739,7 @@ type VisualSampleEntryBoxChild = any;
|
|
|
688
739
|
*
|
|
689
740
|
* @public
|
|
690
741
|
*/
|
|
691
|
-
type VisualSampleEntryBox<T$1 extends
|
|
742
|
+
type VisualSampleEntryBox<T$1 extends IsoBoxType = VisualSampleEntryType> = SampleEntryBox & {
|
|
692
743
|
type: T$1;
|
|
693
744
|
preDefined1: number;
|
|
694
745
|
reserved2: number;
|
|
@@ -1168,28 +1219,6 @@ type SampleAuxiliaryInformationSizesBox = FullBox & {
|
|
|
1168
1219
|
sampleInfoSize?: number[];
|
|
1169
1220
|
};
|
|
1170
1221
|
//#endregion
|
|
1171
|
-
//#region src/boxes/SubsampleEncryption.d.ts
|
|
1172
|
-
/**
|
|
1173
|
-
* Subsample Encryption
|
|
1174
|
-
*
|
|
1175
|
-
* @public
|
|
1176
|
-
*/
|
|
1177
|
-
type SubsampleEncryption = {
|
|
1178
|
-
bytesOfClearData: number;
|
|
1179
|
-
bytesOfProtectedData: number;
|
|
1180
|
-
};
|
|
1181
|
-
//#endregion
|
|
1182
|
-
//#region src/boxes/EncryptedSample.d.ts
|
|
1183
|
-
/**
|
|
1184
|
-
* Encrypted Sample
|
|
1185
|
-
*
|
|
1186
|
-
* @public
|
|
1187
|
-
*/
|
|
1188
|
-
type EncryptedSample = {
|
|
1189
|
-
initializationVector?: Uint8Array;
|
|
1190
|
-
subsampleEncryption?: SubsampleEncryption[];
|
|
1191
|
-
};
|
|
1192
|
-
//#endregion
|
|
1193
1222
|
//#region src/boxes/SampleEncryptionBox.d.ts
|
|
1194
1223
|
/**
|
|
1195
1224
|
* Sample Encryption Box - 'senc'
|
|
@@ -1389,17 +1418,6 @@ type MovieFragmentRandomAccessBox = {
|
|
|
1389
1418
|
boxes: MovieFragmentRandomAccessBoxChild[];
|
|
1390
1419
|
};
|
|
1391
1420
|
//#endregion
|
|
1392
|
-
//#region src/boxes/Entity.d.ts
|
|
1393
|
-
/**
|
|
1394
|
-
* Entity
|
|
1395
|
-
*
|
|
1396
|
-
* @public
|
|
1397
|
-
*/
|
|
1398
|
-
type Entity = {
|
|
1399
|
-
/** Entity ID */
|
|
1400
|
-
entityId: number;
|
|
1401
|
-
};
|
|
1402
|
-
//#endregion
|
|
1403
1421
|
//#region src/boxes/PreselectionGroupBox.d.ts
|
|
1404
1422
|
/**
|
|
1405
1423
|
* Child boxes of Preselection Group Box
|
|
@@ -1641,6 +1659,54 @@ type WebVttSourceLabelBox = {
|
|
|
1641
1659
|
sourceLabel: string;
|
|
1642
1660
|
};
|
|
1643
1661
|
//#endregion
|
|
1662
|
+
//#region src/fields/DATA.d.ts
|
|
1663
|
+
/**
|
|
1664
|
+
* The data field type
|
|
1665
|
+
*
|
|
1666
|
+
* @public
|
|
1667
|
+
*/
|
|
1668
|
+
declare const DATA = "data";
|
|
1669
|
+
//#endregion
|
|
1670
|
+
//#region src/fields/INT.d.ts
|
|
1671
|
+
/**
|
|
1672
|
+
* The integer field type
|
|
1673
|
+
*
|
|
1674
|
+
* @public
|
|
1675
|
+
*/
|
|
1676
|
+
declare const INT = "int";
|
|
1677
|
+
//#endregion
|
|
1678
|
+
//#region src/fields/STRING.d.ts
|
|
1679
|
+
/**
|
|
1680
|
+
* The string field type
|
|
1681
|
+
*
|
|
1682
|
+
* @public
|
|
1683
|
+
*/
|
|
1684
|
+
declare const STRING = "string";
|
|
1685
|
+
//#endregion
|
|
1686
|
+
//#region src/fields/TEMPLATE.d.ts
|
|
1687
|
+
/**
|
|
1688
|
+
* The template field type
|
|
1689
|
+
*
|
|
1690
|
+
* @public
|
|
1691
|
+
*/
|
|
1692
|
+
declare const TEMPLATE = "template";
|
|
1693
|
+
//#endregion
|
|
1694
|
+
//#region src/fields/UINT.d.ts
|
|
1695
|
+
/**
|
|
1696
|
+
* The unsigned integer field type
|
|
1697
|
+
*
|
|
1698
|
+
* @public
|
|
1699
|
+
*/
|
|
1700
|
+
declare const UINT = "uint";
|
|
1701
|
+
//#endregion
|
|
1702
|
+
//#region src/fields/UTF8.d.ts
|
|
1703
|
+
/**
|
|
1704
|
+
* The UTF8 field type
|
|
1705
|
+
*
|
|
1706
|
+
* @public
|
|
1707
|
+
*/
|
|
1708
|
+
declare const UTF8 = "utf8";
|
|
1709
|
+
//#endregion
|
|
1644
1710
|
//#region src/IsoBoxMap.d.ts
|
|
1645
1711
|
/**
|
|
1646
1712
|
* Comprehensive mapping from box type strings to their corresponding TypeScript interfaces
|
|
@@ -1758,21 +1824,49 @@ type IsoBoxMap = {
|
|
|
1758
1824
|
*/
|
|
1759
1825
|
type IsoBox = IsoBoxMap[keyof IsoBoxMap];
|
|
1760
1826
|
//#endregion
|
|
1761
|
-
//#region src/
|
|
1827
|
+
//#region src/IsoBoxContainerMap.d.ts
|
|
1762
1828
|
/**
|
|
1763
|
-
*
|
|
1829
|
+
* Map of container box types to their allowed child box types
|
|
1764
1830
|
*
|
|
1765
1831
|
* @public
|
|
1766
1832
|
*/
|
|
1767
|
-
type
|
|
1833
|
+
type IsoBoxContainerMap = {
|
|
1834
|
+
dinf: DataInformationBox;
|
|
1835
|
+
edts: EditBox;
|
|
1836
|
+
grpl: GroupsListBox;
|
|
1837
|
+
mdia: MediaBox;
|
|
1838
|
+
meco: AdditionalMetadataContainerBox;
|
|
1839
|
+
mfra: MovieFragmentRandomAccessBox;
|
|
1840
|
+
minf: MediaInformationBox;
|
|
1841
|
+
moof: MovieFragmentBox;
|
|
1842
|
+
moov: MovieBox;
|
|
1843
|
+
mvex: MovieExtendsBox;
|
|
1844
|
+
schi: SchemeInformationBox;
|
|
1845
|
+
sinf: ProtectionSchemeInformationBox;
|
|
1846
|
+
stbl: SampleTableBox;
|
|
1847
|
+
strk: SubTrackBox;
|
|
1848
|
+
traf: TrackFragmentBox;
|
|
1849
|
+
trak: TrackBox;
|
|
1850
|
+
tref: TrackReferenceBox;
|
|
1851
|
+
udta: UserDataBox;
|
|
1852
|
+
vttc: WebVttCueBox;
|
|
1853
|
+
};
|
|
1768
1854
|
//#endregion
|
|
1769
|
-
//#region src/
|
|
1855
|
+
//#region src/IsoBoxContainer.d.ts
|
|
1770
1856
|
/**
|
|
1771
|
-
*
|
|
1857
|
+
* Iso Box Container Type
|
|
1858
|
+
*
|
|
1859
|
+
* @public
|
|
1860
|
+
*/
|
|
1861
|
+
type IsoBoxContainer = IsoBoxContainerMap[keyof IsoBoxContainerMap];
|
|
1862
|
+
//#endregion
|
|
1863
|
+
//#region src/IsoBoxData.d.ts
|
|
1864
|
+
/**
|
|
1865
|
+
* ISO data
|
|
1772
1866
|
*
|
|
1773
1867
|
* @public
|
|
1774
1868
|
*/
|
|
1775
|
-
type
|
|
1869
|
+
type IsoBoxData = ArrayBuffer | ArrayBufferView<ArrayBuffer>;
|
|
1776
1870
|
//#endregion
|
|
1777
1871
|
//#region src/IsoBoxReaderMap.d.ts
|
|
1778
1872
|
/**
|
|
@@ -1780,7 +1874,7 @@ type IsoBoxReader<B$1 extends IsoBox> = (view: IsoBoxReadView) => B$1;
|
|
|
1780
1874
|
*
|
|
1781
1875
|
* @public
|
|
1782
1876
|
*/
|
|
1783
|
-
type IsoBoxReaderMap =
|
|
1877
|
+
type IsoBoxReaderMap = Record<string, IsoBoxReader>;
|
|
1784
1878
|
//#endregion
|
|
1785
1879
|
//#region src/IsoBoxReadViewConfig.d.ts
|
|
1786
1880
|
/**
|
|
@@ -1788,11 +1882,11 @@ type IsoBoxReaderMap = Partial<{ [P in IsoBox["type"]]: IsoBoxReader<Extract<Iso
|
|
|
1788
1882
|
*
|
|
1789
1883
|
* @public
|
|
1790
1884
|
*/
|
|
1791
|
-
type IsoBoxReadViewConfig
|
|
1885
|
+
type IsoBoxReadViewConfig = {
|
|
1792
1886
|
/**
|
|
1793
1887
|
* A map of box parsers to their box types
|
|
1794
1888
|
*/
|
|
1795
|
-
readers?:
|
|
1889
|
+
readers?: IsoBoxReaderMap;
|
|
1796
1890
|
};
|
|
1797
1891
|
//#endregion
|
|
1798
1892
|
//#region src/IsoFieldTypeMap.d.ts
|
|
@@ -1811,21 +1905,26 @@ type IsoFieldTypeMap = {
|
|
|
1811
1905
|
utf8string: string;
|
|
1812
1906
|
};
|
|
1813
1907
|
//#endregion
|
|
1814
|
-
//#region src/
|
|
1908
|
+
//#region src/ParsedBox.d.ts
|
|
1815
1909
|
/**
|
|
1816
|
-
*
|
|
1910
|
+
* A Parsed Box Type
|
|
1817
1911
|
*
|
|
1818
1912
|
* @public
|
|
1819
1913
|
*/
|
|
1820
|
-
type
|
|
1914
|
+
type ParsedBox<T$1 = Box> = (T$1 extends IsoBox ? T$1 & Omit<Box, "type"> : T$1) & {
|
|
1915
|
+
view: IsoBoxReadView;
|
|
1916
|
+
size: number;
|
|
1917
|
+
largesize?: number;
|
|
1918
|
+
usertype?: number[];
|
|
1919
|
+
};
|
|
1821
1920
|
//#endregion
|
|
1822
|
-
//#region src/
|
|
1921
|
+
//#region src/ParsedIsoBox.d.ts
|
|
1823
1922
|
/**
|
|
1824
1923
|
* Parsed Box Type
|
|
1825
1924
|
*
|
|
1826
1925
|
* @public
|
|
1827
1926
|
*/
|
|
1828
|
-
type
|
|
1927
|
+
type ParsedIsoBox = ParsedBox<IsoBox | Box>;
|
|
1829
1928
|
//#endregion
|
|
1830
1929
|
//#region src/IsoBoxReadView.d.ts
|
|
1831
1930
|
/**
|
|
@@ -1834,7 +1933,7 @@ type ParsedBox = IsoParsedBox | Box;
|
|
|
1834
1933
|
*
|
|
1835
1934
|
* @public
|
|
1836
1935
|
*/
|
|
1837
|
-
declare class IsoBoxReadView
|
|
1936
|
+
declare class IsoBoxReadView {
|
|
1838
1937
|
private dataView;
|
|
1839
1938
|
private offset;
|
|
1840
1939
|
private config;
|
|
@@ -1847,7 +1946,7 @@ declare class IsoBoxReadView<R extends IsoBoxReaderMap = IsoBoxReaderMap> {
|
|
|
1847
1946
|
* @param raw - The raw data to view.
|
|
1848
1947
|
* @param config - The configuration for the IsoView.
|
|
1849
1948
|
*/
|
|
1850
|
-
constructor(raw: IsoBoxData, config?: IsoBoxReadViewConfig
|
|
1949
|
+
constructor(raw: IsoBoxData, config?: IsoBoxReadViewConfig);
|
|
1851
1950
|
/**
|
|
1852
1951
|
* The buffer of the data view.
|
|
1853
1952
|
*/
|
|
@@ -1878,7 +1977,7 @@ declare class IsoBoxReadView<R extends IsoBoxReaderMap = IsoBoxReaderMap> {
|
|
|
1878
1977
|
* @param size - The size of the slice.
|
|
1879
1978
|
* @returns A new IsoView instance.
|
|
1880
1979
|
*/
|
|
1881
|
-
slice: (offset: number, size: number) => IsoBoxReadView
|
|
1980
|
+
slice: (offset: number, size: number) => IsoBoxReadView;
|
|
1882
1981
|
private read;
|
|
1883
1982
|
/**
|
|
1884
1983
|
* Reads a unsigned integer from the data view.
|
|
@@ -1948,7 +2047,7 @@ declare class IsoBoxReadView<R extends IsoBoxReaderMap = IsoBoxReaderMap> {
|
|
|
1948
2047
|
*
|
|
1949
2048
|
* @returns The box.
|
|
1950
2049
|
*/
|
|
1951
|
-
readBox: () =>
|
|
2050
|
+
readBox: () => ParsedBox;
|
|
1952
2051
|
/**
|
|
1953
2052
|
* Reads a number of boxes from the data view.
|
|
1954
2053
|
*
|
|
@@ -1969,126 +2068,28 @@ declare class IsoBoxReadView<R extends IsoBoxReaderMap = IsoBoxReaderMap> {
|
|
|
1969
2068
|
*
|
|
1970
2069
|
* @returns A generator of boxes.
|
|
1971
2070
|
*/
|
|
1972
|
-
[Symbol.iterator](): Generator<
|
|
2071
|
+
[Symbol.iterator](): Generator<ParsedIsoBox>;
|
|
1973
2072
|
}
|
|
1974
2073
|
//#endregion
|
|
1975
|
-
//#region src/
|
|
1976
|
-
/**
|
|
1977
|
-
* Base Box Type
|
|
1978
|
-
*
|
|
1979
|
-
* @public
|
|
1980
|
-
*/
|
|
1981
|
-
type Box = {
|
|
1982
|
-
type: "";
|
|
1983
|
-
size: number;
|
|
1984
|
-
view: IsoBoxReadView;
|
|
1985
|
-
largesize?: number;
|
|
1986
|
-
usertype?: number[];
|
|
1987
|
-
};
|
|
1988
|
-
//#endregion
|
|
1989
|
-
//#region src/fields/DATA.d.ts
|
|
1990
|
-
/**
|
|
1991
|
-
* The data field type
|
|
1992
|
-
*
|
|
1993
|
-
* @public
|
|
1994
|
-
*/
|
|
1995
|
-
declare const DATA = "data";
|
|
1996
|
-
//#endregion
|
|
1997
|
-
//#region src/fields/INT.d.ts
|
|
1998
|
-
/**
|
|
1999
|
-
* The integer field type
|
|
2000
|
-
*
|
|
2001
|
-
* @public
|
|
2002
|
-
*/
|
|
2003
|
-
declare const INT = "int";
|
|
2004
|
-
//#endregion
|
|
2005
|
-
//#region src/fields/STRING.d.ts
|
|
2006
|
-
/**
|
|
2007
|
-
* The string field type
|
|
2008
|
-
*
|
|
2009
|
-
* @public
|
|
2010
|
-
*/
|
|
2011
|
-
declare const STRING = "string";
|
|
2012
|
-
//#endregion
|
|
2013
|
-
//#region src/fields/TEMPLATE.d.ts
|
|
2014
|
-
/**
|
|
2015
|
-
* The template field type
|
|
2016
|
-
*
|
|
2017
|
-
* @public
|
|
2018
|
-
*/
|
|
2019
|
-
declare const TEMPLATE = "template";
|
|
2020
|
-
//#endregion
|
|
2021
|
-
//#region src/fields/UINT.d.ts
|
|
2022
|
-
/**
|
|
2023
|
-
* The unsigned integer field type
|
|
2024
|
-
*
|
|
2025
|
-
* @public
|
|
2026
|
-
*/
|
|
2027
|
-
declare const UINT = "uint";
|
|
2028
|
-
//#endregion
|
|
2029
|
-
//#region src/fields/UTF8.d.ts
|
|
2030
|
-
/**
|
|
2031
|
-
* The UTF8 field type
|
|
2032
|
-
*
|
|
2033
|
-
* @public
|
|
2034
|
-
*/
|
|
2035
|
-
declare const UTF8 = "utf8";
|
|
2036
|
-
//#endregion
|
|
2037
|
-
//#region src/IsoBoxContainerMap.d.ts
|
|
2038
|
-
/**
|
|
2039
|
-
* Map of container box types to their allowed child box types
|
|
2040
|
-
*
|
|
2041
|
-
* @public
|
|
2042
|
-
*/
|
|
2043
|
-
type IsoBoxContainerMap = {
|
|
2044
|
-
dinf: DataInformationBox;
|
|
2045
|
-
edts: EditBox;
|
|
2046
|
-
grpl: GroupsListBox;
|
|
2047
|
-
mdia: MediaBox;
|
|
2048
|
-
meco: AdditionalMetadataContainerBox;
|
|
2049
|
-
mfra: MovieFragmentRandomAccessBox;
|
|
2050
|
-
minf: MediaInformationBox;
|
|
2051
|
-
moof: MovieFragmentBox;
|
|
2052
|
-
moov: MovieBox;
|
|
2053
|
-
mvex: MovieExtendsBox;
|
|
2054
|
-
schi: SchemeInformationBox;
|
|
2055
|
-
sinf: ProtectionSchemeInformationBox;
|
|
2056
|
-
stbl: SampleTableBox;
|
|
2057
|
-
strk: SubTrackBox;
|
|
2058
|
-
traf: TrackFragmentBox;
|
|
2059
|
-
trak: TrackBox;
|
|
2060
|
-
tref: TrackReferenceBox;
|
|
2061
|
-
udta: UserDataBox;
|
|
2062
|
-
vttc: WebVttCueBox;
|
|
2063
|
-
};
|
|
2064
|
-
//#endregion
|
|
2065
|
-
//#region src/IsoBoxContainer.d.ts
|
|
2074
|
+
//#region src/IsoBoxReader.d.ts
|
|
2066
2075
|
/**
|
|
2067
|
-
*
|
|
2076
|
+
* ISO BMFF box reader
|
|
2068
2077
|
*
|
|
2069
2078
|
* @public
|
|
2070
2079
|
*/
|
|
2071
|
-
type
|
|
2080
|
+
type IsoBoxReader<B = unknown> = (view: IsoBoxReadView) => B;
|
|
2072
2081
|
//#endregion
|
|
2073
2082
|
//#region src/IsoBoxReaderReturn.d.ts
|
|
2074
2083
|
/**
|
|
2075
|
-
* Return type for
|
|
2084
|
+
* Return type for the ISO box reader.
|
|
2076
2085
|
*
|
|
2077
|
-
*
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
/**
|
|
2081
|
-
* Return type for a container reader
|
|
2082
|
-
*
|
|
2083
|
-
* @public
|
|
2084
|
-
*/
|
|
2085
|
-
type ContainerReturn = IsoParsedBox<IsoBoxContainer>;
|
|
2086
|
-
/**
|
|
2087
|
-
* Return type for the ISO box reader
|
|
2086
|
+
* Creates a discriminated union of all box types returned by the readers,
|
|
2087
|
+
* plus ParsedBox for unknown/container boxes. This enables type narrowing
|
|
2088
|
+
* via `box.type === 'xxxx'`.
|
|
2088
2089
|
*
|
|
2089
2090
|
* @public
|
|
2090
2091
|
*/
|
|
2091
|
-
type IsoBoxReaderReturn<T$1
|
|
2092
|
+
type IsoBoxReaderReturn<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: never[]) => infer R) ? ParsedBox<R> : never }[keyof T$1] | ParsedIsoBox;
|
|
2092
2093
|
//#endregion
|
|
2093
2094
|
//#region src/IsoBoxStreamable.d.ts
|
|
2094
2095
|
/**
|
|
@@ -2096,7 +2097,7 @@ type IsoBoxReaderReturn<T$1 extends IsoBoxReaderMap> = BoxReturn<T$1> | Containe
|
|
|
2096
2097
|
*
|
|
2097
2098
|
* @public
|
|
2098
2099
|
*/
|
|
2099
|
-
type IsoBoxStreamable = IsoBox |
|
|
2100
|
+
type IsoBoxStreamable = IsoBox | ParsedIsoBox | ArrayBufferView;
|
|
2100
2101
|
//#endregion
|
|
2101
2102
|
//#region src/IsoBoxWriterMap.d.ts
|
|
2102
2103
|
/**
|
|
@@ -2125,7 +2126,7 @@ type IsoBoxWriteViewConfig = {
|
|
|
2125
2126
|
*
|
|
2126
2127
|
* @public
|
|
2127
2128
|
*/
|
|
2128
|
-
type IsoBoxWriter<B
|
|
2129
|
+
type IsoBoxWriter<B> = (box: B, config: IsoBoxWriteViewConfig) => ArrayBufferView;
|
|
2129
2130
|
//#endregion
|
|
2130
2131
|
//#region src/IsoBoxWriteView.d.ts
|
|
2131
2132
|
/**
|
|
@@ -2236,7 +2237,28 @@ declare class IsoBoxWriteView {
|
|
|
2236
2237
|
*
|
|
2237
2238
|
* @public
|
|
2238
2239
|
*/
|
|
2239
|
-
type IsoTypedParsedBox<T$1 extends keyof IsoBoxMap> = IsoBoxMap[T$1]
|
|
2240
|
+
type IsoTypedParsedBox<T$1 extends keyof IsoBoxMap> = ParsedBox<IsoBoxMap[T$1]>;
|
|
2241
|
+
//#endregion
|
|
2242
|
+
//#region src/TraverseIsoBoxesConfig.d.ts
|
|
2243
|
+
/**
|
|
2244
|
+
* Configuration options for traversing ISO boxes.
|
|
2245
|
+
*
|
|
2246
|
+
* @public
|
|
2247
|
+
*/
|
|
2248
|
+
type TraverseIsoBoxesConfig = {
|
|
2249
|
+
/**
|
|
2250
|
+
* Whether to traverse the boxes depth-first or breadth-first.
|
|
2251
|
+
*
|
|
2252
|
+
* @defaultValue true
|
|
2253
|
+
*/
|
|
2254
|
+
depthFirst?: boolean;
|
|
2255
|
+
/**
|
|
2256
|
+
* The maximum depth to traverse. A value of 0 will only traverse the root boxes.
|
|
2257
|
+
*
|
|
2258
|
+
* @defaultValue Infinity
|
|
2259
|
+
*/
|
|
2260
|
+
maxDepth?: number;
|
|
2261
|
+
};
|
|
2240
2262
|
//#endregion
|
|
2241
2263
|
//#region src/createIsoBoxReadableStream.d.ts
|
|
2242
2264
|
/**
|
|
@@ -2254,6 +2276,46 @@ type IsoTypedParsedBox<T$1 extends keyof IsoBoxMap> = IsoBoxMap[T$1] & Omit<Box,
|
|
|
2254
2276
|
*/
|
|
2255
2277
|
declare function createIsoBoxReadableStream(boxes: Iterable<IsoBoxStreamable>, config?: IsoBoxWriteViewConfig): ReadableStream<Uint8Array>;
|
|
2256
2278
|
//#endregion
|
|
2279
|
+
//#region src/filterIsoBoxes.d.ts
|
|
2280
|
+
/**
|
|
2281
|
+
* Filters boxes in the tree that satisfy the provided testing function.
|
|
2282
|
+
*
|
|
2283
|
+
* This function traverses the entire box structure (including nested boxes)
|
|
2284
|
+
* and returns all boxes for which the callback returns true.
|
|
2285
|
+
*
|
|
2286
|
+
* @param boxes - The boxes to search through
|
|
2287
|
+
* @param callback - A function that accepts a box and returns true if it matches
|
|
2288
|
+
* @param config - Configuration options for traversal
|
|
2289
|
+
*
|
|
2290
|
+
* @returns An array of boxes that satisfy the callback
|
|
2291
|
+
*
|
|
2292
|
+
* @example
|
|
2293
|
+
* {@includeCode ../test/filterIsoBoxes.test.ts#example}
|
|
2294
|
+
*
|
|
2295
|
+
* @public
|
|
2296
|
+
*/
|
|
2297
|
+
declare function filterIsoBoxes<T$1 extends ParsedIsoBox>(boxes: Iterable<T$1>, callback: (box: T$1) => boolean, config?: TraverseIsoBoxesConfig): T$1[];
|
|
2298
|
+
//#endregion
|
|
2299
|
+
//#region src/findIsoBox.d.ts
|
|
2300
|
+
/**
|
|
2301
|
+
* Finds the first box in the tree that satisfies the provided testing function.
|
|
2302
|
+
*
|
|
2303
|
+
* This function traverses the entire box structure (including nested boxes)
|
|
2304
|
+
* and returns the first box for which the callback returns true.
|
|
2305
|
+
*
|
|
2306
|
+
* @param boxes - The boxes to search through
|
|
2307
|
+
* @param callback - A function that accepts a box and returns true if it matches
|
|
2308
|
+
* @param config - Configuration options for traversal
|
|
2309
|
+
*
|
|
2310
|
+
* @returns The first box that satisfies the callback, or null if none is found
|
|
2311
|
+
*
|
|
2312
|
+
* @example
|
|
2313
|
+
* {@includeCode ../test/findIsoBox.test.ts#example}
|
|
2314
|
+
*
|
|
2315
|
+
* @public
|
|
2316
|
+
*/
|
|
2317
|
+
declare function findIsoBox<T$1 extends ParsedIsoBox>(boxes: Iterable<T$1>, callback: (box: T$1) => boolean, config?: TraverseIsoBoxesConfig): T$1 | null;
|
|
2318
|
+
//#endregion
|
|
2257
2319
|
//#region src/IsoBoxReadableStream.d.ts
|
|
2258
2320
|
/**
|
|
2259
2321
|
* A readable stream of ISO BMFF boxes as Uint8Arrays.
|
|
@@ -2284,15 +2346,20 @@ declare class IsoBoxReadableStream extends ReadableStream<Uint8Array> {
|
|
|
2284
2346
|
*
|
|
2285
2347
|
* @public
|
|
2286
2348
|
*/
|
|
2287
|
-
declare function readIsoBoxes<R extends IsoBoxReaderMap>(raw: IsoBoxData, config
|
|
2349
|
+
declare function readIsoBoxes<const R$1 extends IsoBoxReaderMap>(raw: IsoBoxData, config: IsoBoxReadViewConfig & {
|
|
2350
|
+
readers: R$1;
|
|
2351
|
+
}): IsoBoxReaderReturn<R$1>[];
|
|
2352
|
+
/**
|
|
2353
|
+
* @public
|
|
2354
|
+
*/
|
|
2355
|
+
declare function readIsoBoxes(raw: IsoBoxData, config?: IsoBoxReadViewConfig): ParsedIsoBox[];
|
|
2288
2356
|
//#endregion
|
|
2289
2357
|
//#region src/traverseIsoBoxes.d.ts
|
|
2290
2358
|
/**
|
|
2291
2359
|
* Traverse ISO boxes
|
|
2292
2360
|
*
|
|
2293
2361
|
* @param boxes - The boxes to traverse
|
|
2294
|
-
* @param
|
|
2295
|
-
* @param maxDepth - The maximum depth to traverse. A value of 0 will only traverse the root boxes.
|
|
2362
|
+
* @param config - Configuration options for traversal
|
|
2296
2363
|
*
|
|
2297
2364
|
* @returns A generator of boxes
|
|
2298
2365
|
*
|
|
@@ -2301,7 +2368,7 @@ declare function readIsoBoxes<R extends IsoBoxReaderMap>(raw: IsoBoxData, config
|
|
|
2301
2368
|
*
|
|
2302
2369
|
* @public
|
|
2303
2370
|
*/
|
|
2304
|
-
declare function traverseIsoBoxes(boxes: Iterable<
|
|
2371
|
+
declare function traverseIsoBoxes(boxes: Iterable<ParsedIsoBox>, config?: TraverseIsoBoxesConfig): Generator<ParsedIsoBox>;
|
|
2305
2372
|
//#endregion
|
|
2306
2373
|
//#region src/writeIsoBox.d.ts
|
|
2307
2374
|
/**
|
|
@@ -2332,6 +2399,56 @@ declare function writeIsoBox(box: IsoBoxStreamable, config?: IsoBoxWriteViewConf
|
|
|
2332
2399
|
*/
|
|
2333
2400
|
declare function writeIsoBoxes(boxes: Iterable<IsoBoxStreamable>, config?: IsoBoxWriteViewConfig): Uint8Array[];
|
|
2334
2401
|
//#endregion
|
|
2402
|
+
//#region src/readers/createAudioSampleEntryReader.d.ts
|
|
2403
|
+
/**
|
|
2404
|
+
* Creates a reader function for AudioSampleEntryBox with a custom type.
|
|
2405
|
+
*
|
|
2406
|
+
* This utility allows reading audio sample entry boxes with types that
|
|
2407
|
+
* aren't in the standard AudioSampleEntryType union (e.g., 'mp4a', 'enca').
|
|
2408
|
+
*
|
|
2409
|
+
* @param type - The 4-character box type
|
|
2410
|
+
*
|
|
2411
|
+
* @returns A reader function that can be passed to readIsoBoxes
|
|
2412
|
+
*
|
|
2413
|
+
* @example
|
|
2414
|
+
* ```ts
|
|
2415
|
+
* const boxes = readIsoBoxes(data, {
|
|
2416
|
+
* readers: {
|
|
2417
|
+
* 'ac-3': createAudioSampleEntryReader('ac-3'),
|
|
2418
|
+
* 'ec-3': createAudioSampleEntryReader('ec-3'),
|
|
2419
|
+
* }
|
|
2420
|
+
* })
|
|
2421
|
+
* ```
|
|
2422
|
+
*
|
|
2423
|
+
* @public
|
|
2424
|
+
*/
|
|
2425
|
+
declare function createAudioSampleEntryReader<T$1 extends IsoBoxType>(type: T$1): (view: IsoBoxReadView) => AudioSampleEntryBox<T$1>;
|
|
2426
|
+
//#endregion
|
|
2427
|
+
//#region src/readers/createVisualSampleEntryReader.d.ts
|
|
2428
|
+
/**
|
|
2429
|
+
* Creates a reader function for VisualSampleEntryBox with a custom type.
|
|
2430
|
+
*
|
|
2431
|
+
* This utility allows reading visual sample entry boxes with types that
|
|
2432
|
+
* aren't in the standard VisualSampleEntryType union (e.g., 'avc1', 'hvc1').
|
|
2433
|
+
*
|
|
2434
|
+
* @param type - The 4-character box type
|
|
2435
|
+
*
|
|
2436
|
+
* @returns A reader function that can be passed to readIsoBoxes
|
|
2437
|
+
*
|
|
2438
|
+
* @example
|
|
2439
|
+
* ```ts
|
|
2440
|
+
* const boxes = readIsoBoxes(data, {
|
|
2441
|
+
* readers: {
|
|
2442
|
+
* 'vp09': createVisualSampleEntryReader('vp09'),
|
|
2443
|
+
* 'av01': createVisualSampleEntryReader('av01'),
|
|
2444
|
+
* }
|
|
2445
|
+
* })
|
|
2446
|
+
* ```
|
|
2447
|
+
*
|
|
2448
|
+
* @public
|
|
2449
|
+
*/
|
|
2450
|
+
declare function createVisualSampleEntryReader<T$1 extends IsoBoxType>(type: T$1): (view: IsoBoxReadView) => VisualSampleEntryBox<T$1>;
|
|
2451
|
+
//#endregion
|
|
2335
2452
|
//#region src/readers/readArdi.d.ts
|
|
2336
2453
|
/**
|
|
2337
2454
|
* Parse a AudioRenderingIndicationBox from an IsoView
|
|
@@ -2355,7 +2472,7 @@ declare function readArdi(view: IsoBoxReadView): AudioRenderingIndicationBox;
|
|
|
2355
2472
|
*
|
|
2356
2473
|
* @public
|
|
2357
2474
|
*/
|
|
2358
|
-
declare function readAudioSampleEntryBox<T$1 extends
|
|
2475
|
+
declare function readAudioSampleEntryBox<T$1 extends IsoBoxType>(type: T$1, view: IsoBoxReadView): AudioSampleEntryBox<T$1>;
|
|
2359
2476
|
//#endregion
|
|
2360
2477
|
//#region src/readers/readAvc1.d.ts
|
|
2361
2478
|
/**
|
|
@@ -3028,7 +3145,7 @@ declare function readUrn(view: IsoBoxReadView): DataEntryUrnBox;
|
|
|
3028
3145
|
*
|
|
3029
3146
|
* @public
|
|
3030
3147
|
*/
|
|
3031
|
-
declare function readVisualSampleEntryBox<T$1 extends
|
|
3148
|
+
declare function readVisualSampleEntryBox<T$1 extends IsoBoxType>(type: T$1, view: IsoBoxReadView): VisualSampleEntryBox<T$1>;
|
|
3032
3149
|
//#endregion
|
|
3033
3150
|
//#region src/readers/readVlab.d.ts
|
|
3034
3151
|
/**
|
|
@@ -3094,7 +3211,7 @@ declare const CONTAINERS: string[];
|
|
|
3094
3211
|
*
|
|
3095
3212
|
* @public
|
|
3096
3213
|
*/
|
|
3097
|
-
declare function isContainer
|
|
3214
|
+
declare function isContainer<T$1 extends IsoBox | Box<IsoBox["type"]>>(box: T$1): box is T$1 & IsoBoxContainer;
|
|
3098
3215
|
//#endregion
|
|
3099
3216
|
//#region src/utils/isFullBox.d.ts
|
|
3100
3217
|
/**
|
|
@@ -3948,5 +4065,5 @@ declare function writeVttC(box: WebVttConfigurationBox): IsoBoxWriteView;
|
|
|
3948
4065
|
*/
|
|
3949
4066
|
declare function writeVtte(_: WebVttEmptySampleBox): IsoBoxWriteView;
|
|
3950
4067
|
//#endregion
|
|
3951
|
-
export { AdditionalMetadataContainerBox, AdditionalMetadataContainerBoxChild, AudioRenderingIndicationBox, AudioSampleEntryBox, AudioSampleEntryBoxChild, AudioSampleEntryType, Box,
|
|
4068
|
+
export { AdditionalMetadataContainerBox, AdditionalMetadataContainerBoxChild, AudioRenderingIndicationBox, AudioSampleEntryBox, AudioSampleEntryBoxChild, AudioSampleEntryType, Box, CONTAINERS, ChunkLargeOffsetBox, ChunkOffsetBox, CompactSampleSizeBox, CompositionTimeToSampleBox, CompositionTimeToSampleEntry, DATA, DataEntryUrlBox, DataEntryUrnBox, DataInformationBox, DataInformationBoxChild, DataReferenceBox, DecodingTimeSample, DecodingTimeToSampleBox, DegradationPriorityBox, EditBox, EditBoxChild, EditListBox, EditListEntry, EncryptedSample, Entity, EventMessageBox, ExtendedLanguageBox, FileTypeBox, FreeSpaceBox, FullBox, GroupsListBox, GroupsListBoxChild, HandlerReferenceBox, HintMediaHeaderBox, INT, IdentifiedMediaDataBox, IpmpInfoBox, IsoBox, IsoBoxContainer, IsoBoxContainerMap, IsoBoxData, IsoBoxMap, IsoBoxReadView, IsoBoxReadViewConfig, IsoBoxReadableStream, IsoBoxReader, IsoBoxReaderMap, IsoBoxReaderReturn, IsoBoxStreamable, IsoBoxType, IsoBoxWriteView, IsoBoxWriteViewConfig, IsoBoxWriter, IsoBoxWriterMap, IsoFieldTypeMap, IsoTypedParsedBox, ItemExtent, ItemInfoBox, ItemInfoBoxChild, ItemInfoEntry, ItemLocation, ItemLocationBox, ItemProtectionBox, ItemProtectionBoxChild, ItemReferenceBox, ItemReferenceBoxChild, LabelBox, MediaBox, MediaBoxChild, MediaDataBox, MediaHeaderBox, MediaInformationBox, MediaInformationBoxChild, MetaBox, MetaBoxChild, MovieBox, MovieBoxChild, MovieExtendsBox, MovieExtendsBoxChild, MovieExtendsHeaderBox, MovieFragmentBox, MovieFragmentBoxChild, MovieFragmentHeaderBox, MovieFragmentRandomAccessBox, MovieFragmentRandomAccessBoxChild, MovieFragmentRandomAccessOffsetBox, MovieHeaderBox, NullMediaHeaderBox, OriginalFormatBox, ParsedBox, ParsedIsoBox, PreselectionGroupBox, PreselectionGroupBoxChild, PrimaryItemBox, ProducerReferenceTimeBox, ProtectionSchemeInformationBox, ProtectionSchemeInformationBoxChild, ProtectionSystemSpecificHeaderBox, STRING, SampleAuxiliaryInformationOffsetsBox, SampleAuxiliaryInformationSizesBox, SampleDependencyTypeBox, SampleDescriptionBox, SampleEncryptionBox, SampleEntryBox, SampleGroupDescriptionBox, SampleSizeBox, SampleTableBox, SampleTableBoxChild, SampleToChunkBox, SampleToChunkEntry, SampleToGroupBox, SampleToGroupEntry, SchemeInformationBox, SchemeInformationBoxChild, SchemeTypeBox, SegmentIndexBox, SegmentIndexReference, SegmentTypeBox, ShadowSyncEntry, ShadowSyncSampleBox, SingleItemTypeReferenceBox, SoundMediaHeaderBox, SubTrackBox, SubTrackBoxChild, Subsample, SubsampleEncryption, SubsampleEntry, SubsampleInformationBox, Subsegment, SubsegmentIndexBox, SubsegmentRange, SubtitleMediaHeaderBox, SyncSample, SyncSampleBox, TEMPLATE, TrackBox, TrackBoxChild, TrackEncryptionBox, TrackExtendsBox, TrackFragmentBaseMediaDecodeTimeBox, TrackFragmentBox, TrackFragmentBoxChild, TrackFragmentHeaderBox, TrackFragmentRandomAccessBox, TrackFragmentRandomAccessEntry, TrackHeaderBox, TrackKindBox, TrackReferenceBox, TrackReferenceBoxChild, TrackReferenceTypeBox, TrackRunBox, TrackRunSample, TraverseIsoBoxesConfig, TypeBox, UINT, UTF8, UserDataBox, UserDataBoxChild, VideoMediaHeaderBox, VisualSampleEntryBox, VisualSampleEntryBoxChild, VisualSampleEntryType, WebVttConfigurationBox, WebVttCueBox, WebVttCueChild, WebVttCueIdBox, WebVttCuePayloadBox, WebVttEmptySampleBox, WebVttSettingsBox, WebVttSourceLabelBox, co64, createAudioSampleEntryReader, createIsoBoxReadableStream, createVisualSampleEntryReader, filterIsoBoxes, findIsoBox, isContainer, isFullBox, readArdi, readAudioSampleEntryBox, readAvc1, readAvc2, readAvc3, readAvc4, readCtts, readDref, readElng, readElst, readEmsg, readEnca, readEncv, readFree, readFrma, readFtyp, readHdlr, readHev1, readHvc1, readIden, readImda, readIsoBoxes, readKind, readLabl, readMdat, readMdhd, readMehd, readMeta, readMfhd, readMfro, readMp4a, readMvhd, readPayl, readPrft, readPrsl, readPssh, readSchm, readSdtp, readSidx, readSkip, readSmhd, readSsix, readSthd, readStsd, readStss, readSttg, readStts, readStyp, readSubs, readTenc, readTfdt, readTfhd, readTfra, readTkhd, readTrex, readTrun, readUrl, readUrn, readVisualSampleEntryBox, readVlab, readVmhd, readVttC, readVtte, stz2, traverseIsoBoxes, url, urn, writeArdi, writeAudioSampleEntryBox, writeAvc1, writeAvc2, writeAvc3, writeAvc4, writeCtts, writeDref, writeElng, writeElst, writeEmsg, writeEnca, writeEncv, writeFree, writeFrma, writeFtyp, writeHdlr, writeHev1, writeHvc1, writeIden, writeImda, writeIsoBox, writeIsoBoxes, writeKind, writeLabl, writeMdat, writeMdhd, writeMehd, writeMeta, writeMfhd, writeMfro, writeMp4a, writeMvhd, writePayl, writePrft, writePrsl, writePssh, writeSchm, writeSdtp, writeSidx, writeSkip, writeSmhd, writeSsix, writeSthd, writeStsd, writeStss, writeSttg, writeStts, writeStyp, writeSubs, writeTenc, writeTfdt, writeTfhd, writeTfra, writeTkhd, writeTrex, writeTrun, writeUrl, writeUrn, writeVisualSampleEntryBox, writeVlab, writeVmhd, writeVttC, writeVtte };
|
|
3952
4069
|
//# sourceMappingURL=index.d.ts.map
|