@dragon708/docmind-markdown 1.2.5 → 1.2.7
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/node_modules/music-metadata/LICENSE.txt +3 -3
- package/node_modules/music-metadata/README.md +246 -690
- package/node_modules/music-metadata/lib/ParserFactory.d.ts +31 -27
- package/node_modules/music-metadata/lib/ParserFactory.js +219 -108
- package/node_modules/music-metadata/lib/aiff/AiffParser.d.ts +2 -2
- package/node_modules/music-metadata/lib/aiff/AiffParser.js +38 -34
- package/node_modules/music-metadata/lib/aiff/AiffTagMap.d.ts +1 -1
- package/node_modules/music-metadata/lib/aiff/AiffTagMap.js +7 -2
- package/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +6 -32
- package/node_modules/music-metadata/lib/aiff/AiffToken.js +17 -27
- package/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +8 -24
- package/node_modules/music-metadata/lib/apev2/APEv2Parser.js +66 -78
- package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.d.ts +1 -1
- package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +8 -4
- package/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +11 -10
- package/node_modules/music-metadata/lib/apev2/APEv2Token.js +27 -16
- package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +53 -59
- package/node_modules/music-metadata/lib/asf/AsfObject.js +131 -97
- package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +1 -1
- package/node_modules/music-metadata/lib/asf/AsfParser.js +43 -42
- package/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +2 -2
- package/node_modules/music-metadata/lib/asf/AsfTagMapper.js +10 -6
- package/node_modules/music-metadata/lib/asf/AsfUtil.d.ts +13 -4
- package/node_modules/music-metadata/lib/asf/AsfUtil.js +36 -30
- package/node_modules/music-metadata/lib/asf/GUID.d.ts +84 -0
- package/node_modules/music-metadata/lib/asf/GUID.js +121 -0
- package/node_modules/music-metadata/lib/common/BasicParser.d.ts +9 -9
- package/node_modules/music-metadata/lib/common/BasicParser.js +7 -2
- package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +3 -3
- package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.js +7 -2
- package/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +5 -5
- package/node_modules/music-metadata/lib/common/CombinedTagMapper.js +28 -24
- package/node_modules/music-metadata/lib/common/FourCC.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/FourCC.js +11 -10
- package/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +13 -13
- package/node_modules/music-metadata/lib/common/GenericTagMapper.js +12 -7
- package/node_modules/music-metadata/lib/common/GenericTagTypes.d.ts +6 -7
- package/node_modules/music-metadata/lib/common/GenericTagTypes.js +85 -86
- package/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +10 -20
- package/node_modules/music-metadata/lib/common/MetadataCollector.js +69 -100
- package/node_modules/music-metadata/lib/common/RandomFileReader.d.ts +22 -0
- package/node_modules/music-metadata/lib/common/RandomFileReader.js +34 -0
- package/node_modules/music-metadata/lib/common/RandomUint8ArrayReader.d.ts +18 -0
- package/node_modules/music-metadata/lib/common/RandomUint8ArrayReader.js +25 -0
- package/node_modules/music-metadata/lib/common/Util.d.ts +12 -11
- package/node_modules/music-metadata/lib/common/Util.js +53 -47
- package/node_modules/music-metadata/lib/core.d.ts +15 -42
- package/node_modules/music-metadata/lib/core.js +38 -74
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.d.ts +1 -16
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +44 -55
- package/node_modules/music-metadata/lib/dsdiff/DsdiffToken.d.ts +3 -3
- package/node_modules/music-metadata/lib/dsdiff/DsdiffToken.js +7 -4
- package/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +10 -11
- package/node_modules/music-metadata/lib/dsf/DsfChunk.js +19 -15
- package/node_modules/music-metadata/lib/dsf/DsfParser.d.ts +1 -16
- package/node_modules/music-metadata/lib/dsf/DsfParser.js +20 -21
- package/node_modules/music-metadata/lib/flac/FlacParser.d.ts +15 -16
- package/node_modules/music-metadata/lib/flac/FlacParser.js +119 -69
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +3 -7
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +36 -39
- package/node_modules/music-metadata/lib/id3v1/ID3v1TagMap.d.ts +1 -1
- package/node_modules/music-metadata/lib/id3v1/ID3v1TagMap.js +7 -2
- package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.d.ts +2 -2
- package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +19 -15
- package/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +3 -64
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +103 -244
- package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +16 -6
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.d.ts +5 -5
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +35 -36
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +6 -11
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +104 -91
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +29 -67
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +36 -76
- package/node_modules/music-metadata/lib/iff/index.d.ts +1 -1
- package/node_modules/music-metadata/lib/iff/index.js +7 -4
- package/node_modules/music-metadata/lib/index.d.ts +31 -8
- package/node_modules/music-metadata/lib/index.js +53 -32
- package/node_modules/music-metadata/lib/lyrics3/Lyrics3.d.ts +2 -2
- package/node_modules/music-metadata/lib/lyrics3/Lyrics3.js +13 -13
- package/node_modules/music-metadata/lib/matroska/MatroskaDtd.d.ts +2 -2
- package/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +242 -246
- package/node_modules/music-metadata/lib/matroska/MatroskaParser.d.ts +24 -6
- package/node_modules/music-metadata/lib/matroska/MatroskaParser.js +218 -124
- package/node_modules/music-metadata/lib/matroska/MatroskaTagMapper.d.ts +1 -1
- package/node_modules/music-metadata/lib/matroska/MatroskaTagMapper.js +7 -3
- package/node_modules/music-metadata/lib/matroska/types.d.ts +76 -43
- package/node_modules/music-metadata/lib/matroska/types.js +33 -27
- package/node_modules/music-metadata/lib/mp4/Atom.d.ts +7 -7
- package/node_modules/music-metadata/lib/mp4/Atom.js +22 -15
- package/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +18 -110
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +66 -184
- package/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +4 -6
- package/node_modules/music-metadata/lib/mp4/MP4Parser.js +128 -255
- package/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +4 -4
- package/node_modules/music-metadata/lib/mp4/MP4TagMapper.js +12 -8
- package/node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.d.ts +5 -5
- package/node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.js +10 -7
- package/node_modules/music-metadata/lib/mpeg/MpegParser.d.ts +4 -17
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +131 -176
- package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +14 -16
- package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +19 -14
- package/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +7 -6
- package/node_modules/music-metadata/lib/mpeg/XingTag.js +18 -14
- package/node_modules/music-metadata/lib/musepack/index.d.ts +5 -0
- package/node_modules/music-metadata/lib/musepack/index.js +32 -0
- package/node_modules/music-metadata/lib/musepack/sv7/BitReader.d.ts +2 -2
- package/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +24 -16
- package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +15 -16
- package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +7 -5
- package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +17 -18
- package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.d.ts +3 -5
- package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +12 -14
- package/node_modules/music-metadata/lib/ogg/{OggToken.d.ts → Ogg.d.ts} +6 -17
- package/node_modules/music-metadata/lib/ogg/Ogg.js +2 -0
- package/node_modules/music-metadata/lib/ogg/OggParser.d.ts +12 -16
- package/node_modules/music-metadata/lib/ogg/OggParser.js +102 -101
- package/node_modules/music-metadata/lib/ogg/opus/Opus.d.ts +2 -17
- package/node_modules/music-metadata/lib/ogg/opus/Opus.js +14 -13
- package/node_modules/music-metadata/lib/ogg/opus/OpusParser.d.ts +25 -0
- package/node_modules/music-metadata/lib/ogg/opus/{OpusStream.js → OpusParser.js} +18 -18
- package/node_modules/music-metadata/lib/ogg/speex/Speex.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/speex/Speex.js +19 -16
- package/node_modules/music-metadata/lib/ogg/speex/SpeexParser.d.ts +22 -0
- package/node_modules/music-metadata/lib/ogg/speex/{SpeexStream.js → SpeexParser.js} +13 -9
- package/node_modules/music-metadata/lib/ogg/theora/Theora.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/theora/Theora.js +11 -8
- package/node_modules/music-metadata/lib/ogg/theora/TheoraParser.d.ts +28 -0
- package/node_modules/music-metadata/lib/ogg/theora/TheoraParser.js +44 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +7 -6
- package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.js +29 -34
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +9 -6
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisParser.d.ts +36 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisParser.js +128 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.d.ts +3 -3
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +9 -5
- package/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +5 -5
- package/node_modules/music-metadata/lib/riff/RiffChunk.js +9 -5
- package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +2 -2
- package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.js +25 -20
- package/node_modules/music-metadata/lib/type.d.ts +52 -121
- package/node_modules/music-metadata/lib/type.js +6 -2
- package/node_modules/music-metadata/lib/wav/BwfChunk.d.ts +1 -1
- package/node_modules/music-metadata/lib/wav/BwfChunk.js +11 -8
- package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +20 -50
- package/node_modules/music-metadata/lib/wav/WaveChunk.js +32 -45
- package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +2 -2
- package/node_modules/music-metadata/lib/wav/WaveParser.js +39 -46
- package/node_modules/music-metadata/lib/wavpack/WavPackParser.d.ts +2 -18
- package/node_modules/music-metadata/lib/wavpack/WavPackParser.js +32 -42
- package/node_modules/music-metadata/lib/wavpack/WavPackToken.d.ts +18 -14
- package/node_modules/music-metadata/lib/wavpack/WavPackToken.js +30 -24
- package/node_modules/music-metadata/package.json +74 -81
- package/node_modules/{music-metadata/node_modules/strtok3/LICENSE.txt → turndown-plugin-gfm/LICENSE} +21 -21
- package/node_modules/turndown-plugin-gfm/README.md +50 -0
- package/node_modules/turndown-plugin-gfm/dist/turndown-plugin-gfm.js +165 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.browser.cjs.js +162 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.browser.es.js +154 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.cjs.js +162 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js +154 -0
- package/node_modules/turndown-plugin-gfm/package.json +43 -0
- package/package.json +5 -5
- package/node_modules/@borewit/text-codec/LICENSE.txt +0 -9
- package/node_modules/@borewit/text-codec/README.md +0 -87
- package/node_modules/@borewit/text-codec/lib/index.d.ts +0 -6
- package/node_modules/@borewit/text-codec/lib/index.js +0 -380
- package/node_modules/@borewit/text-codec/package.json +0 -70
- package/node_modules/music-metadata/lib/ParseError.d.ts +0 -87
- package/node_modules/music-metadata/lib/ParseError.js +0 -38
- package/node_modules/music-metadata/lib/aiff/AiffLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/aiff/AiffLoader.js +0 -8
- package/node_modules/music-metadata/lib/apev2/Apev2Loader.d.ts +0 -2
- package/node_modules/music-metadata/lib/apev2/Apev2Loader.js +0 -8
- package/node_modules/music-metadata/lib/asf/AsfGuid.d.ts +0 -83
- package/node_modules/music-metadata/lib/asf/AsfGuid.js +0 -109
- package/node_modules/music-metadata/lib/asf/AsfLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/asf/AsfLoader.js +0 -8
- package/node_modules/music-metadata/lib/dsdiff/DsdiffLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/dsdiff/DsdiffLoader.js +0 -8
- package/node_modules/music-metadata/lib/dsf/DsfLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/dsf/DsfLoader.js +0 -8
- package/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +0 -67
- package/node_modules/music-metadata/lib/ebml/EbmlIterator.js +0 -218
- package/node_modules/music-metadata/lib/ebml/types.d.ts +0 -37
- package/node_modules/music-metadata/lib/ebml/types.js +0 -8
- package/node_modules/music-metadata/lib/flac/FlacLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/flac/FlacLoader.js +0 -8
- package/node_modules/music-metadata/lib/flac/FlacToken.d.ts +0 -45
- package/node_modules/music-metadata/lib/flac/FlacToken.js +0 -63
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +0 -31
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +0 -73
- package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.d.ts +0 -11
- package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +0 -17
- package/node_modules/music-metadata/lib/lrc/LyricsParser.d.ts +0 -9
- package/node_modules/music-metadata/lib/lrc/LyricsParser.js +0 -45
- package/node_modules/music-metadata/lib/matroska/MatroskaLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/matroska/MatroskaLoader.js +0 -8
- package/node_modules/music-metadata/lib/mp4/Mp4Loader.d.ts +0 -2
- package/node_modules/music-metadata/lib/mp4/Mp4Loader.js +0 -8
- package/node_modules/music-metadata/lib/mpeg/MpegLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/mpeg/MpegLoader.js +0 -8
- package/node_modules/music-metadata/lib/musepack/MusepackConentError.d.ts +0 -15
- package/node_modules/music-metadata/lib/musepack/MusepackConentError.js +0 -3
- package/node_modules/music-metadata/lib/musepack/MusepackLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/musepack/MusepackLoader.js +0 -8
- package/node_modules/music-metadata/lib/musepack/MusepackParser.d.ts +0 -4
- package/node_modules/music-metadata/lib/musepack/MusepackParser.js +0 -30
- package/node_modules/music-metadata/lib/ogg/OggLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/ogg/OggLoader.js +0 -8
- package/node_modules/music-metadata/lib/ogg/OggToken.js +0 -41
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +0 -29
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +0 -74
- package/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +0 -24
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +0 -20
- package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +0 -25
- package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.js +0 -39
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +0 -53
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +0 -136
- package/node_modules/music-metadata/lib/wav/WaveLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/wav/WaveLoader.js +0 -8
- package/node_modules/music-metadata/lib/wavpack/WavPackLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/wavpack/WavPackLoader.js +0 -8
- package/node_modules/music-metadata/node_modules/file-type/core.d.ts +0 -253
- package/node_modules/music-metadata/node_modules/file-type/core.js +0 -2899
- package/node_modules/music-metadata/node_modules/file-type/index.d.ts +0 -98
- package/node_modules/music-metadata/node_modules/file-type/index.js +0 -163
- package/node_modules/music-metadata/node_modules/file-type/license +0 -9
- package/node_modules/music-metadata/node_modules/file-type/package.json +0 -290
- package/node_modules/music-metadata/node_modules/file-type/readme.md +0 -667
- package/node_modules/music-metadata/node_modules/file-type/supported.js +0 -360
- package/node_modules/music-metadata/node_modules/file-type/util.js +0 -60
- package/node_modules/music-metadata/node_modules/strtok3/README.md +0 -399
- package/node_modules/music-metadata/node_modules/strtok3/lib/AbstractTokenizer.d.ts +0 -76
- package/node_modules/music-metadata/node_modules/strtok3/lib/AbstractTokenizer.js +0 -111
- package/node_modules/music-metadata/node_modules/strtok3/lib/BlobTokenizer.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/BlobTokenizer.js +0 -53
- package/node_modules/music-metadata/node_modules/strtok3/lib/BufferTokenizer.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/BufferTokenizer.js +0 -52
- package/node_modules/music-metadata/node_modules/strtok3/lib/FileTokenizer.d.ts +0 -37
- package/node_modules/music-metadata/node_modules/strtok3/lib/FileTokenizer.js +0 -61
- package/node_modules/music-metadata/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +0 -34
- package/node_modules/music-metadata/node_modules/strtok3/lib/ReadStreamTokenizer.js +0 -107
- package/node_modules/music-metadata/node_modules/strtok3/lib/core.d.ts +0 -40
- package/node_modules/music-metadata/node_modules/strtok3/lib/core.js +0 -62
- package/node_modules/music-metadata/node_modules/strtok3/lib/index.d.ts +0 -16
- package/node_modules/music-metadata/node_modules/strtok3/lib/index.js +0 -22
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +0 -54
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/AbstractStreamReader.js +0 -71
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Deferred.d.ts +0 -6
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Deferred.js +0 -10
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Errors.d.ts +0 -10
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Errors.js +0 -16
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/StreamReader.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/StreamReader.js +0 -83
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +0 -14
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamByobReader.js +0 -27
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +0 -19
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +0 -62
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +0 -14
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReader.js +0 -13
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +0 -5
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +0 -19
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/index.d.ts +0 -6
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/index.js +0 -5
- package/node_modules/music-metadata/node_modules/strtok3/lib/types.d.ts +0 -139
- package/node_modules/music-metadata/node_modules/strtok3/lib/types.js +0 -1
- package/node_modules/music-metadata/node_modules/strtok3/package.json +0 -94
- package/node_modules/music-metadata/node_modules/token-types/LICENSE.txt +0 -9
- package/node_modules/music-metadata/node_modules/token-types/README.md +0 -120
- package/node_modules/music-metadata/node_modules/token-types/lib/index.d.ts +0 -135
- package/node_modules/music-metadata/node_modules/token-types/lib/index.js +0 -401
- package/node_modules/music-metadata/node_modules/token-types/package.json +0 -81
- package/node_modules/sprintf-js/.npmignore +0 -1
- package/node_modules/sprintf-js/LICENSE +0 -24
- package/node_modules/sprintf-js/README.md +0 -88
- package/node_modules/sprintf-js/bower.json +0 -14
- package/node_modules/sprintf-js/demo/angular.html +0 -20
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.map +0 -1
- package/node_modules/sprintf-js/gruntfile.js +0 -36
- package/node_modules/sprintf-js/package.json +0 -22
- package/node_modules/sprintf-js/src/angular-sprintf.js +0 -18
- package/node_modules/sprintf-js/src/sprintf.js +0 -208
- package/node_modules/sprintf-js/test/test.js +0 -82
- package/node_modules/uint8array-extras/index.d.ts +0 -331
- package/node_modules/uint8array-extras/index.js +0 -318
- package/node_modules/uint8array-extras/license +0 -9
- package/node_modules/uint8array-extras/package.json +0 -54
- package/node_modules/uint8array-extras/readme.md +0 -318
- package/node_modules/win-guid/LICENSE.txt +0 -9
- package/node_modules/win-guid/README.md +0 -113
- package/node_modules/win-guid/lib/guid.d.ts +0 -20
- package/node_modules/win-guid/lib/guid.js +0 -107
- package/node_modules/win-guid/package.json +0 -55
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/LICENSE +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/README.md +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/index.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/append/constant.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/append.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/count.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/help.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/constant.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/false.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/true.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/subparsers.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/version.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action_container.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argparse.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/error.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/exclusive.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/group.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument_parser.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/const.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/help/added_formatters.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/help/formatter.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/namespace.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/utils.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/package.json +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const debug =
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MP4Parser = void 0;
|
|
4
|
+
const debug_1 = require("debug");
|
|
5
|
+
const Token = require("token-types");
|
|
6
|
+
const BasicParser_1 = require("../common/BasicParser");
|
|
7
|
+
const ID3v1Parser_1 = require("../id3v1/ID3v1Parser");
|
|
8
|
+
const type_1 = require("../type");
|
|
9
|
+
const Atom_1 = require("./Atom");
|
|
10
|
+
const AtomToken = require("./AtomToken");
|
|
11
|
+
const debug = (0, debug_1.default)('music-metadata:parser:MP4');
|
|
12
12
|
const tagFormat = 'iTunes';
|
|
13
13
|
const encoderDict = {
|
|
14
14
|
raw: {
|
|
@@ -90,12 +90,9 @@ function distinct(value, index, self) {
|
|
|
90
90
|
* https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata
|
|
91
91
|
* https://wiki.multimedia.cx/index.php/QuickTime_container
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
class MP4Parser extends BasicParser_1.BasicParser {
|
|
94
94
|
constructor() {
|
|
95
95
|
super(...arguments);
|
|
96
|
-
this.tracks = new Map();
|
|
97
|
-
this.hasVideoTrack = false;
|
|
98
|
-
this.hasAudioTrack = true;
|
|
99
96
|
this.atomParsers = {
|
|
100
97
|
/**
|
|
101
98
|
* Parse movie header (mvhd) atom
|
|
@@ -106,6 +103,19 @@ export class MP4Parser extends BasicParser {
|
|
|
106
103
|
this.metadata.setFormat('creationTime', mvhd.creationTime);
|
|
107
104
|
this.metadata.setFormat('modificationTime', mvhd.modificationTime);
|
|
108
105
|
},
|
|
106
|
+
/**
|
|
107
|
+
* Parse media header (mdhd) atom
|
|
108
|
+
* Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25615
|
|
109
|
+
*/
|
|
110
|
+
mdhd: async (len) => {
|
|
111
|
+
const mdhd_data = await this.tokenizer.readToken(new AtomToken.MdhdAtom(len));
|
|
112
|
+
// this.parse_mxhd(mdhd_data, this.currentTrack);
|
|
113
|
+
const td = this.getTrackDescription();
|
|
114
|
+
td.creationTime = mdhd_data.creationTime;
|
|
115
|
+
td.modificationTime = mdhd_data.modificationTime;
|
|
116
|
+
td.timeScale = mdhd_data.timeScale;
|
|
117
|
+
td.duration = mdhd_data.duration;
|
|
118
|
+
},
|
|
109
119
|
chap: async (len) => {
|
|
110
120
|
const td = this.getTrackDescription();
|
|
111
121
|
const trackIds = [];
|
|
@@ -115,16 +125,22 @@ export class MP4Parser extends BasicParser {
|
|
|
115
125
|
}
|
|
116
126
|
td.chapterList = trackIds;
|
|
117
127
|
},
|
|
128
|
+
tkhd: async (len) => {
|
|
129
|
+
const track = (await this.tokenizer.readToken(new AtomToken.TrackHeaderAtom(len)));
|
|
130
|
+
this.tracks.push(track);
|
|
131
|
+
},
|
|
118
132
|
/**
|
|
119
133
|
* Parse mdat atom.
|
|
120
134
|
* Will scan for chapters
|
|
121
135
|
*/
|
|
122
136
|
mdat: async (len) => {
|
|
137
|
+
this.audioLengthInBytes = len;
|
|
138
|
+
this.calculateBitRate();
|
|
123
139
|
if (this.options.includeChapters) {
|
|
124
|
-
const trackWithChapters =
|
|
140
|
+
const trackWithChapters = this.tracks.filter(track => track.chapterList);
|
|
125
141
|
if (trackWithChapters.length === 1) {
|
|
126
142
|
const chapterTrackIds = trackWithChapters[0].chapterList;
|
|
127
|
-
const chapterTracks =
|
|
143
|
+
const chapterTracks = this.tracks.filter(track => chapterTrackIds.indexOf(track.trackId) !== -1);
|
|
128
144
|
if (chapterTracks.length === 1) {
|
|
129
145
|
return this.parseChapterTrack(chapterTracks[0], trackWithChapters[0], len);
|
|
130
146
|
}
|
|
@@ -154,6 +170,20 @@ export class MP4Parser extends BasicParser {
|
|
|
154
170
|
const trackDescription = this.getTrackDescription();
|
|
155
171
|
trackDescription.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));
|
|
156
172
|
},
|
|
173
|
+
/**
|
|
174
|
+
* sample-to-Chunk Atoms
|
|
175
|
+
*/
|
|
176
|
+
stsc: async (len) => {
|
|
177
|
+
const stsc = await this.tokenizer.readToken(new AtomToken.StscAtom(len));
|
|
178
|
+
this.getTrackDescription().sampleToChunkTable = stsc.entries;
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* time-to-sample table
|
|
182
|
+
*/
|
|
183
|
+
stts: async (len) => {
|
|
184
|
+
const stts = await this.tokenizer.readToken(new AtomToken.SttsAtom(len));
|
|
185
|
+
this.getTrackDescription().timeToSampleTable = stts.entries;
|
|
186
|
+
},
|
|
157
187
|
/**
|
|
158
188
|
* Parse sample-sizes atom ('stsz')
|
|
159
189
|
*/
|
|
@@ -163,9 +193,16 @@ export class MP4Parser extends BasicParser {
|
|
|
163
193
|
td.sampleSize = stsz.sampleSize;
|
|
164
194
|
td.sampleSizeTable = stsz.entries;
|
|
165
195
|
},
|
|
196
|
+
/**
|
|
197
|
+
* Parse chunk-offset atom ('stco')
|
|
198
|
+
*/
|
|
199
|
+
stco: async (len) => {
|
|
200
|
+
const stco = await this.tokenizer.readToken(new AtomToken.StcoAtom(len));
|
|
201
|
+
this.getTrackDescription().chunkOffsetTable = stco.entries; // remember chunk offsets
|
|
202
|
+
},
|
|
166
203
|
date: async (len) => {
|
|
167
204
|
const date = await this.tokenizer.readToken(new Token.StringType(len, 'utf-8'));
|
|
168
|
-
|
|
205
|
+
this.addTag('date', date);
|
|
169
206
|
}
|
|
170
207
|
};
|
|
171
208
|
}
|
|
@@ -173,15 +210,13 @@ export class MP4Parser extends BasicParser {
|
|
|
173
210
|
const integerType = (signed ? 'INT' : 'UINT') + array.length * 8 + (array.length > 1 ? '_BE' : '');
|
|
174
211
|
const token = Token[integerType];
|
|
175
212
|
if (!token) {
|
|
176
|
-
throw new
|
|
213
|
+
throw new Error('Token for integer type not found: "' + integerType + '"');
|
|
177
214
|
}
|
|
178
215
|
return Number(token.get(array, 0));
|
|
179
216
|
}
|
|
180
217
|
async parse() {
|
|
181
|
-
this.
|
|
182
|
-
|
|
183
|
-
this.tracks.clear();
|
|
184
|
-
let remainingFileSize = this.tokenizer.fileInfo.size || 0;
|
|
218
|
+
this.tracks = [];
|
|
219
|
+
let remainingFileSize = this.tokenizer.fileInfo.size;
|
|
185
220
|
while (!this.tokenizer.fileInfo.size || remainingFileSize > 0) {
|
|
186
221
|
try {
|
|
187
222
|
const token = await this.tokenizer.peekToken(AtomToken.Header);
|
|
@@ -193,16 +228,12 @@ export class MP4Parser extends BasicParser {
|
|
|
193
228
|
}
|
|
194
229
|
}
|
|
195
230
|
catch (error) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this.addWarning(errMsg);
|
|
200
|
-
}
|
|
201
|
-
else
|
|
202
|
-
throw error;
|
|
231
|
+
const errMsg = `Error at offset=${this.tokenizer.position}: ${error.message}`;
|
|
232
|
+
debug(errMsg);
|
|
233
|
+
this.addWarning(errMsg);
|
|
203
234
|
break;
|
|
204
235
|
}
|
|
205
|
-
const rootAtom = await Atom.readAtom(this.tokenizer, (atom, remaining) => this.handleAtom(atom, remaining), null, remainingFileSize);
|
|
236
|
+
const rootAtom = await Atom_1.Atom.readAtom(this.tokenizer, (atom, remaining) => this.handleAtom(atom, remaining), null, remainingFileSize);
|
|
206
237
|
remainingFileSize -= rootAtom.header.length === BigInt(0) ? remainingFileSize : Number(rootAtom.header.length);
|
|
207
238
|
}
|
|
208
239
|
// Post process metadata
|
|
@@ -222,7 +253,7 @@ export class MP4Parser extends BasicParser {
|
|
|
222
253
|
if (ssd.description) {
|
|
223
254
|
const { description } = ssd;
|
|
224
255
|
if (description.sampleRate > 0) {
|
|
225
|
-
streamInfo.type = TrackType.audio;
|
|
256
|
+
streamInfo.type = type_1.TrackType.audio;
|
|
226
257
|
streamInfo.audio = {
|
|
227
258
|
samplingFrequency: description.sampleRate,
|
|
228
259
|
bitDepth: description.sampleSize,
|
|
@@ -239,75 +270,34 @@ export class MP4Parser extends BasicParser {
|
|
|
239
270
|
if (formatList.length > 0) {
|
|
240
271
|
this.metadata.setFormat('codec', formatList.filter(distinct).join('+'));
|
|
241
272
|
}
|
|
242
|
-
const audioTracks =
|
|
273
|
+
const audioTracks = this.tracks.filter(track => {
|
|
243
274
|
return track.soundSampleDescription.length >= 1 && track.soundSampleDescription[0].description && track.soundSampleDescription[0].description.numAudioChannels > 0;
|
|
244
275
|
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (audioTrack.
|
|
248
|
-
audioTrack.
|
|
249
|
-
|
|
250
|
-
debug('Using duration defined on audio track');
|
|
251
|
-
audioTrack.samples = audioTrack.media.header.duration;
|
|
252
|
-
audioTrack.duration = audioTrack.samples / audioTrack.sampleRate;
|
|
253
|
-
}
|
|
254
|
-
if (audioTrack.fragments.length > 0) {
|
|
255
|
-
debug('Calculate duration defined in track fragments');
|
|
256
|
-
let totalTimeUnits = 0;
|
|
257
|
-
audioTrack.sizeInBytes = 0;
|
|
258
|
-
for (const fragment of audioTrack.fragments) {
|
|
259
|
-
for (const sample of fragment.trackRun.samples) {
|
|
260
|
-
const dur = sample.sampleDuration ?? fragment.header.defaultSampleDuration ?? 0;
|
|
261
|
-
const size = sample.sampleSize ?? fragment.header.defaultSampleSize ?? 0;
|
|
262
|
-
if (dur === 0) {
|
|
263
|
-
throw new Error("Missing sampleDuration and no defaultSampleDuration in track fragment header");
|
|
264
|
-
}
|
|
265
|
-
if (size === 0) {
|
|
266
|
-
throw new Error("Missing sampleSize and no defaultSampleSize in track fragment header");
|
|
267
|
-
}
|
|
268
|
-
totalTimeUnits += dur;
|
|
269
|
-
audioTrack.sizeInBytes += size;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
if (!audioTrack.samples) {
|
|
273
|
-
audioTrack.samples = totalTimeUnits;
|
|
274
|
-
}
|
|
275
|
-
if (!audioTrack.duration) {
|
|
276
|
-
audioTrack.duration = totalTimeUnits / audioTrack.sampleRate;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else if (audioTrack.sampleSizeTable.length > 0) {
|
|
280
|
-
audioTrack.sizeInBytes = audioTrack.sampleSizeTable.reduce((sum, n) => sum + n, 0);
|
|
281
|
-
}
|
|
276
|
+
if (audioTracks.length >= 1) {
|
|
277
|
+
const audioTrack = audioTracks[0];
|
|
278
|
+
if (audioTrack.timeScale > 0) {
|
|
279
|
+
const duration = audioTrack.duration / audioTrack.timeScale; // calculate duration in seconds
|
|
280
|
+
this.metadata.setFormat('duration', duration);
|
|
282
281
|
}
|
|
283
282
|
const ssd = audioTrack.soundSampleDescription[0];
|
|
284
|
-
if (ssd.description
|
|
283
|
+
if (ssd.description) {
|
|
285
284
|
this.metadata.setFormat('sampleRate', ssd.description.sampleRate);
|
|
286
285
|
this.metadata.setFormat('bitsPerSample', ssd.description.sampleSize);
|
|
287
286
|
this.metadata.setFormat('numberOfChannels', ssd.description.numAudioChannels);
|
|
288
|
-
if (audioTrack.
|
|
287
|
+
if (audioTrack.timeScale === 0 && audioTrack.timeToSampleTable.length > 0) {
|
|
289
288
|
const totalSampleSize = audioTrack.timeToSampleTable
|
|
290
289
|
.map(ttstEntry => ttstEntry.count * ttstEntry.duration)
|
|
291
290
|
.reduce((total, sampleSize) => total + sampleSize);
|
|
292
|
-
|
|
291
|
+
const duration = totalSampleSize / ssd.description.sampleRate;
|
|
292
|
+
this.metadata.setFormat('duration', duration);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
const encoderInfo = encoderDict[ssd.dataFormat];
|
|
296
296
|
if (encoderInfo) {
|
|
297
297
|
this.metadata.setFormat('lossless', !encoderInfo.lossy);
|
|
298
298
|
}
|
|
299
|
+
this.calculateBitRate();
|
|
299
300
|
}
|
|
300
|
-
if (audioTracks.length >= 1) {
|
|
301
|
-
const firstAudioTrack = audioTracks[0];
|
|
302
|
-
if (firstAudioTrack.duration) {
|
|
303
|
-
this.metadata.setFormat('duration', firstAudioTrack.duration);
|
|
304
|
-
if (firstAudioTrack.sizeInBytes) {
|
|
305
|
-
this.metadata.setFormat('bitrate', 8 * firstAudioTrack.sizeInBytes / firstAudioTrack.duration);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
this.metadata.setFormat('hasAudio', this.hasAudioTrack);
|
|
310
|
-
this.metadata.setFormat('hasVideo', this.hasVideoTrack);
|
|
311
301
|
}
|
|
312
302
|
async handleAtom(atom, remaining) {
|
|
313
303
|
if (atom.parent) {
|
|
@@ -315,38 +305,30 @@ export class MP4Parser extends BasicParser {
|
|
|
315
305
|
case 'ilst':
|
|
316
306
|
case '<id>':
|
|
317
307
|
return this.parseMetadataItemData(atom);
|
|
318
|
-
case 'moov':
|
|
319
|
-
switch (atom.header.name) {
|
|
320
|
-
case 'trak':
|
|
321
|
-
return this.parseTrackBox(atom);
|
|
322
|
-
case 'udta':
|
|
323
|
-
return this.parseTrackBox(atom);
|
|
324
|
-
}
|
|
325
|
-
break;
|
|
326
|
-
case 'moof':
|
|
327
|
-
switch (atom.header.name) {
|
|
328
|
-
case 'traf':
|
|
329
|
-
return this.parseTrackFragmentBox(atom);
|
|
330
|
-
}
|
|
331
308
|
}
|
|
332
309
|
}
|
|
333
310
|
// const payloadLength = atom.getPayloadLength(remaining);
|
|
334
311
|
if (this.atomParsers[atom.header.name]) {
|
|
335
312
|
return this.atomParsers[atom.header.name](remaining);
|
|
336
313
|
}
|
|
337
|
-
|
|
338
|
-
|
|
314
|
+
else {
|
|
315
|
+
debug(`No parser for atom path=${atom.atomPath}, payload-len=${remaining}, ignoring atom`);
|
|
316
|
+
await this.tokenizer.ignore(remaining);
|
|
317
|
+
}
|
|
339
318
|
}
|
|
340
319
|
getTrackDescription() {
|
|
341
|
-
|
|
342
|
-
const tracks = [...this.tracks.values()];
|
|
343
|
-
return tracks[tracks.length - 1];
|
|
320
|
+
return this.tracks[this.tracks.length - 1];
|
|
344
321
|
}
|
|
345
|
-
|
|
346
|
-
|
|
322
|
+
calculateBitRate() {
|
|
323
|
+
if (this.audioLengthInBytes && this.metadata.format.duration) {
|
|
324
|
+
this.metadata.setFormat('bitrate', 8 * this.audioLengthInBytes / this.metadata.format.duration);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
addTag(id, value) {
|
|
328
|
+
this.metadata.addTag(tagFormat, id, value);
|
|
347
329
|
}
|
|
348
330
|
addWarning(message) {
|
|
349
|
-
debug(
|
|
331
|
+
debug('Warning: ' + message);
|
|
350
332
|
this.metadata.addWarning(message);
|
|
351
333
|
}
|
|
352
334
|
/**
|
|
@@ -363,22 +345,20 @@ export class MP4Parser extends BasicParser {
|
|
|
363
345
|
return this.parseValueAtom(tagKey, child);
|
|
364
346
|
case 'name': // name atom (optional)
|
|
365
347
|
case 'mean':
|
|
366
|
-
case 'rate':
|
|
348
|
+
case 'rate':
|
|
367
349
|
const name = await this.tokenizer.readToken(new AtomToken.NameAtom(payLoadLength));
|
|
368
|
-
tagKey +=
|
|
350
|
+
tagKey += ':' + name.name;
|
|
369
351
|
break;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.addWarning(`Unsupported meta-item: ${tagKey}[${child.header.name}] => value=${uint8ArrayToHex(uint8Array)} ascii=${textDecode(uint8Array, 'ascii')}`);
|
|
374
|
-
}
|
|
352
|
+
default:
|
|
353
|
+
const dataAtom = await this.tokenizer.readToken(new Token.BufferType(payLoadLength));
|
|
354
|
+
this.addWarning('Unsupported meta-item: ' + tagKey + '[' + child.header.name + '] => value=' + dataAtom.toString('hex') + ' ascii=' + dataAtom.toString('ascii'));
|
|
375
355
|
}
|
|
376
356
|
}, metaAtom.getPayloadLength(0));
|
|
377
357
|
}
|
|
378
358
|
async parseValueAtom(tagKey, metaAtom) {
|
|
379
359
|
const dataAtom = await this.tokenizer.readToken(new AtomToken.DataAtom(Number(metaAtom.header.length) - AtomToken.Header.len));
|
|
380
360
|
if (dataAtom.type.set !== 0) {
|
|
381
|
-
throw new
|
|
361
|
+
throw new Error('Unsupported type-set != 0: ' + dataAtom.type.set);
|
|
382
362
|
}
|
|
383
363
|
// Use well-known-type table
|
|
384
364
|
// Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW35
|
|
@@ -386,171 +366,65 @@ export class MP4Parser extends BasicParser {
|
|
|
386
366
|
case 0: // reserved: Reserved for use where no type needs to be indicated
|
|
387
367
|
switch (tagKey) {
|
|
388
368
|
case 'trkn':
|
|
389
|
-
case 'disk':
|
|
369
|
+
case 'disk':
|
|
390
370
|
const num = Token.UINT8.get(dataAtom.value, 3);
|
|
391
371
|
const of = Token.UINT8.get(dataAtom.value, 5);
|
|
392
372
|
// console.log(" %s[data] = %s/%s", tagKey, num, of);
|
|
393
|
-
|
|
373
|
+
this.addTag(tagKey, num + '/' + of);
|
|
394
374
|
break;
|
|
395
|
-
|
|
396
|
-
case 'gnre': {
|
|
375
|
+
case 'gnre':
|
|
397
376
|
const genreInt = Token.UINT8.get(dataAtom.value, 1);
|
|
398
|
-
const genreStr = Genres[genreInt - 1];
|
|
377
|
+
const genreStr = ID3v1Parser_1.Genres[genreInt - 1];
|
|
399
378
|
// console.log(" %s[data] = %s", tagKey, genreStr);
|
|
400
|
-
|
|
379
|
+
this.addTag(tagKey, genreStr);
|
|
401
380
|
break;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
await this.addTag(tagKey, rate);
|
|
381
|
+
case 'rate':
|
|
382
|
+
const rate = dataAtom.value.toString('ascii');
|
|
383
|
+
this.addTag(tagKey, rate);
|
|
406
384
|
break;
|
|
407
|
-
}
|
|
408
385
|
default:
|
|
409
|
-
debug(
|
|
386
|
+
debug('unknown proprietary value type for: ' + metaAtom.atomPath);
|
|
410
387
|
}
|
|
411
388
|
break;
|
|
412
389
|
case 1: // UTF-8: Without any count or NULL terminator
|
|
413
390
|
case 18: // Unknown: Found in m4b in combination with a '©gen' tag
|
|
414
|
-
|
|
391
|
+
this.addTag(tagKey, dataAtom.value.toString('utf-8'));
|
|
415
392
|
break;
|
|
416
393
|
case 13: // JPEG
|
|
417
394
|
if (this.options.skipCovers)
|
|
418
395
|
break;
|
|
419
|
-
|
|
396
|
+
this.addTag(tagKey, {
|
|
420
397
|
format: 'image/jpeg',
|
|
421
|
-
data:
|
|
398
|
+
data: Buffer.from(dataAtom.value)
|
|
422
399
|
});
|
|
423
400
|
break;
|
|
424
401
|
case 14: // PNG
|
|
425
402
|
if (this.options.skipCovers)
|
|
426
403
|
break;
|
|
427
|
-
|
|
404
|
+
this.addTag(tagKey, {
|
|
428
405
|
format: 'image/png',
|
|
429
|
-
data:
|
|
406
|
+
data: Buffer.from(dataAtom.value)
|
|
430
407
|
});
|
|
431
408
|
break;
|
|
432
409
|
case 21: // BE Signed Integer
|
|
433
|
-
|
|
410
|
+
this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, true));
|
|
434
411
|
break;
|
|
435
412
|
case 22: // BE Unsigned Integer
|
|
436
|
-
|
|
413
|
+
this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, false));
|
|
437
414
|
break;
|
|
438
415
|
case 65: // An 8-bit signed integer
|
|
439
|
-
|
|
416
|
+
this.addTag(tagKey, dataAtom.value.readInt8(0));
|
|
440
417
|
break;
|
|
441
418
|
case 66: // A big-endian 16-bit signed integer
|
|
442
|
-
|
|
419
|
+
this.addTag(tagKey, dataAtom.value.readInt16BE(0));
|
|
443
420
|
break;
|
|
444
421
|
case 67: // A big-endian 32-bit signed integer
|
|
445
|
-
|
|
422
|
+
this.addTag(tagKey, dataAtom.value.readInt32BE(0));
|
|
446
423
|
break;
|
|
447
424
|
default:
|
|
448
425
|
this.addWarning(`atom key=${tagKey}, has unknown well-known-type (data-type): ${dataAtom.type.type}`);
|
|
449
426
|
}
|
|
450
427
|
}
|
|
451
|
-
async parseTrackBox(trakBox) {
|
|
452
|
-
// @ts-expect-error
|
|
453
|
-
const track = {
|
|
454
|
-
media: {},
|
|
455
|
-
fragments: []
|
|
456
|
-
};
|
|
457
|
-
await trakBox.readAtoms(this.tokenizer, async (child, remaining) => {
|
|
458
|
-
const payLoadLength = child.getPayloadLength(remaining);
|
|
459
|
-
switch (child.header.name) {
|
|
460
|
-
case 'chap': {
|
|
461
|
-
const chap = await this.tokenizer.readToken(new ChapterTrackReferenceBox(remaining));
|
|
462
|
-
track.chapterList = chap;
|
|
463
|
-
break;
|
|
464
|
-
}
|
|
465
|
-
case 'tkhd': // TrackHeaderBox
|
|
466
|
-
track.header = await this.tokenizer.readToken(new AtomToken.TrackHeaderAtom(payLoadLength));
|
|
467
|
-
break;
|
|
468
|
-
case 'hdlr': // TrackHeaderBox
|
|
469
|
-
track.handler = await this.tokenizer.readToken(new AtomToken.HandlerBox(payLoadLength));
|
|
470
|
-
track.isAudio = () => track.handler.handlerType === 'audi' || track.handler.handlerType === 'soun';
|
|
471
|
-
track.isVideo = () => track.handler.handlerType === 'vide';
|
|
472
|
-
if (track.isAudio()) {
|
|
473
|
-
this.hasAudioTrack = true;
|
|
474
|
-
}
|
|
475
|
-
else if (track.isVideo()) {
|
|
476
|
-
this.hasVideoTrack = true;
|
|
477
|
-
}
|
|
478
|
-
break;
|
|
479
|
-
case 'mdhd': { // Parse media header (mdhd) box
|
|
480
|
-
const mdhd_data = await this.tokenizer.readToken(new AtomToken.MdhdAtom(payLoadLength));
|
|
481
|
-
track.media.header = mdhd_data;
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
case 'stco': {
|
|
485
|
-
const stco = await this.tokenizer.readToken(new AtomToken.StcoAtom(payLoadLength));
|
|
486
|
-
track.chunkOffsetTable = stco.entries; // remember chunk offsets
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
case 'stsc': { // sample-to-Chunk box
|
|
490
|
-
const stsc = await this.tokenizer.readToken(new AtomToken.StscAtom(payLoadLength));
|
|
491
|
-
track.sampleToChunkTable = stsc.entries;
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
case 'stsd': { // sample description box
|
|
495
|
-
const stsd = await this.tokenizer.readToken(new AtomToken.StsdAtom(payLoadLength));
|
|
496
|
-
track.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
case 'stts': { // time-to-sample table
|
|
500
|
-
const stts = await this.tokenizer.readToken(new AtomToken.SttsAtom(payLoadLength));
|
|
501
|
-
track.timeToSampleTable = stts.entries;
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
case 'stsz': {
|
|
505
|
-
const stsz = await this.tokenizer.readToken(new AtomToken.StszAtom(payLoadLength));
|
|
506
|
-
track.sampleSize = stsz.sampleSize;
|
|
507
|
-
track.sampleSizeTable = stsz.entries;
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
case 'dinf':
|
|
511
|
-
case 'vmhd':
|
|
512
|
-
case 'smhd':
|
|
513
|
-
debug(`Ignoring: ${child.header.name}`);
|
|
514
|
-
await this.tokenizer.ignore(payLoadLength);
|
|
515
|
-
break;
|
|
516
|
-
default: {
|
|
517
|
-
debug(`Unexpected track box: ${child.header.name}`);
|
|
518
|
-
await this.tokenizer.ignore(payLoadLength);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}, trakBox.getPayloadLength(0));
|
|
522
|
-
// Register track
|
|
523
|
-
this.tracks.set(track.header.trackId, track);
|
|
524
|
-
}
|
|
525
|
-
parseTrackFragmentBox(trafBox) {
|
|
526
|
-
let tfhd;
|
|
527
|
-
return trafBox.readAtoms(this.tokenizer, async (child, remaining) => {
|
|
528
|
-
const payLoadLength = child.getPayloadLength(remaining);
|
|
529
|
-
switch (child.header.name) {
|
|
530
|
-
case 'tfhd': { // TrackFragmentHeaderBox
|
|
531
|
-
const fragmentHeaderBox = new AtomToken.TrackFragmentHeaderBox(child.getPayloadLength(remaining));
|
|
532
|
-
tfhd = await this.tokenizer.readToken(fragmentHeaderBox);
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
case 'tfdt': // TrackFragmentBaseMediaDecodeTimeBo
|
|
536
|
-
await this.tokenizer.ignore(payLoadLength);
|
|
537
|
-
break;
|
|
538
|
-
case 'trun': { // TrackRunBox
|
|
539
|
-
const trackRunBox = new AtomToken.TrackRunBox(payLoadLength);
|
|
540
|
-
const trun = await this.tokenizer.readToken(trackRunBox);
|
|
541
|
-
if (tfhd) {
|
|
542
|
-
const track = this.tracks.get(tfhd.trackId);
|
|
543
|
-
track?.fragments.push({ header: tfhd, trackRun: trun });
|
|
544
|
-
}
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
default: {
|
|
548
|
-
debug(`Unexpected box: ${child.header.name}`);
|
|
549
|
-
await this.tokenizer.ignore(payLoadLength);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}, trafBox.getPayloadLength(0));
|
|
553
|
-
}
|
|
554
428
|
/**
|
|
555
429
|
* @param sampleDescription
|
|
556
430
|
* Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-128916
|
|
@@ -561,16 +435,14 @@ export class MP4Parser extends BasicParser {
|
|
|
561
435
|
dataReferenceIndex: sampleDescription.dataReferenceIndex
|
|
562
436
|
};
|
|
563
437
|
let offset = 0;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
debug(`Warning: sound-sample-description ${version} not implemented`);
|
|
573
|
-
}
|
|
438
|
+
const version = AtomToken.SoundSampleDescriptionVersion.get(sampleDescription.description, offset);
|
|
439
|
+
offset += AtomToken.SoundSampleDescriptionVersion.len;
|
|
440
|
+
if (version.version === 0 || version.version === 1) {
|
|
441
|
+
// Sound Sample Description (Version 0)
|
|
442
|
+
ssd.description = AtomToken.SoundSampleDescriptionV0.get(sampleDescription.description, offset);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
debug(`Warning: sound-sample-description ${version} not implemented`);
|
|
574
446
|
}
|
|
575
447
|
return ssd;
|
|
576
448
|
}
|
|
@@ -581,31 +453,31 @@ export class MP4Parser extends BasicParser {
|
|
|
581
453
|
}
|
|
582
454
|
const chapters = [];
|
|
583
455
|
for (let i = 0; i < chapterTrack.chunkOffsetTable.length && len > 0; ++i) {
|
|
584
|
-
const start = chapterTrack.timeToSampleTable
|
|
585
|
-
.slice(0, i)
|
|
586
|
-
.reduce((acc, cur) => acc + cur.duration, 0);
|
|
587
456
|
const chunkOffset = chapterTrack.chunkOffsetTable[i];
|
|
588
457
|
const nextChunkLen = chunkOffset - this.tokenizer.position;
|
|
589
458
|
const sampleSize = chapterTrack.sampleSize > 0 ? chapterTrack.sampleSize : chapterTrack.sampleSizeTable[i];
|
|
590
459
|
len -= nextChunkLen + sampleSize;
|
|
591
460
|
if (len < 0)
|
|
592
|
-
throw new
|
|
461
|
+
throw new Error('Chapter chunk exceeding token length');
|
|
593
462
|
await this.tokenizer.ignore(nextChunkLen);
|
|
594
463
|
const title = await this.tokenizer.readToken(new AtomToken.ChapterText(sampleSize));
|
|
595
464
|
debug(`Chapter ${i + 1}: ${title}`);
|
|
596
465
|
const chapter = {
|
|
597
466
|
title,
|
|
598
|
-
timeScale: chapterTrack.media.header ? chapterTrack.media.header.timeScale : 0,
|
|
599
|
-
start,
|
|
600
467
|
sampleOffset: this.findSampleOffset(track, this.tokenizer.position)
|
|
601
468
|
};
|
|
602
|
-
debug(`Chapter title=${chapter.title}, offset=${chapter.sampleOffset}/${
|
|
469
|
+
debug(`Chapter title=${chapter.title}, offset=${chapter.sampleOffset}/${this.tracks[0].duration}`);
|
|
603
470
|
chapters.push(chapter);
|
|
604
471
|
}
|
|
605
472
|
this.metadata.setFormat('chapters', chapters);
|
|
606
473
|
await this.tokenizer.ignore(len);
|
|
607
474
|
}
|
|
608
475
|
findSampleOffset(track, chapterOffset) {
|
|
476
|
+
let totalDuration = 0;
|
|
477
|
+
track.timeToSampleTable.forEach(e => {
|
|
478
|
+
totalDuration += e.count * e.duration;
|
|
479
|
+
});
|
|
480
|
+
debug(`Total duration=${totalDuration}`);
|
|
609
481
|
let chunkIndex = 0;
|
|
610
482
|
while (chunkIndex < track.chunkOffsetTable.length && track.chunkOffsetTable[chunkIndex] < chapterOffset) {
|
|
611
483
|
++chunkIndex;
|
|
@@ -645,3 +517,4 @@ export class MP4Parser extends BasicParser {
|
|
|
645
517
|
return stcTable[stcTable.length - 1].samplesPerChunk;
|
|
646
518
|
}
|
|
647
519
|
}
|
|
520
|
+
exports.MP4Parser = MP4Parser;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
|
2
|
+
import { ITag } from "../type";
|
|
3
|
+
import { INativeMetadataCollector } from "../common/MetadataCollector";
|
|
4
4
|
export declare const tagType = "iTunes";
|
|
5
5
|
export declare class MP4TagMapper extends CaseInsensitiveTagMap {
|
|
6
6
|
constructor();
|
|
7
|
-
protected postMap(tag: ITag,
|
|
7
|
+
protected postMap(tag: ITag, warnings: INativeMetadataCollector): void;
|
|
8
8
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MP4TagMapper = exports.tagType = void 0;
|
|
4
|
+
const CaseInsensitiveTagMap_1 = require("../common/CaseInsensitiveTagMap");
|
|
2
5
|
/**
|
|
3
6
|
* Ref: https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata
|
|
4
7
|
*/
|
|
@@ -84,12 +87,11 @@ const mp4TagMap = {
|
|
|
84
87
|
'----:com.apple.iTunes:replaygain_album_minmax': 'replaygain_album_minmax',
|
|
85
88
|
'----:com.apple.iTunes:replaygain_undo': 'replaygain_undo',
|
|
86
89
|
// Additional mappings:
|
|
87
|
-
gnre: 'genre',
|
|
90
|
+
gnre: 'genre',
|
|
88
91
|
'----:com.apple.iTunes:ALBUMARTISTSORT': 'albumartistsort',
|
|
89
92
|
'----:com.apple.iTunes:ARTISTS': 'artists',
|
|
90
93
|
'----:com.apple.iTunes:ORIGINALDATE': 'originaldate',
|
|
91
94
|
'----:com.apple.iTunes:ORIGINALYEAR': 'originalyear',
|
|
92
|
-
'----:com.apple.iTunes:RELEASEDATE': 'releasedate',
|
|
93
95
|
// '----:com.apple.iTunes:PERFORMER': 'performer'
|
|
94
96
|
desc: 'description',
|
|
95
97
|
ldes: 'longDescription',
|
|
@@ -105,19 +107,21 @@ const mp4TagMap = {
|
|
|
105
107
|
stik: 'stik',
|
|
106
108
|
rate: 'rating'
|
|
107
109
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
exports.tagType = 'iTunes';
|
|
111
|
+
class MP4TagMapper extends CaseInsensitiveTagMap_1.CaseInsensitiveTagMap {
|
|
110
112
|
constructor() {
|
|
111
|
-
super([tagType], mp4TagMap);
|
|
113
|
+
super([exports.tagType], mp4TagMap);
|
|
112
114
|
}
|
|
113
|
-
postMap(tag,
|
|
115
|
+
postMap(tag, warnings) {
|
|
114
116
|
switch (tag.id) {
|
|
115
117
|
case 'rate':
|
|
116
118
|
tag.value = {
|
|
117
119
|
source: undefined,
|
|
118
|
-
rating:
|
|
120
|
+
rating: parseFloat(tag.value) / 100
|
|
119
121
|
};
|
|
120
122
|
break;
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
}
|
|
126
|
+
exports.MP4TagMapper = MP4TagMapper;
|
|
127
|
+
//# sourceMappingURL=MP4TagMapper.js.map
|