id
stringlengths 1
6
| tokens
sequence | labels
sequence |
---|---|---|
661800 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CommonTagMapper",
"}",
"from",
"'../common/GenericTagMapper'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"import",
"{",
"CaseInsensitiveTagMap",
"}",
"from",
"'../common/CaseInsensitiveTagMap'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"IRating",
",",
"ITag",
"}",
"from",
"'../type'",
";",
"/**\n * ID3v2.3/ID3v2.4 tag mappings\n */",
"const",
"id3v24TagMap",
"=",
"{",
"TIT2",
":",
"'title'",
",",
"TPE1",
":",
"'artist'",
",",
"'TXXX:Artists'",
":",
"'artists'",
",",
"TPE2",
":",
"'albumartist'",
",",
"TALB",
":",
"'album'",
",",
"TDRV",
":",
"'date'",
",",
"/**\n * Original release year\n */",
"TORY",
":",
"'originalyear'",
",",
"TPOS",
":",
"'disk'",
",",
"TCON",
":",
"'genre'",
",",
"APIC",
":",
"'picture'",
",",
"TCOM",
":",
"'composer'",
",",
"'USLT:description'",
":",
"'lyrics'",
",",
"TSOA",
":",
"'albumsort'",
",",
"TSOT",
":",
"'titlesort'",
",",
"TOAL",
":",
"'originalalbum'",
",",
"TSOP",
":",
"'artistsort'",
",",
"TSO2",
":",
"'albumartistsort'",
",",
"TSOC",
":",
"'composersort'",
",",
"TEXT",
":",
"'lyricist'",
",",
"'TXXX:Writer'",
":",
"'writer'",
",",
"TPE3",
":",
"'conductor'",
",",
"TPE4",
":",
"'remixer'",
",",
"'IPLS:arranger'",
":",
"'arranger'",
",",
"'IPLS:engineer'",
":",
"'engineer'",
",",
"'IPLS:producer'",
":",
"'producer'",
",",
"'IPLS:DJ-mix'",
":",
"'djmixer'",
",",
"'IPLS:mix'",
":",
"'mixer'",
",",
"TPUB",
":",
"'label'",
",",
"TIT1",
":",
"'grouping'",
",",
"TIT3",
":",
"'subtitle'",
",",
"TRCK",
":",
"'track'",
",",
"TCMP",
":",
"'compilation'",
",",
"POPM",
":",
"'rating'",
",",
"TBPM",
":",
"'bpm'",
",",
"TMED",
":",
"'media'",
",",
"'TXXX:CATALOGNUMBER'",
":",
"'catalognumber'",
",",
"'TXXX:MusicBrainz Album Status'",
":",
"'releasestatus'",
",",
"'TXXX:MusicBrainz Album Type'",
":",
"'releasetype'",
",",
"/**\n * Release country as documented: https://picard.musicbrainz.org/docs/mappings/#cite_note-0\n */",
"'TXXX:MusicBrainz Album Release Country'",
":",
"'releasecountry'",
",",
"/**\n * Release country as implemented // ToDo: report\n */",
"'TXXX:RELEASECOUNTRY'",
":",
"'releasecountry'",
",",
"'TXXX:SCRIPT'",
":",
"'script'",
",",
"TLAN",
":",
"'language'",
",",
"TCOP",
":",
"'copyright'",
",",
"WCOP",
":",
"'license'",
",",
"TENC",
":",
"'encodedby'",
",",
"TSSE",
":",
"'encodersettings'",
",",
"'TXXX:BARCODE'",
":",
"'barcode'",
",",
"'TXXX:ISRC'",
":",
"'isrc'",
",",
"TSRC",
":",
"'isrc'",
",",
"'TXXX:ASIN'",
":",
"'asin'",
",",
"'TXXX:originalyear'",
":",
"'originalyear'",
",",
"'UFID:http://musicbrainz.org'",
":",
"'musicbrainz_recordingid'",
",",
"'TXXX:MusicBrainz Release Track Id'",
":",
"'musicbrainz_trackid'",
",",
"'TXXX:MusicBrainz Album Id'",
":",
"'musicbrainz_albumid'",
",",
"'TXXX:MusicBrainz Artist Id'",
":",
"'musicbrainz_artistid'",
",",
"'TXXX:MusicBrainz Album Artist Id'",
":",
"'musicbrainz_albumartistid'",
",",
"'TXXX:MusicBrainz Release Group Id'",
":",
"'musicbrainz_releasegroupid'",
",",
"'TXXX:MusicBrainz Work Id'",
":",
"'musicbrainz_workid'",
",",
"'TXXX:MusicBrainz TRM Id'",
":",
"'musicbrainz_trmid'",
",",
"'TXXX:MusicBrainz Disc Id'",
":",
"'musicbrainz_discid'",
",",
"'TXXX:ACOUSTID_ID'",
":",
"'acoustid_id'",
",",
"'TXXX:Acoustid Id'",
":",
"'acoustid_id'",
",",
"'TXXX:Acoustid Fingerprint'",
":",
"'acoustid_fingerprint'",
",",
"'TXXX:MusicIP PUID'",
":",
"'musicip_puid'",
",",
"'TXXX:MusicMagic Fingerprint'",
":",
"'musicip_fingerprint'",
",",
"WOAR",
":",
"'website'",
",",
"TDRC",
":",
"'date'",
",",
"TYER",
":",
"'year'",
",",
"TDOR",
":",
"'originaldate'",
",",
"'TIPL:arranger'",
":",
"'arranger'",
",",
"'TIPL:engineer'",
":",
"'engineer'",
",",
"'TIPL:producer'",
":",
"'producer'",
",",
"'TIPL:DJ-mix'",
":",
"'djmixer'",
",",
"'TIPL:mix'",
":",
"'mixer'",
",",
"TMOO",
":",
"'mood'",
",",
"SYLT",
":",
"'lyrics'",
",",
"TSST",
":",
"'discsubtitle'",
",",
"TKEY",
":",
"'key'",
",",
"COMM",
":",
"'comment'",
",",
"TOPE",
":",
"'originalartist'",
",",
"'PRIV:AverageLevel'",
":",
"'averageLevel'",
",",
"'PRIV:PeakLevel'",
":",
"'peakLevel'",
",",
"'TXXX:DISCOGS_ARTIST_ID'",
":",
"'discogs_artist_id'",
",",
"'TXXX:DISCOGS_ARTISTS'",
":",
"'artists'",
",",
"'TXXX:DISCOGS_ARTIST_NAME'",
":",
"'artists'",
",",
"'TXXX:DISCOGS_ALBUM_ARTISTS'",
":",
"'albumartist'",
",",
"'TXXX:DISCOGS_CATALOG'",
":",
"'catalognumber'",
",",
"'TXXX:DISCOGS_COUNTRY'",
":",
"'releasecountry'",
",",
"'TXXX:DISCOGS_DATE'",
":",
"'originaldate'",
",",
"'TXXX:DISCOGS_LABEL'",
":",
"'label'",
",",
"'TXXX:DISCOGS_LABEL_ID'",
":",
"'discogs_label_id'",
",",
"'TXXX:DISCOGS_MASTER_RELEASE_ID'",
":",
"'discogs_master_release_id'",
",",
"'TXXX:DISCOGS_RATING'",
":",
"'discogs_rating'",
",",
"'TXXX:DISCOGS_RELEASED'",
":",
"'date'",
",",
"'TXXX:DISCOGS_RELEASE_ID'",
":",
"'discogs_release_id'",
",",
"'TXXX:DISCOGS_VOTES'",
":",
"'discogs_votes'",
",",
"'TXXX:CATALOGID'",
":",
"'catalognumber'",
",",
"'TXXX:STYLE'",
":",
"'genre'",
",",
"'TXXX:REPLAYGAIN_TRACK_PEAK'",
":",
"'replaygain_track_peak'",
",",
"'TXXX:REPLAYGAIN_TRACK_GAIN'",
":",
"'replaygain_track_gain'",
",",
"'TXXX:REPLAYGAIN_ALBUM_PEAK'",
":",
"'replaygain_album_peak'",
",",
"'TXXX:REPLAYGAIN_ALBUM_GAIN'",
":",
"'replaygain_album_gain'",
",",
"'TXXX:MP3GAIN_MINMAX'",
":",
"'replaygain_track_minmax'",
",",
"'TXXX:MP3GAIN_ALBUM_MINMAX'",
":",
"'replaygain_album_minmax'",
",",
"'TXXX:MP3GAIN_UNDO'",
":",
"'replaygain_undo'",
",",
"MVNM",
":",
"'movement'",
",",
"MVIN",
":",
"'movementIndex'",
",",
"PCST",
":",
"'podcast'",
",",
"TCAT",
":",
"'category'",
",",
"TDES",
":",
"'description'",
",",
"TDRL",
":",
"'date'",
",",
"TGID",
":",
"'podcastId'",
",",
"TKWD",
":",
"'keywords'",
",",
"WFED",
":",
"'podcasturl'",
"}",
";",
"export",
"class",
"ID3v24TagMapper",
"extends",
"CaseInsensitiveTagMap",
"{",
"public",
"static",
"toRating",
"(",
"popm",
")",
"{",
"return",
"{",
"source",
":",
"popm",
".",
"email",
",",
"rating",
":",
"popm",
".",
"rating",
">",
"0",
"?",
"(",
"popm",
".",
"rating",
"-",
"1",
")",
"/",
"254",
"*",
"CommonTagMapper",
".",
"maxRatingScore",
":",
"undefined",
"}",
";",
"}",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'ID3v2.3'",
",",
"'ID3v2.4'",
"]",
",",
"id3v24TagMap",
")",
";",
"}",
"param",
"{",
"string",
"}",
"tag",
"param",
"warnings",
"return",
"protected",
"postMap",
"(",
"tag",
",",
"warnings",
")",
"{",
"switch",
"(",
"tag",
".",
"id",
")",
"{",
"case",
"'UFID'",
":",
"if",
"(",
"tag",
".",
"value",
".",
"owner_identifier",
"===",
"'http://musicbrainz.org'",
")",
"{",
"tag",
".",
"id",
"+=",
"':'",
"+",
"tag",
".",
"value",
".",
"owner_identifier",
";",
"tag",
".",
"value",
"=",
"util",
".",
"decodeString",
"(",
"tag",
".",
"value",
".",
"identifier",
",",
"'latin1'",
")",
";",
"}",
"break",
";",
"case",
"'PRIV'",
":",
"switch",
"(",
"tag",
".",
"value",
".",
"owner_identifier",
")",
"{",
"case",
"'AverageLevel'",
":",
"case",
"'PeakValue'",
":",
"tag",
".",
"id",
"+=",
"':'",
"+",
"tag",
".",
"value",
".",
"owner_identifier",
";",
"tag",
".",
"value",
"=",
"tag",
".",
"value",
".",
"data",
".",
"length",
"===",
"4",
"?",
"tag",
".",
"value",
".",
"data",
".",
"readUInt32LE",
"(",
"0",
")",
":",
"null",
";",
"if",
"(",
"tag",
".",
"value",
"===",
"null",
")",
"{",
"warnings",
".",
"addWarning",
"(",
"`Failed to parse PRIV:PeakValue`",
")",
";",
"}",
"break",
";",
"default",
":",
"warnings",
".",
"addWarning",
"(",
"`Unknown PRIV owner-identifier: ${",
"tag",
".",
"value",
".",
"owner_identifier",
"}`",
")",
";",
"}",
"break",
";",
"case",
"'COMM'",
":",
"tag",
".",
"value",
"=",
"tag",
".",
"value",
"?",
"tag",
".",
"value",
".",
"text",
":",
"null",
";",
"break",
";",
"case",
"'POPM'",
":",
"tag",
".",
"value",
"=",
"ID3v24TagMapper",
".",
"toRating",
"(",
"tag",
".",
"value",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27131,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
1271,
null,
6865,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661801 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CommonTagMapper",
"}",
"from",
"'../common/GenericTagMapper'",
";",
"import",
"{",
"IRating",
",",
"ITag",
"}",
"from",
"'../type'",
";",
"/**\n * ASF Metadata tag mappings.\n * See http://msdn.microsoft.com/en-us/library/ms867702.aspx\n */",
"const",
"asfTagMap",
"=",
"{",
"Title",
":",
"'title'",
",",
"Author",
":",
"'artist'",
",",
"'WM/AlbumArtist'",
":",
"'albumartist'",
",",
"'WM/AlbumTitle'",
":",
"'album'",
",",
"'WM/Year'",
":",
"'date'",
",",
"'WM/OriginalReleaseTime'",
":",
"'originaldate'",
",",
"'WM/OriginalReleaseYear'",
":",
"'originalyear'",
",",
"Description",
":",
"'comment'",
",",
"'WM/TrackNumber'",
":",
"'track'",
",",
"'WM/PartOfSet'",
":",
"'disk'",
",",
"'WM/Genre'",
":",
"'genre'",
",",
"'WM/Composer'",
":",
"'composer'",
",",
"'WM/Lyrics'",
":",
"'lyrics'",
",",
"'WM/AlbumSortOrder'",
":",
"'albumsort'",
",",
"'WM/TitleSortOrder'",
":",
"'titlesort'",
",",
"'WM/ArtistSortOrder'",
":",
"'artistsort'",
",",
"'WM/AlbumArtistSortOrder'",
":",
"'albumartistsort'",
",",
"'WM/ComposerSortOrder'",
":",
"'composersort'",
",",
"'WM/Writer'",
":",
"'lyricist'",
",",
"'WM/Conductor'",
":",
"'conductor'",
",",
"'WM/ModifiedBy'",
":",
"'remixer'",
",",
"'WM/Engineer'",
":",
"'engineer'",
",",
"'WM/Producer'",
":",
"'producer'",
",",
"'WM/DJMixer'",
":",
"'djmixer'",
",",
"'WM/Mixer'",
":",
"'mixer'",
",",
"'WM/Publisher'",
":",
"'label'",
",",
"'WM/ContentGroupDescription'",
":",
"'grouping'",
",",
"'WM/SubTitle'",
":",
"'subtitle'",
",",
"'WM/SetSubTitle'",
":",
"'discsubtitle'",
",",
"'WM/IsCompilation'",
":",
"'compilation'",
",",
"'WM/SharedUserRating'",
":",
"'rating'",
",",
"'WM/BeatsPerMinute'",
":",
"'bpm'",
",",
"'WM/Mood'",
":",
"'mood'",
",",
"'WM/Media'",
":",
"'media'",
",",
"'WM/CatalogNo'",
":",
"'catalognumber'",
",",
"'MusicBrainz/Album Status'",
":",
"'releasestatus'",
",",
"'MusicBrainz/Album Type'",
":",
"'releasetype'",
",",
"'MusicBrainz/Album Release Country'",
":",
"'releasecountry'",
",",
"'WM/Script'",
":",
"'script'",
",",
"'WM/Language'",
":",
"'language'",
",",
"Copyright",
":",
"'copyright'",
",",
"LICENSE",
":",
"'license'",
",",
"'WM/EncodedBy'",
":",
"'encodedby'",
",",
"'WM/EncodingSettings'",
":",
"'encodersettings'",
",",
"'WM/Barcode'",
":",
"'barcode'",
",",
"'WM/ISRC'",
":",
"'isrc'",
",",
"'MusicBrainz/Track Id'",
":",
"'musicbrainz_recordingid'",
",",
"'MusicBrainz/Release Track Id'",
":",
"'musicbrainz_trackid'",
",",
"'MusicBrainz/Album Id'",
":",
"'musicbrainz_albumid'",
",",
"'MusicBrainz/Artist Id'",
":",
"'musicbrainz_artistid'",
",",
"'MusicBrainz/Album Artist Id'",
":",
"'musicbrainz_albumartistid'",
",",
"'MusicBrainz/Release Group Id'",
":",
"'musicbrainz_releasegroupid'",
",",
"'MusicBrainz/Work Id'",
":",
"'musicbrainz_workid'",
",",
"'MusicBrainz/TRM Id'",
":",
"'musicbrainz_trmid'",
",",
"'MusicBrainz/Disc Id'",
":",
"'musicbrainz_discid'",
",",
"'Acoustid/Id'",
":",
"'acoustid_id'",
",",
"'Acoustid/Fingerprint'",
":",
"'acoustid_fingerprint'",
",",
"'MusicIP/PUID'",
":",
"'musicip_puid'",
",",
"'WM/ARTISTS'",
":",
"'artists'",
",",
"'WM/InitialKey'",
":",
"'key'",
",",
"ASIN",
":",
"'asin'",
",",
"'WM/Work'",
":",
"'work'",
",",
"'WM/AuthorURL'",
":",
"'website'",
",",
"'WM/Picture'",
":",
"'picture'",
"}",
";",
"export",
"class",
"AsfTagMapper",
"extends",
"CommonTagMapper",
"{",
"public",
"static",
"toRating",
"(",
"rating",
")",
"{",
"return",
"{",
"rating",
":",
"parseFloat",
"(",
"rating",
"+",
"1",
")",
"/",
"5",
"}",
";",
"}",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'asf'",
"]",
",",
"asfTagMap",
")",
";",
"}",
"protected",
"postMap",
"(",
"tag",
")",
"{",
"switch",
"(",
"tag",
".",
"id",
")",
"{",
"case",
"'WM/SharedUserRating'",
":",
"const",
"keys",
"=",
"tag",
".",
"id",
".",
"split",
"(",
"':'",
")",
";",
"tag",
".",
"value",
"=",
"AsfTagMapper",
".",
"toRating",
"(",
"tag",
".",
"value",
")",
";",
"tag",
".",
"id",
"=",
"keys",
"[",
"0",
"]",
";",
"break",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27131,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
1271,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661802 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CaseInsensitiveTagMap",
"}",
"from",
"'../common/CaseInsensitiveTagMap'",
";",
"/**\n * ID3v2.2 tag mappings\n */",
"export",
"const",
"id3v22TagMap",
"=",
"{",
"TT2",
":",
"'title'",
",",
"TP1",
":",
"'artist'",
",",
"TP2",
":",
"'albumartist'",
",",
"TAL",
":",
"'album'",
",",
"TYE",
":",
"'year'",
",",
"COM",
":",
"'comment'",
",",
"TRK",
":",
"'track'",
",",
"TPA",
":",
"'disk'",
",",
"TCO",
":",
"'genre'",
",",
"PIC",
":",
"'picture'",
",",
"TCM",
":",
"'composer'",
",",
"TOR",
":",
"'originaldate'",
",",
"TOT",
":",
"'originalalbum'",
",",
"TXT",
":",
"'lyricist'",
",",
"TP3",
":",
"'conductor'",
",",
"TPB",
":",
"'label'",
",",
"TT1",
":",
"'grouping'",
",",
"TT3",
":",
"'subtitle'",
",",
"TLA",
":",
"'language'",
",",
"TCR",
":",
"'copyright'",
",",
"WCP",
":",
"'license'",
",",
"TEN",
":",
"'encodedby'",
",",
"TSS",
":",
"'encodersettings'",
",",
"WAR",
":",
"'website'",
",",
"'COM:iTunPGAP'",
":",
"'gapless'",
",",
"PCS",
":",
"'podcast'",
",",
"TCP",
":",
"\"compilation\"",
",",
"TDR",
":",
"'date'",
",",
"TS2",
":",
"'albumartistsort'",
",",
"TSA",
":",
"'albumsort'",
",",
"TSC",
":",
"'composersort'",
",",
"TSP",
":",
"'artistsort'",
",",
"TST",
":",
"'titlesort'",
",",
"WFD",
":",
"'podcasturl'",
",",
"TBP",
":",
"'bpm'",
"}",
";",
"export",
"class",
"ID3v22TagMapper",
"extends",
"CaseInsensitiveTagMap",
"{",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'ID3v2.2'",
"]",
",",
"id3v22TagMap",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661803 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CaseInsensitiveTagMap",
"}",
"from",
"'../common/CaseInsensitiveTagMap'",
";",
"/**\n * ID3v2.2 tag mappings\n */",
"const",
"apev2TagMap",
"=",
"{",
"Title",
":",
"'title'",
",",
"Artist",
":",
"'artist'",
",",
"Artists",
":",
"'artists'",
",",
"'Album Artist'",
":",
"'albumartist'",
",",
"Album",
":",
"'album'",
",",
"Year",
":",
"'date'",
",",
"Originalyear",
":",
"'originalyear'",
",",
"Originaldate",
":",
"'originaldate'",
",",
"Comment",
":",
"'comment'",
",",
"Track",
":",
"'track'",
",",
"Disc",
":",
"'disk'",
",",
"DISCNUMBER",
":",
"'disk'",
",",
"Genre",
":",
"'genre'",
",",
"'Cover Art (Front)'",
":",
"'picture'",
",",
"'Cover Art (Back)'",
":",
"'picture'",
",",
"Composer",
":",
"'composer'",
",",
"Lyrics",
":",
"'lyrics'",
",",
"ALBUMSORT",
":",
"'albumsort'",
",",
"TITLESORT",
":",
"'titlesort'",
",",
"WORK",
":",
"'work'",
",",
"ARTISTSORT",
":",
"'artistsort'",
",",
"ALBUMARTISTSORT",
":",
"'albumartistsort'",
",",
"COMPOSERSORT",
":",
"'composersort'",
",",
"Lyricist",
":",
"'lyricist'",
",",
"Writer",
":",
"'writer'",
",",
"Conductor",
":",
"'conductor'",
",",
"MixArtist",
":",
"'remixer'",
",",
"Arranger",
":",
"'arranger'",
",",
"Engineer",
":",
"'engineer'",
",",
"Producer",
":",
"'producer'",
",",
"DJMixer",
":",
"'djmixer'",
",",
"Mixer",
":",
"'mixer'",
",",
"Label",
":",
"'label'",
",",
"Grouping",
":",
"'grouping'",
",",
"Subtitle",
":",
"'subtitle'",
",",
"DiscSubtitle",
":",
"'discsubtitle'",
",",
"Compilation",
":",
"'compilation'",
",",
"BPM",
":",
"'bpm'",
",",
"Mood",
":",
"'mood'",
",",
"Media",
":",
"'media'",
",",
"CatalogNumber",
":",
"'catalognumber'",
",",
"MUSICBRAINZ_ALBUMSTATUS",
":",
"'releasestatus'",
",",
"MUSICBRAINZ_ALBUMTYPE",
":",
"'releasetype'",
",",
"RELEASECOUNTRY",
":",
"'releasecountry'",
",",
"Script",
":",
"'script'",
",",
"Language",
":",
"'language'",
",",
"Copyright",
":",
"'copyright'",
",",
"LICENSE",
":",
"'license'",
",",
"EncodedBy",
":",
"'encodedby'",
",",
"EncoderSettings",
":",
"'encodersettings'",
",",
"Barcode",
":",
"'barcode'",
",",
"ISRC",
":",
"'isrc'",
",",
"ASIN",
":",
"'asin'",
",",
"musicbrainz_trackid",
":",
"'musicbrainz_recordingid'",
",",
"musicbrainz_releasetrackid",
":",
"'musicbrainz_trackid'",
",",
"MUSICBRAINZ_ALBUMID",
":",
"'musicbrainz_albumid'",
",",
"MUSICBRAINZ_ARTISTID",
":",
"'musicbrainz_artistid'",
",",
"MUSICBRAINZ_ALBUMARTISTID",
":",
"'musicbrainz_albumartistid'",
",",
"MUSICBRAINZ_RELEASEGROUPID",
":",
"'musicbrainz_releasegroupid'",
",",
"MUSICBRAINZ_WORKID",
":",
"'musicbrainz_workid'",
",",
"MUSICBRAINZ_TRMID",
":",
"'musicbrainz_trmid'",
",",
"MUSICBRAINZ_DISCID",
":",
"'musicbrainz_discid'",
",",
"Acoustid_Id",
":",
"'acoustid_id'",
",",
"ACOUSTID_FINGERPRINT",
":",
"'acoustid_fingerprint'",
",",
"MUSICIP_PUID",
":",
"'musicip_puid'",
",",
"Weblink",
":",
"'website'",
",",
"REPLAYGAIN_TRACK_GAIN",
":",
"'replaygain_track_gain'",
",",
"REPLAYGAIN_TRACK_PEAK",
":",
"'replaygain_track_peak'",
",",
"MP3GAIN_MINMAX",
":",
"'replaygain_track_minmax'",
",",
"MP3GAIN_UNDO",
":",
"'replaygain_undo'",
"}",
";",
"export",
"class",
"APEv2TagMapper",
"extends",
"CaseInsensitiveTagMap",
"{",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'APEv2'",
"]",
",",
"apev2TagMap",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661804 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CaseInsensitiveTagMap",
"}",
"from",
"'../common/CaseInsensitiveTagMap'",
";",
"/**\n * Ref: https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata\n */",
"const",
"mp4TagMap",
"=",
"{",
"'©nam'",
":",
"'title'",
",",
"'©ART'",
":",
"'artist'",
",",
"aART",
":",
"'albumartist'",
",",
"/**\n * ToDo: Album artist seems to be stored here while Picard documentation says: aART\n */",
"'----:com.apple.iTunes:Band'",
":",
"'albumartist'",
",",
"'©alb'",
":",
"'album'",
",",
"'©day'",
":",
"'date'",
",",
"'©cmt'",
":",
"'comment'",
",",
"'©com'",
":",
"'comment'",
",",
"trkn",
":",
"'track'",
",",
"disk",
":",
"'disk'",
",",
"'©gen'",
":",
"'genre'",
",",
"covr",
":",
"'picture'",
",",
"'©wrt'",
":",
"'composer'",
",",
"'©lyr'",
":",
"'lyrics'",
",",
"soal",
":",
"'albumsort'",
",",
"sonm",
":",
"'titlesort'",
",",
"soar",
":",
"'artistsort'",
",",
"soaa",
":",
"'albumartistsort'",
",",
"soco",
":",
"'composersort'",
",",
"'----:com.apple.iTunes:LYRICIST'",
":",
"'lyricist'",
",",
"'----:com.apple.iTunes:CONDUCTOR'",
":",
"'conductor'",
",",
"'----:com.apple.iTunes:REMIXER'",
":",
"'remixer'",
",",
"'----:com.apple.iTunes:ENGINEER'",
":",
"'engineer'",
",",
"'----:com.apple.iTunes:PRODUCER'",
":",
"'producer'",
",",
"'----:com.apple.iTunes:DJMIXER'",
":",
"'djmixer'",
",",
"'----:com.apple.iTunes:MIXER'",
":",
"'mixer'",
",",
"'----:com.apple.iTunes:LABEL'",
":",
"'label'",
",",
"'©grp'",
":",
"'grouping'",
",",
"'----:com.apple.iTunes:SUBTITLE'",
":",
"'subtitle'",
",",
"'----:com.apple.iTunes:DISCSUBTITLE'",
":",
"'discsubtitle'",
",",
"cpil",
":",
"'compilation'",
",",
"tmpo",
":",
"'bpm'",
",",
"'----:com.apple.iTunes:MOOD'",
":",
"'mood'",
",",
"'----:com.apple.iTunes:MEDIA'",
":",
"'media'",
",",
"'----:com.apple.iTunes:CATALOGNUMBER'",
":",
"'catalognumber'",
",",
"tvsh",
":",
"'tvShow'",
",",
"tvsn",
":",
"'tvSeason'",
",",
"tves",
":",
"'tvEpisode'",
",",
"sosn",
":",
"'tvShowSort'",
",",
"tven",
":",
"'tvEpisodeId'",
",",
"tvnn",
":",
"'tvNetwork'",
",",
"pcst",
":",
"'podcast'",
",",
"purl",
":",
"'podcasturl'",
",",
"'----:com.apple.iTunes:MusicBrainz Album Status'",
":",
"'releasestatus'",
",",
"'----:com.apple.iTunes:MusicBrainz Album Type'",
":",
"'releasetype'",
",",
"'----:com.apple.iTunes:MusicBrainz Album Release Country'",
":",
"'releasecountry'",
",",
"'----:com.apple.iTunes:SCRIPT'",
":",
"'script'",
",",
"'----:com.apple.iTunes:LANGUAGE'",
":",
"'language'",
",",
"cprt",
":",
"'copyright'",
",",
"'©cpy'",
":",
"'copyright'",
",",
"'----:com.apple.iTunes:LICENSE'",
":",
"'license'",
",",
"'©too'",
":",
"'encodedby'",
",",
"pgap",
":",
"'gapless'",
",",
"'----:com.apple.iTunes:BARCODE'",
":",
"'barcode'",
",",
"'----:com.apple.iTunes:ISRC'",
":",
"'isrc'",
",",
"'----:com.apple.iTunes:ASIN'",
":",
"'asin'",
",",
"'----:com.apple.iTunes:NOTES'",
":",
"'comment'",
",",
"'----:com.apple.iTunes:MusicBrainz Track Id'",
":",
"'musicbrainz_recordingid'",
",",
"'----:com.apple.iTunes:MusicBrainz Release Track Id'",
":",
"'musicbrainz_trackid'",
",",
"'----:com.apple.iTunes:MusicBrainz Album Id'",
":",
"'musicbrainz_albumid'",
",",
"'----:com.apple.iTunes:MusicBrainz Artist Id'",
":",
"'musicbrainz_artistid'",
",",
"'----:com.apple.iTunes:MusicBrainz Album Artist Id'",
":",
"'musicbrainz_albumartistid'",
",",
"'----:com.apple.iTunes:MusicBrainz Release Group Id'",
":",
"'musicbrainz_releasegroupid'",
",",
"'----:com.apple.iTunes:MusicBrainz Work Id'",
":",
"'musicbrainz_workid'",
",",
"'----:com.apple.iTunes:MusicBrainz TRM Id'",
":",
"'musicbrainz_trmid'",
",",
"'----:com.apple.iTunes:MusicBrainz Disc Id'",
":",
"'musicbrainz_discid'",
",",
"'----:com.apple.iTunes:Acoustid Id'",
":",
"'acoustid_id'",
",",
"'----:com.apple.iTunes:Acoustid Fingerprint'",
":",
"'acoustid_fingerprint'",
",",
"'----:com.apple.iTunes:MusicIP PUID'",
":",
"'musicip_puid'",
",",
"'----:com.apple.iTunes:fingerprint'",
":",
"'musicip_fingerprint'",
",",
"'----:com.apple.iTunes:replaygain_track_gain'",
":",
"'replaygain_track_gain'",
",",
"'----:com.apple.iTunes:replaygain_track_peak'",
":",
"'replaygain_track_peak'",
",",
"'----:com.apple.iTunes:replaygain_album_gain'",
":",
"'replaygain_album_gain'",
",",
"'----:com.apple.iTunes:replaygain_album_peak'",
":",
"'replaygain_album_peak'",
",",
"'----:com.apple.iTunes:replaygain_track_minmax'",
":",
"'replaygain_track_minmax'",
",",
"'----:com.apple.iTunes:replaygain_album_minmax'",
":",
"'replaygain_album_minmax'",
",",
"'----:com.apple.iTunes:replaygain_undo'",
":",
"'replaygain_undo'",
",",
"gnre",
":",
"'genre'",
",",
"'----:com.apple.iTunes:ALBUMARTISTSORT'",
":",
"'albumartistsort'",
",",
"'----:com.apple.iTunes:ARTISTS'",
":",
"'artists'",
",",
"'----:com.apple.iTunes:ORIGINALDATE'",
":",
"'originaldate'",
",",
"'----:com.apple.iTunes:ORIGINALYEAR'",
":",
"'originalyear'",
",",
"desc",
":",
"'description'",
",",
"ldes",
":",
"'longDescription'",
",",
"'©mvn'",
":",
"'movement'",
",",
"'©mvi'",
":",
"'movementIndex'",
",",
"'©mvc'",
":",
"'movementTotal'",
",",
"'©wrk'",
":",
"'work'",
",",
"catg",
":",
"'category'",
",",
"egid",
":",
"'podcastId'",
",",
"hdvd",
":",
"'hdVideo'",
",",
"keyw",
":",
"'keywords'",
",",
"shwm",
":",
"'showMovement'",
",",
"stik",
":",
"'stik'",
"}",
";",
"export",
"const",
"tagType",
"=",
"'iTunes'",
";",
"export",
"class",
"MP4TagMapper",
"extends",
"CaseInsensitiveTagMap",
"{",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"tagType",
"]",
",",
"mp4TagMap",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661805 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../../common/GenericTagTypes'",
";",
"import",
"{",
"CommonTagMapper",
"}",
"from",
"'../../common/GenericTagMapper'",
";",
"import",
"{",
"IRating",
",",
"ITag",
"}",
"from",
"'../../type'",
";",
"/**\n * Vorbis tag mappings\n *\n * Mapping from native header format to one or possibly more 'common' entries\n * The common entries aim to read the same information from different media files\n * independent of the underlying format\n */",
"const",
"vorbisTagMap",
"=",
"{",
"TITLE",
":",
"'title'",
",",
"ARTIST",
":",
"'artist'",
",",
"ARTISTS",
":",
"'artists'",
",",
"ALBUMARTIST",
":",
"'albumartist'",
",",
"'ALBUM ARTIST'",
":",
"'albumartist'",
",",
"ALBUM",
":",
"'album'",
",",
"DATE",
":",
"'date'",
",",
"ORIGINALDATE",
":",
"'originaldate'",
",",
"ORIGINALYEAR",
":",
"'originalyear'",
",",
"COMMENT",
":",
"'comment'",
",",
"TRACKNUMBER",
":",
"'track'",
",",
"DISCNUMBER",
":",
"'disk'",
",",
"GENRE",
":",
"'genre'",
",",
"METADATA_BLOCK_PICTURE",
":",
"'picture'",
",",
"COMPOSER",
":",
"'composer'",
",",
"LYRICS",
":",
"'lyrics'",
",",
"ALBUMSORT",
":",
"'albumsort'",
",",
"TITLESORT",
":",
"'titlesort'",
",",
"WORK",
":",
"'work'",
",",
"ARTISTSORT",
":",
"'artistsort'",
",",
"ALBUMARTISTSORT",
":",
"'albumartistsort'",
",",
"COMPOSERSORT",
":",
"'composersort'",
",",
"LYRICIST",
":",
"'lyricist'",
",",
"WRITER",
":",
"'writer'",
",",
"CONDUCTOR",
":",
"'conductor'",
",",
"REMIXER",
":",
"'remixer'",
",",
"ARRANGER",
":",
"'arranger'",
",",
"ENGINEER",
":",
"'engineer'",
",",
"PRODUCER",
":",
"'producer'",
",",
"DJMIXER",
":",
"'djmixer'",
",",
"MIXER",
":",
"'mixer'",
",",
"LABEL",
":",
"'label'",
",",
"GROUPING",
":",
"'grouping'",
",",
"SUBTITLE",
":",
"'subtitle'",
",",
"DISCSUBTITLE",
":",
"'discsubtitle'",
",",
"TRACKTOTAL",
":",
"'totaltracks'",
",",
"DISCTOTAL",
":",
"'totaldiscs'",
",",
"COMPILATION",
":",
"'compilation'",
",",
"RATING",
":",
"'rating'",
",",
"BPM",
":",
"'bpm'",
",",
"KEY",
":",
"'key'",
",",
"MOOD",
":",
"'mood'",
",",
"MEDIA",
":",
"'media'",
",",
"CATALOGNUMBER",
":",
"'catalognumber'",
",",
"RELEASESTATUS",
":",
"'releasestatus'",
",",
"RELEASETYPE",
":",
"'releasetype'",
",",
"RELEASECOUNTRY",
":",
"'releasecountry'",
",",
"SCRIPT",
":",
"'script'",
",",
"LANGUAGE",
":",
"'language'",
",",
"COPYRIGHT",
":",
"'copyright'",
",",
"LICENSE",
":",
"'license'",
",",
"ENCODEDBY",
":",
"'encodedby'",
",",
"ENCODERSETTINGS",
":",
"'encodersettings'",
",",
"BARCODE",
":",
"'barcode'",
",",
"ISRC",
":",
"'isrc'",
",",
"ASIN",
":",
"'asin'",
",",
"MUSICBRAINZ_TRACKID",
":",
"'musicbrainz_recordingid'",
",",
"MUSICBRAINZ_RELEASETRACKID",
":",
"'musicbrainz_trackid'",
",",
"MUSICBRAINZ_ALBUMID",
":",
"'musicbrainz_albumid'",
",",
"MUSICBRAINZ_ARTISTID",
":",
"'musicbrainz_artistid'",
",",
"MUSICBRAINZ_ALBUMARTISTID",
":",
"'musicbrainz_albumartistid'",
",",
"MUSICBRAINZ_RELEASEGROUPID",
":",
"'musicbrainz_releasegroupid'",
",",
"MUSICBRAINZ_WORKID",
":",
"'musicbrainz_workid'",
",",
"MUSICBRAINZ_TRMID",
":",
"'musicbrainz_trmid'",
",",
"MUSICBRAINZ_DISCID",
":",
"'musicbrainz_discid'",
",",
"ACOUSTID_ID",
":",
"'acoustid_id'",
",",
"ACOUSTID_ID_FINGERPRINT",
":",
"'acoustid_fingerprint'",
",",
"MUSICIP_PUID",
":",
"'musicip_puid'",
",",
"WEBSITE",
":",
"'website'",
",",
"NOTES",
":",
"'notes'",
",",
"TOTALTRACKS",
":",
"'totaltracks'",
",",
"TOTALDISCS",
":",
"'totaldiscs'",
",",
"DISCOGS_ARTIST_ID",
":",
"'discogs_artist_id'",
",",
"DISCOGS_ARTISTS",
":",
"'artists'",
",",
"DISCOGS_ARTIST_NAME",
":",
"'artists'",
",",
"DISCOGS_ALBUM_ARTISTS",
":",
"'albumartist'",
",",
"DISCOGS_CATALOG",
":",
"'catalognumber'",
",",
"DISCOGS_COUNTRY",
":",
"'releasecountry'",
",",
"DISCOGS_DATE",
":",
"'originaldate'",
",",
"DISCOGS_LABEL",
":",
"'label'",
",",
"DISCOGS_LABEL_ID",
":",
"'discogs_label_id'",
",",
"DISCOGS_MASTER_RELEASE_ID",
":",
"'discogs_master_release_id'",
",",
"DISCOGS_RATING",
":",
"'discogs_rating'",
",",
"DISCOGS_RELEASED",
":",
"'date'",
",",
"DISCOGS_RELEASE_ID",
":",
"'discogs_release_id'",
",",
"DISCOGS_VOTES",
":",
"'discogs_votes'",
",",
"CATALOGID",
":",
"'catalognumber'",
",",
"STYLE",
":",
"'genre'",
",",
"REPLAYGAIN_TRACK_GAIN",
":",
"'replaygain_track_gain'",
",",
"REPLAYGAIN_TRACK_PEAK",
":",
"'replaygain_track_peak'",
",",
"REPLAYGAIN_ALBUM_GAIN",
":",
"'replaygain_album_gain'",
",",
"REPLAYGAIN_ALBUM_PEAK",
":",
"'replaygain_album_peak'",
",",
"REPLAYGAIN_MINMAX",
":",
"'replaygain_track_minmax'",
",",
"REPLAYGAIN_ALBUM_MINMAX",
":",
"'replaygain_album_minmax'",
",",
"REPLAYGAIN_UNDO",
":",
"'replaygain_undo'",
"}",
";",
"export",
"class",
"VorbisTagMapper",
"extends",
"CommonTagMapper",
"{",
"public",
"static",
"toRating",
"(",
"email",
",",
"rating",
")",
"{",
"return",
"{",
"source",
":",
"email",
"?",
"email",
".",
"toLowerCase",
"(",
")",
":",
"email",
",",
"rating",
":",
"parseFloat",
"(",
"rating",
")",
"*",
"CommonTagMapper",
".",
"maxRatingScore",
"}",
";",
"}",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'vorbis'",
"]",
",",
"vorbisTagMap",
")",
";",
"}",
"protected",
"postMap",
"(",
"tag",
")",
"{",
"if",
"(",
"tag",
".",
"id",
".",
"indexOf",
"(",
"'RATING:'",
")",
"===",
"0",
")",
"{",
"const",
"keys",
"=",
"tag",
".",
"id",
".",
"split",
"(",
"':'",
")",
";",
"tag",
".",
"value",
"=",
"VorbisTagMapper",
".",
"toRating",
"(",
"keys",
"[",
"1",
"]",
",",
"tag",
".",
"value",
")",
";",
"tag",
".",
"id",
"=",
"keys",
"[",
"0",
"]",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27131,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
1271,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661806 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CommonTagMapper",
"}",
"from",
"'../common/GenericTagMapper'",
";",
"/**\n * RIFF Info Tags; part of the EXIF 2.3\n * Ref: http://owl.phy.queensu.ca/~phil/exiftool/TagNames/RIFF.html#Info\n */",
"export",
"const",
"riffInfoTagMap",
"=",
"{",
"IART",
":",
"'artist'",
",",
"ICRD",
":",
"'date'",
",",
"INAM",
":",
"'title'",
",",
"TITL",
":",
"'title'",
",",
"IPRD",
":",
"'album'",
",",
"ITRK",
":",
"'track'",
",",
"COMM",
":",
"'comment'",
",",
"ICMT",
":",
"'comment'",
",",
"ICNT",
":",
"'releasecountry'",
",",
"GNRE",
":",
"'genre'",
",",
"IWRI",
":",
"'writer'",
",",
"RATE",
":",
"'rating'",
",",
"YEAR",
":",
"'year'",
",",
"ISFT",
":",
"'encodedby'",
",",
"CODE",
":",
"'encodedby'",
",",
"TURL",
":",
"'website'",
",",
"IGNR",
":",
"'genre'",
",",
"IENG",
":",
"'engineer'",
",",
"ITCH",
":",
"'technician'",
",",
"IMED",
":",
"'media'",
",",
"IRPD",
":",
"'album'",
"}",
";",
"export",
"class",
"RiffInfoTagMapper",
"extends",
"CommonTagMapper",
"{",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'exif'",
"]",
",",
"riffInfoTagMap",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661807 | [
"import",
"{",
"INativeTagMap",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"CaseInsensitiveTagMap",
"}",
"from",
"'../common/CaseInsensitiveTagMap'",
";",
"/**\n * EBML Tag map\n */",
"const",
"ebmlTagMap",
"=",
"{",
"'segment:title'",
":",
"'title'",
",",
"'album:ARTIST'",
":",
"'albumartist'",
",",
"'album:ARTISTSORT'",
":",
"'albumartistsort'",
",",
"'album:TITLE'",
":",
"'album'",
",",
"'album:DATE_RECORDED'",
":",
"'originaldate'",
",",
"'album:PART_NUMBER'",
":",
"'disk'",
",",
"'album:TOTAL_PARTS'",
":",
"'totaltracks'",
",",
"'track:ARTIST'",
":",
"'artist'",
",",
"'track:ARTISTSORT'",
":",
"'artistsort'",
",",
"'track:TITLE'",
":",
"'title'",
",",
"'track:PART_NUMBER'",
":",
"'track'",
",",
"'track:MUSICBRAINZ_TRACKID'",
":",
"'musicbrainz_recordingid'",
",",
"'track:MUSICBRAINZ_ALBUMID'",
":",
"'musicbrainz_albumid'",
",",
"'track:MUSICBRAINZ_ARTISTID'",
":",
"'musicbrainz_artistid'",
",",
"'track:PUBLISHER'",
":",
"'label'",
",",
"'track:GENRE'",
":",
"'genre'",
",",
"'track:ENCODER'",
":",
"'encodedby'",
",",
"'track:ENCODER_OPTIONS'",
":",
"'encodersettings'",
",",
"'edition:TOTAL_PARTS'",
":",
"'totaldiscs'",
",",
"picture",
":",
"'picture'",
"}",
";",
"export",
"class",
"MatroskaTagMapper",
"extends",
"CaseInsensitiveTagMap",
"{",
"public",
"constructor",
"(",
")",
"{",
"super",
"(",
"[",
"'matroska'",
"]",
",",
"ebmlTagMap",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7341,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661808 | [
"import",
"{",
"ID3v1TagMapper",
"}",
"from",
"\"../id3v1/ID3v1TagMap\"",
";",
"import",
"{",
"ID3v24TagMapper",
"}",
"from",
"\"../id3v2/ID3v24TagMapper\"",
";",
"import",
"{",
"AsfTagMapper",
"}",
"from",
"\"../asf/AsfTagMapper\"",
";",
"import",
"{",
"IGenericTag",
",",
"TagType",
"}",
"from",
"\"./GenericTagTypes\"",
";",
"import",
"{",
"ID3v22TagMapper",
"}",
"from",
"\"../id3v2/ID3v22TagMapper\"",
";",
"import",
"{",
"APEv2TagMapper",
"}",
"from",
"\"../apev2/APEv2TagMapper\"",
";",
"import",
"{",
"IGenericTagMapper",
"}",
"from",
"\"./GenericTagMapper\"",
";",
"import",
"{",
"MP4TagMapper",
"}",
"from",
"\"../mp4/MP4TagMapper\"",
";",
"import",
"{",
"VorbisTagMapper",
"}",
"from",
"\"../ogg/vorbis/VorbisTagMapper\"",
";",
"import",
"{",
"RiffInfoTagMapper",
"}",
"from",
"\"../riff/RiffInfoTagMap\"",
";",
"import",
"{",
"ITag",
"}",
"from",
"\"../type\"",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'./MetadataCollector'",
";",
"import",
"{",
"MatroskaTagMapper",
"}",
"from",
"'../matroska/MatroskaTagMapper'",
";",
"export",
"class",
"CombinedTagMapper",
"{",
"public",
"tagMappers",
":",
"{",
"[",
"index",
"]",
":",
"IGenericTagMapper",
";",
"}",
"=",
"{",
"}",
";",
"public",
"constructor",
"(",
")",
"{",
"[",
"new",
"ID3v1TagMapper",
"(",
")",
",",
"new",
"ID3v22TagMapper",
"(",
")",
",",
"new",
"ID3v24TagMapper",
"(",
")",
",",
"new",
"MP4TagMapper",
"(",
")",
",",
"new",
"MP4TagMapper",
"(",
")",
",",
"new",
"VorbisTagMapper",
"(",
")",
",",
"new",
"APEv2TagMapper",
"(",
")",
",",
"new",
"AsfTagMapper",
"(",
")",
",",
"new",
"RiffInfoTagMapper",
"(",
")",
",",
"new",
"MatroskaTagMapper",
"(",
")",
"]",
".",
"forEach",
"(",
"mapper",
"=>",
"{",
"this",
".",
"registerTagMapper",
"(",
"mapper",
")",
";",
"}",
")",
";",
"}",
"param",
"tagType",
"param",
"tag",
"param",
"warnings",
"return",
"public",
"mapTag",
"(",
"tagType",
",",
"tag",
",",
"warnings",
")",
"{",
"const",
"tagMapper",
"=",
"this",
".",
"tagMappers",
"[",
"tagType",
"]",
";",
"if",
"(",
"tagMapper",
")",
"{",
"return",
"this",
".",
"tagMappers",
"[",
"tagType",
"]",
".",
"mapGenericTag",
"(",
"tag",
",",
"warnings",
")",
";",
"}",
"throw",
"new",
"Error",
"(",
"\"No generic tag mapper defined for tag-format: \"",
"+",
"tagType",
")",
";",
"}",
"private",
"registerTagMapper",
"(",
"genericTagMapper",
")",
"{",
"for",
"(",
"const",
"tagType",
"of",
"genericTagMapper",
".",
"tagTypes",
")",
"{",
"this",
".",
"tagMappers",
"[",
"tagType",
"]",
"=",
"genericTagMapper",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
16309,
null,
3940,
null,
1271,
null,
6865,
null,
null,
null,
28981,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
28981,
null,
null,
null,
null,
null,
3940,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661809 | [
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"{",
"commonTags",
"}",
"from",
"'../lib/common/GenericTagTypes'",
";",
"import",
"{",
"CombinedTagMapper",
"}",
"from",
"'../lib/common/CombinedTagMapper'",
";",
"import",
"*",
"as",
"markDown",
"from",
"\"./MarkDown\"",
";",
"interface",
"ITagInfoDict",
"{",
"[",
"key",
"]",
":",
"{",
"description",
":",
"string",
";",
"}",
";",
"}",
"const",
"combinedTagMapper",
"=",
"new",
"CombinedTagMapper",
"(",
")",
";",
"function",
"getNativeSourceTags",
"(",
"nativeType",
",",
"commonTag",
")",
"{",
"const",
"result",
"=",
"[",
"]",
";",
"const",
"tagMapper",
"=",
"combinedTagMapper",
".",
"tagMappers",
"[",
"nativeType",
"]",
";",
"Object",
".",
"keys",
"(",
"tagMapper",
".",
"tagMap",
")",
".",
"forEach",
"(",
"nativeTag",
"=>",
"{",
"if",
"(",
"commonTag",
"===",
"tagMapper",
".",
"tagMap",
"[",
"nativeTag",
"]",
")",
"{",
"result",
".",
"push",
"(",
"nativeTag",
")",
";",
"}",
"}",
")",
";",
"return",
"result",
";",
"}",
"function",
"write",
"(",
"out",
")",
"{",
"const",
"json",
"=",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'common.json'",
")",
")",
";",
"const",
"commonDescriptionDict",
"=",
"JSON",
".",
"parse",
"(",
"json",
"as",
"any",
")",
";",
"const",
"table",
"=",
"new",
"markDown",
".",
"Table",
"(",
")",
";",
"table",
".",
"header",
"=",
"new",
"markDown",
".",
"Row",
"(",
"[",
"\"Common tag\"",
",",
"\"n\"",
",",
"\"Description\"",
"]",
")",
";",
"for",
"(",
"const",
"nativeType",
"in",
"combinedTagMapper",
".",
"tagMappers",
")",
"{",
"table",
".",
"header",
".",
"values",
".",
"push",
"(",
"nativeType",
")",
";",
"}",
"for",
"(",
"const",
"commonTagKey",
"of",
"Object",
".",
"keys",
"(",
"commonTags",
")",
")",
"{",
"const",
"tagInfo",
"=",
"commonDescriptionDict",
"[",
"commonTagKey",
"]",
";",
"if",
"(",
"!",
"tagInfo",
")",
"throw",
"new",
"Error",
"(",
"`${",
"commonTagKey",
"} not found`",
")",
";",
"const",
"multiplicity",
"=",
"commonTags",
"[",
"commonTagKey",
"]",
".",
"multiple",
"?",
"'*'",
":",
"'1'",
";",
"const",
"row",
"=",
"new",
"markDown",
".",
"Row",
"(",
"[",
"commonTagKey",
",",
"multiplicity",
",",
"tagInfo",
".",
"description",
"]",
")",
";",
"for",
"(",
"const",
"nativeType",
"in",
"combinedTagMapper",
".",
"tagMappers",
")",
"{",
"row",
".",
"values",
".",
"push",
"(",
"getNativeSourceTags",
"(",
"nativeType",
",",
"commonTagKey",
")",
".",
"join",
"(",
"\", \"",
")",
")",
";",
"}",
"table",
".",
"rows",
".",
"push",
"(",
"row",
")",
";",
"}",
"table",
".",
"writeTo",
"(",
"out",
")",
";",
"}",
"const",
"txt",
"=",
"fs",
".",
"createWriteStream",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'doc'",
",",
"'common_metadata.md'",
")",
")",
";",
"txt",
".",
"write",
"(",
"\"# Common Metadata\\n\\n\"",
")",
";",
"txt",
".",
"write",
"(",
"\"Common tags, and _native_ to _common_ tag mappings. _n_ indicates the multiplicity.\\n\"",
")",
";",
"txt",
".",
"write",
"(",
"\"The tag mapping is strongly inspired on the [MusicBrainz Picard tag-mapping](https://picard.musicbrainz.org/docs/mappings/).\\n\\n\"",
")",
";",
"write",
"(",
"txt",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
2,
null,
null,
null,
5,
null,
null,
null,
null,
null,
28981,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
8810,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
285,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
392,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
846,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661810 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"/**\n * The picture type according to the ID3v2 APIC frame\n * Ref: http://id3.org/id3v2.3.0#Attached_picture\n */",
"export",
"enum",
"AttachedPictureType",
"{",
"'Other'",
",",
"\"32x32 pixels 'file icon' (PNG only)\"",
",",
"'Other file icon'",
",",
"'Cover (front)'",
",",
"'Cover (back)'",
",",
"'Leaflet page'",
",",
"'Media (e.g. label side of CD)'",
",",
"'Lead artist/lead performer/soloist'",
",",
"'Artist/performer'",
",",
"'Conductor'",
",",
"'Band/Orchestra'",
",",
"'Composer'",
",",
"'Lyricist/text writer'",
",",
"'Recording Location'",
",",
"'During recording'",
",",
"'During performance'",
",",
"'Movie/video screen capture'",
",",
"'A bright coloured fish'",
",",
"'Illustration'",
",",
"'Band/artist logotype'",
",",
"'Publisher/Studio logotype'",
"}",
"export",
"type",
"ID3v2MajorVersion",
"=",
"2",
"|",
"3",
"|",
"4",
";",
"export",
"interface",
"IExtendedHeader",
"{",
"size",
":",
"number",
";",
"extendedFlags",
":",
"number",
";",
"sizeOfPadding",
":",
"number",
";",
"crcDataPresent",
":",
"boolean",
";",
"}",
"/**\n * 28 bits (representing up to 256MB) integer, the msb is 0 to avoid 'false syncsignals'.\n * 4 * %0xxxxxxx\n */",
"export",
"const",
"UINT32SYNCSAFE",
"=",
"{",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"number",
"=>",
"{",
"return",
"buf",
"[",
"off",
"+",
"3",
"]",
"&",
"0x7f",
"|",
"(",
"(",
"buf",
"[",
"off",
"+",
"2",
"]",
")",
"<<",
"7",
")",
"|",
"(",
"(",
"buf",
"[",
"off",
"+",
"1",
"]",
")",
"<<",
"14",
")",
"|",
"(",
"(",
"buf",
"[",
"off",
"]",
")",
"<<",
"21",
")",
";",
"}",
",",
"len",
":",
"4",
"}",
";",
"/**\n * ID3v2 tag header\n */",
"export",
"interface",
"IID3v2header",
"{",
"fileIdentifier",
":",
"string",
";",
"version",
":",
"{",
"major",
":",
"ID3v2MajorVersion",
";",
"revision",
":",
"number",
";",
"}",
";",
"flags",
":",
"{",
"unsynchronisation",
":",
"boolean",
";",
"isExtendedHeader",
":",
"boolean",
";",
"expIndicator",
":",
"boolean",
";",
"footer",
":",
"boolean",
";",
"}",
";",
"size",
":",
"number",
";",
"}",
"/**\n * ID3v2 header\n * Ref: http://id3.org/id3v2.3.0#ID3v2_header\n * ToDo\n */",
"export",
"const",
"ID3v2Header",
"=",
"{",
"len",
":",
"10",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IID3v2header",
"=>",
"{",
"return",
"{",
"fileIdentifier",
":",
"new",
"Token",
".",
"StringType",
"(",
"3",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"version",
":",
"{",
"major",
":",
"Token",
".",
"INT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"3",
")",
"as",
"ID3v2MajorVersion",
",",
"revision",
":",
"Token",
".",
"INT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
",",
"flags",
":",
"{",
"unsynchronisation",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"7",
")",
",",
"isExtendedHeader",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"6",
")",
",",
"expIndicator",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"5",
")",
",",
"footer",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"4",
")",
"}",
",",
"size",
":",
"UINT32SYNCSAFE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"6",
")",
"}",
";",
"}",
"}",
";",
"export",
"const",
"ExtendedHeader",
"=",
"{",
"len",
":",
"10",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IExtendedHeader",
"=>",
"{",
"return",
"{",
"size",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"extendedFlags",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"sizeOfPadding",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"6",
")",
",",
"crcDataPresent",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"4",
",",
"31",
")",
"}",
";",
"}",
"}",
";",
"export",
"interface",
"ITextEncoding",
"{",
"encoding",
":",
"util",
".",
"StringEncoding",
";",
"bom",
"?",
":",
"boolean",
";",
"}",
"export",
"const",
"TextEncodingToken",
"=",
"{",
"len",
":",
"1",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"ITextEncoding",
"=>",
"{",
"switch",
"(",
"buf",
".",
"readUInt8",
"(",
"off",
")",
")",
"{",
"case",
"0x00",
":",
"return",
"{",
"encoding",
":",
"'latin1'",
"}",
";",
"case",
"0x01",
":",
"return",
"{",
"encoding",
":",
"'utf16le'",
",",
"bom",
":",
"true",
"}",
";",
"case",
"0x02",
":",
"return",
"{",
"encoding",
":",
"'utf16le'",
",",
"bom",
":",
"false",
"}",
";",
"case",
"0x03",
":",
"return",
"{",
"encoding",
":",
"'utf8'",
",",
"bom",
":",
"false",
"}",
";",
"default",
":",
"return",
"{",
"encoding",
":",
"'utf8'",
",",
"bom",
":",
"false",
"}",
";",
"}",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661811 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"ITokenParser",
"}",
"from",
"'../ParserFactory'",
";",
"import",
"{",
"IOptions",
",",
"IPrivateOptions",
"}",
"from",
"'../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'./MetadataCollector'",
";",
"export",
"abstract",
"class",
"BasicParser",
"implements",
"ITokenParser",
"{",
"protected",
"metadata",
":",
"INativeMetadataCollector",
";",
"protected",
"tokenizer",
":",
"ITokenizer",
";",
"protected",
"options",
":",
"IPrivateOptions",
";",
"param",
"{",
"INativeMetadataCollector",
"}",
"metadata",
"param",
"{",
"ITokenizer",
"}",
"tokenizer",
"param",
"{",
"IOptions",
"}",
"options",
"public",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
"{",
"this",
".",
"metadata",
"=",
"metadata",
";",
"this",
".",
"tokenizer",
"=",
"tokenizer",
";",
"this",
".",
"options",
"=",
"options",
";",
"return",
"this",
";",
"}",
"public",
"abstract",
"parse",
"(",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20348,
null,
6865,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661812 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"StringType",
"}",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"IOptions",
",",
"IRandomReader",
",",
"IApeHeader",
"}",
"from",
"'../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"DataType",
",",
"DescriptorParser",
",",
"Header",
",",
"IDescriptor",
",",
"IFooter",
",",
"IHeader",
",",
"ITagItemHeader",
",",
"TagFooter",
",",
"TagItemHeader",
"}",
"from",
"'./APEv2Token'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:APEv2'",
")",
";",
"const",
"tagFormat",
"=",
"'APEv2'",
";",
"interface",
"IApeInfo",
"{",
"descriptor",
"?",
":",
"IDescriptor",
";",
"header",
"?",
":",
"IHeader",
";",
"footer",
"?",
":",
"IFooter",
";",
"}",
"const",
"preamble",
"=",
"'APETAGEX'",
";",
"export",
"class",
"APEv2Parser",
"extends",
"BasicParser",
"{",
"public",
"static",
"tryParseApeHeader",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
"{",
"const",
"apeParser",
"=",
"new",
"APEv2Parser",
"(",
")",
";",
"apeParser",
".",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
";",
"return",
"apeParser",
".",
"tryParseApeHeader",
"(",
")",
";",
"}",
"param",
"ah",
"return",
"{",
"number",
"}",
"public",
"static",
"calculateDuration",
"(",
"ah",
")",
"{",
"let",
"duration",
"=",
"ah",
".",
"totalFrames",
">",
"1",
"?",
"ah",
".",
"blocksPerFrame",
"*",
"(",
"ah",
".",
"totalFrames",
"-",
"1",
")",
":",
"0",
";",
"duration",
"+=",
"ah",
".",
"finalFrameBlocks",
";",
"return",
"duration",
"/",
"ah",
".",
"sampleRate",
";",
"}",
"param",
"reader",
"param",
"offset",
"public",
"static",
"async",
"findApeFooterOffset",
"(",
"reader",
",",
"offset",
")",
"{",
"const",
"apeBuf",
"=",
"Buffer",
".",
"alloc",
"(",
"TagFooter",
".",
"len",
")",
";",
"await",
"reader",
".",
"randomRead",
"(",
"apeBuf",
",",
"0",
",",
"TagFooter",
".",
"len",
",",
"offset",
"-",
"TagFooter",
".",
"len",
")",
";",
"const",
"tagFooter",
"=",
"TagFooter",
".",
"get",
"(",
"apeBuf",
",",
"0",
")",
";",
"if",
"(",
"tagFooter",
".",
"ID",
"===",
"'APETAGEX'",
")",
"{",
"debug",
"(",
"`APE footer header at offset=${",
"offset",
"}`",
")",
";",
"return",
"{",
"footer",
":",
"tagFooter",
",",
"offset",
":",
"offset",
"-",
"tagFooter",
".",
"size",
"}",
";",
"}",
"}",
"private",
"static",
"parseTagFooter",
"(",
"metadata",
",",
"buffer",
",",
"options",
")",
"{",
"const",
"footer",
"=",
"TagFooter",
".",
"get",
"(",
"buffer",
",",
"buffer",
".",
"length",
"-",
"TagFooter",
".",
"len",
")",
";",
"if",
"(",
"footer",
".",
"ID",
"!==",
"preamble",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected APEv2 Footer ID preamble value.'",
")",
";",
"strtok3",
".",
"fromBuffer",
"(",
"buffer",
")",
";",
"const",
"apeParser",
"=",
"new",
"APEv2Parser",
"(",
")",
";",
"apeParser",
".",
"init",
"(",
"metadata",
",",
"strtok3",
".",
"fromBuffer",
"(",
"buffer",
")",
",",
"options",
")",
";",
"return",
"apeParser",
".",
"parseTags",
"(",
"footer",
")",
";",
"}",
"private",
"ape",
":",
"IApeInfo",
"=",
"{",
"}",
";",
"/**\n * Parse APEv1 / APEv2 header if header signature found\n */",
"public",
"async",
"tryParseApeHeader",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"&&",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
"<",
"TagFooter",
".",
"len",
")",
"{",
"debug",
"(",
"`No APEv2 header found, end-of-file reached`",
")",
";",
"return",
";",
"}",
"const",
"footer",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekToken",
"<",
"IFooter",
">",
"(",
"TagFooter",
")",
";",
"if",
"(",
"footer",
".",
"ID",
"===",
"preamble",
")",
"{",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"TagFooter",
".",
"len",
")",
";",
"return",
"this",
".",
"parseTags",
"(",
"footer",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"`APEv2 header not found at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}`",
")",
";",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
")",
"{",
"const",
"remaining",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
";",
"const",
"buffer",
"=",
"Buffer",
".",
"alloc",
"(",
"remaining",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"buffer",
")",
";",
"return",
"APEv2Parser",
".",
"parseTagFooter",
"(",
"this",
".",
"metadata",
",",
"buffer",
",",
"this",
".",
"options",
")",
";",
"}",
"}",
"}",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"descriptor",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IDescriptor",
">",
"(",
"DescriptorParser",
")",
";",
"if",
"(",
"descriptor",
".",
"ID",
"!==",
"'MAC '",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected descriptor ID'",
")",
";",
"this",
".",
"ape",
".",
"descriptor",
"=",
"descriptor",
";",
"const",
"lenExp",
"=",
"descriptor",
".",
"descriptorBytes",
"-",
"DescriptorParser",
".",
"len",
";",
"const",
"header",
"=",
"await",
"(",
"lenExp",
">",
"0",
"?",
"this",
".",
"parseDescriptorExpansion",
"(",
"lenExp",
")",
":",
"this",
".",
"parseHeader",
"(",
")",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"forwardBytes",
")",
";",
"return",
"this",
".",
"tryParseApeHeader",
"(",
")",
";",
"}",
"public",
"async",
"parseTags",
"(",
"footer",
")",
"{",
"const",
"keyBuffer",
"=",
"Buffer",
".",
"alloc",
"(",
"256",
")",
";",
"let",
"bytesRemaining",
"=",
"footer",
".",
"size",
"-",
"TagFooter",
".",
"len",
";",
"debug",
"(",
"`Parse APE tags at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}, size=${",
"bytesRemaining",
"}`",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"footer",
".",
"fields",
";",
"i",
"++",
")",
"{",
"if",
"(",
"bytesRemaining",
"<",
"TagItemHeader",
".",
"len",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"`APEv2 Tag-header: ${",
"footer",
".",
"fields",
"-",
"i",
"} items remaining, but no more tag data to read.`",
")",
";",
"break",
";",
"}",
"const",
"tagItemHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"ITagItemHeader",
">",
"(",
"TagItemHeader",
")",
";",
"bytesRemaining",
"-=",
"TagItemHeader",
".",
"len",
"+",
"tagItemHeader",
".",
"size",
";",
"await",
"this",
".",
"tokenizer",
".",
"peekBuffer",
"(",
"keyBuffer",
",",
"{",
"length",
":",
"Math",
".",
"min",
"(",
"keyBuffer",
".",
"length",
",",
"bytesRemaining",
")",
"}",
")",
";",
"let",
"zero",
"=",
"util",
".",
"findZero",
"(",
"keyBuffer",
",",
"0",
",",
"keyBuffer",
".",
"length",
")",
";",
"const",
"key",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"new",
"StringType",
"(",
"zero",
",",
"'ascii'",
")",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"1",
")",
";",
"bytesRemaining",
"-=",
"key",
".",
"length",
"+",
"1",
";",
"switch",
"(",
"tagItemHeader",
".",
"flags",
".",
"dataType",
")",
"{",
"case",
"DataType",
".",
"text_utf8",
":",
"{",
"const",
"value",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"new",
"StringType",
"(",
"tagItemHeader",
".",
"size",
",",
"'utf8'",
")",
")",
";",
"const",
"values",
"=",
"value",
".",
"split",
"(",
"/\\x00/g",
")",
";",
"for",
"(",
"const",
"val",
"of",
"values",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"tagFormat",
",",
"key",
",",
"val",
")",
";",
"}",
"break",
";",
"}",
"case",
"DataType",
".",
"binary",
":",
"if",
"(",
"this",
".",
"options",
".",
"skipCovers",
")",
"{",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"tagItemHeader",
".",
"size",
")",
";",
"}",
"else",
"{",
"const",
"picData",
"=",
"Buffer",
".",
"alloc",
"(",
"tagItemHeader",
".",
"size",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"picData",
")",
";",
"zero",
"=",
"util",
".",
"findZero",
"(",
"picData",
",",
"0",
",",
"picData",
".",
"length",
")",
";",
"const",
"description",
"=",
"picData",
".",
"toString",
"(",
"'utf8'",
",",
"0",
",",
"zero",
")",
";",
"const",
"data",
"=",
"Buffer",
".",
"from",
"(",
"picData",
".",
"slice",
"(",
"zero",
"+",
"1",
")",
")",
";",
"this",
".",
"metadata",
".",
"addTag",
"(",
"tagFormat",
",",
"key",
",",
"{",
"description",
",",
"data",
"}",
")",
";",
"}",
"break",
";",
"case",
"DataType",
".",
"external_info",
":",
"debug",
"(",
"`Ignore external info ${",
"key",
"}`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"tagItemHeader",
".",
"size",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"`Unexpected data-type: ${",
"tagItemHeader",
".",
"flags",
".",
"dataType",
"}`",
")",
";",
"}",
"}",
"}",
"private",
"async",
"parseDescriptorExpansion",
"(",
"lenExp",
")",
"{",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"lenExp",
")",
";",
"return",
"this",
".",
"parseHeader",
"(",
")",
";",
"}",
"private",
"async",
"parseHeader",
"(",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"Header",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'Monkey\\'s Audio'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"header",
".",
"bitsPerSample",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"header",
".",
"sampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"header",
".",
"channel",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"APEv2Parser",
".",
"calculateDuration",
"(",
"header",
")",
")",
";",
"return",
"{",
"forwardBytes",
":",
"this",
".",
"ape",
".",
"descriptor",
".",
"seekTableBytes",
"+",
"this",
".",
"ape",
".",
"descriptor",
".",
"headerDataBytes",
"+",
"this",
".",
"ape",
".",
"descriptor",
".",
"apeFrameDataBytes",
"+",
"this",
".",
"ape",
".",
"descriptor",
".",
"terminatingDataBytes",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
6865,
null,
49851,
null,
630,
null,
null,
null,
33696,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
2316,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25250,
null,
3,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25251,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
6865,
null,
12,
null,
630,
null,
null,
null,
25251,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33696,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25251,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
9736,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25251,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661813 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'../apev2/APEv2Parser'",
";",
"import",
"{",
"IRandomReader",
"}",
"from",
"'../type'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:ID3v1'",
")",
";",
"/**\n * ID3v1 Genre mappings\n * Ref: https://de.wikipedia.org/wiki/Liste_der_ID3v1-Genres\n */",
"export",
"const",
"Genres",
"=",
"[",
"\"Blues\"",
",",
"\"Classic Rock\"",
",",
"\"Country\"",
",",
"\"Dance\"",
",",
"\"Disco\"",
",",
"\"Funk\"",
",",
"\"Grunge\"",
",",
"\"Hip-Hop\"",
",",
"\"Jazz\"",
",",
"\"Metal\"",
",",
"\"New Age\"",
",",
"\"Oldies\"",
",",
"\"Other\"",
",",
"\"Pop\"",
",",
"\"R&B\"",
",",
"\"Rap\"",
",",
"\"Reggae\"",
",",
"\"Rock\"",
",",
"\"Techno\"",
",",
"\"Industrial\"",
",",
"\"Alternative\"",
",",
"\"Ska\"",
",",
"\"Death Metal\"",
",",
"\"Pranks\"",
",",
"\"Soundtrack\"",
",",
"\"Euro-Techno\"",
",",
"\"Ambient\"",
",",
"\"Trip-Hop\"",
",",
"\"Vocal\"",
",",
"\"Jazz+Funk\"",
",",
"\"Fusion\"",
",",
"\"Trance\"",
",",
"\"Classical\"",
",",
"\"Instrumental\"",
",",
"\"Acid\"",
",",
"\"House\"",
",",
"\"Game\"",
",",
"\"Sound Clip\"",
",",
"\"Gospel\"",
",",
"\"Noise\"",
",",
"\"Alt. Rock\"",
",",
"\"Bass\"",
",",
"\"Soul\"",
",",
"\"Punk\"",
",",
"\"Space\"",
",",
"\"Meditative\"",
",",
"\"Instrumental Pop\"",
",",
"\"Instrumental Rock\"",
",",
"\"Ethnic\"",
",",
"\"Gothic\"",
",",
"\"Darkwave\"",
",",
"\"Techno-Industrial\"",
",",
"\"Electronic\"",
",",
"\"Pop-Folk\"",
",",
"\"Eurodance\"",
",",
"\"Dream\"",
",",
"\"Southern Rock\"",
",",
"\"Comedy\"",
",",
"\"Cult\"",
",",
"\"Gangsta Rap\"",
",",
"\"Top 40\"",
",",
"\"Christian Rap\"",
",",
"\"Pop/Funk\"",
",",
"\"Jungle\"",
",",
"\"Native American\"",
",",
"\"Cabaret\"",
",",
"\"New Wave\"",
",",
"\"Psychedelic\"",
",",
"\"Rave\"",
",",
"\"Showtunes\"",
",",
"\"Trailer\"",
",",
"\"Lo-Fi\"",
",",
"\"Tribal\"",
",",
"\"Acid Punk\"",
",",
"\"Acid Jazz\"",
",",
"\"Polka\"",
",",
"\"Retro\"",
",",
"\"Musical\"",
",",
"\"Rock & Roll\"",
",",
"\"Hard Rock\"",
",",
"\"Folk\"",
",",
"\"Folk/Rock\"",
",",
"\"National Folk\"",
",",
"\"Swing\"",
",",
"\"Fast-Fusion\"",
",",
"\"Bebob\"",
",",
"\"Latin\"",
",",
"\"Revival\"",
",",
"\"Celtic\"",
",",
"\"Bluegrass\"",
",",
"\"Avantgarde\"",
",",
"\"Gothic Rock\"",
",",
"\"Progressive Rock\"",
",",
"\"Psychedelic Rock\"",
",",
"\"Symphonic Rock\"",
",",
"\"Slow Rock\"",
",",
"\"Big Band\"",
",",
"\"Chorus\"",
",",
"\"Easy Listening\"",
",",
"\"Acoustic\"",
",",
"\"Humour\"",
",",
"\"Speech\"",
",",
"\"Chanson\"",
",",
"\"Opera\"",
",",
"\"Chamber Music\"",
",",
"\"Sonata\"",
",",
"\"Symphony\"",
",",
"\"Booty Bass\"",
",",
"\"Primus\"",
",",
"\"Porn Groove\"",
",",
"\"Satire\"",
",",
"\"Slow Jam\"",
",",
"\"Club\"",
",",
"\"Tango\"",
",",
"\"Samba\"",
",",
"\"Folklore\"",
",",
"\"Ballad\"",
",",
"\"Power Ballad\"",
",",
"\"Rhythmic Soul\"",
",",
"\"Freestyle\"",
",",
"\"Duet\"",
",",
"\"Punk Rock\"",
",",
"\"Drum Solo\"",
",",
"\"A Cappella\"",
",",
"\"Euro-House\"",
",",
"\"Dance Hall\"",
",",
"\"Goa\"",
",",
"\"Drum & Bass\"",
",",
"\"Club-House\"",
",",
"\"Hardcore\"",
",",
"\"Terror\"",
",",
"\"Indie\"",
",",
"\"BritPop\"",
",",
"\"Negerpunk\"",
",",
"\"Polsk Punk\"",
",",
"\"Beat\"",
",",
"\"Christian Gangsta Rap\"",
",",
"\"Heavy Metal\"",
",",
"\"Black Metal\"",
",",
"\"Crossover\"",
",",
"\"Contemporary Christian\"",
",",
"\"Christian Rock\"",
",",
"\"Merengue\"",
",",
"\"Salsa\"",
",",
"\"Thrash Metal\"",
",",
"\"Anime\"",
",",
"\"JPop\"",
",",
"\"Synthpop\"",
",",
"\"Abstract\"",
",",
"\"Art Rock\"",
",",
"\"Baroque\"",
",",
"\"Bhangra\"",
",",
"\"Big Beat\"",
",",
"\"Breakbeat\"",
",",
"\"Chillout\"",
",",
"\"Downtempo\"",
",",
"\"Dub\"",
",",
"\"EBM\"",
",",
"\"Eclectic\"",
",",
"\"Electro\"",
",",
"\"Electroclash\"",
",",
"\"Emo\"",
",",
"\"Experimental\"",
",",
"\"Garage\"",
",",
"\"Global\"",
",",
"\"IDM\"",
",",
"\"Illbient\"",
",",
"\"Industro-Goth\"",
",",
"\"Jam Band\"",
",",
"\"Krautrock\"",
",",
"\"Leftfield\"",
",",
"\"Lounge\"",
",",
"\"Math Rock\"",
",",
"\"New Romantic\"",
",",
"\"Nu-Breakz\"",
",",
"\"Post-Punk\"",
",",
"\"Post-Rock\"",
",",
"\"Psytrance\"",
",",
"\"Shoegaze\"",
",",
"\"Space Rock\"",
",",
"\"Trop Rock\"",
",",
"\"World Music\"",
",",
"\"Neoclassical\"",
",",
"\"Audiobook\"",
",",
"\"Audio Theatre\"",
",",
"\"Neue Deutsche Welle\"",
",",
"\"Podcast\"",
",",
"\"Indie Rock\"",
",",
"\"G-Funk\"",
",",
"\"Dubstep\"",
",",
"\"Garage Rock\"",
",",
"\"Psybient\"",
"]",
";",
"/**\n * ID3v1 tag header interface\n */",
"interface",
"IId3v1Header",
"{",
"header",
":",
"string",
";",
"title",
":",
"string",
";",
"artist",
":",
"string",
";",
"album",
":",
"string",
";",
"year",
":",
"string",
";",
"comment",
":",
"string",
";",
"zeroByte",
":",
"number",
";",
"track",
":",
"number",
";",
"genre",
":",
"number",
";",
"}",
"/**\n * Spec: http://id3.org/ID3v1\n * Wiki: https://en.wikipedia.org/wiki/ID3\n */",
"const",
"Iid3v1Token",
"=",
"{",
"len",
":",
"128",
",",
"param",
"buf",
"param",
"off",
"returns",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IId3v1Header",
"=>",
"{",
"const",
"header",
"=",
"new",
"Id3v1StringType",
"(",
"3",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"return",
"header",
"===",
"\"TAG\"",
"?",
"{",
"header",
",",
"title",
":",
"new",
"Id3v1StringType",
"(",
"30",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"3",
")",
",",
"artist",
":",
"new",
"Id3v1StringType",
"(",
"30",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"33",
")",
",",
"album",
":",
"new",
"Id3v1StringType",
"(",
"30",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"63",
")",
",",
"year",
":",
"new",
"Id3v1StringType",
"(",
"4",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"93",
")",
",",
"comment",
":",
"new",
"Id3v1StringType",
"(",
"28",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"97",
")",
",",
"zeroByte",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"127",
")",
",",
"track",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"126",
")",
",",
"genre",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"127",
")",
"}",
":",
"null",
";",
"}",
"}",
";",
"class",
"Id3v1StringType",
"extends",
"Token",
".",
"StringType",
"{",
"constructor",
"(",
"len",
")",
"{",
"super",
"(",
"len",
",",
"\"binary\"",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"let",
"value",
"=",
"super",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"value",
"=",
"util",
".",
"trimRightNull",
"(",
"value",
")",
";",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"return",
"value",
".",
"length",
">",
"0",
"?",
"value",
":",
"undefined",
";",
"}",
"}",
"export",
"class",
"ID3v1Parser",
"extends",
"BasicParser",
"{",
"private",
"static",
"getGenre",
"(",
"genreIndex",
")",
"{",
"if",
"(",
"genreIndex",
"<",
"Genres",
".",
"length",
")",
"{",
"return",
"Genres",
"[",
"genreIndex",
"]",
";",
"}",
"return",
"undefined",
";",
"}",
"public",
"async",
"parse",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
")",
"{",
"debug",
"(",
"'Skip checking for ID3v1 because the file-size is unknown'",
")",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"options",
".",
"apeHeader",
")",
"{",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"this",
".",
"options",
".",
"apeHeader",
".",
"offset",
"-",
"this",
".",
"tokenizer",
".",
"position",
")",
";",
"const",
"apeParser",
"=",
"new",
"APEv2Parser",
"(",
")",
";",
"apeParser",
".",
"init",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"await",
"apeParser",
".",
"parseTags",
"(",
"this",
".",
"options",
".",
"apeHeader",
".",
"footer",
")",
";",
"}",
"const",
"offset",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"Iid3v1Token",
".",
"len",
";",
"if",
"(",
"this",
".",
"tokenizer",
".",
"position",
">",
"offset",
")",
"{",
"debug",
"(",
"'Already consumed the last 128 bytes'",
")",
";",
"return",
";",
"}",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IId3v1Header",
">",
"(",
"Iid3v1Token",
",",
"offset",
")",
";",
"if",
"(",
"header",
")",
"{",
"debug",
"(",
"\"ID3v1 header found at: pos=%s\"",
",",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"Iid3v1Token",
".",
"len",
")",
";",
"for",
"(",
"const",
"id",
"of",
"[",
"\"title\"",
",",
"\"artist\"",
",",
"\"album\"",
",",
"\"comment\"",
",",
"\"track\"",
",",
"\"year\"",
"]",
")",
"{",
"if",
"(",
"header",
"[",
"id",
"]",
"&&",
"header",
"[",
"id",
"]",
"!==",
"\"\"",
")",
"this",
".",
"addTag",
"(",
"id",
",",
"header",
"[",
"id",
"]",
")",
";",
"}",
"const",
"genre",
"=",
"ID3v1Parser",
".",
"getGenre",
"(",
"header",
".",
"genre",
")",
";",
"if",
"(",
"genre",
")",
"this",
".",
"addTag",
"(",
"'genre'",
",",
"genre",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"\"ID3v1 header not found at: pos=%s\"",
",",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"Iid3v1Token",
".",
"len",
")",
";",
"}",
"}",
"private",
"addTag",
"(",
"id",
",",
"value",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"'ID3v1'",
",",
"id",
",",
"value",
")",
";",
"}",
"}",
"export",
"async",
"function",
"hasID3v1Header",
"(",
"reader",
")",
"{",
"if",
"(",
"reader",
".",
"fileSize",
">=",
"128",
")",
"{",
"const",
"tag",
"=",
"Buffer",
".",
"alloc",
"(",
"3",
")",
";",
"await",
"reader",
".",
"randomRead",
"(",
"tag",
",",
"0",
",",
"tag",
".",
"length",
",",
"reader",
".",
"fileSize",
"-",
"128",
")",
";",
"return",
"tag",
".",
"toString",
"(",
"'binary'",
")",
"===",
"'TAG'",
";",
"}",
"return",
"false",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
12,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33696,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25250,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661814 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"AttachedPictureType",
",",
"ID3v2MajorVersion",
",",
"TextEncodingToken",
"}",
"from",
"'./ID3v2Token'",
";",
"import",
"{",
"IWarningCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"import",
"{",
"Genres",
"}",
"from",
"'../id3v1/ID3v1Parser'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:id3v2:frame-parser'",
")",
";",
"interface",
"IOut",
"{",
"language",
"?",
":",
"string",
";",
"description",
"?",
":",
"string",
";",
"text",
"?",
":",
"string",
";",
"}",
"interface",
"IPicture",
"{",
"type",
"?",
":",
"string",
";",
"description",
"?",
":",
"string",
";",
"format",
"?",
":",
"string",
";",
"data",
"?",
":",
"Uint8Array",
";",
"}",
"const",
"defaultEnc",
"=",
"'latin1'",
";",
"export",
"function",
"parseGenre",
"(",
"origVal",
")",
"{",
"const",
"genres",
"=",
"[",
"]",
";",
"let",
"code",
";",
"let",
"word",
"=",
"''",
";",
"for",
"(",
"const",
"c",
"of",
"origVal",
")",
"{",
"if",
"(",
"typeof",
"code",
"===",
"'string'",
")",
"{",
"if",
"(",
"c",
"===",
"'('",
"&&",
"code",
"===",
"''",
")",
"{",
"word",
"+=",
"'('",
";",
"code",
"=",
"undefined",
";",
"}",
"else",
"if",
"(",
"c",
"===",
"')'",
")",
"{",
"if",
"(",
"word",
"!==",
"''",
")",
"{",
"genres",
".",
"push",
"(",
"word",
")",
";",
"word",
"=",
"''",
";",
"}",
"const",
"genre",
"=",
"parseGenreCode",
"(",
"code",
")",
";",
"if",
"(",
"genre",
")",
"{",
"genres",
".",
"push",
"(",
"genre",
")",
";",
"}",
"code",
"=",
"undefined",
";",
"}",
"else",
"code",
"+=",
"c",
";",
"}",
"else",
"if",
"(",
"c",
"===",
"'('",
")",
"{",
"code",
"=",
"''",
";",
"}",
"else",
"{",
"word",
"+=",
"c",
";",
"}",
"}",
"if",
"(",
"word",
")",
"{",
"if",
"(",
"genres",
".",
"length",
"===",
"0",
"&&",
"word",
".",
"match",
"(",
"/^\\d*$/",
")",
")",
"{",
"word",
"=",
"Genres",
"[",
"word",
"]",
";",
"}",
"genres",
".",
"push",
"(",
"word",
")",
";",
"}",
"return",
"genres",
";",
"}",
"function",
"parseGenreCode",
"(",
"code",
")",
"{",
"if",
"(",
"code",
"===",
"'RX'",
")",
"return",
"'Remix'",
";",
"if",
"(",
"code",
"===",
"'CR'",
")",
"return",
"'Cover'",
";",
"if",
"(",
"code",
".",
"match",
"(",
"/^\\d*$/",
")",
")",
"{",
"return",
"Genres",
"[",
"code",
"]",
";",
"}",
"}",
"export",
"class",
"FrameParser",
"{",
"param",
"major",
"param",
"warningCollector",
"constructor",
"(",
"private",
"major",
",",
"private",
"warningCollector",
")",
"{",
"}",
"public",
"readData",
"(",
"b",
",",
"type",
",",
"includeCovers",
")",
"{",
"if",
"(",
"b",
".",
"length",
"===",
"0",
")",
"{",
"this",
".",
"warningCollector",
".",
"addWarning",
"(",
"`id3v2.${",
"this",
".",
"major",
"} header has empty tag type=${",
"type",
"}`",
")",
";",
"return",
";",
"}",
"const",
"{",
"encoding",
",",
"bom",
"}",
"=",
"TextEncodingToken",
".",
"get",
"(",
"b",
",",
"0",
")",
";",
"const",
"length",
"=",
"b",
".",
"length",
";",
"let",
"offset",
"=",
"0",
";",
"let",
"output",
"=",
"[",
"]",
";",
"const",
"nullTerminatorLength",
"=",
"FrameParser",
".",
"getNullTerminatorLength",
"(",
"encoding",
")",
";",
"let",
"fzero",
";",
"const",
"out",
"=",
"{",
"}",
";",
"debug",
"(",
"`Parsing tag type=${",
"type",
"}, encoding=${",
"encoding",
"}, bom=${",
"bom",
"}`",
")",
";",
"switch",
"(",
"type",
"!==",
"'TXXX'",
"&&",
"type",
"[",
"0",
"]",
"===",
"'T'",
"?",
"'T*'",
":",
"type",
")",
"{",
"case",
"'T*'",
":",
"case",
"'IPLS'",
":",
"case",
"'MVIN'",
":",
"case",
"'MVNM'",
":",
"case",
"'PCS'",
":",
"case",
"'PCST'",
":",
"const",
"text",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"1",
")",
",",
"encoding",
")",
".",
"replace",
"(",
"/\\x00+$/",
",",
"''",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'TMCL'",
":",
"case",
"'TIPL'",
":",
"case",
"'IPLS'",
":",
"output",
"=",
"this",
".",
"splitValue",
"(",
"type",
",",
"text",
")",
";",
"output",
"=",
"FrameParser",
".",
"functionList",
"(",
"output",
")",
";",
"break",
";",
"case",
"'TRK'",
":",
"case",
"'TRCK'",
":",
"case",
"'TPOS'",
":",
"output",
"=",
"text",
";",
"break",
";",
"case",
"'TCOM'",
":",
"case",
"'TEXT'",
":",
"case",
"'TOLY'",
":",
"case",
"'TOPE'",
":",
"case",
"'TPE1'",
":",
"case",
"'TSRC'",
":",
"output",
"=",
"this",
".",
"splitValue",
"(",
"type",
",",
"text",
")",
";",
"break",
";",
"case",
"'TCO'",
":",
"case",
"'TCON'",
":",
"output",
"=",
"this",
".",
"splitValue",
"(",
"type",
",",
"text",
")",
".",
"map",
"(",
"v",
"=>",
"parseGenre",
"(",
"v",
")",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"val",
")",
"=>",
"acc",
".",
"concat",
"(",
"val",
")",
",",
"[",
"]",
")",
";",
"break",
";",
"case",
"'PCS'",
":",
"case",
"'PCST'",
":",
"output",
"=",
"this",
".",
"major",
">=",
"4",
"?",
"this",
".",
"splitValue",
"(",
"type",
",",
"text",
")",
":",
"[",
"text",
"]",
";",
"output",
"=",
"(",
"Array",
".",
"isArray",
"(",
"output",
")",
"&&",
"output",
"[",
"0",
"]",
"===",
"''",
")",
"?",
"1",
":",
"0",
";",
"break",
";",
"default",
":",
"output",
"=",
"this",
".",
"major",
">=",
"4",
"?",
"this",
".",
"splitValue",
"(",
"type",
",",
"text",
")",
":",
"[",
"text",
"]",
";",
"}",
"break",
";",
"case",
"'TXXX'",
":",
"output",
"=",
"FrameParser",
".",
"readIdentifierAndData",
"(",
"b",
",",
"offset",
"+",
"1",
",",
"length",
",",
"encoding",
")",
";",
"output",
"=",
"{",
"description",
":",
"output",
".",
"id",
",",
"text",
":",
"this",
".",
"splitValue",
"(",
"type",
",",
"util",
".",
"decodeString",
"(",
"output",
".",
"data",
",",
"encoding",
")",
".",
"replace",
"(",
"/\\x00+$/",
",",
"''",
")",
")",
"}",
";",
"break",
";",
"case",
"'PIC'",
":",
"case",
"'APIC'",
":",
"if",
"(",
"includeCovers",
")",
"{",
"const",
"pic",
"=",
"{",
"}",
";",
"offset",
"+=",
"1",
";",
"switch",
"(",
"this",
".",
"major",
")",
"{",
"case",
"2",
":",
"pic",
".",
"format",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"offset",
"+",
"3",
")",
",",
"'latin1'",
")",
";",
"offset",
"+=",
"3",
";",
"break",
";",
"case",
"3",
":",
"case",
"4",
":",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"defaultEnc",
")",
";",
"pic",
".",
"format",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"offset",
"=",
"fzero",
"+",
"1",
";",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"'Warning: unexpected major versionIndex: '",
"+",
"this",
".",
"major",
")",
";",
"}",
"pic",
".",
"format",
"=",
"FrameParser",
".",
"fixPictureMimeType",
"(",
"pic",
".",
"format",
")",
";",
"pic",
".",
"type",
"=",
"AttachedPictureType",
"[",
"b",
"[",
"offset",
"]",
"]",
";",
"offset",
"+=",
"1",
";",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"encoding",
")",
";",
"pic",
".",
"description",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"encoding",
")",
";",
"offset",
"=",
"fzero",
"+",
"nullTerminatorLength",
";",
"pic",
".",
"data",
"=",
"Buffer",
".",
"from",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"length",
")",
")",
";",
"output",
"=",
"pic",
";",
"}",
"break",
";",
"case",
"'CNT'",
":",
"case",
"'PCNT'",
":",
"output",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"b",
",",
"0",
")",
";",
"break",
";",
"case",
"'SYLT'",
":",
"offset",
"+=",
"7",
";",
"output",
"=",
"[",
"]",
";",
"while",
"(",
"offset",
"<",
"length",
")",
"{",
"const",
"txt",
"=",
"b",
".",
"slice",
"(",
"offset",
",",
"offset",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"encoding",
")",
")",
";",
"offset",
"+=",
"5",
";",
"output",
".",
"push",
"(",
"util",
".",
"decodeString",
"(",
"txt",
",",
"encoding",
")",
")",
";",
"}",
"break",
";",
"case",
"'ULT'",
":",
"case",
"'USLT'",
":",
"case",
"'COM'",
":",
"case",
"'COMM'",
":",
"offset",
"+=",
"1",
";",
"out",
".",
"language",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"offset",
"+",
"3",
")",
",",
"defaultEnc",
")",
";",
"offset",
"+=",
"3",
";",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"encoding",
")",
";",
"out",
".",
"description",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"encoding",
")",
";",
"offset",
"=",
"fzero",
"+",
"nullTerminatorLength",
";",
"out",
".",
"text",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"length",
")",
",",
"encoding",
")",
".",
"replace",
"(",
"/\\x00+$/",
",",
"''",
")",
";",
"output",
"=",
"[",
"out",
"]",
";",
"break",
";",
"case",
"'UFID'",
":",
"output",
"=",
"FrameParser",
".",
"readIdentifierAndData",
"(",
"b",
",",
"offset",
",",
"length",
",",
"defaultEnc",
")",
";",
"output",
"=",
"{",
"owner_identifier",
":",
"output",
".",
"id",
",",
"identifier",
":",
"output",
".",
"data",
"}",
";",
"break",
";",
"case",
"'PRIV'",
":",
"output",
"=",
"FrameParser",
".",
"readIdentifierAndData",
"(",
"b",
",",
"offset",
",",
"length",
",",
"defaultEnc",
")",
";",
"output",
"=",
"{",
"owner_identifier",
":",
"output",
".",
"id",
",",
"data",
":",
"output",
".",
"data",
"}",
";",
"break",
";",
"case",
"'POPM'",
":",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"defaultEnc",
")",
";",
"const",
"email",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"offset",
"=",
"fzero",
"+",
"1",
";",
"const",
"dataLen",
"=",
"length",
"-",
"offset",
";",
"output",
"=",
"{",
"email",
",",
"rating",
":",
"b",
".",
"readUInt8",
"(",
"offset",
")",
",",
"counter",
":",
"dataLen",
">=",
"5",
"?",
"b",
".",
"readUInt32BE",
"(",
"offset",
"+",
"1",
")",
":",
"undefined",
"}",
";",
"break",
";",
"case",
"'GEOB'",
":",
"{",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
"+",
"1",
",",
"length",
",",
"encoding",
")",
";",
"const",
"mimeType",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
"+",
"1",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"offset",
"=",
"fzero",
"+",
"1",
";",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
"-",
"offset",
",",
"encoding",
")",
";",
"const",
"filename",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"offset",
"=",
"fzero",
"+",
"1",
";",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
"-",
"offset",
",",
"encoding",
")",
";",
"const",
"description",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"output",
"=",
"{",
"type",
":",
"mimeType",
",",
"filename",
",",
"description",
",",
"data",
":",
"b",
".",
"slice",
"(",
"offset",
"+",
"1",
",",
"length",
")",
"}",
";",
"break",
";",
"}",
"case",
"'WCOM'",
":",
"case",
"'WCOP'",
":",
"case",
"'WOAF'",
":",
"case",
"'WOAR'",
":",
"case",
"'WOAS'",
":",
"case",
"'WORS'",
":",
"case",
"'WPAY'",
":",
"case",
"'WPUB'",
":",
"output",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"defaultEnc",
")",
";",
"break",
";",
"case",
"'WXXX'",
":",
"{",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
"+",
"1",
",",
"length",
",",
"encoding",
")",
";",
"const",
"description",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
"+",
"1",
",",
"fzero",
")",
",",
"encoding",
")",
";",
"offset",
"=",
"fzero",
"+",
"(",
"encoding",
"===",
"'utf16le'",
"?",
"2",
":",
"1",
")",
";",
"output",
"=",
"{",
"description",
",",
"url",
":",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"length",
")",
",",
"defaultEnc",
")",
"}",
";",
"break",
";",
"}",
"case",
"'WFD'",
":",
"case",
"'WFED'",
":",
"output",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
"+",
"1",
",",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
"+",
"1",
",",
"length",
",",
"encoding",
")",
")",
",",
"encoding",
")",
";",
"break",
";",
"case",
"'MCDI'",
":",
"{",
"output",
"=",
"b",
".",
"slice",
"(",
"0",
",",
"length",
")",
";",
"break",
";",
"}",
"default",
":",
"debug",
"(",
"'Warning: unsupported id3v2-tag-type: '",
"+",
"type",
")",
";",
"break",
";",
"}",
"return",
"output",
";",
"}",
"protected",
"static",
"fixPictureMimeType",
"(",
"pictureType",
")",
"{",
"pictureType",
"=",
"pictureType",
".",
"toLocaleLowerCase",
"(",
")",
";",
"switch",
"(",
"pictureType",
")",
"{",
"case",
"'jpg'",
":",
"return",
"'image/jpeg'",
";",
"case",
"'png'",
":",
"return",
"'image/png'",
";",
"}",
"return",
"pictureType",
";",
"}",
"param",
"entries",
"private",
"static",
"functionList",
"(",
"entries",
")",
"{",
"const",
"res",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"+",
"1",
"<",
"entries",
".",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"const",
"names",
"=",
"entries",
"[",
"i",
"+",
"1",
"]",
".",
"split",
"(",
"','",
")",
";",
"res",
"[",
"entries",
"[",
"i",
"]",
"]",
"=",
"res",
".",
"hasOwnProperty",
"(",
"entries",
"[",
"i",
"]",
")",
"?",
"res",
"[",
"entries",
"[",
"i",
"]",
"]",
".",
"concat",
"(",
"names",
")",
":",
"names",
";",
"}",
"return",
"res",
";",
"}",
"param",
"tag",
"param",
"text",
"returns",
"private",
"splitValue",
"(",
"tag",
",",
"text",
")",
"{",
"let",
"values",
";",
"if",
"(",
"this",
".",
"major",
"<",
"4",
")",
"{",
"values",
"=",
"text",
".",
"split",
"(",
"/\\x00/g",
")",
";",
"if",
"(",
"values",
".",
"length",
">",
"1",
")",
"{",
"this",
".",
"warningCollector",
".",
"addWarning",
"(",
"`ID3v2.${",
"this",
".",
"major",
"} ${",
"tag",
"} uses non standard null-separator.`",
")",
";",
"}",
"else",
"{",
"values",
"=",
"text",
".",
"split",
"(",
"/\\//g",
")",
";",
"}",
"}",
"else",
"{",
"values",
"=",
"text",
".",
"split",
"(",
"/\\x00/g",
")",
";",
"}",
"return",
"FrameParser",
".",
"trimArray",
"(",
"values",
")",
";",
"}",
"private",
"static",
"trimArray",
"(",
"values",
")",
"{",
"return",
"values",
".",
"map",
"(",
"value",
"=>",
"value",
".",
"replace",
"(",
"/\\x00+$/",
",",
"''",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"private",
"static",
"readIdentifierAndData",
"(",
"b",
",",
"offset",
",",
"length",
",",
"encoding",
")",
"{",
"const",
"fzero",
"=",
"util",
".",
"findZero",
"(",
"b",
",",
"offset",
",",
"length",
",",
"encoding",
")",
";",
"const",
"id",
"=",
"util",
".",
"decodeString",
"(",
"b",
".",
"slice",
"(",
"offset",
",",
"fzero",
")",
",",
"encoding",
")",
";",
"offset",
"=",
"fzero",
"+",
"FrameParser",
".",
"getNullTerminatorLength",
"(",
"encoding",
")",
";",
"return",
"{",
"id",
",",
"data",
":",
"b",
".",
"slice",
"(",
"offset",
",",
"length",
")",
"}",
";",
"}",
"private",
"static",
"getNullTerminatorLength",
"(",
"enc",
")",
"{",
"return",
"enc",
"===",
"'utf16le'",
"?",
"2",
":",
"1",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33697,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
5,
null,
null,
null,
null,
null,
2,
null,
null,
2,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49852,
null,
null,
22574,
null,
null,
null,
null,
null,
null,
12,
null,
2,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
2,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
5,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
12,
null,
3,
null,
3,
null,
33697,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
33697,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661815 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"TagType",
"}",
"from",
"'../common/GenericTagTypes'",
";",
"import",
"{",
"ITag",
",",
"IOptions",
"}",
"from",
"'../type'",
";",
"import",
"{",
"FrameParser",
"}",
"from",
"'./FrameParser'",
";",
"import",
"{",
"ExtendedHeader",
",",
"ID3v2Header",
",",
"ID3v2MajorVersion",
",",
"IID3v2header",
",",
"UINT32SYNCSAFE",
"}",
"from",
"'./ID3v2Token'",
";",
"import",
"{",
"INativeMetadataCollector",
",",
"IWarningCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"interface",
"IFrameFlags",
"{",
"status",
":",
"{",
"tag_alter_preservation",
":",
"boolean",
";",
"file_alter_preservation",
":",
"boolean",
";",
"read_only",
":",
"boolean",
";",
"}",
";",
"format",
":",
"{",
"grouping_identity",
":",
"boolean",
";",
"compression",
":",
"boolean",
";",
"encryption",
":",
"boolean",
";",
"unsynchronisation",
":",
"boolean",
";",
"data_length_indicator",
":",
"boolean",
";",
"}",
";",
"}",
"interface",
"IFrameHeader",
"{",
"id",
":",
"string",
";",
"length",
"?",
":",
"number",
";",
"flags",
"?",
":",
"IFrameFlags",
";",
"}",
"export",
"class",
"ID3v2Parser",
"{",
"public",
"static",
"removeUnsyncBytes",
"(",
"buffer",
")",
"{",
"let",
"readI",
"=",
"0",
";",
"let",
"writeI",
"=",
"0",
";",
"while",
"(",
"readI",
"<",
"buffer",
".",
"length",
"-",
"1",
")",
"{",
"if",
"(",
"readI",
"!==",
"writeI",
")",
"{",
"buffer",
"[",
"writeI",
"]",
"=",
"buffer",
"[",
"readI",
"]",
";",
"}",
"readI",
"+=",
"(",
"buffer",
"[",
"readI",
"]",
"===",
"0xFF",
"&&",
"buffer",
"[",
"readI",
"+",
"1",
"]",
"===",
"0",
")",
"?",
"2",
":",
"1",
";",
"writeI",
"++",
";",
"}",
"if",
"(",
"readI",
"<",
"buffer",
".",
"length",
")",
"{",
"buffer",
"[",
"writeI",
"++",
"]",
"=",
"buffer",
"[",
"readI",
"]",
";",
"}",
"return",
"buffer",
".",
"slice",
"(",
"0",
",",
"writeI",
")",
";",
"}",
"private",
"static",
"getFrameHeaderLength",
"(",
"majorVer",
")",
"{",
"switch",
"(",
"majorVer",
")",
"{",
"case",
"2",
":",
"return",
"6",
";",
"case",
"3",
":",
"case",
"4",
":",
"return",
"10",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"'header versionIndex is incorrect'",
")",
";",
"}",
"}",
"private",
"static",
"readFrameFlags",
"(",
"b",
")",
"{",
"return",
"{",
"status",
":",
"{",
"tag_alter_preservation",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"0",
",",
"6",
")",
",",
"file_alter_preservation",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"0",
",",
"5",
")",
",",
"read_only",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"0",
",",
"4",
")",
"}",
",",
"format",
":",
"{",
"grouping_identity",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"1",
",",
"7",
")",
",",
"compression",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"1",
",",
"3",
")",
",",
"encryption",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"1",
",",
"2",
")",
",",
"unsynchronisation",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"1",
",",
"1",
")",
",",
"data_length_indicator",
":",
"util",
".",
"getBit",
"(",
"b",
",",
"1",
",",
"0",
")",
"}",
"}",
";",
"}",
"private",
"static",
"readFrameData",
"(",
"buf",
",",
"frameHeader",
",",
"majorVer",
",",
"includeCovers",
",",
"warningCollector",
")",
"{",
"const",
"frameParser",
"=",
"new",
"FrameParser",
"(",
"majorVer",
",",
"warningCollector",
")",
";",
"switch",
"(",
"majorVer",
")",
"{",
"case",
"2",
":",
"return",
"frameParser",
".",
"readData",
"(",
"buf",
",",
"frameHeader",
".",
"id",
",",
"includeCovers",
")",
";",
"case",
"3",
":",
"case",
"4",
":",
"if",
"(",
"frameHeader",
".",
"flags",
".",
"format",
".",
"unsynchronisation",
")",
"{",
"buf",
"=",
"ID3v2Parser",
".",
"removeUnsyncBytes",
"(",
"buf",
")",
";",
"}",
"if",
"(",
"frameHeader",
".",
"flags",
".",
"format",
".",
"data_length_indicator",
")",
"{",
"buf",
"=",
"buf",
".",
"slice",
"(",
"4",
",",
"buf",
".",
"length",
")",
";",
"}",
"return",
"frameParser",
".",
"readData",
"(",
"buf",
",",
"frameHeader",
".",
"id",
",",
"includeCovers",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"'Unexpected majorVer: '",
"+",
"majorVer",
")",
";",
"}",
"}",
"param",
"{",
"string",
"}",
"tag",
"param",
"{",
"string",
"}",
"description",
"returns",
"{",
"string",
"}",
"private",
"static",
"makeDescriptionTagName",
"(",
"tag",
",",
"description",
")",
"{",
"return",
"tag",
"+",
"(",
"description",
"?",
"':'",
"+",
"description",
":",
"''",
")",
";",
"}",
"private",
"tokenizer",
":",
"ITokenizer",
";",
"private",
"id3Header",
":",
"IID3v2header",
";",
"private",
"metadata",
":",
"INativeMetadataCollector",
";",
"private",
"headerType",
":",
"TagType",
";",
"private",
"options",
":",
"IOptions",
";",
"public",
"async",
"parse",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
"{",
"this",
".",
"tokenizer",
"=",
"tokenizer",
";",
"this",
".",
"metadata",
"=",
"metadata",
";",
"this",
".",
"options",
"=",
"options",
";",
"const",
"id3Header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"ID3v2Header",
")",
";",
"if",
"(",
"id3Header",
".",
"fileIdentifier",
"!==",
"'ID3'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'expected ID3-header file-identifier \\'ID3\\' was not found'",
")",
";",
"}",
"this",
".",
"id3Header",
"=",
"id3Header",
";",
"this",
".",
"headerType",
"=",
"(",
"'ID3v2.'",
"+",
"id3Header",
".",
"version",
".",
"major",
")",
"as",
"TagType",
";",
"if",
"(",
"id3Header",
".",
"flags",
".",
"isExtendedHeader",
")",
"{",
"return",
"this",
".",
"parseExtendedHeader",
"(",
")",
";",
"}",
"else",
"{",
"return",
"this",
".",
"parseId3Data",
"(",
"id3Header",
".",
"size",
")",
";",
"}",
"}",
"public",
"async",
"parseExtendedHeader",
"(",
")",
"{",
"const",
"extendedHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"ExtendedHeader",
")",
";",
"const",
"dataRemaining",
"=",
"extendedHeader",
".",
"size",
"-",
"ExtendedHeader",
".",
"len",
";",
"if",
"(",
"dataRemaining",
">",
"0",
")",
"{",
"return",
"this",
".",
"parseExtendedHeaderData",
"(",
"dataRemaining",
",",
"extendedHeader",
".",
"size",
")",
";",
"}",
"else",
"{",
"return",
"this",
".",
"parseId3Data",
"(",
"this",
".",
"id3Header",
".",
"size",
"-",
"extendedHeader",
".",
"size",
")",
";",
"}",
"}",
"public",
"async",
"parseExtendedHeaderData",
"(",
"dataRemaining",
",",
"extendedHeaderSize",
")",
"{",
"const",
"buffer",
"=",
"Buffer",
".",
"alloc",
"(",
"dataRemaining",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"buffer",
",",
"{",
"length",
":",
"dataRemaining",
"}",
")",
";",
"return",
"this",
".",
"parseId3Data",
"(",
"this",
".",
"id3Header",
".",
"size",
"-",
"extendedHeaderSize",
")",
";",
"}",
"public",
"async",
"parseId3Data",
"(",
"dataLen",
")",
"{",
"const",
"buffer",
"=",
"Buffer",
".",
"alloc",
"(",
"dataLen",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"buffer",
",",
"{",
"length",
":",
"dataLen",
"}",
")",
";",
"for",
"(",
"const",
"tag",
"of",
"this",
".",
"parseMetadata",
"(",
"buffer",
")",
")",
"{",
"if",
"(",
"tag",
".",
"id",
"===",
"'TXXX'",
")",
"{",
"if",
"(",
"tag",
".",
"value",
")",
"{",
"for",
"(",
"const",
"text",
"of",
"tag",
".",
"value",
".",
"text",
")",
"{",
"this",
".",
"addTag",
"(",
"ID3v2Parser",
".",
"makeDescriptionTagName",
"(",
"tag",
".",
"id",
",",
"tag",
".",
"value",
".",
"description",
")",
",",
"text",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"tag",
".",
"id",
"===",
"'COM'",
")",
"{",
"for",
"(",
"const",
"value",
"of",
"tag",
".",
"value",
")",
"{",
"this",
".",
"addTag",
"(",
"ID3v2Parser",
".",
"makeDescriptionTagName",
"(",
"tag",
".",
"id",
",",
"value",
".",
"description",
")",
",",
"value",
".",
"text",
")",
";",
"}",
"}",
"else",
"if",
"(",
"tag",
".",
"id",
"===",
"'COMM'",
")",
"{",
"for",
"(",
"const",
"value",
"of",
"tag",
".",
"value",
")",
"{",
"this",
".",
"addTag",
"(",
"ID3v2Parser",
".",
"makeDescriptionTagName",
"(",
"tag",
".",
"id",
",",
"value",
".",
"description",
")",
",",
"value",
")",
";",
"}",
"}",
"else",
"if",
"(",
"Array",
".",
"isArray",
"(",
"tag",
".",
"value",
")",
")",
"{",
"for",
"(",
"const",
"value",
"of",
"tag",
".",
"value",
")",
"{",
"this",
".",
"addTag",
"(",
"tag",
".",
"id",
",",
"value",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"addTag",
"(",
"tag",
".",
"id",
",",
"tag",
".",
"value",
")",
";",
"}",
"}",
"}",
"private",
"addTag",
"(",
"id",
",",
"value",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"this",
".",
"headerType",
",",
"id",
",",
"value",
")",
";",
"}",
"private",
"parseMetadata",
"(",
"data",
")",
"{",
"let",
"offset",
"=",
"0",
";",
"const",
"tags",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"offset",
"===",
"data",
".",
"length",
")",
"break",
";",
"const",
"frameHeaderLength",
"=",
"ID3v2Parser",
".",
"getFrameHeaderLength",
"(",
"this",
".",
"id3Header",
".",
"version",
".",
"major",
")",
";",
"if",
"(",
"offset",
"+",
"frameHeaderLength",
">",
"data",
".",
"length",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Illegal ID3v2 tag length'",
")",
";",
"break",
";",
"}",
"const",
"frameHeaderBytes",
"=",
"data",
".",
"slice",
"(",
"offset",
",",
"offset",
"+=",
"frameHeaderLength",
")",
";",
"const",
"frameHeader",
"=",
"this",
".",
"readFrameHeader",
"(",
"frameHeaderBytes",
",",
"this",
".",
"id3Header",
".",
"version",
".",
"major",
")",
";",
"const",
"frameDataBytes",
"=",
"data",
".",
"slice",
"(",
"offset",
",",
"offset",
"+=",
"frameHeader",
".",
"length",
")",
";",
"const",
"values",
"=",
"ID3v2Parser",
".",
"readFrameData",
"(",
"frameDataBytes",
",",
"frameHeader",
",",
"this",
".",
"id3Header",
".",
"version",
".",
"major",
",",
"!",
"this",
".",
"options",
".",
"skipCovers",
",",
"this",
".",
"metadata",
")",
";",
"if",
"(",
"values",
")",
"{",
"tags",
".",
"push",
"(",
"{",
"id",
":",
"frameHeader",
".",
"id",
",",
"value",
":",
"values",
"}",
")",
";",
"}",
"}",
"return",
"tags",
";",
"}",
"private",
"readFrameHeader",
"(",
"v",
",",
"majorVer",
")",
"{",
"let",
"header",
";",
"switch",
"(",
"majorVer",
")",
"{",
"case",
"2",
":",
"header",
"=",
"{",
"id",
":",
"v",
".",
"toString",
"(",
"'ascii'",
",",
"0",
",",
"3",
")",
",",
"length",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"v",
",",
"3",
")",
"}",
";",
"if",
"(",
"!",
"header",
".",
"id",
".",
"match",
"(",
"/[A-Z0-9]{3}/g",
")",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"`Invalid ID3v2.${",
"this",
".",
"id3Header",
".",
"version",
".",
"major",
"} frame-header-ID: ${",
"header",
".",
"id",
"}`",
")",
";",
"}",
"break",
";",
"case",
"3",
":",
"case",
"4",
":",
"header",
"=",
"{",
"id",
":",
"v",
".",
"toString",
"(",
"'ascii'",
",",
"0",
",",
"4",
")",
",",
"length",
":",
"(",
"majorVer",
"===",
"4",
"?",
"UINT32SYNCSAFE",
":",
"Token",
".",
"UINT32_BE",
")",
".",
"get",
"(",
"v",
",",
"4",
")",
",",
"flags",
":",
"ID3v2Parser",
".",
"readFrameFlags",
"(",
"v",
".",
"slice",
"(",
"8",
",",
"10",
")",
")",
"}",
";",
"if",
"(",
"!",
"header",
".",
"id",
".",
"match",
"(",
"/[A-Z0-9]{4}/g",
")",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"`Invalid ID3v2.${",
"this",
".",
"id3Header",
".",
"version",
".",
"major",
"} frame-header-ID: ${",
"header",
".",
"id",
"}`",
")",
";",
"}",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"'Unexpected majorVer: '",
"+",
"majorVer",
")",
";",
"}",
"return",
"header",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
12,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
25252,
null,
49852,
null,
8,
null,
22574,
null,
null,
null,
39770,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
6865,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49853,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
3,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1271,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
12,
null,
null,
null,
3,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25252,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25252,
null,
12,
null,
3,
null,
null,
null,
25252,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661816 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"/**\n * \"EA IFF 85\" Standard for Interchange Format Files\n * Ref: http://www.martinreddy.net/gfx/2d/IFF.txt\n */",
"export",
"interface",
"IChunkHeader",
"{",
"/**\n * A chunk ID (ie, 4 ASCII bytes)\n */",
"chunkID",
":",
"string",
";",
"/**\n * Number of data bytes following this data header\n */",
"chunkSize",
":",
"number",
";",
"}",
"/**\n * \"EA IFF 85\" Standard for Interchange Format Files\n * Ref: http://www.martinreddy.net/gfx/2d/IFF.txt\n */",
"export",
"interface",
"IChunkHeader64",
"{",
"/**\n * A chunk ID (ie, 4 ASCII bytes)\n */",
"chunkID",
":",
"string",
";",
"/**\n * Number of data bytes following this data header\n */",
"chunkSize",
":",
"bigint",
";",
"}",
"/**\n * Common AIFF chunk header\n */",
"export",
"const",
"Header",
"=",
"{",
"len",
":",
"8",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IChunkHeader",
"=>",
"{",
"return",
"{",
"chunkID",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"chunkSize",
":",
"Number",
"(",
"BigInt",
"(",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
")",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661817 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"*",
"as",
"iff",
"from",
"'../iff'",
";",
"/**\n * The Common Chunk.\n * Describes fundamental parameters of the waveform data such as sample rate, bit resolution, and how many channels of\n * digital audio are stored in the FORM AIFF.\n */",
"export",
"interface",
"ICommon",
"{",
"numChannels",
":",
"number",
";",
"numSampleFrames",
":",
"number",
";",
"sampleSize",
":",
"number",
";",
"sampleRate",
":",
"number",
";",
"compressionType",
"?",
":",
"string",
";",
"compressionName",
"?",
":",
"string",
";",
"}",
"export",
"class",
"Common",
"implements",
"IGetToken",
"<",
"ICommon",
">",
"{",
"public",
"len",
":",
"number",
";",
"public",
"constructor",
"(",
"header",
",",
"private",
"isAifc",
")",
"{",
"const",
"minimumChunkSize",
"=",
"isAifc",
"?",
"22",
":",
"18",
";",
"if",
"(",
"header",
".",
"chunkSize",
"<",
"minimumChunkSize",
")",
"throw",
"new",
"Error",
"(",
"`COMMON CHUNK size should always be at least ${",
"minimumChunkSize",
"}`",
")",
";",
"this",
".",
"len",
"=",
"header",
".",
"chunkSize",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"shift",
"=",
"buf",
".",
"readUInt16BE",
"(",
"off",
"+",
"8",
")",
"-",
"16398",
";",
"const",
"baseSampleRate",
"=",
"buf",
".",
"readUInt16BE",
"(",
"off",
"+",
"8",
"+",
"2",
")",
";",
"const",
"res",
"=",
"{",
"numChannels",
":",
"buf",
".",
"readUInt16BE",
"(",
"off",
")",
",",
"numSampleFrames",
":",
"buf",
".",
"readUInt32BE",
"(",
"off",
"+",
"2",
")",
",",
"sampleSize",
":",
"buf",
".",
"readUInt16BE",
"(",
"off",
"+",
"6",
")",
",",
"sampleRate",
":",
"shift",
"<",
"0",
"?",
"baseSampleRate",
">>",
"Math",
".",
"abs",
"(",
"shift",
")",
":",
"baseSampleRate",
"<<",
"shift",
"}",
";",
"if",
"(",
"this",
".",
"isAifc",
")",
"{",
"res",
".",
"compressionType",
"=",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"18",
")",
";",
"if",
"(",
"this",
".",
"len",
">",
"22",
")",
"{",
"const",
"strLen",
"=",
"buf",
".",
"readInt8",
"(",
"off",
"+",
"22",
")",
";",
"const",
"padding",
"=",
"(",
"strLen",
"+",
"1",
")",
"%",
"2",
";",
"if",
"(",
"23",
"+",
"strLen",
"+",
"padding",
"===",
"this",
".",
"len",
")",
"{",
"res",
".",
"compressionName",
"=",
"new",
"Token",
".",
"StringType",
"(",
"strLen",
",",
"'binary'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"23",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"'Illegal pstring length'",
")",
";",
"}",
"}",
"}",
"else",
"{",
"res",
".",
"compressionName",
"=",
"'PCM'",
";",
"}",
"return",
"res",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49854,
null,
null,
8,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33698,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33698,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661818 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'../id3v2/ID3v2Parser'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"*",
"as",
"AiffToken",
"from",
"'./AiffToken'",
";",
"import",
"*",
"as",
"iff",
"from",
"'../iff'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:aiff'",
")",
";",
"/**\n * AIFF - Audio Interchange File Format\n *\n * Ref:\n * http://www.onicos.com/staff/iz/formats/aiff.html\n * http://muratnkonar.com/aiff/index.html\n * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/AIFF/AIFF.html\n */",
"export",
"class",
"AIFFParser",
"extends",
"BasicParser",
"{",
"private",
"isCompressed",
":",
"boolean",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"iff",
".",
"IChunkHeader",
">",
"(",
"iff",
".",
"Header",
")",
";",
"if",
"(",
"header",
".",
"chunkID",
"!==",
"'FORM'",
")",
"throw",
"new",
"Error",
"(",
"'Invalid Chunk-ID, expected \\'FORM\\''",
")",
";",
"const",
"type",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'AIFF'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"type",
")",
";",
"this",
".",
"isCompressed",
"=",
"false",
";",
"break",
";",
"case",
"'AIFC'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'AIFF-C'",
")",
";",
"this",
".",
"isCompressed",
"=",
"true",
";",
"break",
";",
"default",
":",
"throw",
"Error",
"(",
"'Unsupported AIFF type: '",
"+",
"type",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"!",
"this",
".",
"isCompressed",
")",
";",
"try",
"{",
"while",
"(",
"!",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"||",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
">=",
"iff",
".",
"Header",
".",
"len",
")",
"{",
"debug",
"(",
"'Reading AIFF chunk at offset='",
"+",
"this",
".",
"tokenizer",
".",
"position",
")",
";",
"const",
"chunkHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"iff",
".",
"IChunkHeader",
">",
"(",
"iff",
".",
"Header",
")",
";",
"debug",
"(",
"`Chunk id=${",
"chunkHeader",
".",
"chunkID",
"}`",
")",
";",
"const",
"nextChunk",
"=",
"2",
"*",
"Math",
".",
"round",
"(",
"chunkHeader",
".",
"chunkSize",
"/",
"2",
")",
";",
"const",
"bytesRead",
"=",
"await",
"this",
".",
"readData",
"(",
"chunkHeader",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"nextChunk",
"-",
"bytesRead",
")",
";",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"instanceof",
"strtok3",
".",
"EndOfStreamError",
")",
"{",
"debug",
"(",
"`End-of-stream`",
")",
";",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"public",
"async",
"readData",
"(",
"header",
")",
"{",
"switch",
"(",
"header",
".",
"chunkID",
")",
"{",
"case",
"'COMM'",
":",
"const",
"common",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AiffToken",
".",
"ICommon",
">",
"(",
"new",
"AiffToken",
".",
"Common",
"(",
"header",
",",
"this",
".",
"isCompressed",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"common",
".",
"sampleSize",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"common",
".",
"sampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"common",
".",
"numChannels",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"common",
".",
"numSampleFrames",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"common",
".",
"numSampleFrames",
"/",
"common",
".",
"sampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"common",
".",
"compressionName",
")",
";",
"return",
"header",
".",
"chunkSize",
";",
"case",
"'ID3 '",
":",
"const",
"id3_data",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Uint8Array",
">",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"header",
".",
"chunkSize",
")",
")",
";",
"const",
"rst",
"=",
"strtok3",
".",
"fromBuffer",
"(",
"id3_data",
")",
";",
"await",
"new",
"ID3v2Parser",
"(",
")",
".",
"parse",
"(",
"this",
".",
"metadata",
",",
"rst",
",",
"this",
".",
"options",
")",
";",
"return",
"header",
".",
"chunkSize",
";",
"case",
"'SSND'",
":",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"8",
"*",
"header",
".",
"chunkSize",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"}",
"return",
"0",
";",
"default",
":",
"return",
"0",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
49854,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33698,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25253,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661819 | [
"/**\n * Ref:\n * https://tools.ietf.org/html/draft-fleischman-asf-01, Appendix A: ASF GUIDs\n * http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html\n * http://drang.s4.xrea.com/program/tips/id3tag/wmp/index.html\n *\n * http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html\n *\n * ASF File Structure:\n * https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575(v=vs.85).aspx\n *\n * ASF GUIDs:\n * http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html\n *\n * https://github.com/dji-sdk/FFmpeg/blob/master/libavformat/asf.c\n */",
"export",
"default",
"class",
"GUID",
"{",
"public",
"static",
"HeaderObject",
"=",
"new",
"GUID",
"(",
"\"75B22630-668E-11CF-A6D9-00AA0062CE6C\"",
")",
";",
"public",
"static",
"DataObject",
"=",
"new",
"GUID",
"(",
"\"75B22636-668E-11CF-A6D9-00AA0062CE6C\"",
")",
";",
"public",
"static",
"SimpleIndexObject",
"=",
"new",
"GUID",
"(",
"\"33000890-E5B1-11CF-89F4-00A0C90349CB\"",
")",
";",
"public",
"static",
"IndexObject",
"=",
"new",
"GUID",
"(",
"\"D6E229D3-35DA-11D1-9034-00A0C90349BE\"",
")",
";",
"public",
"static",
"MediaObjectIndexObject",
"=",
"new",
"GUID",
"(",
"\"FEB103F8-12AD-4C64-840F-2A1D2F7AD48C\"",
")",
";",
"public",
"static",
"TimecodeIndexObject",
"=",
"new",
"GUID",
"(",
"\"3CB73FD0-0C4A-4803-953D-EDF7B6228F0C\"",
")",
";",
"public",
"static",
"FilePropertiesObject",
"=",
"new",
"GUID",
"(",
"\"8CABDCA1-A947-11CF-8EE4-00C00C205365\"",
")",
";",
"public",
"static",
"StreamPropertiesObject",
"=",
"new",
"GUID",
"(",
"\"B7DC0791-A9B7-11CF-8EE6-00C00C205365\"",
")",
";",
"public",
"static",
"HeaderExtensionObject",
"=",
"new",
"GUID",
"(",
"\"5FBF03B5-A92E-11CF-8EE3-00C00C205365\"",
")",
";",
"public",
"static",
"CodecListObject",
"=",
"new",
"GUID",
"(",
"\"86D15240-311D-11D0-A3A4-00A0C90348F6\"",
")",
";",
"public",
"static",
"ScriptCommandObject",
"=",
"new",
"GUID",
"(",
"\"1EFB1A30-0B62-11D0-A39B-00A0C90348F6\"",
")",
";",
"public",
"static",
"MarkerObject",
"=",
"new",
"GUID",
"(",
"\"F487CD01-A951-11CF-8EE6-00C00C205365\"",
")",
";",
"public",
"static",
"BitrateMutualExclusionObject",
"=",
"new",
"GUID",
"(",
"\"D6E229DC-35DA-11D1-9034-00A0C90349BE\"",
")",
";",
"public",
"static",
"ErrorCorrectionObject",
"=",
"new",
"GUID",
"(",
"\"75B22635-668E-11CF-A6D9-00AA0062CE6C\"",
")",
";",
"public",
"static",
"ContentDescriptionObject",
"=",
"new",
"GUID",
"(",
"\"75B22633-668E-11CF-A6D9-00AA0062CE6C\"",
")",
";",
"public",
"static",
"ExtendedContentDescriptionObject",
"=",
"new",
"GUID",
"(",
"\"D2D0A440-E307-11D2-97F0-00A0C95EA850\"",
")",
";",
"public",
"static",
"ContentBrandingObject",
"=",
"new",
"GUID",
"(",
"\"2211B3FA-BD23-11D2-B4B7-00A0C955FC6E\"",
")",
";",
"public",
"static",
"StreamBitratePropertiesObject",
"=",
"new",
"GUID",
"(",
"\"7BF875CE-468D-11D1-8D82-006097C9A2B2\"",
")",
";",
"public",
"static",
"ContentEncryptionObject",
"=",
"new",
"GUID",
"(",
"\"2211B3FB-BD23-11D2-B4B7-00A0C955FC6E\"",
")",
";",
"public",
"static",
"ExtendedContentEncryptionObject",
"=",
"new",
"GUID",
"(",
"\"298AE614-2622-4C17-B935-DAE07EE9289C\"",
")",
";",
"public",
"static",
"DigitalSignatureObject",
"=",
"new",
"GUID",
"(",
"\"2211B3FC-BD23-11D2-B4B7-00A0C955FC6E\"",
")",
";",
"public",
"static",
"PaddingObject",
"=",
"new",
"GUID",
"(",
"\"1806D474-CADF-4509-A4BA-9AABCB96AAE8\"",
")",
";",
"public",
"static",
"ExtendedStreamPropertiesObject",
"=",
"new",
"GUID",
"(",
"\"14E6A5CB-C672-4332-8399-A96952065B5A\"",
")",
";",
"public",
"static",
"AdvancedMutualExclusionObject",
"=",
"new",
"GUID",
"(",
"\"A08649CF-4775-4670-8A16-6E35357566CD\"",
")",
";",
"public",
"static",
"GroupMutualExclusionObject",
"=",
"new",
"GUID",
"(",
"\"D1465A40-5A79-4338-B71B-E36B8FD6C249\"",
")",
";",
"public",
"static",
"StreamPrioritizationObject",
"=",
"new",
"GUID",
"(",
"\"D4FED15B-88D3-454F-81F0-ED5C45999E24\"",
")",
";",
"public",
"static",
"BandwidthSharingObject",
"=",
"new",
"GUID",
"(",
"\"A69609E6-517B-11D2-B6AF-00C04FD908E9\"",
")",
";",
"public",
"static",
"LanguageListObject",
"=",
"new",
"GUID",
"(",
"\"7C4346A9-EFE0-4BFC-B229-393EDE415C85\"",
")",
";",
"public",
"static",
"MetadataObject",
"=",
"new",
"GUID",
"(",
"\"C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA\"",
")",
";",
"public",
"static",
"MetadataLibraryObject",
"=",
"new",
"GUID",
"(",
"\"44231C94-9498-49D1-A141-1D134E457054\"",
")",
";",
"public",
"static",
"IndexParametersObject",
"=",
"new",
"GUID",
"(",
"\"D6E229DF-35DA-11D1-9034-00A0C90349BE\"",
")",
";",
"public",
"static",
"MediaObjectIndexParametersObject",
"=",
"new",
"GUID",
"(",
"\"6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7\"",
")",
";",
"public",
"static",
"TimecodeIndexParametersObject",
"=",
"new",
"GUID",
"(",
"\"F55E496D-9797-4B5D-8C8B-604DFE9BFB24\"",
")",
";",
"public",
"static",
"CompatibilityObject",
"=",
"new",
"GUID",
"(",
"\"26F18B5D-4584-47EC-9F5F-0E651F0452C9\"",
")",
";",
"public",
"static",
"AdvancedContentEncryptionObject",
"=",
"new",
"GUID",
"(",
"\"43058533-6981-49E6-9B74-AD12CB86D58C\"",
")",
";",
"public",
"static",
"AudioMedia",
"=",
"new",
"GUID",
"(",
"\"F8699E40-5B4D-11CF-A8FD-00805F5C442B\"",
")",
";",
"public",
"static",
"VideoMedia",
"=",
"new",
"GUID",
"(",
"\"BC19EFC0-5B4D-11CF-A8FD-00805F5C442B\"",
")",
";",
"public",
"static",
"CommandMedia",
"=",
"new",
"GUID",
"(",
"\"59DACFC0-59E6-11D0-A3AC-00A0C90348F6\"",
")",
";",
"public",
"static",
"JFIF_Media",
"=",
"new",
"GUID",
"(",
"\"B61BE100-5B4E-11CF-A8FD-00805F5C442B\"",
")",
";",
"public",
"static",
"Degradable_JPEG_Media",
"=",
"new",
"GUID",
"(",
"\"35907DE0-E415-11CF-A917-00805F5C442B\"",
")",
";",
"public",
"static",
"FileTransferMedia",
"=",
"new",
"GUID",
"(",
"\"91BD222C-F21C-497A-8B6D-5AA86BFC0185\"",
")",
";",
"public",
"static",
"BinaryMedia",
"=",
"new",
"GUID",
"(",
"\"3AFB65E2-47EF-40F2-AC2C-70A90D71D343\"",
")",
";",
"public",
"static",
"ASF_Index_Placeholder_Object",
"=",
"new",
"GUID",
"(",
"\"D9AADE20-7C17-4F9C-BC28-8555DD98E2A2\"",
")",
";",
"public",
"static",
"fromBin",
"(",
"bin",
",",
"offset",
"=",
"0",
")",
"{",
"return",
"new",
"GUID",
"(",
"this",
".",
"decode",
"(",
"bin",
",",
"offset",
")",
")",
";",
"}",
"param",
"objectId",
"param",
"offset",
"returns",
"{",
"string",
"}",
"public",
"static",
"decode",
"(",
"objectId",
",",
"offset",
"=",
"0",
")",
"{",
"const",
"guid",
"=",
"objectId",
".",
"readUInt32LE",
"(",
"offset",
")",
".",
"toString",
"(",
"16",
")",
"+",
"\"-\"",
"+",
"objectId",
".",
"readUInt16LE",
"(",
"offset",
"+",
"4",
")",
".",
"toString",
"(",
"16",
")",
"+",
"\"-\"",
"+",
"objectId",
".",
"readUInt16LE",
"(",
"offset",
"+",
"6",
")",
".",
"toString",
"(",
"16",
")",
"+",
"\"-\"",
"+",
"objectId",
".",
"readUInt16BE",
"(",
"offset",
"+",
"8",
")",
".",
"toString",
"(",
"16",
")",
"+",
"\"-\"",
"+",
"objectId",
".",
"slice",
"(",
"offset",
"+",
"10",
",",
"offset",
"+",
"16",
")",
".",
"toString",
"(",
"'hex'",
")",
";",
"return",
"guid",
".",
"toUpperCase",
"(",
")",
";",
"}",
"param",
"{",
"string",
"}",
"mediaType",
"returns",
"{",
"string",
"}",
"public",
"static",
"decodeMediaType",
"(",
"mediaType",
")",
"{",
"switch",
"(",
"mediaType",
".",
"str",
")",
"{",
"case",
"GUID",
".",
"AudioMedia",
".",
"str",
":",
"return",
"'audio'",
";",
"case",
"GUID",
".",
"VideoMedia",
".",
"str",
":",
"return",
"'video'",
";",
"case",
"GUID",
".",
"CommandMedia",
".",
"str",
":",
"return",
"'command'",
";",
"case",
"GUID",
".",
"Degradable_JPEG_Media",
".",
"str",
":",
"return",
"'degradable-jpeg'",
";",
"case",
"GUID",
".",
"FileTransferMedia",
".",
"str",
":",
"return",
"'file-transfer'",
";",
"case",
"GUID",
".",
"BinaryMedia",
".",
"str",
":",
"return",
"'binary'",
";",
"}",
"}",
"param",
"guid",
"returns",
"{",
"Buffer",
"}",
"public",
"static",
"encode",
"(",
"str",
")",
"{",
"const",
"bin",
"=",
"Buffer",
".",
"alloc",
"(",
"16",
")",
";",
"bin",
".",
"writeUInt32LE",
"(",
"parseInt",
"(",
"str",
".",
"slice",
"(",
"0",
",",
"8",
")",
",",
"16",
")",
",",
"0",
")",
";",
"bin",
".",
"writeUInt16LE",
"(",
"parseInt",
"(",
"str",
".",
"slice",
"(",
"9",
",",
"13",
")",
",",
"16",
")",
",",
"4",
")",
";",
"bin",
".",
"writeUInt16LE",
"(",
"parseInt",
"(",
"str",
".",
"slice",
"(",
"14",
",",
"18",
")",
",",
"16",
")",
",",
"6",
")",
";",
"Buffer",
".",
"from",
"(",
"str",
".",
"slice",
"(",
"19",
",",
"23",
")",
",",
"\"hex\"",
")",
".",
"copy",
"(",
"bin",
",",
"8",
")",
";",
"Buffer",
".",
"from",
"(",
"str",
".",
"slice",
"(",
"24",
")",
",",
"\"hex\"",
")",
".",
"copy",
"(",
"bin",
",",
"10",
")",
";",
"return",
"bin",
";",
"}",
"public",
"constructor",
"(",
"public",
"str",
")",
"{",
"}",
"public",
"equals",
"(",
"guid",
")",
"{",
"return",
"this",
".",
"str",
"===",
"guid",
".",
"str",
";",
"}",
"public",
"toBin",
"(",
")",
"{",
"return",
"GUID",
".",
"encode",
"(",
"this",
".",
"str",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33699,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
12,
null,
3,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
33699,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
2,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
8,
null,
33699,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661820 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"DataType",
"}",
"from",
"'./AsfObject'",
";",
"export",
"type",
"AttributeParser",
"=",
"(",
"buf",
":",
"Buffer",
")",
"=>",
"boolean",
"|",
"string",
"|",
"number",
"|",
"bigint",
"|",
"Buffer",
";",
"export",
"class",
"AsfUtil",
"{",
"public",
"static",
"getParserForAttr",
"(",
"i",
")",
"{",
"return",
"AsfUtil",
".",
"attributeParsers",
"[",
"i",
"]",
";",
"}",
"public",
"static",
"parseUnicodeAttr",
"(",
"buf",
")",
"{",
"return",
"util",
".",
"stripNulls",
"(",
"util",
".",
"decodeString",
"(",
"buf",
",",
"'utf16le'",
")",
")",
";",
"}",
"private",
"static",
"attributeParsers",
":",
"AttributeParser",
"[",
"]",
"=",
"[",
"AsfUtil",
".",
"parseUnicodeAttr",
",",
"AsfUtil",
".",
"parseByteArrayAttr",
",",
"AsfUtil",
".",
"parseBoolAttr",
",",
"AsfUtil",
".",
"parseDWordAttr",
",",
"AsfUtil",
".",
"parseQWordAttr",
",",
"AsfUtil",
".",
"parseWordAttr",
",",
"AsfUtil",
".",
"parseByteArrayAttr",
"]",
";",
"private",
"static",
"parseByteArrayAttr",
"(",
"buf",
")",
"{",
"const",
"newBuf",
"=",
"Buffer",
".",
"alloc",
"(",
"buf",
".",
"length",
")",
";",
"buf",
".",
"copy",
"(",
"newBuf",
")",
";",
"return",
"newBuf",
";",
"}",
"private",
"static",
"parseBoolAttr",
"(",
"buf",
",",
"offset",
"=",
"0",
")",
"{",
"return",
"AsfUtil",
".",
"parseWordAttr",
"(",
"buf",
",",
"offset",
")",
"===",
"1",
";",
"}",
"private",
"static",
"parseDWordAttr",
"(",
"buf",
",",
"offset",
"=",
"0",
")",
"{",
"return",
"buf",
".",
"readUInt32LE",
"(",
"offset",
")",
";",
"}",
"private",
"static",
"parseQWordAttr",
"(",
"buf",
",",
"offset",
"=",
"0",
")",
"{",
"return",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"offset",
")",
";",
"}",
"private",
"static",
"parseWordAttr",
"(",
"buf",
",",
"offset",
"=",
"0",
")",
"{",
"return",
"buf",
".",
"readUInt16LE",
"(",
"offset",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33700,
null,
457,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
12,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
102,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661821 | [
"import",
"{",
"IGetToken",
",",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"IPicture",
",",
"ITag",
"}",
"from",
"'../type'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"GUID",
"from",
"'./GUID'",
";",
"import",
"{",
"AsfUtil",
"}",
"from",
"'./AsfUtil'",
";",
"import",
"{",
"AttachedPictureType",
"}",
"from",
"'../id3v2/ID3v2Token'",
";",
"/**\n * Data Type: Specifies the type of information being stored. The following values are recognized.\n */",
"export",
"enum",
"DataType",
"{",
"/**\n * Unicode string. The data consists of a sequence of Unicode characters.\n */",
"UnicodeString",
",",
"/**\n * BYTE array. The type of data is implementation-specific.\n */",
"ByteArray",
",",
"/**\n * BOOL. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values.\n */",
"Bool",
",",
"/**\n * DWORD. The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer.\n */",
"DWord",
",",
"/**\n * QWORD. The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer.\n */",
"QWord",
",",
"/**\n * WORD. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer.\n */",
"Word",
"}",
"/**\n * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575\n */",
"export",
"interface",
"IAsfObjectHeader",
"{",
"/**\n * A GUID that identifies the object. 128 bits\n */",
"objectId",
":",
"GUID",
";",
"/**\n * The size of the object (64-bits)\n */",
"objectSize",
":",
"number",
";",
"}",
"/**\n * Interface for: 3. ASF top-level Header Object\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3\n */",
"export",
"interface",
"IAsfTopLevelObjectHeader",
"extends",
"IAsfObjectHeader",
"{",
"numberOfHeaderObjects",
":",
"number",
";",
"}",
"/**\n * Token for: 3. ASF top-level Header Object\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3\n */",
"export",
"const",
"TopLevelHeaderObjectToken",
"=",
"{",
"len",
":",
"30",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAsfTopLevelObjectHeader",
"=>",
"{",
"return",
"{",
"objectId",
":",
"GUID",
".",
"fromBin",
"(",
"new",
"Token",
".",
"BufferType",
"(",
"16",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
")",
",",
"objectSize",
":",
"Number",
"(",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
")",
",",
"numberOfHeaderObjects",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Token for: 3.1 Header Object (mandatory, one only)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_1\n */",
"export",
"const",
"HeaderObjectToken",
"=",
"{",
"len",
":",
"24",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAsfObjectHeader",
"=>",
"{",
"return",
"{",
"objectId",
":",
"GUID",
".",
"fromBin",
"(",
"new",
"Token",
".",
"BufferType",
"(",
"16",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
")",
",",
"objectSize",
":",
"Number",
"(",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
")",
"}",
";",
"}",
"}",
";",
"export",
"abstract",
"class",
"State",
"<",
"T",
">",
"implements",
"IGetToken",
"<",
"T",
">",
"{",
"public",
"len",
":",
"number",
";",
"constructor",
"(",
"header",
")",
"{",
"this",
".",
"len",
"=",
"Number",
"(",
"header",
".",
"objectSize",
")",
"-",
"HeaderObjectToken",
".",
"len",
";",
"}",
"public",
"abstract",
"get",
"(",
"buf",
",",
"off",
")",
";",
"protected",
"postProcessTag",
"(",
"tags",
",",
"name",
",",
"valueType",
",",
"data",
")",
"{",
"if",
"(",
"name",
"===",
"'WM/Picture'",
")",
"{",
"tags",
".",
"push",
"(",
"{",
"id",
":",
"name",
",",
"value",
":",
"WmPictureToken",
".",
"fromBuffer",
"(",
"data",
")",
"}",
")",
";",
"}",
"else",
"{",
"const",
"parseAttr",
"=",
"AsfUtil",
".",
"getParserForAttr",
"(",
"valueType",
")",
";",
"if",
"(",
"!",
"parseAttr",
")",
"{",
"throw",
"new",
"Error",
"(",
"'unexpected value headerType: '",
"+",
"valueType",
")",
";",
"}",
"tags",
".",
"push",
"(",
"{",
"id",
":",
"name",
",",
"value",
":",
"parseAttr",
"(",
"data",
")",
"}",
")",
";",
"}",
"}",
"}",
"export",
"class",
"IgnoreObjectState",
"extends",
"State",
"<",
"any",
">",
"{",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"null",
";",
"}",
"}",
"/**\n * Interface for: 3.2: File Properties Object (mandatory, one only)\n *\n * The File Properties Object defines the global characteristics of the combined digital media streams found within the Data Object.\n */",
"export",
"interface",
"IFilePropertiesObject",
"{",
"/**\n * Specifies the unique identifier for this file.\n * The value of this field shall be regenerated every time the file is modified in any way.\n * The value of this field shall be identical to the value of the File ID field of the Data Object.\n */",
"fileId",
":",
"GUID",
";",
"/**\n * Specifies the size, in bytes, of the entire file.\n * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.\n */",
"fileSize",
":",
"bigint",
";",
"/**\n * Specifies the date and time of the initial creation of the file. The value is given as the number of 100-nanosecond\n * intervals since January 1, 1601, according to Coordinated Universal Time (Greenwich Mean Time). The value of this\n * field may be invalid if the Broadcast Flag bit in the Flags field is set to 1.\n */",
"creationDate",
":",
"bigint",
";",
"/**\n * Specifies the number of Data Packet entries that exist within the Data Object. The value of this field is invalid\n * if the Broadcast Flag bit in the Flags field is set to 1.\n */",
"dataPacketsCount",
":",
"bigint",
";",
"/**\n * Specifies the time needed to play the file in 100-nanosecond units.\n * This value should include the duration (estimated, if an exact value is unavailable) of the the last media object\n * in the presentation. The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.\n */",
"playDuration",
":",
"bigint",
";",
"/**\n * Specifies the time needed to send the file in 100-nanosecond units.\n * This value should include the duration of the last packet in the content.\n * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.\n * Players can ignore this value.\n */",
"sendDuration",
":",
"bigint",
";",
"/**\n * Specifies the amount of time to buffer data before starting to play the file, in millisecond units.\n * If this value is nonzero, the Play Duration field and all of the payload Presentation Time fields have been offset\n * by this amount. Therefore, player software must subtract the value in the preroll field from the play duration and\n * presentation times to calculate their actual values. It follows that all payload Presentation Time fields need to\n * be at least this value.\n */",
"preroll",
":",
"bigint",
";",
"/**\n * The flags\n */",
"flags",
":",
"{",
"/**\n * Specifies, if set, that a file is in the process of being created (for example, for recording applications),\n * and thus that various values stored in the header objects are invalid. It is highly recommended that\n * post-processing be performed to remove this condition at the earliest opportunity.\n */",
"broadcast",
":",
"boolean",
";",
"/**\n * Specifies, if set, that a file is seekable.\n * Note that for files containing a single audio stream and a Minimum Data Packet Size field equal to the Maximum\n * Data Packet Size field, this flag shall always be set to 1.\n * For files containing a single audio stream and a video stream or mutually exclusive video streams,\n * this flag is only set to 1 if the file contains a matching Simple Index Object for each regular video stream\n * (that is, video streams that are not hidden according to the method described in section 8.2.2).\n */",
"seekable",
":",
"boolean",
";",
"}",
";",
"/**\n * Specifies the minimum Data Packet size in bytes. In general, the value of this field is invalid if the Broadcast\n * Flag bit in the Flags field is set to 1.\n * However, for the purposes of this specification, the values for the Minimum Data Packet Size and Maximum Data\n * Packet Size fields shall be set to the same value, and this value should be set to the packet size, even when the\n * Broadcast Flag in the Flags field is set to 1.\n */",
"minimumDataPacketSize",
":",
"number",
";",
"/**\n * Specifies the maximum Data Packet size in bytes.\n * In general, the value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.\n * However, for the purposes of this specification, the values of the Minimum Data Packet Size and Maximum Data Packet\n * Size fields shall be set to the same value,\n * and this value should be set to the packet size, even when the Broadcast Flag field is set to 1.\n */",
"maximumDataPacketSize",
":",
"number",
";",
"/**\n * Specifies the maximum instantaneous bit rate in bits per second for the entire file.\n * This shall equal the sum of the bit rates of the individual digital media streams.\n * It shall be noted that the digital media stream includes ASF data packetization overhead as well as digital media\n * data in payloads.\n * Only those streams that have a free-standing Stream Properties Object in the header shall have their bit rates\n * included in the sum;\n * streams whose Stream Properties Object exists as part of an Extended Stream Properties Object in the Header\n * Extension Object shall not have their bit rates included in this sum, except when this value would otherwise be 0.\n */",
"maximumBitrate",
":",
"number",
";",
"}",
"/**\n * Token for: 3.2: File Properties Object (mandatory, one only)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_2\n */",
"export",
"class",
"FilePropertiesObject",
"extends",
"State",
"<",
"IFilePropertiesObject",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"FilePropertiesObject",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"fileId",
":",
"GUID",
".",
"fromBin",
"(",
"buf",
",",
"off",
")",
",",
"fileSize",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"creationDate",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
",",
"dataPacketsCount",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"32",
")",
",",
"playDuration",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"40",
")",
",",
"sendDuration",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"48",
")",
",",
"preroll",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"56",
")",
",",
"flags",
":",
"{",
"broadcast",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"64",
",",
"24",
")",
",",
"seekable",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"64",
",",
"25",
")",
"}",
",",
"minimumDataPacketSize",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"68",
")",
",",
"maximumDataPacketSize",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"72",
")",
",",
"maximumBitrate",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"76",
")",
"}",
";",
"}",
"}",
"/**\n * Interface for: 3.3 Stream Properties Object (mandatory, one per stream)\n */",
"export",
"interface",
"IStreamPropertiesObject",
"{",
"/**\n * Stream Type\n */",
"streamType",
":",
"string",
";",
"/**\n * Error Correction Type\n */",
"errorCorrectionType",
":",
"GUID",
";",
"}",
"/**\n * Token for: 3.3 Stream Properties Object (mandatory, one per stream)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_3\n */",
"export",
"class",
"StreamPropertiesObject",
"extends",
"State",
"<",
"IStreamPropertiesObject",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"StreamPropertiesObject",
";",
"public",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"streamType",
":",
"GUID",
".",
"decodeMediaType",
"(",
"GUID",
".",
"fromBin",
"(",
"buf",
",",
"off",
")",
")",
",",
"errorCorrectionType",
":",
"GUID",
".",
"fromBin",
"(",
"buf",
",",
"off",
"+",
"8",
")",
"}",
";",
"}",
"}",
"export",
"interface",
"IHeaderExtensionObject",
"{",
"reserved1",
":",
"GUID",
";",
"reserved2",
":",
"number",
";",
"extensionDataSize",
":",
"number",
";",
"}",
"/**\n * 3.4: Header Extension Object (mandatory, one only)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_4\n */",
"export",
"class",
"HeaderExtensionObject",
"implements",
"IGetToken",
"<",
"IHeaderExtensionObject",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"HeaderExtensionObject",
";",
"public",
"len",
":",
"number",
";",
"public",
"constructor",
"(",
")",
"{",
"this",
".",
"len",
"=",
"22",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"reserved1",
":",
"GUID",
".",
"fromBin",
"(",
"buf",
",",
"off",
")",
",",
"reserved2",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"16",
")",
",",
"extensionDataSize",
":",
"buf",
".",
"readUInt32LE",
"(",
"off",
"+",
"18",
")",
"}",
";",
"}",
"}",
"/**\n * 3.5: The Codec-List-Object interface.\n */",
"interface",
"ICodecListObjectHeader",
"{",
"entryCount",
":",
"number",
";",
"}",
"/**\n * 3.5: The Codec List Object provides user-friendly information about the codecs and formats used to encode the content found in the ASF file.\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_5\n */",
"const",
"CodecListObjectHeader",
"=",
"{",
"len",
":",
"20",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"ICodecListObjectHeader",
"=>",
"{",
"return",
"{",
"entryCount",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"16",
")",
"}",
";",
"}",
"}",
";",
"export",
"interface",
"ICodecEntry",
"{",
"type",
":",
"{",
"videoCodec",
":",
"boolean",
";",
"audioCodec",
":",
"boolean",
";",
"}",
";",
"codecName",
":",
"string",
";",
"description",
":",
"string",
";",
"information",
":",
"Buffer",
";",
"}",
"async",
"function",
"readString",
"(",
"tokenizer",
")",
"{",
"const",
"length",
"=",
"await",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"UINT16_LE",
")",
";",
"return",
"(",
"await",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"length",
"*",
"2",
",",
"'utf16le'",
")",
")",
")",
".",
"replace",
"(",
"'\\0'",
",",
"''",
")",
";",
"}",
"/**\n * 3.5: Read the Codec-List-Object, which provides user-friendly information about the codecs and formats used to encode the content found in the ASF file.\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_5\n */",
"export",
"async",
"function",
"readCodecEntries",
"(",
"tokenizer",
")",
"{",
"const",
"codecHeader",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"CodecListObjectHeader",
")",
";",
"const",
"entries",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"codecHeader",
".",
"entryCount",
";",
"++",
"i",
")",
"{",
"entries",
".",
"push",
"(",
"await",
"readCodecEntry",
"(",
"tokenizer",
")",
")",
";",
"}",
"return",
"entries",
";",
"}",
"async",
"function",
"readInformation",
"(",
"tokenizer",
")",
"{",
"const",
"length",
"=",
"await",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"UINT16_LE",
")",
";",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"length",
")",
";",
"await",
"tokenizer",
".",
"readBuffer",
"(",
"buf",
")",
";",
"return",
"buf",
";",
"}",
"param",
"tokenizer",
"async",
"function",
"readCodecEntry",
"(",
"tokenizer",
")",
"{",
"const",
"type",
"=",
"await",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"UINT16_LE",
")",
";",
"return",
"{",
"type",
":",
"{",
"videoCodec",
":",
"(",
"type",
"&",
"0x0001",
")",
"===",
"0x0001",
",",
"audioCodec",
":",
"(",
"type",
"&",
"0x0002",
")",
"===",
"0x0002",
"}",
",",
"codecName",
":",
"await",
"readString",
"(",
"tokenizer",
")",
",",
"description",
":",
"await",
"readString",
"(",
"tokenizer",
")",
",",
"information",
":",
"await",
"readInformation",
"(",
"tokenizer",
")",
"}",
";",
"}",
"/**\n * 3.10 Content Description Object (optional, one only)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_10\n */",
"export",
"class",
"ContentDescriptionObjectState",
"extends",
"State",
"<",
"ITag",
"[",
"]",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"ContentDescriptionObject",
";",
"private",
"static",
"contentDescTags",
"=",
"[",
"'Title'",
",",
"'Author'",
",",
"'Copyright'",
",",
"'Description'",
",",
"'Rating'",
"]",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"tags",
"=",
"[",
"]",
";",
"let",
"pos",
"=",
"off",
"+",
"10",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"ContentDescriptionObjectState",
".",
"contentDescTags",
".",
"length",
";",
"++",
"i",
")",
"{",
"const",
"length",
"=",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"i",
"*",
"2",
")",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"const",
"tagName",
"=",
"ContentDescriptionObjectState",
".",
"contentDescTags",
"[",
"i",
"]",
";",
"const",
"end",
"=",
"pos",
"+",
"length",
";",
"tags",
".",
"push",
"(",
"{",
"id",
":",
"tagName",
",",
"value",
":",
"AsfUtil",
".",
"parseUnicodeAttr",
"(",
"buf",
".",
"slice",
"(",
"pos",
",",
"end",
")",
")",
"}",
")",
";",
"pos",
"=",
"end",
";",
"}",
"}",
"return",
"tags",
";",
"}",
"}",
"/**\n * 3.11 Extended Content Description Object (optional, one only)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_11\n */",
"export",
"class",
"ExtendedContentDescriptionObjectState",
"extends",
"State",
"<",
"ITag",
"[",
"]",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"ExtendedContentDescriptionObject",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"tags",
"=",
"[",
"]",
";",
"const",
"attrCount",
"=",
"buf",
".",
"readUInt16LE",
"(",
"off",
")",
";",
"let",
"pos",
"=",
"off",
"+",
"2",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"attrCount",
";",
"i",
"+=",
"1",
")",
"{",
"const",
"nameLen",
"=",
"buf",
".",
"readUInt16LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"2",
";",
"const",
"name",
"=",
"AsfUtil",
".",
"parseUnicodeAttr",
"(",
"buf",
".",
"slice",
"(",
"pos",
",",
"pos",
"+",
"nameLen",
")",
")",
";",
"pos",
"+=",
"nameLen",
";",
"const",
"valueType",
"=",
"buf",
".",
"readUInt16LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"2",
";",
"const",
"valueLen",
"=",
"buf",
".",
"readUInt16LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"2",
";",
"const",
"value",
"=",
"buf",
".",
"slice",
"(",
"pos",
",",
"pos",
"+",
"valueLen",
")",
";",
"pos",
"+=",
"valueLen",
";",
"this",
".",
"postProcessTag",
"(",
"tags",
",",
"name",
",",
"valueType",
",",
"value",
")",
";",
"}",
"return",
"tags",
";",
"}",
"}",
"export",
"interface",
"IStreamName",
"{",
"streamLanguageId",
":",
"number",
";",
"streamName",
":",
"string",
";",
"}",
"/**\n * 4.1 Extended Stream Properties Object (optional, 1 per media stream)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1\n */",
"export",
"interface",
"IExtendedStreamPropertiesObject",
"{",
"startTime",
":",
"bigint",
";",
"endTime",
":",
"bigint",
";",
"dataBitrate",
":",
"number",
";",
"bufferSize",
":",
"number",
";",
"initialBufferFullness",
":",
"number",
";",
"alternateDataBitrate",
":",
"number",
";",
"alternateBufferSize",
":",
"number",
";",
"alternateInitialBufferFullness",
":",
"number",
";",
"maximumObjectSize",
":",
"number",
";",
"flags",
":",
"{",
"reliableFlag",
":",
"boolean",
";",
"seekableFlag",
":",
"boolean",
";",
"resendLiveCleanpointsFlag",
":",
"boolean",
";",
"}",
";",
"streamNumber",
":",
"number",
";",
"streamLanguageId",
":",
"number",
";",
"averageTimePerFrame",
":",
"number",
";",
"streamNameCount",
":",
"number",
";",
"payloadExtensionSystems",
":",
"number",
";",
"streamNames",
":",
"IStreamName",
"[",
"]",
";",
"streamPropertiesObject",
":",
"number",
";",
"}",
"/**\n * 4.1 Extended Stream Properties Object (optional, 1 per media stream)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1\n */",
"export",
"class",
"ExtendedStreamPropertiesObjectState",
"extends",
"State",
"<",
"IExtendedStreamPropertiesObject",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"ExtendedStreamPropertiesObject",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"startTime",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"endTime",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"dataBitrate",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"12",
")",
",",
"bufferSize",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"16",
")",
",",
"initialBufferFullness",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"20",
")",
",",
"alternateDataBitrate",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"24",
")",
",",
"alternateBufferSize",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"28",
")",
",",
"alternateInitialBufferFullness",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"32",
")",
",",
"maximumObjectSize",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"36",
")",
",",
"flags",
":",
"{",
"reliableFlag",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"40",
",",
"0",
")",
",",
"seekableFlag",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"40",
",",
"1",
")",
",",
"resendLiveCleanpointsFlag",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"40",
",",
"2",
")",
"}",
",",
"streamNumber",
":",
"buf",
".",
"readInt16LE",
"(",
"off",
"+",
"42",
")",
",",
"streamLanguageId",
":",
"buf",
".",
"readInt16LE",
"(",
"off",
"+",
"44",
")",
",",
"averageTimePerFrame",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"52",
")",
",",
"streamNameCount",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"54",
")",
",",
"payloadExtensionSystems",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"56",
")",
",",
"streamNames",
":",
"[",
"]",
",",
"streamPropertiesObject",
":",
"null",
"}",
";",
"}",
"}",
"/**\n * 4.7 Metadata Object (optional, 0 or 1)\n * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_7\n */",
"export",
"class",
"MetadataObjectState",
"extends",
"State",
"<",
"ITag",
"[",
"]",
">",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"MetadataObject",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"tags",
"=",
"[",
"]",
";",
"const",
"descriptionRecordsCount",
"=",
"buf",
".",
"readUInt16LE",
"(",
"off",
")",
";",
"let",
"pos",
"=",
"off",
"+",
"2",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"descriptionRecordsCount",
";",
"i",
"+=",
"1",
")",
"{",
"pos",
"+=",
"4",
";",
"const",
"nameLen",
"=",
"buf",
".",
"readUInt16LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"2",
";",
"const",
"dataType",
"=",
"buf",
".",
"readUInt16LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"2",
";",
"const",
"dataLen",
"=",
"buf",
".",
"readUInt32LE",
"(",
"pos",
")",
";",
"pos",
"+=",
"4",
";",
"const",
"name",
"=",
"AsfUtil",
".",
"parseUnicodeAttr",
"(",
"buf",
".",
"slice",
"(",
"pos",
",",
"pos",
"+",
"nameLen",
")",
")",
";",
"pos",
"+=",
"nameLen",
";",
"const",
"data",
"=",
"buf",
".",
"slice",
"(",
"pos",
",",
"pos",
"+",
"dataLen",
")",
";",
"pos",
"+=",
"dataLen",
";",
"const",
"parseAttr",
"=",
"AsfUtil",
".",
"getParserForAttr",
"(",
"dataType",
")",
";",
"if",
"(",
"!",
"parseAttr",
")",
"{",
"throw",
"new",
"Error",
"(",
"'unexpected value headerType: '",
"+",
"dataType",
")",
";",
"}",
"this",
".",
"postProcessTag",
"(",
"tags",
",",
"name",
",",
"dataType",
",",
"data",
")",
";",
"}",
"return",
"tags",
";",
"}",
"}",
"export",
"class",
"MetadataLibraryObjectState",
"extends",
"MetadataObjectState",
"{",
"public",
"static",
"guid",
"=",
"GUID",
".",
"MetadataLibraryObject",
";",
"constructor",
"(",
"header",
")",
"{",
"super",
"(",
"header",
")",
";",
"}",
"}",
"export",
"interface",
"IWmPicture",
"extends",
"IPicture",
"{",
"type",
":",
"string",
";",
"format",
":",
"string",
";",
"description",
":",
"string",
";",
"size",
":",
"number",
";",
"data",
":",
"Buffer",
";",
"}",
"/**\n * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd757977(v=vs.85).aspx\n */",
"export",
"class",
"WmPictureToken",
"implements",
"IGetToken",
"<",
"IWmPicture",
">",
"{",
"public",
"static",
"fromBase64",
"(",
"base64str",
")",
"{",
"return",
"this",
".",
"fromBuffer",
"(",
"Buffer",
".",
"from",
"(",
"base64str",
",",
"'base64'",
")",
")",
";",
"}",
"public",
"static",
"fromBuffer",
"(",
"buffer",
")",
"{",
"const",
"pic",
"=",
"new",
"WmPictureToken",
"(",
"buffer",
".",
"length",
")",
";",
"return",
"pic",
".",
"get",
"(",
"buffer",
",",
"0",
")",
";",
"}",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buffer",
",",
"offset",
")",
"{",
"const",
"typeId",
"=",
"buffer",
".",
"readUInt8",
"(",
"offset",
"++",
")",
";",
"const",
"size",
"=",
"buffer",
".",
"readInt32LE",
"(",
"offset",
")",
";",
"let",
"index",
"=",
"5",
";",
"while",
"(",
"buffer",
".",
"readUInt16BE",
"(",
"index",
")",
"!==",
"0",
")",
"{",
"index",
"+=",
"2",
";",
"}",
"const",
"format",
"=",
"buffer",
".",
"slice",
"(",
"5",
",",
"index",
")",
".",
"toString",
"(",
"'utf16le'",
")",
";",
"while",
"(",
"buffer",
".",
"readUInt16BE",
"(",
"index",
")",
"!==",
"0",
")",
"{",
"index",
"+=",
"2",
";",
"}",
"const",
"description",
"=",
"buffer",
".",
"slice",
"(",
"5",
",",
"index",
")",
".",
"toString",
"(",
"'utf16le'",
")",
";",
"return",
"{",
"type",
":",
"AttachedPictureType",
"[",
"typeId",
"]",
",",
"format",
",",
"description",
",",
"size",
",",
"data",
":",
"buffer",
".",
"slice",
"(",
"index",
"+",
"4",
")",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
12,
null,
3,
null,
null,
null,
4,
null,
5,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33700,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
225,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49855,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49856,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49857,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
12,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
12,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
12,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33700,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49858,
null,
12,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49858,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661822 | [
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"ITag",
",",
"TrackType",
"}",
"from",
"'../type'",
";",
"import",
"GUID",
"from",
"'./GUID'",
";",
"import",
"*",
"as",
"AsfObject",
"from",
"'./AsfObject'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:ASF'",
")",
";",
"const",
"headerType",
"=",
"'asf'",
";",
"/**\n * Windows Media Metadata Usage Guidelines\n * Ref: https://msdn.microsoft.com/en-us/library/ms867702.aspx\n *\n * Ref:\n * https://tools.ietf.org/html/draft-fleischman-asf-01\n * https://hwiegman.home.xs4all.nl/fileformats/asf/ASF_Specification.pdf\n * http://drang.s4.xrea.com/program/tips/id3tag/wmp/index.html\n * https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575(v=vs.85).aspx\n */",
"export",
"class",
"AsfParser",
"extends",
"BasicParser",
"{",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IAsfTopLevelObjectHeader",
">",
"(",
"AsfObject",
".",
"TopLevelHeaderObjectToken",
")",
";",
"if",
"(",
"!",
"header",
".",
"objectId",
".",
"equals",
"(",
"GUID",
".",
"HeaderObject",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'expected asf header; but was not found; got: '",
"+",
"header",
".",
"objectId",
".",
"str",
")",
";",
"}",
"try",
"{",
"await",
"this",
".",
"parseObjectHeader",
"(",
"header",
".",
"numberOfHeaderObjects",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"debug",
"(",
"'Error while parsing ASF: %s'",
",",
"err",
")",
";",
"}",
"}",
"private",
"async",
"parseObjectHeader",
"(",
"numberOfObjectHeaders",
")",
"{",
"let",
"tags",
";",
"do",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IAsfObjectHeader",
">",
"(",
"AsfObject",
".",
"HeaderObjectToken",
")",
";",
"debug",
"(",
"'header GUID=%s'",
",",
"header",
".",
"objectId",
".",
"str",
")",
";",
"switch",
"(",
"header",
".",
"objectId",
".",
"str",
")",
"{",
"case",
"AsfObject",
".",
"FilePropertiesObject",
".",
"guid",
".",
"str",
":",
"const",
"fpo",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IFilePropertiesObject",
">",
"(",
"new",
"AsfObject",
".",
"FilePropertiesObject",
"(",
"header",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"Number",
"(",
"fpo",
".",
"playDuration",
"/",
"BigInt",
"(",
"1000",
")",
")",
"/",
"10000",
"-",
"Number",
"(",
"fpo",
".",
"preroll",
")",
"/",
"1000",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"fpo",
".",
"maximumBitrate",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"StreamPropertiesObject",
".",
"guid",
".",
"str",
":",
"const",
"spo",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IStreamPropertiesObject",
">",
"(",
"new",
"AsfObject",
".",
"StreamPropertiesObject",
"(",
"header",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'ASF/'",
"+",
"spo",
".",
"streamType",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"HeaderExtensionObject",
".",
"guid",
".",
"str",
":",
"const",
"extHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IHeaderExtensionObject",
">",
"(",
"new",
"AsfObject",
".",
"HeaderExtensionObject",
"(",
")",
")",
";",
"await",
"this",
".",
"parseExtensionObject",
"(",
"extHeader",
".",
"extensionDataSize",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"ContentDescriptionObjectState",
".",
"guid",
".",
"str",
":",
"tags",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"ITag",
"[",
"]",
">",
"(",
"new",
"AsfObject",
".",
"ContentDescriptionObjectState",
"(",
"header",
")",
")",
";",
"this",
".",
"addTags",
"(",
"tags",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"ExtendedContentDescriptionObjectState",
".",
"guid",
".",
"str",
":",
"tags",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"ITag",
"[",
"]",
">",
"(",
"new",
"AsfObject",
".",
"ExtendedContentDescriptionObjectState",
"(",
"header",
")",
")",
";",
"this",
".",
"addTags",
"(",
"tags",
")",
";",
"break",
";",
"case",
"GUID",
".",
"CodecListObject",
".",
"str",
":",
"const",
"codecs",
"=",
"await",
"AsfObject",
".",
"readCodecEntries",
"(",
"this",
".",
"tokenizer",
")",
";",
"codecs",
".",
"forEach",
"(",
"codec",
"=>",
"{",
"this",
".",
"metadata",
".",
"addStreamInfo",
"(",
"{",
"type",
":",
"codec",
".",
"type",
".",
"videoCodec",
"?",
"TrackType",
".",
"video",
":",
"TrackType",
".",
"audio",
",",
"codecName",
":",
"codec",
".",
"codecName",
"}",
")",
";",
"}",
")",
";",
"const",
"audioCodecs",
"=",
"codecs",
".",
"filter",
"(",
"codec",
"=>",
"codec",
".",
"type",
".",
"audioCodec",
")",
".",
"map",
"(",
"codec",
"=>",
"codec",
".",
"codecName",
")",
".",
"join",
"(",
"'/'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"audioCodecs",
")",
";",
"break",
";",
"case",
"GUID",
".",
"StreamBitratePropertiesObject",
".",
"str",
":",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"objectSize",
"-",
"AsfObject",
".",
"HeaderObjectToken",
".",
"len",
")",
";",
"break",
";",
"case",
"GUID",
".",
"PaddingObject",
".",
"str",
":",
"debug",
"(",
"'Padding: %s bytes'",
",",
"header",
".",
"objectSize",
"-",
"AsfObject",
".",
"HeaderObjectToken",
".",
"len",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"objectSize",
"-",
"AsfObject",
".",
"HeaderObjectToken",
".",
"len",
")",
";",
"break",
";",
"default",
":",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Ignore ASF-Object-GUID: '",
"+",
"header",
".",
"objectId",
".",
"str",
")",
";",
"debug",
"(",
"'Ignore ASF-Object-GUID: %s'",
",",
"header",
".",
"objectId",
".",
"str",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"void",
">",
"(",
"new",
"AsfObject",
".",
"IgnoreObjectState",
"(",
"header",
")",
")",
";",
"}",
"}",
"while",
"(",
"--",
"numberOfObjectHeaders",
")",
";",
"}",
"private",
"addTags",
"(",
"tags",
")",
"{",
"tags",
".",
"forEach",
"(",
"tag",
"=>",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"headerType",
",",
"tag",
".",
"id",
",",
"tag",
".",
"value",
")",
";",
"}",
")",
";",
"}",
"private",
"async",
"parseExtensionObject",
"(",
"extensionSize",
")",
"{",
"do",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IAsfObjectHeader",
">",
"(",
"AsfObject",
".",
"HeaderObjectToken",
")",
";",
"const",
"remaining",
"=",
"header",
".",
"objectSize",
"-",
"AsfObject",
".",
"HeaderObjectToken",
".",
"len",
";",
"switch",
"(",
"header",
".",
"objectId",
".",
"str",
")",
"{",
"case",
"AsfObject",
".",
"ExtendedStreamPropertiesObjectState",
".",
"guid",
".",
"str",
":",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AsfObject",
".",
"IExtendedStreamPropertiesObject",
">",
"(",
"new",
"AsfObject",
".",
"ExtendedStreamPropertiesObjectState",
"(",
"header",
")",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"MetadataObjectState",
".",
"guid",
".",
"str",
":",
"const",
"moTags",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"ITag",
"[",
"]",
">",
"(",
"new",
"AsfObject",
".",
"MetadataObjectState",
"(",
"header",
")",
")",
";",
"this",
".",
"addTags",
"(",
"moTags",
")",
";",
"break",
";",
"case",
"AsfObject",
".",
"MetadataLibraryObjectState",
".",
"guid",
".",
"str",
":",
"const",
"mlTags",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"ITag",
"[",
"]",
">",
"(",
"new",
"AsfObject",
".",
"MetadataLibraryObjectState",
"(",
"header",
")",
")",
";",
"this",
".",
"addTags",
"(",
"mlTags",
")",
";",
"break",
";",
"case",
"GUID",
".",
"PaddingObject",
".",
"str",
":",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"remaining",
")",
";",
"break",
";",
"case",
"GUID",
".",
"CompatibilityObject",
".",
"str",
":",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"remaining",
")",
";",
"break",
";",
"case",
"GUID",
".",
"ASF_Index_Placeholder_Object",
".",
"str",
":",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"remaining",
")",
";",
"break",
";",
"default",
":",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Ignore ASF-Object-GUID: '",
"+",
"header",
".",
"objectId",
".",
"str",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"void",
">",
"(",
"new",
"AsfObject",
".",
"IgnoreObjectState",
"(",
"header",
")",
")",
";",
"break",
";",
"}",
"extensionSize",
"-=",
"header",
".",
"objectSize",
";",
"}",
"while",
"(",
"extensionSize",
">",
"0",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49855,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49856,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49857,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
5,
null,
null,
null,
null,
null,
null,
1271,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
9313,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661823 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"AttachedPictureType",
"}",
"from",
"'../../id3v2/ID3v2Token'",
";",
"import",
"{",
"IPicture",
"}",
"from",
"'../../type'",
";",
"export",
"interface",
"IVorbisPicture",
"extends",
"IPicture",
"{",
"type",
":",
"string",
";",
"description",
":",
"string",
";",
"width",
":",
"number",
";",
"height",
":",
"number",
";",
"colour_depth",
":",
"number",
";",
"indexed_color",
":",
"number",
";",
"}",
"/**\n * Interface to parsed result of METADATA_BLOCK_PICTURE\n * Ref: https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE\n * Ref: https://xiph.org/flac/format.html#metadata_block_picture\n */",
"export",
"interface",
"IVorbisPicture",
"{",
"type",
":",
"string",
";",
"format",
":",
"string",
";",
"description",
":",
"string",
";",
"width",
":",
"number",
";",
"height",
":",
"number",
";",
"colour_depth",
":",
"number",
";",
"indexed_color",
":",
"number",
";",
"data",
":",
"Buffer",
";",
"}",
"/**\n * Parse the METADATA_BLOCK_PICTURE\n * Ref: https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE\n * Ref: https://xiph.org/flac/format.html#metadata_block_picture\n * // ToDo: move to ID3 / APIC?\n */",
"export",
"class",
"VorbisPictureToken",
"implements",
"IGetToken",
"<",
"IVorbisPicture",
">",
"{",
"public",
"static",
"fromBase64",
"(",
"base64str",
")",
"{",
"return",
"this",
".",
"fromBuffer",
"(",
"Buffer",
".",
"from",
"(",
"base64str",
",",
"'base64'",
")",
")",
";",
"}",
"public",
"static",
"fromBuffer",
"(",
"buffer",
")",
"{",
"const",
"pic",
"=",
"new",
"VorbisPictureToken",
"(",
"buffer",
".",
"length",
")",
";",
"return",
"pic",
".",
"get",
"(",
"buffer",
",",
"0",
")",
";",
"}",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buffer",
",",
"offset",
")",
"{",
"const",
"type",
"=",
"AttachedPictureType",
"[",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
")",
"]",
";",
"const",
"mimeLen",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"4",
")",
";",
"const",
"format",
"=",
"buffer",
".",
"toString",
"(",
"'utf-8'",
",",
"offset",
"+=",
"4",
",",
"offset",
"+",
"mimeLen",
")",
";",
"const",
"descLen",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"mimeLen",
")",
";",
"const",
"description",
"=",
"buffer",
".",
"toString",
"(",
"'utf-8'",
",",
"offset",
"+=",
"4",
",",
"offset",
"+",
"descLen",
")",
";",
"const",
"width",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"descLen",
")",
";",
"const",
"height",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"4",
")",
";",
"const",
"colour_depth",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"4",
")",
";",
"const",
"indexed_color",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"4",
")",
";",
"const",
"picDataLen",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buffer",
",",
"offset",
"+=",
"4",
")",
";",
"const",
"data",
"=",
"Buffer",
".",
"from",
"(",
"buffer",
".",
"slice",
"(",
"offset",
"+=",
"4",
",",
"offset",
"+",
"picDataLen",
")",
")",
";",
"return",
"{",
"type",
",",
"format",
",",
"description",
",",
"width",
",",
"height",
",",
"colour_depth",
",",
"indexed_color",
",",
"data",
"}",
";",
"}",
"}",
"/**\n * Vorbis 1 decoding tokens\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-620004.2.1\n */",
"/**\n * Comment header interface\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-620004.2.1\n */",
"export",
"interface",
"ICommonHeader",
"{",
"/**\n * Packet Type\n */",
"packetType",
":",
"number",
";",
"/**\n * Should be 'vorbis'\n */",
"vorbis",
":",
"string",
";",
"}",
"/**\n * Comment header decoder\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-620004.2.1\n */",
"export",
"const",
"CommonHeader",
"=",
"{",
"len",
":",
"7",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"ICommonHeader",
"=>",
"{",
"return",
"{",
"packetType",
":",
"buf",
".",
"readUInt8",
"(",
"off",
")",
",",
"vorbis",
":",
"new",
"Token",
".",
"StringType",
"(",
"6",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Identification header interface\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-630004.2.2\n */",
"export",
"interface",
"IFormatInfo",
"{",
"version",
":",
"number",
";",
"channelMode",
":",
"number",
";",
"sampleRate",
":",
"number",
";",
"bitrateMax",
":",
"number",
";",
"bitrateNominal",
":",
"number",
";",
"bitrateMin",
":",
"number",
";",
"}",
"/**\n * Identification header decoder\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-630004.2.2\n */",
"export",
"const",
"IdentificationHeader",
"=",
"{",
"len",
":",
"23",
",",
"get",
":",
"(",
"uint8Array",
",",
"off",
")",
":",
"IFormatInfo",
"=>",
"{",
"const",
"dataView",
"=",
"new",
"DataView",
"(",
"uint8Array",
".",
"buffer",
",",
"uint8Array",
".",
"byteOffset",
")",
";",
"return",
"{",
"version",
":",
"dataView",
".",
"getUint32",
"(",
"off",
"+",
"0",
",",
"true",
")",
",",
"channelMode",
":",
"dataView",
".",
"getUint8",
"(",
"off",
"+",
"4",
")",
",",
"sampleRate",
":",
"dataView",
".",
"getUint32",
"(",
"off",
"+",
"5",
",",
"true",
")",
",",
"bitrateMax",
":",
"dataView",
".",
"getUint32",
"(",
"off",
"+",
"9",
",",
"true",
")",
",",
"bitrateNominal",
":",
"dataView",
".",
"getUint32",
"(",
"off",
"+",
"13",
",",
"true",
")",
",",
"bitrateMin",
":",
"dataView",
".",
"getUint32",
"(",
"off",
"+",
"17",
",",
"true",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25254,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25254,
null,
12,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25254,
null,
12,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
263,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661824 | [
"import",
"{",
"EndOfStreamError",
",",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"ID3v2Header",
"}",
"from",
"'./ID3v2Token'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'./ID3v2Parser'",
";",
"import",
"{",
"ID3v1Parser",
"}",
"from",
"'../id3v1/ID3v1Parser'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:ID3'",
")",
";",
"/**\n * Abstract parser which tries take ID3v2 and ID3v1 headers.\n */",
"export",
"abstract",
"class",
"AbstractID3Parser",
"extends",
"BasicParser",
"{",
"public",
"static",
"async",
"startsWithID3v2Header",
"(",
"tokenizer",
")",
"{",
"return",
"(",
"await",
"tokenizer",
".",
"peekToken",
"(",
"ID3v2Header",
")",
")",
".",
"fileIdentifier",
"===",
"'ID3'",
";",
"}",
"private",
"id3parser",
"=",
"new",
"ID3v2Parser",
"(",
")",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"try",
"{",
"await",
"this",
".",
"parseID3v2",
"(",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"instanceof",
"EndOfStreamError",
")",
"{",
"debug",
"(",
"`End-of-stream`",
")",
";",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"/**\n * Called after ID3v2 headers are parsed\n */",
"public",
"abstract",
"_parse",
"(",
")",
";",
"protected",
"finalize",
"(",
")",
"{",
"return",
";",
"}",
"private",
"async",
"parseID3v2",
"(",
")",
"{",
"await",
"this",
".",
"tryReadId3v2Headers",
"(",
")",
";",
"debug",
"(",
"'End of ID3v2 header, go to MPEG-parser: pos=%s'",
",",
"this",
".",
"tokenizer",
".",
"position",
")",
";",
"await",
"this",
".",
"_parse",
"(",
")",
";",
"if",
"(",
"this",
".",
"options",
".",
"skipPostHeaders",
"&&",
"this",
".",
"metadata",
".",
"hasAny",
"(",
")",
")",
"{",
"this",
".",
"finalize",
"(",
")",
";",
"}",
"else",
"{",
"const",
"id3v1parser",
"=",
"new",
"ID3v1Parser",
"(",
")",
";",
"await",
"id3v1parser",
".",
"init",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
".",
"parse",
"(",
")",
";",
"this",
".",
"finalize",
"(",
")",
";",
"}",
"}",
"private",
"async",
"tryReadId3v2Headers",
"(",
")",
"{",
"const",
"id3Header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekToken",
"(",
"ID3v2Header",
")",
";",
"if",
"(",
"id3Header",
".",
"fileIdentifier",
"===",
"'ID3'",
")",
"{",
"debug",
"(",
"'Found ID3v2 header, pos=%s'",
",",
"this",
".",
"tokenizer",
".",
"position",
")",
";",
"await",
"this",
".",
"id3parser",
".",
"parse",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"return",
"this",
".",
"tryReadId3v2Headers",
"(",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
49853,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661825 | [
"/**\n * Page header\n * Ref: https://www.xiph.org/ogg/doc/framing.html#page_header\n */",
"export",
"interface",
"IPageHeader",
"{",
"/**\n * capture_pattern\n * A header begins with a capture pattern that simplifies identifying pages;\n * once the decoder has found the capture pattern it can do a more intensive job of verifying that it has in fact found a page boundary (as opposed to an inadvertent coincidence in the byte stream).\n */",
"capturePattern",
":",
"string",
";",
"/**\n * stream_structure_version\n */",
"version",
":",
"number",
";",
"/**\n * header_type_flag\n */",
"headerType",
":",
"{",
"/**\n * True: continued packet;\n * False: fresh packet\n */",
"continued",
":",
"boolean",
";",
"/**\n * True: first page of logical bitstream (bos)\n * False: not first page of logical bitstream\n */",
"firstPage",
":",
"boolean",
";",
"/**\n * True: last page of logical bitstream (eos)\n * False: not last page of logical bitstream\n */",
"lastPage",
":",
"boolean",
";",
"}",
";",
"/**\n * The total samples encoded after including all packets finished on this page\n * The position specified in the frame header of the last page tells how long the data coded by the bitstream is.\n */",
"absoluteGranulePosition",
":",
"number",
";",
"streamSerialNumber",
":",
"number",
";",
"pageSequenceNo",
":",
"number",
";",
"pageChecksum",
":",
"number",
";",
"/**\n * The number of segment entries to appear in the segment table.\n * The maximum number of 255 segments (255 bytes each) sets the maximum possible physical page size at 65307 bytes or\n * just under 64kB (thus we know that a header corrupted so as destroy sizing/alignment information will not cause a\n * runaway bitstream. We'll read in the page according to the corrupted size information that's guaranteed to be a\n * reasonable size regardless, notice the checksum mismatch, drop sync and then look for recapture).\n */",
"page_segments",
":",
"number",
";",
"}",
"export",
"interface",
"ISegmentTable",
"{",
"totalPageSize",
":",
"number",
";",
"}",
"export",
"interface",
"IPageConsumer",
"{",
"param",
"{",
"IPageHeader",
"}",
"header",
"param",
"{",
"Buffer",
"}",
"pageData",
"parsePage",
"(",
"header",
",",
"pageData",
")",
";",
"param",
"header",
"calculateDuration",
"(",
"header",
")",
";",
"/**\n * Force to parse pending segments\n */",
"flush",
"(",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20349,
null,
29,
null,
null,
null,
null,
null,
null,
20349,
null,
null,
null,
null,
null,
null,
null,
null
] |
661826 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"export",
"class",
"VorbisDecoder",
"{",
"constructor",
"(",
"private",
"readonly",
"data",
",",
"private",
"offset",
")",
"{",
"}",
"public",
"readInt32",
"(",
")",
"{",
"const",
"value",
"=",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"this",
".",
"data",
",",
"this",
".",
"offset",
")",
";",
"this",
".",
"offset",
"+=",
"4",
";",
"return",
"value",
";",
"}",
"public",
"readStringUtf8",
"(",
")",
"{",
"const",
"len",
"=",
"this",
".",
"readInt32",
"(",
")",
";",
"const",
"value",
"=",
"Buffer",
".",
"from",
"(",
"this",
".",
"data",
")",
".",
"toString",
"(",
"'utf-8'",
",",
"this",
".",
"offset",
",",
"this",
".",
"offset",
"+",
"len",
")",
";",
"this",
".",
"offset",
"+=",
"len",
";",
"return",
"value",
";",
"}",
"public",
"parseUserComment",
"(",
")",
"{",
"const",
"offset0",
"=",
"this",
".",
"offset",
";",
"const",
"v",
"=",
"this",
".",
"readStringUtf8",
"(",
")",
";",
"const",
"idx",
"=",
"v",
".",
"indexOf",
"(",
"'='",
")",
";",
"return",
"{",
"key",
":",
"v",
".",
"slice",
"(",
"0",
",",
"idx",
")",
".",
"toUpperCase",
"(",
")",
",",
"value",
":",
"v",
".",
"slice",
"(",
"idx",
"+",
"1",
")",
",",
"len",
":",
"this",
".",
"offset",
"-",
"offset0",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661827 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"IOptions",
"}",
"from",
"'../../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../../common/MetadataCollector'",
";",
"import",
"*",
"as",
"Ogg",
"from",
"'../Ogg'",
";",
"import",
"{",
"VorbisDecoder",
"}",
"from",
"'./VorbisDecoder'",
";",
"import",
"{",
"CommonHeader",
",",
"IdentificationHeader",
",",
"IVorbisPicture",
",",
"VorbisPictureToken",
"}",
"from",
"'./Vorbis'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:ogg:vorbis1'",
")",
";",
"/**\n * Vorbis 1 Parser.\n * Used by OggParser\n */",
"export",
"class",
"VorbisParser",
"implements",
"Ogg",
".",
"IPageConsumer",
"{",
"private",
"pageSegments",
":",
"Buffer",
"[",
"]",
"=",
"[",
"]",
";",
"constructor",
"(",
"protected",
"metadata",
",",
"protected",
"options",
")",
"{",
"}",
"param",
"header",
"param",
"pageData",
"public",
"parsePage",
"(",
"header",
",",
"pageData",
")",
"{",
"if",
"(",
"header",
".",
"headerType",
".",
"firstPage",
")",
"{",
"this",
".",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
";",
"}",
"else",
"{",
"if",
"(",
"header",
".",
"headerType",
".",
"continued",
")",
"{",
"if",
"(",
"this",
".",
"pageSegments",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Cannot continue on previous page\"",
")",
";",
"}",
"this",
".",
"pageSegments",
".",
"push",
"(",
"pageData",
")",
";",
"}",
"if",
"(",
"header",
".",
"headerType",
".",
"lastPage",
"||",
"!",
"header",
".",
"headerType",
".",
"continued",
")",
"{",
"if",
"(",
"this",
".",
"pageSegments",
".",
"length",
">",
"0",
")",
"{",
"const",
"fullPage",
"=",
"Buffer",
".",
"concat",
"(",
"this",
".",
"pageSegments",
")",
";",
"this",
".",
"parseFullPage",
"(",
"fullPage",
")",
";",
"}",
"this",
".",
"pageSegments",
"=",
"header",
".",
"headerType",
".",
"lastPage",
"?",
"[",
"]",
":",
"[",
"pageData",
"]",
";",
"}",
"}",
"if",
"(",
"header",
".",
"headerType",
".",
"lastPage",
")",
"{",
"this",
".",
"calculateDuration",
"(",
"header",
")",
";",
"}",
"}",
"public",
"flush",
"(",
")",
"{",
"this",
".",
"parseFullPage",
"(",
"Buffer",
".",
"concat",
"(",
"this",
".",
"pageSegments",
")",
")",
";",
"}",
"public",
"parseUserComment",
"(",
"pageData",
",",
"offset",
")",
"{",
"const",
"decoder",
"=",
"new",
"VorbisDecoder",
"(",
"pageData",
",",
"offset",
")",
";",
"const",
"tag",
"=",
"decoder",
".",
"parseUserComment",
"(",
")",
";",
"this",
".",
"addTag",
"(",
"tag",
".",
"key",
",",
"tag",
".",
"value",
")",
";",
"return",
"tag",
".",
"len",
";",
"}",
"public",
"addTag",
"(",
"id",
",",
"value",
")",
"{",
"if",
"(",
"id",
"===",
"'METADATA_BLOCK_PICTURE'",
"&&",
"(",
"typeof",
"value",
"===",
"'string'",
")",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"skipCovers",
")",
"{",
"debug",
"(",
"`Ignore picture`",
")",
";",
"return",
";",
"}",
"value",
"=",
"VorbisPictureToken",
".",
"fromBase64",
"(",
"value",
")",
";",
"debug",
"(",
"`Push picture: id=${",
"id",
"}, format=${",
"value",
".",
"format",
"}`",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"`Push tag: id=${",
"id",
"}, value=${",
"value",
"}`",
")",
";",
"}",
"this",
".",
"metadata",
".",
"addTag",
"(",
"'vorbis'",
",",
"id",
",",
"value",
")",
";",
"}",
"public",
"calculateDuration",
"(",
"header",
")",
"{",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
"&&",
"header",
".",
"absoluteGranulePosition",
">=",
"0",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"header",
".",
"absoluteGranulePosition",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfSamples",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
")",
";",
"}",
"}",
"param",
"{",
"IPageHeader",
"}",
"header",
"param",
"{",
"Buffer",
"}",
"pageData",
"protected",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"'Vorbis I'",
")",
";",
"debug",
"(",
"\"Parse first page\"",
")",
";",
"const",
"commonHeader",
"=",
"CommonHeader",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"if",
"(",
"commonHeader",
".",
"vorbis",
"!==",
"'vorbis'",
")",
"throw",
"new",
"Error",
"(",
"'Metadata does not look like Vorbis'",
")",
";",
"if",
"(",
"commonHeader",
".",
"packetType",
"===",
"1",
")",
"{",
"const",
"idHeader",
"=",
"IdentificationHeader",
".",
"get",
"(",
"pageData",
",",
"CommonHeader",
".",
"len",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"idHeader",
".",
"sampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"idHeader",
".",
"bitrateNominal",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"idHeader",
".",
"channelMode",
")",
";",
"debug",
"(",
"\"sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s\"",
",",
"idHeader",
".",
"sampleRate",
",",
"idHeader",
".",
"bitrateNominal",
",",
"idHeader",
".",
"channelMode",
")",
";",
"}",
"else",
"throw",
"new",
"Error",
"(",
"'First Ogg page should be type 1: the identification header'",
")",
";",
"}",
"protected",
"parseFullPage",
"(",
"pageData",
")",
"{",
"const",
"commonHeader",
"=",
"CommonHeader",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"debug",
"(",
"\"Parse full page: type=%s, byteLength=%s\"",
",",
"commonHeader",
".",
"packetType",
",",
"pageData",
".",
"byteLength",
")",
";",
"switch",
"(",
"commonHeader",
".",
"packetType",
")",
"{",
"case",
"3",
":",
"return",
"this",
".",
"parseUserCommentList",
"(",
"pageData",
",",
"CommonHeader",
".",
"len",
")",
";",
"case",
"1",
":",
"case",
"5",
":",
"break",
";",
"}",
"}",
"/**\n * Ref: https://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-840005.2\n */",
"protected",
"parseUserCommentList",
"(",
"pageData",
",",
"offset",
")",
"{",
"const",
"strLen",
"=",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"pageData",
",",
"offset",
")",
";",
"offset",
"+=",
"4",
";",
"offset",
"+=",
"strLen",
";",
"let",
"userCommentListLength",
"=",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"pageData",
",",
"offset",
")",
";",
"offset",
"+=",
"4",
";",
"while",
"(",
"userCommentListLength",
"--",
">",
"0",
")",
"{",
"offset",
"+=",
"this",
".",
"parseUserComment",
"(",
"pageData",
",",
"offset",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6865,
null,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
12,
null,
3,
null,
null,
null,
49859,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49860,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12,
null,
null,
null,
49860,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661828 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"ITokenizer",
",",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"IVorbisPicture",
",",
"VorbisPictureToken",
"}",
"from",
"'../ogg/vorbis/Vorbis'",
";",
"import",
"{",
"AbstractID3Parser",
"}",
"from",
"'../id3v2/AbstractID3Parser'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"VorbisParser",
"}",
"from",
"'../ogg/vorbis/VorbisParser'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"import",
"{",
"IOptions",
"}",
"from",
"'../type'",
";",
"import",
"{",
"ITokenParser",
"}",
"from",
"'../ParserFactory'",
";",
"import",
"{",
"VorbisDecoder",
"}",
"from",
"'../ogg/vorbis/VorbisDecoder'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:FLAC'",
")",
";",
"/**\n * FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:\n * ref: https://xiph.org/flac/format.html#metadata_block\n */",
"enum",
"BlockType",
"{",
"STREAMINFO",
"=",
"0",
",",
"PADDING",
"=",
"1",
",",
"APPLICATION",
"=",
"2",
",",
"SEEKTABLE",
"=",
"3",
",",
"VORBIS_COMMENT",
"=",
"4",
",",
"CUESHEET",
"=",
"5",
",",
"PICTURE",
"=",
"6",
"}",
"export",
"class",
"FlacParser",
"extends",
"AbstractID3Parser",
"{",
"private",
"vorbisParser",
":",
"VorbisParser",
";",
"private",
"padding",
":",
"number",
"=",
"0",
";",
"param",
"{",
"INativeMetadataCollector",
"}",
"metadata",
"param",
"{",
"ITokenizer",
"}",
"tokenizer",
"param",
"{",
"IOptions",
"}",
"options",
"public",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
"{",
"super",
".",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
";",
"this",
".",
"vorbisParser",
"=",
"new",
"VorbisParser",
"(",
"metadata",
",",
"options",
")",
";",
"return",
"this",
";",
"}",
"public",
"async",
"_parse",
"(",
")",
"{",
"const",
"fourCC",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
";",
"if",
"(",
"fourCC",
".",
"toString",
"(",
")",
"!==",
"'fLaC'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid FLAC preamble'",
")",
";",
"}",
"let",
"blockHeader",
";",
"do",
"{",
"blockHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IBlockHeader",
">",
"(",
"Metadata",
".",
"BlockHeader",
")",
";",
"await",
"this",
".",
"parseDataBlock",
"(",
"blockHeader",
")",
";",
"}",
"while",
"(",
"!",
"blockHeader",
".",
"lastBlock",
")",
";",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
"{",
"const",
"dataSize",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"8",
"*",
"dataSize",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"}",
"}",
"private",
"parseDataBlock",
"(",
"blockHeader",
")",
"{",
"debug",
"(",
"`blockHeader type=${",
"blockHeader",
".",
"type",
"}, length=${",
"blockHeader",
".",
"length",
"}`",
")",
";",
"switch",
"(",
"blockHeader",
".",
"type",
")",
"{",
"case",
"BlockType",
".",
"STREAMINFO",
":",
"return",
"this",
".",
"parseBlockStreamInfo",
"(",
"blockHeader",
".",
"length",
")",
";",
"case",
"BlockType",
".",
"PADDING",
":",
"this",
".",
"padding",
"+=",
"blockHeader",
".",
"length",
";",
"break",
";",
"case",
"BlockType",
".",
"APPLICATION",
":",
"break",
";",
"case",
"BlockType",
".",
"SEEKTABLE",
":",
"break",
";",
"case",
"BlockType",
".",
"VORBIS_COMMENT",
":",
"return",
"this",
".",
"parseComment",
"(",
"blockHeader",
".",
"length",
")",
";",
"case",
"BlockType",
".",
"CUESHEET",
":",
"break",
";",
"case",
"BlockType",
".",
"PICTURE",
":",
"return",
"this",
".",
"parsePicture",
"(",
"blockHeader",
".",
"length",
")",
".",
"then",
"(",
")",
";",
"default",
":",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Unknown block type: '",
"+",
"blockHeader",
".",
"type",
")",
";",
"}",
"return",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"blockHeader",
".",
"length",
")",
".",
"then",
"(",
")",
";",
"}",
"/**\n * Parse STREAMINFO\n */",
"private",
"async",
"parseBlockStreamInfo",
"(",
"dataLen",
")",
"{",
"if",
"(",
"dataLen",
"!==",
"Metadata",
".",
"BlockStreamInfo",
".",
"len",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected block-stream-info length'",
")",
";",
"const",
"streamInfo",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IBlockStreamInfo",
">",
"(",
"Metadata",
".",
"BlockStreamInfo",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'FLAC'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"'FLAC'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"streamInfo",
".",
"channels",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"streamInfo",
".",
"bitsPerSample",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"streamInfo",
".",
"sampleRate",
")",
";",
"if",
"(",
"streamInfo",
".",
"totalSamples",
">",
"0",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"streamInfo",
".",
"totalSamples",
"/",
"streamInfo",
".",
"sampleRate",
")",
";",
"}",
"}",
"/**\n * Parse VORBIS_COMMENT\n * Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3\n */",
"private",
"async",
"parseComment",
"(",
"dataLen",
")",
"{",
"const",
"data",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Uint8Array",
">",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"dataLen",
")",
")",
";",
"const",
"decoder",
"=",
"new",
"VorbisDecoder",
"(",
"data",
",",
"0",
")",
";",
"decoder",
".",
"readStringUtf8",
"(",
")",
";",
"const",
"commentListLength",
"=",
"decoder",
".",
"readInt32",
"(",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"commentListLength",
";",
"i",
"++",
")",
"{",
"const",
"tag",
"=",
"decoder",
".",
"parseUserComment",
"(",
")",
";",
"this",
".",
"vorbisParser",
".",
"addTag",
"(",
"tag",
".",
"key",
",",
"tag",
".",
"value",
")",
";",
"}",
"}",
"private",
"async",
"parsePicture",
"(",
"dataLen",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"skipCovers",
")",
"{",
"return",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"dataLen",
")",
";",
"}",
"else",
"{",
"const",
"picture",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IVorbisPicture",
">",
"(",
"new",
"VorbisPictureToken",
"(",
"dataLen",
")",
")",
";",
"this",
".",
"vorbisParser",
".",
"addTag",
"(",
"'METADATA_BLOCK_PICTURE'",
",",
"picture",
")",
";",
"}",
"}",
"}",
"/**\n * METADATA_BLOCK_DATA\n * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo\n */",
"interface",
"IBlockHeader",
"{",
"lastBlock",
":",
"boolean",
";",
"type",
":",
"BlockType",
";",
"length",
":",
"number",
";",
"}",
"/**\n * METADATA_BLOCK_DATA\n * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo\n */",
"interface",
"IBlockStreamInfo",
"{",
"minimumBlockSize",
":",
"number",
";",
"maximumBlockSize",
":",
"number",
";",
"minimumFrameSize",
":",
"number",
";",
"maximumFrameSize",
":",
"number",
";",
"sampleRate",
":",
"number",
";",
"channels",
":",
"number",
";",
"bitsPerSample",
":",
"number",
";",
"totalSamples",
":",
"number",
";",
"fileMD5",
":",
"Uint8Array",
";",
"}",
"class",
"Metadata",
"{",
"public",
"static",
"BlockHeader",
":",
"IGetToken",
"<",
"IBlockHeader",
">",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IBlockHeader",
"=>",
"{",
"return",
"{",
"lastBlock",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
",",
"7",
")",
",",
"type",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"1",
",",
"7",
")",
",",
"length",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
"}",
";",
"}",
"}",
";",
"/**\n * METADATA_BLOCK_DATA\n * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo\n */",
"public",
"static",
"BlockStreamInfo",
":",
"IGetToken",
"<",
"IBlockStreamInfo",
">",
"=",
"{",
"len",
":",
"34",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IBlockStreamInfo",
"=>",
"{",
"return",
"{",
"minimumBlockSize",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"maximumBlockSize",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"2",
")",
"/",
"1000",
",",
"minimumFrameSize",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"maximumFrameSize",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"7",
")",
",",
"sampleRate",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"10",
")",
">>",
"4",
",",
"channels",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"12",
",",
"4",
",",
"3",
")",
"+",
"1",
",",
"bitsPerSample",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"12",
",",
"7",
",",
"5",
")",
"+",
"1",
",",
"totalSamples",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"13",
",",
"4",
",",
"36",
")",
",",
"fileMD5",
":",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"16",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"18",
")",
"}",
";",
"}",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20348,
null,
6865,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25255,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25255,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49859,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25254,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661829 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"{",
"IToken",
",",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:MP4:atom'",
")",
";",
"interface",
"IVersionAndFlags",
"{",
"/**\n * A 1-byte specification of the version\n */",
"version",
":",
"number",
";",
"/**\n * Three bytes of space for (future) flags.\n */",
"flags",
":",
"number",
";",
"}",
"export",
"interface",
"IAtomHeader",
"{",
"length",
":",
"bigint",
";",
"name",
":",
"string",
";",
"}",
"export",
"interface",
"IAtomFtyp",
"{",
"type",
":",
"string",
";",
"}",
"/**\n * Common interface for the mvhd (Movie Header) & mdhd (Media) atom\n */",
"export",
"interface",
"IAtomMxhd",
"extends",
"IVersionAndFlags",
"{",
"/**\n * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was created.\n * It is strongly recommended that this value should be specified using coordinated universal time (UTC).\n */",
"creationTime",
":",
"Date",
";",
"/**\n * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was changed.\n * It is strongly recommended that this value should be specified using coordinated universal time (UTC).\n */",
"modificationTime",
":",
"Date",
";",
"/**\n * A time value that indicates the time scale for this media—that is, the number of time units that pass per second in its time coordinate system.\n */",
"timeScale",
":",
"number",
";",
"/**\n * Duration: the duration of this media in units of its time scale.\n */",
"duration",
":",
"number",
";",
"}",
"/**\n * Interface for the parsed Movie Header Atom (mvhd)\n */",
"export",
"interface",
"IAtomMvhd",
"extends",
"IAtomMxhd",
"{",
"/**\n * Preferred rate: a 32-bit fixed-point number that specifies the rate at which to play this movie.\n * A value of 1.0 indicates normal rate.\n */",
"preferredRate",
":",
"number",
";",
"/**\n * Preferred volume: A 16-bit fixed-point number that specifies how loud to play this movie’s sound.\n * A value of 1.0 indicates full volume.\n */",
"preferredVolume",
":",
"number",
";",
"/**\n * Reserved: Ten bytes reserved for use by Apple. Set to 0.\n */",
"/**\n * Matrix structure: The matrix structure associated with this movie.\n * A matrix shows how to map points from one coordinate space into another.\n * See Matrices for a discussion of how display matrices are used in QuickTime.\n */",
"/**\n * Preview time: The time value in the movie at which the preview begins.\n */",
"previewTime",
":",
"number",
";",
"/**\n * Preview duration: The duration of the movie preview in movie time scale units.\n */",
"previewDuration",
":",
"number",
";",
"/**\n * Poster time: The time value of the time of the movie poster.\n */",
"posterTime",
":",
"number",
";",
"/**\n * selection time: The time value for the start time of the current selection.\n */",
"selectionTime",
":",
"number",
";",
"/**\n * Selection duration: The duration of the current selection in movie time scale units.\n */",
"selectionDuration",
":",
"number",
";",
"/**\n * Current time: The time value for current time position within the movie.\n */",
"currentTime",
":",
"number",
";",
"/**\n * Next track ID: A 32-bit integer that indicates a value to use for the track ID number of the next track added to this movie. Note that 0 is not a valid track ID value.\n */",
"nextTrackID",
":",
"number",
";",
"}",
"/**\n * Interface for the metadata header atom: 'mhdr'\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW13\n */",
"export",
"interface",
"IMovieHeaderAtom",
"extends",
"IVersionAndFlags",
"{",
"/**\n * A 32-bit unsigned integer indicating the value to use for the item ID of the next item created or assigned an item ID.\n * If the value is all ones, it indicates that future additions will require a search for an unused item ID.\n */",
"nextItemID",
":",
"number",
";",
"}",
"export",
"const",
"Header",
"=",
"{",
"len",
":",
"8",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAtomHeader",
"=>",
"{",
"const",
"length",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"if",
"(",
"length",
"<",
"0",
")",
"throw",
"new",
"Error",
"(",
"'Invalid atom header length'",
")",
";",
"return",
"{",
"length",
":",
"BigInt",
"(",
"length",
")",
",",
"name",
":",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'binary'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
",",
"put",
":",
"(",
"buf",
",",
"off",
",",
"hdr",
")",
"=>",
"{",
"Token",
".",
"UINT32_BE",
".",
"put",
"(",
"buf",
",",
"off",
",",
"Number",
"(",
"hdr",
".",
"length",
")",
")",
";",
"return",
"FourCcToken",
".",
"put",
"(",
"buf",
",",
"off",
"+",
"4",
",",
"hdr",
".",
"name",
")",
";",
"}",
"}",
";",
"/**\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190\n */",
"export",
"const",
"ExtendedSize",
"=",
"Token",
".",
"UINT64_BE",
";",
"export",
"const",
"ftyp",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAtomFtyp",
"=>",
"{",
"return",
"{",
"type",
":",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
"}",
";",
"}",
"}",
";",
"export",
"const",
"tkhd",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAtomFtyp",
"=>",
"{",
"return",
"{",
"type",
":",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Token: Movie Header Atom\n */",
"export",
"const",
"mhdr",
"=",
"{",
"len",
":",
"8",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IMovieHeaderAtom",
"=>",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"nextItemID",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Base class for 'fixed' length atoms.\n * In some cases these atoms are longer then the sum of the described fields.\n * Issue: https://github.com/Borewit/music-metadata/issues/120\n */",
"export",
"abstract",
"class",
"FixedLengthAtom",
"{",
"param",
"{",
"number",
"}",
"len",
"param",
"{",
"number",
"}",
"expLen",
"protected",
"constructor",
"(",
"public",
"len",
",",
"expLen",
",",
"atomId",
")",
"{",
"if",
"(",
"len",
"<",
"expLen",
")",
"{",
"throw",
"new",
"Error",
"(",
"`Atom ${",
"atomId",
"} expected to be ${",
"expLen",
"}, but specifies ${",
"len",
"} bytes long.`",
")",
";",
"}",
"else",
"if",
"(",
"len",
">",
"expLen",
")",
"{",
"debug",
"(",
"`Warning: atom ${",
"atomId",
"} expected to be ${",
"expLen",
"}, but was actually ${",
"len",
"} bytes long.`",
")",
";",
"}",
"}",
"}",
"/**\n * Interface for the parsed Movie Header Atom (mdhd)\n */",
"export",
"interface",
"IAtomMdhd",
"extends",
"IAtomMxhd",
"{",
"/**\n * A 16-bit integer that specifies the language code for this media.\n * See Language Code Values for valid language codes.\n * Also see Extended Language Tag Atom for the preferred code to use here if an extended language tag is also included in the media atom.\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-34353\n */",
"language",
":",
"number",
";",
"quality",
":",
"number",
";",
"}",
"/**\n * Timestamp stored in seconds since Mac Epoch (1 January 1904)\n */",
"const",
"SecondsSinceMacEpoch",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"Date",
"=>",
"{",
"const",
"secondsSinceUnixEpoch",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
"-",
"2082844800",
";",
"return",
"new",
"Date",
"(",
"secondsSinceUnixEpoch",
"*",
"1000",
")",
";",
"}",
"}",
";",
"/**\n * Token: Media Header Atom\n * Ref:\n * https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34\n * https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd\n */",
"export",
"class",
"MdhdAtom",
"extends",
"FixedLengthAtom",
"implements",
"IGetToken",
"<",
"IAtomMdhd",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"super",
"(",
"len",
",",
"24",
",",
"'mdhd'",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"creationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"modificationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"timeScale",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"duration",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"language",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"quality",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"22",
")",
"}",
";",
"}",
"}",
"/**\n * Token: Movie Header Atom\n */",
"export",
"class",
"MvhdAtom",
"extends",
"FixedLengthAtom",
"implements",
"IGetToken",
"<",
"IAtomMvhd",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"super",
"(",
"len",
",",
"100",
",",
"'mvhd'",
")",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"creationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"modificationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"timeScale",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"duration",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"preferredRate",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"preferredVolume",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
",",
"previewTime",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"72",
")",
",",
"previewDuration",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"76",
")",
",",
"posterTime",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"80",
")",
",",
"selectionTime",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"84",
")",
",",
"selectionDuration",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"88",
")",
",",
"currentTime",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"92",
")",
",",
"nextTrackID",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"96",
")",
"}",
";",
"}",
"}",
"/**\n * Data Atom Structure ('data')\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32\n */",
"export",
"interface",
"IDataAtom",
"{",
"/**\n * Type Indicator\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW28\n */",
"type",
":",
"{",
"/**\n * The set of types from which the type is drawn\n * If 0, type is drawn from the well-known set of types.\n */",
"set",
":",
"number",
";",
"type",
":",
"number",
";",
"}",
";",
"/**\n * Locale Indicator\n */",
"locale",
":",
"number",
";",
"/**\n * An array of bytes containing the value of the metadata.\n */",
"value",
":",
"Buffer",
";",
"}",
"/**\n * Data Atom Structure\n */",
"export",
"class",
"DataAtom",
"implements",
"IGetToken",
"<",
"IDataAtom",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"type",
":",
"{",
"set",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"type",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
"}",
",",
"locale",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"value",
":",
"Buffer",
".",
"from",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"this",
".",
"len",
"-",
"8",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
")",
"}",
";",
"}",
"}",
"/**\n * Data Atom Structure ('data')\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32\n */",
"export",
"interface",
"INameAtom",
"extends",
"IVersionAndFlags",
"{",
"/**\n * An array of bytes containing the value of the metadata.\n */",
"name",
":",
"string",
";",
"}",
"/**\n * Data Atom Structure\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW31\n */",
"export",
"class",
"NameAtom",
"implements",
"IGetToken",
"<",
"INameAtom",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"name",
":",
"new",
"Token",
".",
"StringType",
"(",
"this",
".",
"len",
"-",
"4",
",",
"'utf-8'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
"/**\n * Track Header Atoms interface\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550\n */",
"export",
"interface",
"ITrackHeaderAtom",
"extends",
"IVersionAndFlags",
"{",
"/**\n * Creation Time\n */",
"creationTime",
":",
"Date",
";",
"/**\n * Modification Time\n */",
"modificationTime",
":",
"Date",
";",
"/**\n * TrackID\n */",
"trackId",
":",
"number",
";",
"/**\n * A time value that indicates the duration of this track (in the movie’s time coordinate system).\n * Note that this property is derived from the track’s edits. The value of this field is equal to the sum of the\n * durations of all of the track’s edits. If there is no edit list, then the duration is the sum of the sample\n * durations, converted into the movie timescale.\n */",
"duration",
":",
"number",
";",
"/**\n * A 16-bit integer that indicates this track’s spatial priority in its movie.\n * The QuickTime Movie Toolbox uses this value to determine how tracks overlay one another.\n * Tracks with lower layer values are displayed in front of tracks with higher layer values.\n */",
"layer",
":",
"number",
";",
"/**\n * A 16-bit integer that identifies a collection of movie tracks that contain alternate data for one another.\n * This same identifier appears in each 'tkhd' atom of the other tracks in the group.\n * QuickTime chooses one track from the group to be used when the movie is played.\n * The choice may be based on such considerations as playback quality, language, or the capabilities of the computer.\n * A value of zero indicates that the track is not in an alternate track group.\n */",
"alternateGroup",
":",
"number",
";",
"/**\n * A 16-bit fixed-point value that indicates how loudly this track’s sound is to be played.\n * A value of 1.0 indicates normal volume.\n */",
"volume",
":",
"number",
";",
"}",
"/**\n * Track Header Atoms structure\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550\n */",
"export",
"class",
"TrackHeaderAtom",
"implements",
"IGetToken",
"<",
"ITrackHeaderAtom",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"creationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"modificationTime",
":",
"SecondsSinceMacEpoch",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"trackId",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"duration",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"layer",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
",",
"alternateGroup",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"26",
")",
",",
"volume",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"28",
")",
"}",
";",
"}",
"}",
"/**\n * Atom: Sample Description Atom ('stsd')\n */",
"interface",
"IAtomStsdHeader",
"extends",
"IVersionAndFlags",
"{",
"numberOfEntries",
":",
"number",
";",
"}",
"/**\n * Atom: Sample Description Atom ('stsd')\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691\n */",
"const",
"stsdHeader",
"=",
"{",
"len",
":",
"8",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IAtomStsdHeader",
"=>",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"numberOfEntries",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Atom: Sample Description Atom ('stsd')\n */",
"export",
"interface",
"ISampleDescription",
"{",
"dataFormat",
":",
"string",
";",
"dataReferenceIndex",
":",
"number",
";",
"description",
":",
"Uint8Array",
";",
"}",
"export",
"interface",
"IAtomStsd",
"{",
"header",
":",
"IAtomStsdHeader",
";",
"table",
":",
"ISampleDescription",
"[",
"]",
";",
"}",
"/**\n * Atom: Sample Description Atom ('stsd')\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691\n */",
"class",
"SampleDescriptionTable",
"implements",
"IGetToken",
"<",
"ISampleDescription",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"dataFormat",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"dataReferenceIndex",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"10",
")",
",",
"description",
":",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"this",
".",
"len",
"-",
"12",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
"}",
";",
"}",
"}",
"/**\n * Atom: Sample-description Atom ('stsd')\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691\n */",
"export",
"class",
"StsdAtom",
"implements",
"IGetToken",
"<",
"IAtomStsd",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"header",
"=",
"stsdHeader",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"off",
"+=",
"stsdHeader",
".",
"len",
";",
"const",
"table",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"n",
"=",
"0",
";",
"n",
"<",
"header",
".",
"numberOfEntries",
";",
"++",
"n",
")",
"{",
"const",
"size",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"off",
"+=",
"Token",
".",
"UINT32_BE",
".",
"len",
";",
"table",
".",
"push",
"(",
"new",
"SampleDescriptionTable",
"(",
"size",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
")",
";",
"off",
"+=",
"size",
";",
"}",
"return",
"{",
"header",
",",
"table",
"}",
";",
"}",
"}",
"export",
"interface",
"ISoundSampleDescriptionVersion",
"{",
"version",
":",
"number",
";",
"revision",
":",
"number",
";",
"vendor",
":",
"number",
";",
"}",
"/**\n * Common Sound Sample Description (version & revision)\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57317\n */",
"export",
"const",
"SoundSampleDescriptionVersion",
"=",
"{",
"len",
":",
"8",
",",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"version",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"revision",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"2",
")",
",",
"vendor",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"export",
"interface",
"ISoundSampleDescriptionV0",
"{",
"numAudioChannels",
":",
"number",
";",
"/**\n * number of bits in each uncompressed sound sample\n */",
"sampleSize",
":",
"number",
";",
"/**\n * Compression ID\n */",
"compressionId",
":",
"number",
";",
"packetSize",
":",
"number",
";",
"sampleRate",
":",
"number",
";",
"}",
"/**\n * Sound Sample Description (Version 0)\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-130736\n */",
"export",
"const",
"SoundSampleDescriptionV0",
"=",
"{",
"len",
":",
"12",
",",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"numAudioChannels",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"sampleSize",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"2",
")",
",",
"compressionId",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"packetSize",
":",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"6",
")",
",",
"sampleRate",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
"+",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"10",
")",
"/",
"10000",
"}",
";",
"}",
"}",
";",
"export",
"interface",
"ITableAtom",
"<",
"T",
">",
"extends",
"IVersionAndFlags",
"{",
"numberOfEntries",
":",
"number",
";",
"entries",
":",
"T",
"[",
"]",
";",
"}",
"class",
"SimpleTableAtom",
"<",
"T",
">",
"implements",
"IGetToken",
"<",
"ITableAtom",
"<",
"T",
">",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
",",
"private",
"token",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"nrOfEntries",
"=",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
";",
"return",
"{",
"version",
":",
"Token",
".",
"INT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"flags",
":",
"Token",
".",
"INT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"numberOfEntries",
":",
"nrOfEntries",
",",
"entries",
":",
"readTokenTable",
"(",
"buf",
",",
"this",
".",
"token",
",",
"off",
"+",
"8",
",",
"this",
".",
"len",
"-",
"8",
",",
"nrOfEntries",
")",
"}",
";",
"}",
"}",
"export",
"interface",
"ITimeToSampleToken",
"{",
"count",
":",
"number",
";",
"duration",
":",
"number",
";",
"}",
"export",
"const",
"TimeToSampleToken",
"=",
"{",
"len",
":",
"8",
",",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"count",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"duration",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Time-to-sample('stts') atom.\n * Store duration information for a media’s samples.\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25696\n */",
"export",
"class",
"SttsAtom",
"extends",
"SimpleTableAtom",
"<",
"ITimeToSampleToken",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"super",
"(",
"len",
",",
"TimeToSampleToken",
")",
";",
"}",
"}",
"/**\n * Sample-to-Chunk ('stsc') atom table entry interface\n */",
"export",
"interface",
"ISampleToChunk",
"{",
"firstChunk",
":",
"number",
";",
"samplesPerChunk",
":",
"number",
";",
"sampleDescriptionId",
":",
"number",
";",
"}",
"export",
"const",
"SampleToChunkToken",
"=",
"{",
"len",
":",
"12",
",",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"firstChunk",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"samplesPerChunk",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"sampleDescriptionId",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Sample-to-Chunk ('stsc') atom interface\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25706\n */",
"export",
"class",
"StscAtom",
"extends",
"SimpleTableAtom",
"<",
"ISampleToChunk",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"super",
"(",
"len",
",",
"SampleToChunkToken",
")",
";",
"}",
"}",
"/**\n * Sample-size ('stsz') atom interface\n */",
"export",
"interface",
"IStszAtom",
"extends",
"ITableAtom",
"<",
"number",
">",
"{",
"sampleSize",
":",
"number",
";",
"}",
"/**\n * Sample-size ('stsz') atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25710\n */",
"export",
"class",
"StszAtom",
"implements",
"IGetToken",
"<",
"IStszAtom",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"nrOfEntries",
"=",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
";",
"return",
"{",
"version",
":",
"Token",
".",
"INT8",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"flags",
":",
"Token",
".",
"INT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"sampleSize",
":",
"Token",
".",
"INT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"numberOfEntries",
":",
"nrOfEntries",
",",
"entries",
":",
"readTokenTable",
"(",
"buf",
",",
"Token",
".",
"INT32_BE",
",",
"off",
"+",
"12",
",",
"this",
".",
"len",
"-",
"12",
",",
"nrOfEntries",
")",
"}",
";",
"}",
"}",
"/**\n * Chunk offset atom, 'stco'\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25715\n */",
"export",
"class",
"StcoAtom",
"extends",
"SimpleTableAtom",
"<",
"number",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"super",
"(",
"len",
",",
"Token",
".",
"INT32_BE",
")",
";",
"}",
"}",
"/**\n * Token used to decode text-track from 'mdat' atom (raw data stream)\n */",
"export",
"class",
"ChapterText",
"implements",
"IGetToken",
"<",
"string",
">",
"{",
"public",
"constructor",
"(",
"public",
"len",
")",
"{",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"const",
"titleLen",
"=",
"Token",
".",
"INT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
";",
"const",
"str",
"=",
"new",
"Token",
".",
"StringType",
"(",
"titleLen",
",",
"'utf-8'",
")",
";",
"return",
"str",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"2",
")",
";",
"}",
"}",
"function",
"readTokenTable",
"<",
"T",
">",
"(",
"buf",
",",
"token",
",",
"off",
",",
"remainingLen",
",",
"numberOfEntries",
")",
"{",
"debug",
"(",
"`remainingLen=${",
"remainingLen",
"}, numberOfEntries=${",
"numberOfEntries",
"} * token-len=${",
"token",
".",
"len",
"}`",
")",
";",
"if",
"(",
"remainingLen",
"===",
"0",
")",
"return",
"[",
"]",
";",
"if",
"(",
"remainingLen",
"!==",
"numberOfEntries",
"*",
"token",
".",
"len",
")",
"throw",
"new",
"Error",
"(",
"'mismatch number-of-entries with remaining atom-length'",
")",
";",
"const",
"entries",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"n",
"=",
"0",
";",
"n",
"<",
"numberOfEntries",
";",
"++",
"n",
")",
"{",
"entries",
".",
"push",
"(",
"token",
".",
"get",
"(",
"buf",
",",
"off",
")",
")",
";",
"off",
"+=",
"token",
".",
"len",
";",
"}",
"return",
"entries",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
298,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
33701,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
298,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49861,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49862,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
0,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
33702,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49863,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49864,
null,
12,
null,
3,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
2519,
null,
null,
null,
null,
25256,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
49865,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49866,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
2,
null,
12,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8749,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
12,
null,
2519,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661830 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"AtomToken",
"from",
"'./AtomToken'",
";",
"export",
"type",
"AtomDataHandler",
"=",
"(",
"atom",
":",
"Atom",
",",
"remaining",
":",
"number",
")",
"=>",
"Promise",
"<",
"void",
">",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:MP4:Atom'",
")",
";",
"export",
"class",
"Atom",
"{",
"public",
"static",
"async",
"readAtom",
"(",
"tokenizer",
",",
"dataHandler",
",",
"parent",
",",
"remaining",
")",
"{",
"const",
"offset",
"=",
"tokenizer",
".",
"position",
";",
"const",
"header",
"=",
"await",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IAtomHeader",
">",
"(",
"AtomToken",
".",
"Header",
")",
";",
"const",
"extended",
"=",
"header",
".",
"length",
"===",
"BigInt",
"(",
"1",
")",
";",
"if",
"(",
"extended",
")",
"{",
"header",
".",
"length",
"=",
"await",
"tokenizer",
".",
"readToken",
"<",
"bigint",
">",
"(",
"AtomToken",
".",
"ExtendedSize",
")",
";",
"}",
"const",
"atomBean",
"=",
"new",
"Atom",
"(",
"header",
",",
"header",
".",
"length",
"===",
"BigInt",
"(",
"1",
")",
",",
"parent",
")",
";",
"const",
"payloadLength",
"=",
"atomBean",
".",
"getPayloadLength",
"(",
"remaining",
")",
";",
"debug",
"(",
"`parse atom name=${",
"atomBean",
".",
"atomPath",
"}, extended=${",
"atomBean",
".",
"extended",
"}, offset=${",
"offset",
"}, len=${",
"atomBean",
".",
"header",
".",
"length",
"}`",
")",
";",
"await",
"atomBean",
".",
"readData",
"(",
"tokenizer",
",",
"dataHandler",
",",
"payloadLength",
")",
";",
"return",
"atomBean",
";",
"}",
"public",
"readonly",
"children",
":",
"Atom",
"[",
"]",
";",
"public",
"readonly",
"atomPath",
":",
"string",
";",
"public",
"constructor",
"(",
"public",
"readonly",
"header",
",",
"public",
"extended",
",",
"public",
"readonly",
"parent",
")",
"{",
"this",
".",
"children",
"=",
"[",
"]",
";",
"this",
".",
"atomPath",
"=",
"(",
"this",
".",
"parent",
"?",
"this",
".",
"parent",
".",
"atomPath",
"+",
"'.'",
":",
"''",
")",
"+",
"this",
".",
"header",
".",
"name",
";",
"}",
"public",
"getHeaderLength",
"(",
")",
"{",
"return",
"this",
".",
"extended",
"?",
"16",
":",
"8",
";",
"}",
"public",
"getPayloadLength",
"(",
"remaining",
")",
"{",
"return",
"(",
"this",
".",
"header",
".",
"length",
"===",
"BigInt",
"(",
"0",
")",
"?",
"remaining",
":",
"Number",
"(",
"this",
".",
"header",
".",
"length",
")",
")",
"-",
"this",
".",
"getHeaderLength",
"(",
")",
";",
"}",
"public",
"async",
"readAtoms",
"(",
"tokenizer",
",",
"dataHandler",
",",
"size",
")",
"{",
"while",
"(",
"size",
">",
"0",
")",
"{",
"const",
"atomBean",
"=",
"await",
"Atom",
".",
"readAtom",
"(",
"tokenizer",
",",
"dataHandler",
",",
"this",
",",
"size",
")",
";",
"this",
".",
"children",
".",
"push",
"(",
"atomBean",
")",
";",
"size",
"-=",
"atomBean",
".",
"header",
".",
"length",
"===",
"BigInt",
"(",
"0",
")",
"?",
"size",
":",
"Number",
"(",
"atomBean",
".",
"header",
".",
"length",
")",
";",
"}",
"}",
"private",
"async",
"readData",
"(",
"tokenizer",
",",
"dataHandler",
",",
"remaining",
")",
"{",
"switch",
"(",
"this",
".",
"header",
".",
"name",
")",
"{",
"case",
"'moov'",
":",
"case",
"'udta'",
":",
"case",
"'trak'",
":",
"case",
"'mdia'",
":",
"case",
"'minf'",
":",
"case",
"'stbl'",
":",
"case",
"'<id>'",
":",
"case",
"'ilst'",
":",
"case",
"'tref'",
":",
"return",
"this",
".",
"readAtoms",
"(",
"tokenizer",
",",
"dataHandler",
",",
"this",
".",
"getPayloadLength",
"(",
"remaining",
")",
")",
";",
"case",
"'meta'",
":",
"await",
"tokenizer",
".",
"ignore",
"(",
"4",
")",
";",
"return",
"this",
".",
"readAtoms",
"(",
"tokenizer",
",",
"dataHandler",
",",
"this",
".",
"getPayloadLength",
"(",
"remaining",
")",
"-",
"4",
")",
";",
"case",
"'mdhd'",
":",
"case",
"'mvhd'",
":",
"case",
"'tkhd'",
":",
"case",
"'stsz'",
":",
"case",
"'mdat'",
":",
"default",
":",
"return",
"dataHandler",
"(",
"this",
",",
"remaining",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
33703,
null,
413,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
33701,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
413,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
8,
null,
null,
null,
413,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
33703,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
413,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
33703,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661831 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'@tokenizer/token'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"Genres",
"}",
"from",
"'../id3v1/ID3v1Parser'",
";",
"import",
"{",
"IChapter",
",",
"ITrackInfo",
",",
"TrackType",
"}",
"from",
"'../type'",
";",
"import",
"{",
"Atom",
"}",
"from",
"'./Atom'",
";",
"import",
"*",
"as",
"AtomToken",
"from",
"'./AtomToken'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:MP4'",
")",
";",
"const",
"tagFormat",
"=",
"'iTunes'",
";",
"interface",
"IEncoder",
"{",
"lossy",
":",
"boolean",
";",
"format",
":",
"string",
";",
"}",
"interface",
"ISoundSampleDescription",
"{",
"dataFormat",
":",
"string",
";",
"dataReferenceIndex",
":",
"number",
";",
"description",
"?",
":",
"{",
"numAudioChannels",
"?",
":",
"number",
";",
"/**\n * number of bits in each uncompressed sound sample\n */",
"sampleSize",
"?",
":",
"number",
";",
"/**\n * Compression ID\n */",
"compressionId",
"?",
":",
"number",
";",
"packetSize",
"?",
":",
"number",
";",
"sampleRate",
"?",
":",
"number",
";",
"}",
";",
"}",
"interface",
"ITrackDescription",
"extends",
"AtomToken",
".",
"ITrackHeaderAtom",
"{",
"soundSampleDescription",
":",
"ISoundSampleDescription",
"[",
"]",
";",
"timeScale",
":",
"number",
";",
"chapterList",
"?",
":",
"number",
"[",
"]",
";",
"chunkOffsetTable",
"?",
":",
"number",
"[",
"]",
";",
"sampleSize",
"?",
":",
"number",
";",
"sampleSizeTable",
"?",
":",
"number",
"[",
"]",
";",
"sampleToChunkTable",
"?",
":",
"AtomToken",
".",
"ISampleToChunk",
"[",
"]",
";",
"timeToSampleTable",
"?",
":",
"AtomToken",
".",
"ITimeToSampleToken",
"[",
"]",
";",
"}",
"type",
"IAtomParser",
"=",
"(",
"payloadLength",
":",
"number",
")",
"=>",
"Promise",
"<",
"any",
">",
";",
"const",
"encoderDict",
"=",
"{",
"raw",
":",
"{",
"lossy",
":",
"false",
",",
"format",
":",
"'raw'",
"}",
",",
"MAC3",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'MACE 3:1'",
"}",
",",
"MAC6",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'MACE 6:1'",
"}",
",",
"ima4",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'IMA 4:1'",
"}",
",",
"ulaw",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'uLaw 2:1'",
"}",
",",
"alaw",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'uLaw 2:1'",
"}",
",",
"Qclp",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'QUALCOMM PureVoice'",
"}",
",",
"'.mp3'",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'MPEG-1 layer 3'",
"}",
",",
"alac",
":",
"{",
"lossy",
":",
"false",
",",
"format",
":",
"'ALAC'",
"}",
",",
"'ac-3'",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'AC-3'",
"}",
",",
"mp4a",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'MPEG-4/AAC'",
"}",
",",
"mp4s",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'MP4S'",
"}",
",",
"c608",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'CEA-608'",
"}",
",",
"c708",
":",
"{",
"lossy",
":",
"true",
",",
"format",
":",
"'CEA-708'",
"}",
"}",
";",
"function",
"distinct",
"(",
"value",
",",
"index",
",",
"self",
")",
"{",
"return",
"self",
".",
"indexOf",
"(",
"value",
")",
"===",
"index",
";",
"}",
"export",
"class",
"MP4Parser",
"extends",
"BasicParser",
"{",
"private",
"static",
"read_BE_Integer",
"(",
"array",
",",
"signed",
")",
"{",
"const",
"integerType",
"=",
"(",
"signed",
"?",
"'INT'",
":",
"'UINT'",
")",
"+",
"array",
".",
"length",
"*",
"8",
"+",
"(",
"array",
".",
"length",
">",
"1",
"?",
"'_BE'",
":",
"''",
")",
";",
"const",
"token",
"=",
"Token",
"[",
"integerType",
"]",
";",
"if",
"(",
"!",
"token",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Token for integer type not found: \"'",
"+",
"integerType",
"+",
"'\"'",
")",
";",
"}",
"return",
"Number",
"(",
"token",
".",
"get",
"(",
"array",
",",
"0",
")",
")",
";",
"}",
"private",
"audioLengthInBytes",
":",
"number",
";",
"private",
"tracks",
":",
"ITrackDescription",
"[",
"]",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"this",
".",
"tracks",
"=",
"[",
"]",
";",
"let",
"remainingFileSize",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
";",
"while",
"(",
"!",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"||",
"remainingFileSize",
">",
"0",
")",
"{",
"try",
"{",
"const",
"token",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekToken",
"<",
"AtomToken",
".",
"IAtomHeader",
">",
"(",
"AtomToken",
".",
"Header",
")",
";",
"if",
"(",
"token",
".",
"name",
"===",
"'\\0\\0\\0\\0'",
")",
"{",
"const",
"errMsg",
"=",
"`Error at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}: box.id=0`",
";",
"debug",
"(",
"errMsg",
")",
";",
"this",
".",
"addWarning",
"(",
"errMsg",
")",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"error",
")",
"{",
"const",
"errMsg",
"=",
"`Error at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}: ${",
"error",
".",
"message",
"}`",
";",
"debug",
"(",
"errMsg",
")",
";",
"this",
".",
"addWarning",
"(",
"errMsg",
")",
";",
"break",
";",
"}",
"const",
"rootAtom",
"=",
"await",
"Atom",
".",
"readAtom",
"(",
"this",
".",
"tokenizer",
",",
"(",
"atom",
",",
"remaining",
")",
"=>",
"this",
".",
"handleAtom",
"(",
"atom",
",",
"remaining",
")",
",",
"null",
",",
"remainingFileSize",
")",
";",
"remainingFileSize",
"-=",
"rootAtom",
".",
"header",
".",
"length",
"===",
"BigInt",
"(",
"0",
")",
"?",
"remainingFileSize",
":",
"Number",
"(",
"rootAtom",
".",
"header",
".",
"length",
")",
";",
"}",
"const",
"formatList",
"=",
"[",
"]",
";",
"this",
".",
"tracks",
".",
"forEach",
"(",
"track",
"=>",
"{",
"const",
"trackFormats",
"=",
"[",
"]",
";",
"track",
".",
"soundSampleDescription",
".",
"forEach",
"(",
"ssd",
"=>",
"{",
"const",
"streamInfo",
"=",
"{",
"}",
";",
"const",
"encoderInfo",
"=",
"encoderDict",
"[",
"ssd",
".",
"dataFormat",
"]",
";",
"if",
"(",
"encoderInfo",
")",
"{",
"trackFormats",
".",
"push",
"(",
"encoderInfo",
".",
"format",
")",
";",
"streamInfo",
".",
"codecName",
"=",
"encoderInfo",
".",
"format",
";",
"}",
"else",
"{",
"streamInfo",
".",
"codecName",
"=",
"`<${",
"ssd",
".",
"dataFormat",
"}>`",
";",
"}",
"if",
"(",
"ssd",
".",
"description",
")",
"{",
"const",
"{",
"description",
"}",
"=",
"ssd",
";",
"if",
"(",
"description",
".",
"sampleRate",
">",
"0",
")",
"{",
"streamInfo",
".",
"type",
"=",
"TrackType",
".",
"audio",
";",
"streamInfo",
".",
"audio",
"=",
"{",
"samplingFrequency",
":",
"description",
".",
"sampleRate",
",",
"bitDepth",
":",
"description",
".",
"sampleSize",
",",
"channels",
":",
"description",
".",
"numAudioChannels",
"}",
";",
"}",
"}",
"this",
".",
"metadata",
".",
"addStreamInfo",
"(",
"streamInfo",
")",
";",
"}",
")",
";",
"if",
"(",
"trackFormats",
".",
"length",
">=",
"1",
")",
"{",
"formatList",
".",
"push",
"(",
"trackFormats",
".",
"join",
"(",
"'/'",
")",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"formatList",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"formatList",
".",
"filter",
"(",
"distinct",
")",
".",
"join",
"(",
"'+'",
")",
")",
";",
"}",
"const",
"audioTracks",
"=",
"this",
".",
"tracks",
".",
"filter",
"(",
"track",
"=>",
"{",
"return",
"track",
".",
"soundSampleDescription",
".",
"length",
">=",
"1",
"&&",
"track",
".",
"soundSampleDescription",
"[",
"0",
"]",
".",
"description",
"&&",
"track",
".",
"soundSampleDescription",
"[",
"0",
"]",
".",
"description",
".",
"numAudioChannels",
">",
"0",
";",
"}",
")",
";",
"if",
"(",
"audioTracks",
".",
"length",
">=",
"1",
")",
"{",
"const",
"audioTrack",
"=",
"audioTracks",
"[",
"0",
"]",
";",
"const",
"duration",
"=",
"audioTrack",
".",
"duration",
"/",
"audioTrack",
".",
"timeScale",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"duration",
")",
";",
"const",
"ssd",
"=",
"audioTrack",
".",
"soundSampleDescription",
"[",
"0",
"]",
";",
"if",
"(",
"ssd",
".",
"description",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"ssd",
".",
"description",
".",
"sampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"ssd",
".",
"description",
".",
"sampleSize",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"ssd",
".",
"description",
".",
"numAudioChannels",
")",
";",
"}",
"const",
"encoderInfo",
"=",
"encoderDict",
"[",
"ssd",
".",
"dataFormat",
"]",
";",
"if",
"(",
"encoderInfo",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"!",
"encoderInfo",
".",
"lossy",
")",
";",
"}",
"this",
".",
"calculateBitRate",
"(",
")",
";",
"}",
"}",
"public",
"async",
"handleAtom",
"(",
"atom",
",",
"remaining",
")",
"{",
"if",
"(",
"atom",
".",
"parent",
")",
"{",
"switch",
"(",
"atom",
".",
"parent",
".",
"header",
".",
"name",
")",
"{",
"case",
"'ilst'",
":",
"case",
"'<id>'",
":",
"return",
"this",
".",
"parseMetadataItemData",
"(",
"atom",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"atomParsers",
"[",
"atom",
".",
"header",
".",
"name",
"]",
")",
"{",
"return",
"this",
".",
"atomParsers",
"[",
"atom",
".",
"header",
".",
"name",
"]",
"(",
"remaining",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"`No parser for atom path=${",
"atom",
".",
"atomPath",
"}, payload-len=${",
"remaining",
"}, ignoring atom`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"remaining",
")",
";",
"}",
"}",
"private",
"getTrackDescription",
"(",
")",
"{",
"return",
"this",
".",
"tracks",
"[",
"this",
".",
"tracks",
".",
"length",
"-",
"1",
"]",
";",
"}",
"private",
"calculateBitRate",
"(",
")",
"{",
"if",
"(",
"this",
".",
"audioLengthInBytes",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"8",
"*",
"this",
".",
"audioLengthInBytes",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"}",
"}",
"private",
"addTag",
"(",
"id",
",",
"value",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"tagFormat",
",",
"id",
",",
"value",
")",
";",
"}",
"private",
"addWarning",
"(",
"message",
")",
"{",
"debug",
"(",
"'Warning: '",
"+",
"message",
")",
";",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"message",
")",
";",
"}",
"param",
"metaAtom",
"private",
"parseMetadataItemData",
"(",
"metaAtom",
")",
"{",
"let",
"tagKey",
"=",
"metaAtom",
".",
"header",
".",
"name",
";",
"return",
"metaAtom",
".",
"readAtoms",
"(",
"this",
".",
"tokenizer",
",",
"async",
"(",
"child",
",",
"remaining",
")",
"=>",
"{",
"const",
"payLoadLength",
"=",
"child",
".",
"getPayloadLength",
"(",
"remaining",
")",
";",
"switch",
"(",
"child",
".",
"header",
".",
"name",
")",
"{",
"case",
"'data'",
":",
"return",
"this",
".",
"parseValueAtom",
"(",
"tagKey",
",",
"child",
")",
";",
"case",
"'name'",
":",
"const",
"name",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"INameAtom",
">",
"(",
"new",
"AtomToken",
".",
"NameAtom",
"(",
"payLoadLength",
")",
")",
";",
"tagKey",
"+=",
"':'",
"+",
"name",
".",
"name",
";",
"break",
";",
"case",
"'mean'",
":",
"const",
"mean",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"INameAtom",
">",
"(",
"new",
"AtomToken",
".",
"NameAtom",
"(",
"payLoadLength",
")",
")",
";",
"tagKey",
"+=",
"':'",
"+",
"mean",
".",
"name",
";",
"break",
";",
"default",
":",
"const",
"dataAtom",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Buffer",
">",
"(",
"new",
"Token",
".",
"BufferType",
"(",
"payLoadLength",
")",
")",
";",
"this",
".",
"addWarning",
"(",
"'Unsupported meta-item: '",
"+",
"tagKey",
"+",
"'['",
"+",
"child",
".",
"header",
".",
"name",
"+",
"'] => value='",
"+",
"dataAtom",
".",
"toString",
"(",
"'hex'",
")",
"+",
"' ascii='",
"+",
"dataAtom",
".",
"toString",
"(",
"'ascii'",
")",
")",
";",
"}",
"}",
",",
"metaAtom",
".",
"getPayloadLength",
"(",
"0",
")",
")",
";",
"}",
"private",
"async",
"parseValueAtom",
"(",
"tagKey",
",",
"metaAtom",
")",
"{",
"const",
"dataAtom",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"AtomToken",
".",
"DataAtom",
"(",
"Number",
"(",
"metaAtom",
".",
"header",
".",
"length",
")",
"-",
"AtomToken",
".",
"Header",
".",
"len",
")",
")",
";",
"if",
"(",
"dataAtom",
".",
"type",
".",
"set",
"!==",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unsupported type-set != 0: '",
"+",
"dataAtom",
".",
"type",
".",
"set",
")",
";",
"}",
"switch",
"(",
"dataAtom",
".",
"type",
".",
"type",
")",
"{",
"case",
"0",
":",
"switch",
"(",
"tagKey",
")",
"{",
"case",
"'trkn'",
":",
"case",
"'disk'",
":",
"const",
"num",
"=",
"Token",
".",
"UINT8",
".",
"get",
"(",
"dataAtom",
".",
"value",
",",
"3",
")",
";",
"const",
"of",
"=",
"Token",
".",
"UINT8",
".",
"get",
"(",
"dataAtom",
".",
"value",
",",
"5",
")",
";",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"num",
"+",
"'/'",
"+",
"of",
")",
";",
"break",
";",
"case",
"'gnre'",
":",
"const",
"genreInt",
"=",
"Token",
".",
"UINT8",
".",
"get",
"(",
"dataAtom",
".",
"value",
",",
"1",
")",
";",
"const",
"genreStr",
"=",
"Genres",
"[",
"genreInt",
"-",
"1",
"]",
";",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"genreStr",
")",
";",
"break",
";",
"default",
":",
"}",
"break",
";",
"case",
"1",
":",
"case",
"18",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"dataAtom",
".",
"value",
".",
"toString",
"(",
"'utf-8'",
")",
")",
";",
"break",
";",
"case",
"13",
":",
"if",
"(",
"this",
".",
"options",
".",
"skipCovers",
")",
"break",
";",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"{",
"format",
":",
"'image/jpeg'",
",",
"data",
":",
"Buffer",
".",
"from",
"(",
"dataAtom",
".",
"value",
")",
"}",
")",
";",
"break",
";",
"case",
"14",
":",
"if",
"(",
"this",
".",
"options",
".",
"skipCovers",
")",
"break",
";",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"{",
"format",
":",
"'image/png'",
",",
"data",
":",
"Buffer",
".",
"from",
"(",
"dataAtom",
".",
"value",
")",
"}",
")",
";",
"break",
";",
"case",
"21",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"MP4Parser",
".",
"read_BE_Integer",
"(",
"dataAtom",
".",
"value",
",",
"true",
")",
")",
";",
"break",
";",
"case",
"22",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"MP4Parser",
".",
"read_BE_Integer",
"(",
"dataAtom",
".",
"value",
",",
"false",
")",
")",
";",
"break",
";",
"case",
"65",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"dataAtom",
".",
"value",
".",
"readInt8",
"(",
"0",
")",
")",
";",
"break",
";",
"case",
"66",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"dataAtom",
".",
"value",
".",
"readInt16BE",
"(",
"0",
")",
")",
";",
"break",
";",
"case",
"67",
":",
"this",
".",
"addTag",
"(",
"tagKey",
",",
"dataAtom",
".",
"value",
".",
"readInt32BE",
"(",
"0",
")",
")",
";",
"break",
";",
"default",
":",
"this",
".",
"addWarning",
"(",
"`atom key=${",
"tagKey",
"}, has unknown well-known-type (data-type): ${",
"dataAtom",
".",
"type",
".",
"type",
"}`",
")",
";",
"}",
"}",
"private",
"atomParsers",
":",
"{",
"[",
"id",
"]",
":",
"IAtomParser",
";",
"}",
"=",
"{",
"/**\n * Parse movie header (mvhd) atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-56313\n */",
"mvhd",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"_mvhd",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IAtomMvhd",
">",
"(",
"new",
"AtomToken",
".",
"MvhdAtom",
"(",
"len",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'creationTime'",
",",
"_mvhd",
".",
"creationTime",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'modificationTime'",
",",
"_mvhd",
".",
"modificationTime",
")",
";",
"}",
",",
"/**\n * Parse media header (mdhd) atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25615\n */",
"mdhd",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"mdhd_data",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IAtomMdhd",
">",
"(",
"new",
"AtomToken",
".",
"MdhdAtom",
"(",
"len",
")",
")",
";",
"const",
"td",
"=",
"this",
".",
"getTrackDescription",
"(",
")",
";",
"td",
".",
"creationTime",
"=",
"mdhd_data",
".",
"creationTime",
";",
"td",
".",
"modificationTime",
"=",
"mdhd_data",
".",
"modificationTime",
";",
"td",
".",
"timeScale",
"=",
"mdhd_data",
".",
"timeScale",
";",
"td",
".",
"duration",
"=",
"mdhd_data",
".",
"duration",
";",
"}",
",",
"chap",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"td",
"=",
"this",
".",
"getTrackDescription",
"(",
")",
";",
"const",
"trackIds",
"=",
"[",
"]",
";",
"while",
"(",
"len",
">=",
"Token",
".",
"UINT32_BE",
".",
"len",
")",
"{",
"trackIds",
".",
"push",
"(",
"await",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"UINT32_BE",
")",
")",
";",
"len",
"-=",
"Token",
".",
"UINT32_BE",
".",
"len",
";",
"}",
"td",
".",
"chapterList",
"=",
"trackIds",
";",
"}",
",",
"tkhd",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"track",
"=",
"(",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"ITrackHeaderAtom",
">",
"(",
"new",
"AtomToken",
".",
"TrackHeaderAtom",
"(",
"len",
")",
")",
")",
"as",
"ITrackDescription",
";",
"this",
".",
"tracks",
".",
"push",
"(",
"track",
")",
";",
"}",
",",
"/**\n * Parse mdat atom.\n * Will scan for chapters\n */",
"mdat",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"this",
".",
"audioLengthInBytes",
"=",
"len",
";",
"this",
".",
"calculateBitRate",
"(",
")",
";",
"if",
"(",
"this",
".",
"options",
".",
"includeChapters",
")",
"{",
"const",
"trackWithChapters",
"=",
"this",
".",
"tracks",
".",
"filter",
"(",
"track",
"=>",
"track",
".",
"chapterList",
")",
";",
"if",
"(",
"trackWithChapters",
".",
"length",
"===",
"1",
")",
"{",
"const",
"chapterTrackIds",
"=",
"trackWithChapters",
"[",
"0",
"]",
".",
"chapterList",
";",
"const",
"chapterTracks",
"=",
"this",
".",
"tracks",
".",
"filter",
"(",
"track",
"=>",
"chapterTrackIds",
".",
"indexOf",
"(",
"track",
".",
"trackId",
")",
"!==",
"-",
"1",
")",
";",
"if",
"(",
"chapterTracks",
".",
"length",
"===",
"1",
")",
"{",
"return",
"this",
".",
"parseChapterTrack",
"(",
"chapterTracks",
"[",
"0",
"]",
",",
"trackWithChapters",
"[",
"0",
"]",
",",
"len",
")",
";",
"}",
"}",
"}",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"len",
")",
";",
"}",
",",
"ftyp",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"types",
"=",
"[",
"]",
";",
"while",
"(",
"len",
">",
"0",
")",
"{",
"const",
"ftype",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IAtomFtyp",
">",
"(",
"AtomToken",
".",
"ftyp",
")",
";",
"len",
"-=",
"AtomToken",
".",
"ftyp",
".",
"len",
";",
"const",
"value",
"=",
"ftype",
".",
"type",
".",
"replace",
"(",
"/\\W/g",
",",
"''",
")",
";",
"if",
"(",
"value",
".",
"length",
">",
"0",
")",
"{",
"types",
".",
"push",
"(",
"value",
")",
";",
"}",
"}",
"debug",
"(",
"`ftyp: ${",
"types",
".",
"join",
"(",
"'/'",
")",
"}`",
")",
";",
"const",
"x",
"=",
"types",
".",
"filter",
"(",
"distinct",
")",
".",
"join",
"(",
"'/'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"x",
")",
";",
"}",
",",
"/**\n * Parse sample description atom\n */",
"stsd",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"stsd",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IAtomStsd",
">",
"(",
"new",
"AtomToken",
".",
"StsdAtom",
"(",
"len",
")",
")",
";",
"const",
"trackDescription",
"=",
"this",
".",
"getTrackDescription",
"(",
")",
";",
"trackDescription",
".",
"soundSampleDescription",
"=",
"stsd",
".",
"table",
".",
"map",
"(",
"dfEntry",
"=>",
"this",
".",
"parseSoundSampleDescription",
"(",
"dfEntry",
")",
")",
";",
"}",
",",
"/**\n * sample-to-Chunk Atoms\n */",
"stsc",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"stsc",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"ITableAtom",
"<",
"AtomToken",
".",
"ISampleToChunk",
">",
">",
"(",
"new",
"AtomToken",
".",
"StscAtom",
"(",
"len",
")",
")",
";",
"this",
".",
"getTrackDescription",
"(",
")",
".",
"sampleToChunkTable",
"=",
"stsc",
".",
"entries",
";",
"}",
",",
"/**\n * time to sample\n */",
"stts",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"stts",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"ITableAtom",
"<",
"AtomToken",
".",
"ITimeToSampleToken",
">",
">",
"(",
"new",
"AtomToken",
".",
"SttsAtom",
"(",
"len",
")",
")",
";",
"this",
".",
"getTrackDescription",
"(",
")",
".",
"timeToSampleTable",
"=",
"stts",
".",
"entries",
";",
"}",
",",
"/**\n * Parse sample-sizes atom ('stsz')\n */",
"stsz",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"stsz",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"IStszAtom",
">",
"(",
"new",
"AtomToken",
".",
"StszAtom",
"(",
"len",
")",
")",
";",
"const",
"td",
"=",
"this",
".",
"getTrackDescription",
"(",
")",
";",
"td",
".",
"sampleSize",
"=",
"stsz",
".",
"sampleSize",
";",
"td",
".",
"sampleSizeTable",
"=",
"stsz",
".",
"entries",
";",
"}",
",",
"/**\n * Parse chunk-offset atom ('stco')\n */",
"stco",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"stco",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"AtomToken",
".",
"ITableAtom",
"<",
"number",
">",
">",
"(",
"new",
"AtomToken",
".",
"StcoAtom",
"(",
"len",
")",
")",
";",
"this",
".",
"getTrackDescription",
"(",
")",
".",
"chunkOffsetTable",
"=",
"stco",
".",
"entries",
";",
"}",
",",
"date",
":",
"async",
"(",
"len",
")",
"=>",
"{",
"const",
"date",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"len",
",",
"'utf-8'",
")",
")",
";",
"this",
".",
"addTag",
"(",
"'date'",
",",
"date",
")",
";",
"}",
"}",
";",
"param",
"sampleDescription",
"private",
"parseSoundSampleDescription",
"(",
"sampleDescription",
")",
"{",
"const",
"ssd",
"=",
"{",
"dataFormat",
":",
"sampleDescription",
".",
"dataFormat",
",",
"dataReferenceIndex",
":",
"sampleDescription",
".",
"dataReferenceIndex",
"}",
";",
"let",
"offset",
"=",
"0",
";",
"const",
"version",
"=",
"AtomToken",
".",
"SoundSampleDescriptionVersion",
".",
"get",
"(",
"sampleDescription",
".",
"description",
",",
"offset",
")",
";",
"offset",
"+=",
"AtomToken",
".",
"SoundSampleDescriptionVersion",
".",
"len",
";",
"if",
"(",
"version",
".",
"version",
"===",
"0",
"||",
"version",
".",
"version",
"===",
"1",
")",
"{",
"ssd",
".",
"description",
"=",
"AtomToken",
".",
"SoundSampleDescriptionV0",
".",
"get",
"(",
"sampleDescription",
".",
"description",
",",
"offset",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"`Warning: sound-sample-description ${",
"version",
"} not implemented`",
")",
";",
"}",
"return",
"ssd",
";",
"}",
"private",
"async",
"parseChapterTrack",
"(",
"chapterTrack",
",",
"track",
",",
"len",
")",
"{",
"if",
"(",
"!",
"chapterTrack",
".",
"sampleSize",
")",
"{",
"if",
"(",
"chapterTrack",
".",
"chunkOffsetTable",
".",
"length",
"!==",
"chapterTrack",
".",
"sampleSizeTable",
".",
"length",
")",
"throw",
"new",
"Error",
"(",
"'Expected equal chunk-offset-table & sample-size-table length.'",
")",
";",
"}",
"const",
"chapters",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"chapterTrack",
".",
"chunkOffsetTable",
".",
"length",
"&&",
"len",
">",
"0",
";",
"++",
"i",
")",
"{",
"const",
"chunkOffset",
"=",
"chapterTrack",
".",
"chunkOffsetTable",
"[",
"i",
"]",
";",
"const",
"nextChunkLen",
"=",
"chunkOffset",
"-",
"this",
".",
"tokenizer",
".",
"position",
";",
"const",
"sampleSize",
"=",
"chapterTrack",
".",
"sampleSize",
">",
"0",
"?",
"chapterTrack",
".",
"sampleSize",
":",
"chapterTrack",
".",
"sampleSizeTable",
"[",
"i",
"]",
";",
"len",
"-=",
"nextChunkLen",
"+",
"sampleSize",
";",
"if",
"(",
"len",
"<",
"0",
")",
"throw",
"new",
"Error",
"(",
"'Chapter chunk exceeding token length'",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"nextChunkLen",
")",
";",
"const",
"title",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"AtomToken",
".",
"ChapterText",
"(",
"sampleSize",
")",
")",
";",
"debug",
"(",
"`Chapter ${",
"i",
"+",
"1",
"}: ${",
"title",
"}`",
")",
";",
"const",
"chapter",
"=",
"{",
"title",
",",
"sampleOffset",
":",
"this",
".",
"findSampleOffset",
"(",
"track",
",",
"this",
".",
"tokenizer",
".",
"position",
")",
"}",
";",
"debug",
"(",
"`Chapter title=${",
"chapter",
".",
"title",
"}, offset=${",
"chapter",
".",
"sampleOffset",
"}/${",
"this",
".",
"tracks",
"[",
"0",
"]",
".",
"duration",
"}`",
")",
";",
"chapters",
".",
"push",
"(",
"chapter",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'chapters'",
",",
"chapters",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"len",
")",
";",
"}",
"private",
"findSampleOffset",
"(",
"track",
",",
"chapterOffset",
")",
"{",
"let",
"totalDuration",
"=",
"0",
";",
"track",
".",
"timeToSampleTable",
".",
"forEach",
"(",
"e",
"=>",
"{",
"totalDuration",
"+=",
"e",
".",
"count",
"*",
"e",
".",
"duration",
";",
"}",
")",
";",
"debug",
"(",
"`Total duration=${",
"totalDuration",
"}`",
")",
";",
"let",
"chunkIndex",
"=",
"0",
";",
"while",
"(",
"chunkIndex",
"<",
"track",
".",
"chunkOffsetTable",
".",
"length",
"&&",
"track",
".",
"chunkOffsetTable",
"[",
"chunkIndex",
"]",
"<",
"chapterOffset",
")",
"{",
"++",
"chunkIndex",
";",
"}",
"return",
"this",
".",
"getChunkDuration",
"(",
"chunkIndex",
"+",
"1",
",",
"track",
")",
";",
"}",
"private",
"getChunkDuration",
"(",
"chunkId",
",",
"track",
")",
"{",
"let",
"ttsi",
"=",
"0",
";",
"let",
"ttsc",
"=",
"track",
".",
"timeToSampleTable",
"[",
"ttsi",
"]",
".",
"count",
";",
"let",
"ttsd",
"=",
"track",
".",
"timeToSampleTable",
"[",
"ttsi",
"]",
".",
"duration",
";",
"let",
"curChunkId",
"=",
"1",
";",
"let",
"samplesPerChunk",
"=",
"this",
".",
"getSamplesPerChunk",
"(",
"curChunkId",
",",
"track",
".",
"sampleToChunkTable",
")",
";",
"let",
"totalDuration",
"=",
"0",
";",
"while",
"(",
"curChunkId",
"<",
"chunkId",
")",
"{",
"const",
"nrOfSamples",
"=",
"Math",
".",
"min",
"(",
"ttsc",
",",
"samplesPerChunk",
")",
";",
"totalDuration",
"+=",
"nrOfSamples",
"*",
"ttsd",
";",
"ttsc",
"-=",
"nrOfSamples",
";",
"samplesPerChunk",
"-=",
"nrOfSamples",
";",
"if",
"(",
"samplesPerChunk",
"===",
"0",
")",
"{",
"++",
"curChunkId",
";",
"samplesPerChunk",
"=",
"this",
".",
"getSamplesPerChunk",
"(",
"curChunkId",
",",
"track",
".",
"sampleToChunkTable",
")",
";",
"}",
"else",
"{",
"++",
"ttsi",
";",
"ttsc",
"=",
"track",
".",
"timeToSampleTable",
"[",
"ttsi",
"]",
".",
"count",
";",
"ttsd",
"=",
"track",
".",
"timeToSampleTable",
"[",
"ttsi",
"]",
".",
"duration",
";",
"}",
"}",
"return",
"totalDuration",
";",
"}",
"private",
"getSamplesPerChunk",
"(",
"chunkId",
",",
"stcTable",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"stcTable",
".",
"length",
"-",
"1",
";",
"++",
"i",
")",
"{",
"if",
"(",
"chunkId",
">=",
"stcTable",
"[",
"i",
"]",
".",
"firstChunk",
"&&",
"chunkId",
"<",
"stcTable",
"[",
"i",
"+",
"1",
"]",
".",
"firstChunk",
")",
"{",
"return",
"stcTable",
"[",
"i",
"]",
".",
"samplesPerChunk",
";",
"}",
"}",
"return",
"stcTable",
"[",
"stcTable",
".",
"length",
"-",
"1",
"]",
".",
"samplesPerChunk",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
3,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
29,
null,
8,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33701,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
413,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
413,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25257,
null,
null,
null,
20320,
null,
null,
null,
null,
null,
49867,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25257,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49867,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
413,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
413,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
413,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33702,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33702,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
413,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49862,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49861,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49864,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49863,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
25256,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
25256,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
49866,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6758,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
25256,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25257,
null,
0,
null,
null,
null,
25257,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
6758,
null,
6758,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
6758,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49865,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
6758,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661832 | [
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"common",
"from",
"'../common/Util'",
";",
"export",
"interface",
"IReplayGain",
"{",
"type",
":",
"NameCode",
";",
"origin",
":",
"ReplayGainOriginator",
";",
"adjustment",
":",
"number",
";",
"}",
"/**\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format#name-code\n */",
"enum",
"NameCode",
"{",
"/**\n * not set\n */",
"not_set",
"=",
"0",
",",
"/**\n * Radio Gain Adjustment\n */",
"radio",
"=",
"1",
",",
"/**\n * Audiophile Gain Adjustment\n */",
"audiophile",
"=",
"2",
"}",
"/**\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format#originator-code\n */",
"enum",
"ReplayGainOriginator",
"{",
"/**\n * Replay Gain unspecified\n */",
"unspecified",
"=",
"0",
",",
"/**\n * Replay Gain pre-set by artist/producer/mastering engineer\n */",
"engineer",
"=",
"1",
",",
"/**\n * Replay Gain set by user\n */",
"user",
"=",
"2",
",",
"/**\n * Replay Gain determined automatically, as described on this site\n */",
"automatic",
"=",
"3",
",",
"/**\n * Set by simple RMS average\n */",
"rms_average",
"=",
"4",
"}",
"/**\n * Replay Gain Data Format\n *\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format\n */",
"export",
"const",
"ReplayGain",
"=",
"{",
"len",
":",
"2",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"const",
"gain_type",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"0",
",",
"3",
")",
";",
"const",
"sign",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"6",
",",
"1",
")",
";",
"const",
"gain_adj",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"7",
",",
"9",
")",
"/",
"10.0",
";",
"if",
"(",
"gain_type",
">",
"0",
")",
"{",
"return",
"{",
"type",
":",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"0",
",",
"3",
")",
",",
"origin",
":",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"3",
",",
"3",
")",
",",
"adjustment",
":",
"(",
"sign",
"?",
"-",
"gain_adj",
":",
"gain_adj",
")",
"}",
";",
"}",
"return",
"undefined",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661833 | [
"/**\n * Extended Lame Header\n */",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"common",
"from",
"'../common/Util'",
";",
"import",
"{",
"ReplayGain",
",",
"IReplayGain",
"}",
"from",
"'./ReplayGainDataFormat'",
";",
"/**\n * LAME Tag, extends the Xing header format\n * First added in LAME 3.12 for VBR\n * The modified header is also included in CBR files (effective LAME 3.94), with \"Info\" instead of \"XING\" near the beginning.\n */",
"export",
"interface",
"IExtendedLameHeader",
"{",
"revision",
":",
"number",
";",
"vbr_method",
":",
"number",
";",
"lowpass_filter",
":",
"number",
";",
"track_peak",
"?",
":",
"number",
";",
"track_gain",
":",
"IReplayGain",
";",
"album_gain",
":",
"IReplayGain",
";",
"music_length",
":",
"number",
";",
"music_crc",
":",
"number",
";",
"header_crc",
":",
"number",
";",
"}",
"link",
"link",
"export",
"const",
"ExtendedLameHeader",
"=",
"{",
"len",
":",
"27",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"const",
"track_peak",
"=",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"2",
")",
";",
"return",
"{",
"revision",
":",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"0",
",",
"4",
")",
",",
"vbr_method",
":",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"4",
",",
"4",
")",
",",
"lowpass_filter",
":",
"100",
"*",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"1",
")",
",",
"track_peak",
":",
"track_peak",
"===",
"0",
"?",
"undefined",
":",
"track_peak",
"/",
"Math",
".",
"pow",
"(",
"2",
",",
"23",
")",
",",
"track_gain",
":",
"ReplayGain",
".",
"get",
"(",
"buf",
",",
"6",
")",
",",
"album_gain",
":",
"ReplayGain",
".",
"get",
"(",
"buf",
",",
"8",
")",
",",
"music_length",
":",
"Token",
".",
"UINT32_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"music_crc",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
",",
"header_crc",
":",
"Token",
".",
"UINT16_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661834 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
",",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"ExtendedLameHeader",
",",
"IExtendedLameHeader",
"}",
"from",
"'./ExtendedLameHeader'",
";",
"export",
"interface",
"IXingHeaderFlags",
"{",
"frames",
":",
"boolean",
";",
"bytes",
":",
"boolean",
";",
"toc",
":",
"boolean",
";",
"vbrScale",
":",
"boolean",
";",
"}",
"/**\n * Info Tag: Xing, LAME\n */",
"export",
"const",
"InfoTagHeaderTag",
"=",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'ascii'",
")",
";",
"/**\n * LAME TAG value\n * Did not find any official documentation for this\n * Value e.g.: \"3.98.4\"\n */",
"export",
"const",
"LameEncoderVersion",
"=",
"new",
"Token",
".",
"StringType",
"(",
"6",
",",
"'ascii'",
")",
";",
"export",
"interface",
"IXingInfoTag",
"{",
"/**\n * total bit stream frames from Vbr header data\n */",
"numFrames",
"?",
":",
"number",
";",
"/**\n * Actual stream size = file size - header(s) size [bytes]\n */",
"streamSize",
"?",
":",
"number",
";",
"toc",
"?",
":",
"Buffer",
";",
"/**\n * the number of header data bytes (from original file)\n */",
"vbrScale",
"?",
":",
"number",
";",
"lame",
"?",
":",
"{",
"version",
":",
"string",
";",
"extended",
"?",
":",
"IExtendedLameHeader",
";",
"}",
";",
"}",
"/**\n * Info Tag\n * Ref: http://gabriel.mp3-tech.org/mp3infotag.html\n */",
"export",
"const",
"XingHeaderFlags",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"return",
"{",
"frames",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
",",
"31",
")",
",",
"bytes",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
",",
"30",
")",
",",
"toc",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
",",
"29",
")",
",",
"vbrScale",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
",",
"28",
")",
"}",
";",
"}",
"}",
";",
"export",
"async",
"function",
"readXingHeader",
"(",
"tokenizer",
")",
"{",
"const",
"flags",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"XingHeaderFlags",
")",
";",
"const",
"xingInfoTag",
"=",
"{",
"}",
";",
"if",
"(",
"flags",
".",
"frames",
")",
"{",
"xingInfoTag",
".",
"numFrames",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"Token",
".",
"UINT32_BE",
")",
";",
"}",
"if",
"(",
"flags",
".",
"bytes",
")",
"{",
"xingInfoTag",
".",
"streamSize",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"Token",
".",
"UINT32_BE",
")",
";",
"}",
"if",
"(",
"flags",
".",
"toc",
")",
"{",
"xingInfoTag",
".",
"toc",
"=",
"Buffer",
".",
"alloc",
"(",
"100",
")",
";",
"await",
"tokenizer",
".",
"readBuffer",
"(",
"xingInfoTag",
".",
"toc",
")",
";",
"}",
"if",
"(",
"flags",
".",
"vbrScale",
")",
"{",
"xingInfoTag",
".",
"vbrScale",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"Token",
".",
"UINT32_BE",
")",
";",
"}",
"const",
"lameTag",
"=",
"await",
"tokenizer",
".",
"peekToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'ascii'",
")",
")",
";",
"if",
"(",
"lameTag",
"===",
"'LAME'",
")",
"{",
"await",
"tokenizer",
".",
"ignore",
"(",
"4",
")",
";",
"xingInfoTag",
".",
"lame",
"=",
"{",
"version",
":",
"await",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"5",
",",
"'ascii'",
")",
")",
"}",
";",
"const",
"match",
"=",
"xingInfoTag",
".",
"lame",
".",
"version",
".",
"match",
"(",
"/\\d+.\\d+/g",
")",
";",
"if",
"(",
"match",
")",
"{",
"const",
"majorMinorVersion",
"=",
"xingInfoTag",
".",
"lame",
".",
"version",
".",
"match",
"(",
"/\\d+.\\d+/g",
")",
"[",
"0",
"]",
";",
"const",
"version",
"=",
"majorMinorVersion",
".",
"split",
"(",
"'.'",
")",
".",
"map",
"(",
"n",
"=>",
"parseInt",
"(",
"n",
",",
"10",
")",
")",
";",
"if",
"(",
"version",
"[",
"0",
"]",
">=",
"3",
"&&",
"version",
"[",
"1",
"]",
">=",
"90",
")",
"{",
"xingInfoTag",
".",
"lame",
".",
"extended",
"=",
"await",
"tokenizer",
".",
"readToken",
"(",
"ExtendedLameHeader",
")",
";",
"}",
"}",
"}",
"return",
"xingInfoTag",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8749,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8749,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33704,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
63,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661835 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"EndOfStreamError",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"common",
"from",
"'../common/Util'",
";",
"import",
"{",
"AbstractID3Parser",
"}",
"from",
"'../id3v2/AbstractID3Parser'",
";",
"import",
"{",
"InfoTagHeaderTag",
",",
"IXingInfoTag",
",",
"LameEncoderVersion",
",",
"readXingHeader",
"}",
"from",
"'./XingTag'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:mpeg'",
")",
";",
"/**\n * Cache buffer size used for searching synchronization preabmle\n */",
"const",
"maxPeekLen",
"=",
"1024",
";",
"type",
"MPEG4Channel",
"=",
"'front-center'",
"|",
"'front-left'",
"|",
"'front-right'",
"|",
"'side-left'",
"|",
"'side-right'",
"|",
"'back-left'",
"|",
"'back-right'",
"|",
"'back-center'",
"|",
"'LFE-channel'",
";",
"type",
"MPEG4ChannelConfiguration",
"=",
"MPEG4Channel",
"[",
"]",
";",
"/**\n * MPEG-4 Audio definitions\n * Ref: https://wiki.multimedia.cx/index.php/MPEG-4_Audio\n */",
"const",
"MPEG4",
"=",
"{",
"/**\n * Audio Object Types\n */",
"AudioObjectTypes",
":",
"[",
"'AAC Main'",
",",
"'AAC LC'",
",",
"'AAC SSR'",
",",
"'AAC LTP'",
"]",
",",
"/**\n * Sampling Frequencies\n * https://wiki.multimedia.cx/index.php/MPEG-4_Audio#Sampling_Frequencies\n */",
"SamplingFrequencies",
":",
"[",
"96000",
",",
"88200",
",",
"64000",
",",
"48000",
",",
"44100",
",",
"32000",
",",
"24000",
",",
"22050",
",",
"16000",
",",
"12000",
",",
"11025",
",",
"8000",
",",
"7350",
",",
"undefined",
",",
"undefined",
",",
"-",
"1",
"]",
"}",
";",
"const",
"MPEG4_ChannelConfigurations",
"=",
"[",
"undefined",
",",
"[",
"'front-center'",
"]",
",",
"[",
"'front-left'",
",",
"'front-right'",
"]",
",",
"[",
"'front-center'",
",",
"'front-left'",
",",
"'front-right'",
"]",
",",
"[",
"'front-center'",
",",
"'front-left'",
",",
"'front-right'",
",",
"'back-center'",
"]",
",",
"[",
"'front-center'",
",",
"'front-left'",
",",
"'front-right'",
",",
"'back-left'",
",",
"'back-right'",
"]",
",",
"[",
"'front-center'",
",",
"'front-left'",
",",
"'front-right'",
",",
"'back-left'",
",",
"'back-right'",
",",
"'LFE-channel'",
"]",
",",
"[",
"'front-center'",
",",
"'front-left'",
",",
"'front-right'",
",",
"'side-left'",
",",
"'side-right'",
",",
"'back-left'",
",",
"'back-right'",
",",
"'LFE-channel'",
"]",
"]",
";",
"/**\n * MPEG Audio Layer I/II/III frame header\n * Ref: https://www.mp3-tech.org/programmer/frame_header.html\n * Bit layout: AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM\n * Ref: https://wiki.multimedia.cx/index.php/ADTS\n */",
"class",
"MpegFrameHeader",
"{",
"public",
"static",
"SyncByte1",
"=",
"0xFF",
";",
"public",
"static",
"SyncByte2",
"=",
"0xE0",
";",
"public",
"static",
"VersionID",
"=",
"[",
"2.5",
",",
"null",
",",
"2",
",",
"1",
"]",
";",
"public",
"static",
"LayerDescription",
"=",
"[",
"0",
",",
"3",
",",
"2",
",",
"1",
"]",
";",
"public",
"static",
"ChannelMode",
"=",
"[",
"'stereo'",
",",
"'joint_stereo'",
",",
"'dual_channel'",
",",
"'mono'",
"]",
";",
"private",
"static",
"bitrate_index",
"=",
"{",
"0x01",
":",
"{",
"11",
":",
"32",
",",
"12",
":",
"32",
",",
"13",
":",
"32",
",",
"21",
":",
"32",
",",
"22",
":",
"8",
",",
"23",
":",
"8",
"}",
",",
"0x02",
":",
"{",
"11",
":",
"64",
",",
"12",
":",
"48",
",",
"13",
":",
"40",
",",
"21",
":",
"48",
",",
"22",
":",
"16",
",",
"23",
":",
"16",
"}",
",",
"0x03",
":",
"{",
"11",
":",
"96",
",",
"12",
":",
"56",
",",
"13",
":",
"48",
",",
"21",
":",
"56",
",",
"22",
":",
"24",
",",
"23",
":",
"24",
"}",
",",
"0x04",
":",
"{",
"11",
":",
"128",
",",
"12",
":",
"64",
",",
"13",
":",
"56",
",",
"21",
":",
"64",
",",
"22",
":",
"32",
",",
"23",
":",
"32",
"}",
",",
"0x05",
":",
"{",
"11",
":",
"160",
",",
"12",
":",
"80",
",",
"13",
":",
"64",
",",
"21",
":",
"80",
",",
"22",
":",
"40",
",",
"23",
":",
"40",
"}",
",",
"0x06",
":",
"{",
"11",
":",
"192",
",",
"12",
":",
"96",
",",
"13",
":",
"80",
",",
"21",
":",
"96",
",",
"22",
":",
"48",
",",
"23",
":",
"48",
"}",
",",
"0x07",
":",
"{",
"11",
":",
"224",
",",
"12",
":",
"112",
",",
"13",
":",
"96",
",",
"21",
":",
"112",
",",
"22",
":",
"56",
",",
"23",
":",
"56",
"}",
",",
"0x08",
":",
"{",
"11",
":",
"256",
",",
"12",
":",
"128",
",",
"13",
":",
"112",
",",
"21",
":",
"128",
",",
"22",
":",
"64",
",",
"23",
":",
"64",
"}",
",",
"0x09",
":",
"{",
"11",
":",
"288",
",",
"12",
":",
"160",
",",
"13",
":",
"128",
",",
"21",
":",
"144",
",",
"22",
":",
"80",
",",
"23",
":",
"80",
"}",
",",
"0x0A",
":",
"{",
"11",
":",
"320",
",",
"12",
":",
"192",
",",
"13",
":",
"160",
",",
"21",
":",
"160",
",",
"22",
":",
"96",
",",
"23",
":",
"96",
"}",
",",
"0x0B",
":",
"{",
"11",
":",
"352",
",",
"12",
":",
"224",
",",
"13",
":",
"192",
",",
"21",
":",
"176",
",",
"22",
":",
"112",
",",
"23",
":",
"112",
"}",
",",
"0x0C",
":",
"{",
"11",
":",
"384",
",",
"12",
":",
"256",
",",
"13",
":",
"224",
",",
"21",
":",
"192",
",",
"22",
":",
"128",
",",
"23",
":",
"128",
"}",
",",
"0x0D",
":",
"{",
"11",
":",
"416",
",",
"12",
":",
"320",
",",
"13",
":",
"256",
",",
"21",
":",
"224",
",",
"22",
":",
"144",
",",
"23",
":",
"144",
"}",
",",
"0x0E",
":",
"{",
"11",
":",
"448",
",",
"12",
":",
"384",
",",
"13",
":",
"320",
",",
"21",
":",
"256",
",",
"22",
":",
"160",
",",
"23",
":",
"160",
"}",
"}",
";",
"private",
"static",
"sampling_rate_freq_index",
"=",
"{",
"1",
":",
"{",
"0x00",
":",
"44100",
",",
"0x01",
":",
"48000",
",",
"0x02",
":",
"32000",
"}",
",",
"2",
":",
"{",
"0x00",
":",
"22050",
",",
"0x01",
":",
"24000",
",",
"0x02",
":",
"16000",
"}",
",",
"2.5",
":",
"{",
"0x00",
":",
"11025",
",",
"0x01",
":",
"12000",
",",
"0x02",
":",
"8000",
"}",
"}",
";",
"private",
"static",
"samplesInFrameTable",
"=",
"[",
"[",
"0",
",",
"384",
",",
"1152",
",",
"1152",
"]",
",",
"[",
"0",
",",
"384",
",",
"1152",
",",
"576",
"]",
"]",
";",
"public",
"versionIndex",
":",
"number",
";",
"public",
"layer",
":",
"number",
";",
"public",
"isProtectedByCRC",
":",
"boolean",
";",
"public",
"bitrateIndex",
":",
"number",
";",
"public",
"sampRateFreqIndex",
":",
"number",
";",
"public",
"padding",
":",
"boolean",
";",
"public",
"privateBit",
":",
"boolean",
";",
"public",
"channelModeIndex",
":",
"number",
";",
"public",
"modeExtension",
":",
"number",
";",
"public",
"isCopyrighted",
":",
"boolean",
";",
"public",
"isOriginalMedia",
":",
"boolean",
";",
"public",
"emphasis",
":",
"number",
";",
"public",
"version",
":",
"number",
";",
"public",
"channelMode",
":",
"string",
";",
"public",
"bitrate",
":",
"number",
";",
"public",
"samplingRate",
":",
"number",
";",
"public",
"container",
":",
"string",
";",
"public",
"codec",
":",
"string",
";",
"public",
"codecProfile",
":",
"string",
";",
"public",
"frameLength",
":",
"number",
";",
"public",
"mp4ChannelConfig",
":",
"MPEG4ChannelConfiguration",
";",
"public",
"constructor",
"(",
"buf",
",",
"off",
")",
"{",
"this",
".",
"versionIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"3",
",",
"2",
")",
";",
"this",
".",
"layer",
"=",
"MpegFrameHeader",
".",
"LayerDescription",
"[",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"5",
",",
"2",
")",
"]",
";",
"if",
"(",
"this",
".",
"versionIndex",
">",
"1",
"&&",
"this",
".",
"layer",
"===",
"0",
")",
"{",
"this",
".",
"parseAdtsHeader",
"(",
"buf",
",",
"off",
")",
";",
"}",
"else",
"{",
"this",
".",
"parseMpegHeader",
"(",
"buf",
",",
"off",
")",
";",
"}",
"this",
".",
"isProtectedByCRC",
"=",
"!",
"common",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"7",
")",
";",
"}",
"public",
"calcDuration",
"(",
"numFrames",
")",
"{",
"return",
"numFrames",
"*",
"this",
".",
"calcSamplesPerFrame",
"(",
")",
"/",
"this",
".",
"samplingRate",
";",
"}",
"public",
"calcSamplesPerFrame",
"(",
")",
"{",
"return",
"MpegFrameHeader",
".",
"samplesInFrameTable",
"[",
"this",
".",
"version",
"===",
"1",
"?",
"0",
":",
"1",
"]",
"[",
"this",
".",
"layer",
"]",
";",
"}",
"public",
"calculateSideInfoLength",
"(",
")",
"{",
"if",
"(",
"this",
".",
"layer",
"!==",
"3",
")",
"return",
"2",
";",
"if",
"(",
"this",
".",
"channelModeIndex",
"===",
"3",
")",
"{",
"if",
"(",
"this",
".",
"version",
"===",
"1",
")",
"{",
"return",
"17",
";",
"}",
"else",
"if",
"(",
"this",
".",
"version",
"===",
"2",
"||",
"this",
".",
"version",
"===",
"2.5",
")",
"{",
"return",
"9",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"version",
"===",
"1",
")",
"{",
"return",
"32",
";",
"}",
"else",
"if",
"(",
"this",
".",
"version",
"===",
"2",
"||",
"this",
".",
"version",
"===",
"2.5",
")",
"{",
"return",
"17",
";",
"}",
"}",
"}",
"public",
"calcSlotSize",
"(",
")",
"{",
"return",
"[",
"null",
",",
"4",
",",
"1",
",",
"1",
"]",
"[",
"this",
".",
"layer",
"]",
";",
"}",
"private",
"parseMpegHeader",
"(",
"buf",
",",
"off",
")",
"{",
"this",
".",
"container",
"=",
"'MPEG'",
";",
"this",
".",
"bitrateIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"0",
",",
"4",
")",
";",
"this",
".",
"sampRateFreqIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"4",
",",
"2",
")",
";",
"this",
".",
"padding",
"=",
"common",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"6",
")",
";",
"this",
".",
"privateBit",
"=",
"common",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"7",
")",
";",
"this",
".",
"channelModeIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"0",
",",
"2",
")",
";",
"this",
".",
"modeExtension",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"2",
",",
"2",
")",
";",
"this",
".",
"isCopyrighted",
"=",
"common",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"4",
")",
";",
"this",
".",
"isOriginalMedia",
"=",
"common",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"5",
")",
";",
"this",
".",
"emphasis",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"7",
",",
"2",
")",
";",
"this",
".",
"version",
"=",
"MpegFrameHeader",
".",
"VersionID",
"[",
"this",
".",
"versionIndex",
"]",
";",
"this",
".",
"channelMode",
"=",
"MpegFrameHeader",
".",
"ChannelMode",
"[",
"this",
".",
"channelModeIndex",
"]",
";",
"this",
".",
"codec",
"=",
"`MPEG ${",
"this",
".",
"version",
"} Layer ${",
"this",
".",
"layer",
"}`",
";",
"const",
"bitrateInKbps",
"=",
"this",
".",
"calcBitrate",
"(",
")",
";",
"if",
"(",
"!",
"bitrateInKbps",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Cannot determine bit-rate'",
")",
";",
"}",
"this",
".",
"bitrate",
"=",
"bitrateInKbps",
"*",
"1000",
";",
"this",
".",
"samplingRate",
"=",
"this",
".",
"calcSamplingRate",
"(",
")",
";",
"if",
"(",
"this",
".",
"samplingRate",
"==",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Cannot determine sampling-rate'",
")",
";",
"}",
"}",
"private",
"parseAdtsHeader",
"(",
"buf",
",",
"off",
")",
"{",
"debug",
"(",
"`layer=0 => ADTS`",
")",
";",
"this",
".",
"version",
"=",
"this",
".",
"versionIndex",
"===",
"2",
"?",
"4",
":",
"2",
";",
"this",
".",
"container",
"=",
"'ADTS/MPEG-'",
"+",
"this",
".",
"version",
";",
"const",
"profileIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"0",
",",
"2",
")",
";",
"this",
".",
"codec",
"=",
"'AAC'",
";",
"this",
".",
"codecProfile",
"=",
"MPEG4",
".",
"AudioObjectTypes",
"[",
"profileIndex",
"]",
";",
"debug",
"(",
"`MPEG-4 audio-codec=${",
"this",
".",
"codec",
"}`",
")",
";",
"const",
"samplingFrequencyIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"2",
",",
"4",
")",
";",
"this",
".",
"samplingRate",
"=",
"MPEG4",
".",
"SamplingFrequencies",
"[",
"samplingFrequencyIndex",
"]",
";",
"debug",
"(",
"`sampling-rate=${",
"this",
".",
"samplingRate",
"}`",
")",
";",
"const",
"channelIndex",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"2",
",",
"7",
",",
"3",
")",
";",
"this",
".",
"mp4ChannelConfig",
"=",
"MPEG4_ChannelConfigurations",
"[",
"channelIndex",
"]",
";",
"debug",
"(",
"`channel-config=${",
"this",
".",
"mp4ChannelConfig",
".",
"join",
"(",
"'+'",
")",
"}`",
")",
";",
"this",
".",
"frameLength",
"=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"6",
",",
"2",
")",
"<<",
"11",
";",
"}",
"private",
"calcBitrate",
"(",
")",
"{",
"if",
"(",
"this",
".",
"bitrateIndex",
"===",
"0x00",
"||",
"this",
".",
"bitrateIndex",
"===",
"0x0F",
")",
"{",
"return",
";",
"}",
"const",
"codecIndex",
"=",
"`${",
"Math",
".",
"floor",
"(",
"this",
".",
"version",
")",
"}${",
"this",
".",
"layer",
"}`",
";",
"return",
"MpegFrameHeader",
".",
"bitrate_index",
"[",
"this",
".",
"bitrateIndex",
"]",
"[",
"codecIndex",
"]",
";",
"}",
"private",
"calcSamplingRate",
"(",
")",
"{",
"if",
"(",
"this",
".",
"sampRateFreqIndex",
"===",
"0x03",
")",
"return",
"null",
";",
"return",
"MpegFrameHeader",
".",
"sampling_rate_freq_index",
"[",
"this",
".",
"version",
"]",
"[",
"this",
".",
"sampRateFreqIndex",
"]",
";",
"}",
"}",
"/**\n * MPEG Audio Layer I/II/III\n */",
"const",
"FrameHeader",
"=",
"{",
"len",
":",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"MpegFrameHeader",
"=>",
"{",
"return",
"new",
"MpegFrameHeader",
"(",
"buf",
",",
"off",
")",
";",
"}",
"}",
";",
"function",
"getVbrCodecProfile",
"(",
"vbrScale",
")",
"{",
"return",
"'V'",
"+",
"Math",
".",
"floor",
"(",
"(",
"100",
"-",
"vbrScale",
")",
"/",
"10",
")",
";",
"}",
"export",
"class",
"MpegParser",
"extends",
"AbstractID3Parser",
"{",
"private",
"frameCount",
":",
"number",
"=",
"0",
";",
"private",
"syncFrameCount",
":",
"number",
"=",
"-",
"1",
";",
"private",
"countSkipFrameData",
":",
"number",
"=",
"0",
";",
"private",
"totalDataLength",
"=",
"0",
";",
"private",
"audioFrameHeader",
";",
"private",
"bitrates",
":",
"number",
"[",
"]",
"=",
"[",
"]",
";",
"private",
"offset",
":",
"number",
";",
"private",
"frame_size",
";",
"private",
"crc",
":",
"number",
";",
"private",
"calculateEofDuration",
":",
"boolean",
"=",
"false",
";",
"private",
"samplesPerFrame",
";",
"private",
"buf_frame_header",
"=",
"Buffer",
".",
"alloc",
"(",
"4",
")",
";",
"/**\n * Number of bytes already parsed since beginning of stream / file\n */",
"private",
"mpegOffset",
":",
"number",
";",
"private",
"syncPeek",
"=",
"{",
"buf",
":",
"Buffer",
".",
"alloc",
"(",
"maxPeekLen",
")",
",",
"len",
":",
"0",
"}",
";",
"/**\n * Called after ID3 headers have been parsed\n */",
"public",
"async",
"_parse",
"(",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"false",
")",
";",
"try",
"{",
"let",
"quit",
"=",
"false",
";",
"while",
"(",
"!",
"quit",
")",
"{",
"await",
"this",
".",
"sync",
"(",
")",
";",
"quit",
"=",
"await",
"this",
".",
"parseCommonMpegHeader",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"instanceof",
"EndOfStreamError",
")",
"{",
"debug",
"(",
"`End-of-stream`",
")",
";",
"if",
"(",
"this",
".",
"calculateEofDuration",
")",
"{",
"const",
"numberOfSamples",
"=",
"this",
".",
"frameCount",
"*",
"this",
".",
"samplesPerFrame",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"numberOfSamples",
")",
";",
"const",
"duration",
"=",
"numberOfSamples",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
";",
"debug",
"(",
"`Calculate duration at EOF: ${",
"duration",
"} sec.`",
",",
"duration",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"duration",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"/**\n * Called after file has been fully parsed, this allows, if present, to exclude the ID3v1.1 header length\n */",
"protected",
"finalize",
"(",
")",
"{",
"const",
"format",
"=",
"this",
".",
"metadata",
".",
"format",
";",
"const",
"hasID3v1",
"=",
"this",
".",
"metadata",
".",
"native",
".",
"hasOwnProperty",
"(",
"'ID3v1'",
")",
";",
"if",
"(",
"format",
".",
"duration",
"&&",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
")",
"{",
"const",
"mpegSize",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"mpegOffset",
"-",
"(",
"hasID3v1",
"?",
"128",
":",
"0",
")",
";",
"if",
"(",
"format",
".",
"codecProfile",
"&&",
"format",
".",
"codecProfile",
"[",
"0",
"]",
"===",
"'V'",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"mpegSize",
"*",
"8",
"/",
"format",
".",
"duration",
")",
";",
"}",
"}",
"else",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"&&",
"format",
".",
"codecProfile",
"===",
"'CBR'",
")",
"{",
"const",
"mpegSize",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"mpegOffset",
"-",
"(",
"hasID3v1",
"?",
"128",
":",
"0",
")",
";",
"const",
"numberOfSamples",
"=",
"Math",
".",
"round",
"(",
"mpegSize",
"/",
"this",
".",
"frame_size",
")",
"*",
"this",
".",
"samplesPerFrame",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"numberOfSamples",
")",
";",
"const",
"duration",
"=",
"numberOfSamples",
"/",
"format",
".",
"sampleRate",
";",
"debug",
"(",
"\"Calculate CBR duration based on file size: %s\"",
",",
"duration",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"duration",
")",
";",
"}",
"}",
"private",
"async",
"sync",
"(",
")",
"{",
"let",
"gotFirstSync",
"=",
"false",
";",
"while",
"(",
"true",
")",
"{",
"let",
"bo",
"=",
"0",
";",
"this",
".",
"syncPeek",
".",
"len",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekBuffer",
"(",
"this",
".",
"syncPeek",
".",
"buf",
",",
"{",
"length",
":",
"maxPeekLen",
",",
"mayBeLess",
":",
"true",
"}",
")",
";",
"if",
"(",
"this",
".",
"syncPeek",
".",
"len",
"<=",
"163",
")",
"{",
"throw",
"new",
"EndOfStreamError",
"(",
")",
";",
"}",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"gotFirstSync",
"&&",
"(",
"this",
".",
"syncPeek",
".",
"buf",
"[",
"bo",
"]",
"&",
"0xE0",
")",
"===",
"0xE0",
")",
"{",
"this",
".",
"buf_frame_header",
"[",
"0",
"]",
"=",
"MpegFrameHeader",
".",
"SyncByte1",
";",
"this",
".",
"buf_frame_header",
"[",
"1",
"]",
"=",
"this",
".",
"syncPeek",
".",
"buf",
"[",
"bo",
"]",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"bo",
")",
";",
"debug",
"(",
"`Sync at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"-",
"1",
"}, frameCount=${",
"this",
".",
"frameCount",
"}`",
")",
";",
"if",
"(",
"this",
".",
"syncFrameCount",
"===",
"this",
".",
"frameCount",
")",
"{",
"debug",
"(",
"`Re-synced MPEG stream, frameCount=${",
"this",
".",
"frameCount",
"}`",
")",
";",
"this",
".",
"frameCount",
"=",
"0",
";",
"this",
".",
"frame_size",
"=",
"0",
";",
"}",
"this",
".",
"syncFrameCount",
"=",
"this",
".",
"frameCount",
";",
"return",
";",
"}",
"else",
"{",
"gotFirstSync",
"=",
"false",
";",
"bo",
"=",
"this",
".",
"syncPeek",
".",
"buf",
".",
"indexOf",
"(",
"MpegFrameHeader",
".",
"SyncByte1",
",",
"bo",
")",
";",
"if",
"(",
"bo",
"===",
"-",
"1",
")",
"{",
"if",
"(",
"this",
".",
"syncPeek",
".",
"len",
"<",
"this",
".",
"syncPeek",
".",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"EndOfStreamError",
"(",
")",
";",
"}",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"this",
".",
"syncPeek",
".",
"len",
")",
";",
"break",
";",
"}",
"else",
"{",
"++",
"bo",
";",
"gotFirstSync",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"{",
"Promise",
"<",
"boolean",
">",
"}",
"private",
"async",
"parseCommonMpegHeader",
"(",
")",
"{",
"if",
"(",
"this",
".",
"frameCount",
"===",
"0",
")",
"{",
"this",
".",
"mpegOffset",
"=",
"this",
".",
"tokenizer",
".",
"position",
"-",
"1",
";",
"}",
"await",
"this",
".",
"tokenizer",
".",
"peekBuffer",
"(",
"this",
".",
"buf_frame_header",
",",
"{",
"offset",
":",
"1",
",",
"length",
":",
"3",
"}",
")",
";",
"let",
"header",
";",
"try",
"{",
"header",
"=",
"FrameHeader",
".",
"get",
"(",
"this",
".",
"buf_frame_header",
",",
"0",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"1",
")",
";",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Parse error: '",
"+",
"err",
".",
"message",
")",
";",
"return",
"false",
";",
"}",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"3",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"header",
".",
"container",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"header",
".",
"codec",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"false",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"header",
".",
"samplingRate",
")",
";",
"this",
".",
"frameCount",
"++",
";",
"if",
"(",
"header",
".",
"version",
">=",
"2",
"&&",
"header",
".",
"layer",
"===",
"0",
")",
"{",
"return",
"this",
".",
"parseAdts",
"(",
"header",
")",
";",
"}",
"else",
"{",
"return",
"this",
".",
"parseAudioFrameHeader",
"(",
"header",
")",
";",
"}",
"}",
"return",
"{",
"Promise",
"<",
"boolean",
">",
"}",
"private",
"async",
"parseAudioFrameHeader",
"(",
"header",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"header",
".",
"channelMode",
"===",
"'mono'",
"?",
"1",
":",
"2",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"header",
".",
"bitrate",
")",
";",
"if",
"(",
"this",
".",
"frameCount",
"<",
"20",
"*",
"10000",
")",
"{",
"debug",
"(",
"'offset=%s MP%s bitrate=%s sample-rate=%s'",
",",
"this",
".",
"tokenizer",
".",
"position",
"-",
"4",
",",
"header",
".",
"layer",
",",
"header",
".",
"bitrate",
",",
"header",
".",
"samplingRate",
")",
";",
"}",
"const",
"slot_size",
"=",
"header",
".",
"calcSlotSize",
"(",
")",
";",
"if",
"(",
"slot_size",
"===",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'invalid slot_size'",
")",
";",
"}",
"const",
"samples_per_frame",
"=",
"header",
".",
"calcSamplesPerFrame",
"(",
")",
";",
"debug",
"(",
"`samples_per_frame=${",
"samples_per_frame",
"}`",
")",
";",
"const",
"bps",
"=",
"samples_per_frame",
"/",
"8.0",
";",
"const",
"fsize",
"=",
"(",
"bps",
"*",
"header",
".",
"bitrate",
"/",
"header",
".",
"samplingRate",
")",
"+",
"(",
"(",
"header",
".",
"padding",
")",
"?",
"slot_size",
":",
"0",
")",
";",
"this",
".",
"frame_size",
"=",
"Math",
".",
"floor",
"(",
"fsize",
")",
";",
"this",
".",
"audioFrameHeader",
"=",
"header",
";",
"this",
".",
"bitrates",
".",
"push",
"(",
"header",
".",
"bitrate",
")",
";",
"if",
"(",
"this",
".",
"frameCount",
"===",
"1",
")",
"{",
"this",
".",
"offset",
"=",
"FrameHeader",
".",
"len",
";",
"await",
"this",
".",
"skipSideInformation",
"(",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"frameCount",
"===",
"3",
")",
"{",
"if",
"(",
"this",
".",
"areAllSame",
"(",
"this",
".",
"bitrates",
")",
")",
"{",
"this",
".",
"samplesPerFrame",
"=",
"samples_per_frame",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codecProfile'",
",",
"'CBR'",
")",
";",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
")",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"this",
".",
"options",
".",
"duration",
")",
"{",
"return",
"true",
";",
"}",
"}",
"if",
"(",
"this",
".",
"options",
".",
"duration",
"&&",
"this",
".",
"frameCount",
"===",
"4",
")",
"{",
"this",
".",
"samplesPerFrame",
"=",
"samples_per_frame",
";",
"this",
".",
"calculateEofDuration",
"=",
"true",
";",
"}",
"this",
".",
"offset",
"=",
"4",
";",
"if",
"(",
"header",
".",
"isProtectedByCRC",
")",
"{",
"await",
"this",
".",
"parseCrc",
"(",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"await",
"this",
".",
"skipSideInformation",
"(",
")",
";",
"return",
"false",
";",
"}",
"}",
"private",
"async",
"parseAdts",
"(",
"header",
")",
"{",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"3",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"buf",
")",
";",
"header",
".",
"frameLength",
"+=",
"common",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"0",
",",
"0",
",",
"11",
")",
";",
"this",
".",
"totalDataLength",
"+=",
"header",
".",
"frameLength",
";",
"this",
".",
"samplesPerFrame",
"=",
"1024",
";",
"const",
"framesPerSec",
"=",
"header",
".",
"samplingRate",
"/",
"this",
".",
"samplesPerFrame",
";",
"const",
"bytesPerFrame",
"=",
"this",
".",
"frameCount",
"===",
"0",
"?",
"0",
":",
"this",
".",
"totalDataLength",
"/",
"this",
".",
"frameCount",
";",
"const",
"bitrate",
"=",
"8",
"*",
"bytesPerFrame",
"*",
"framesPerSec",
"+",
"0.5",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"bitrate",
")",
";",
"debug",
"(",
"`frame-count=${",
"this",
".",
"frameCount",
"}, size=${",
"header",
".",
"frameLength",
"} bytes, bit-rate=${",
"bitrate",
"}`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"frameLength",
">",
"7",
"?",
"header",
".",
"frameLength",
"-",
"7",
":",
"1",
")",
";",
"if",
"(",
"this",
".",
"frameCount",
"===",
"3",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codecProfile'",
",",
"header",
".",
"codecProfile",
")",
";",
"if",
"(",
"header",
".",
"mp4ChannelConfig",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"header",
".",
"mp4ChannelConfig",
".",
"length",
")",
";",
"}",
"if",
"(",
"this",
".",
"options",
".",
"duration",
")",
"{",
"this",
".",
"calculateEofDuration",
"=",
"true",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"async",
"parseCrc",
"(",
")",
"{",
"this",
".",
"crc",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"INT16_BE",
")",
";",
"this",
".",
"offset",
"+=",
"2",
";",
"return",
"this",
".",
"skipSideInformation",
"(",
")",
";",
"}",
"private",
"async",
"skipSideInformation",
"(",
")",
"{",
"const",
"sideinfo_length",
"=",
"this",
".",
"audioFrameHeader",
".",
"calculateSideInfoLength",
"(",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"sideinfo_length",
")",
")",
";",
"this",
".",
"offset",
"+=",
"sideinfo_length",
";",
"await",
"this",
".",
"readXtraInfoHeader",
"(",
")",
";",
"return",
";",
"}",
"private",
"async",
"readXtraInfoHeader",
"(",
")",
"{",
"const",
"headerTag",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"InfoTagHeaderTag",
")",
";",
"this",
".",
"offset",
"+=",
"InfoTagHeaderTag",
".",
"len",
";",
"switch",
"(",
"headerTag",
")",
"{",
"case",
"'Info'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codecProfile'",
",",
"'CBR'",
")",
";",
"return",
"this",
".",
"readXingInfoHeader",
"(",
")",
";",
"case",
"'Xing'",
":",
"const",
"infoTag",
"=",
"await",
"this",
".",
"readXingInfoHeader",
"(",
")",
";",
"const",
"codecProfile",
"=",
"getVbrCodecProfile",
"(",
"infoTag",
".",
"vbrScale",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codecProfile'",
",",
"codecProfile",
")",
";",
"return",
"null",
";",
"case",
"'Xtra'",
":",
"break",
";",
"case",
"'LAME'",
":",
"const",
"version",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"LameEncoderVersion",
")",
";",
"if",
"(",
"this",
".",
"frame_size",
">=",
"this",
".",
"offset",
"+",
"LameEncoderVersion",
".",
"len",
")",
"{",
"this",
".",
"offset",
"+=",
"LameEncoderVersion",
".",
"len",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'tool'",
",",
"'LAME '",
"+",
"version",
")",
";",
"await",
"this",
".",
"skipFrameData",
"(",
"this",
".",
"frame_size",
"-",
"this",
".",
"offset",
")",
";",
"return",
"null",
";",
"}",
"else",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Corrupt LAME header'",
")",
";",
"break",
";",
"}",
"}",
"const",
"frameDataLeft",
"=",
"this",
".",
"frame_size",
"-",
"this",
".",
"offset",
";",
"if",
"(",
"frameDataLeft",
"<",
"0",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Frame '",
"+",
"this",
".",
"frameCount",
"+",
"'corrupt: negative frameDataLeft'",
")",
";",
"}",
"else",
"{",
"await",
"this",
".",
"skipFrameData",
"(",
"frameDataLeft",
")",
";",
"}",
"return",
"null",
";",
"}",
"returns",
"{",
"Promise",
"<",
"string",
">",
"}",
"private",
"async",
"readXingInfoHeader",
"(",
")",
"{",
"const",
"_offset",
"=",
"this",
".",
"tokenizer",
".",
"position",
";",
"const",
"infoTag",
"=",
"await",
"readXingHeader",
"(",
"this",
".",
"tokenizer",
")",
";",
"this",
".",
"offset",
"+=",
"this",
".",
"tokenizer",
".",
"position",
"-",
"_offset",
";",
"if",
"(",
"infoTag",
".",
"lame",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'tool'",
",",
"'LAME '",
"+",
"common",
".",
"stripNulls",
"(",
"infoTag",
".",
"lame",
".",
"version",
")",
")",
";",
"if",
"(",
"infoTag",
".",
"lame",
".",
"extended",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'trackPeakLevel'",
",",
"infoTag",
".",
"lame",
".",
"extended",
".",
"track_peak",
")",
";",
"if",
"(",
"infoTag",
".",
"lame",
".",
"extended",
".",
"track_gain",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'trackGain'",
",",
"infoTag",
".",
"lame",
".",
"extended",
".",
"track_gain",
".",
"adjustment",
")",
";",
"}",
"if",
"(",
"infoTag",
".",
"lame",
".",
"extended",
".",
"album_gain",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'albumGain'",
",",
"infoTag",
".",
"lame",
".",
"extended",
".",
"album_gain",
".",
"adjustment",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"infoTag",
".",
"lame",
".",
"extended",
".",
"music_length",
"/",
"1000",
")",
";",
"}",
"}",
"if",
"(",
"infoTag",
".",
"streamSize",
")",
"{",
"const",
"duration",
"=",
"this",
".",
"audioFrameHeader",
".",
"calcDuration",
"(",
"infoTag",
".",
"numFrames",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"duration",
")",
";",
"debug",
"(",
"'Get duration from Xing header: %s'",
",",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"return",
"infoTag",
";",
"}",
"const",
"frameDataLeft",
"=",
"this",
".",
"frame_size",
"-",
"this",
".",
"offset",
";",
"await",
"this",
".",
"skipFrameData",
"(",
"frameDataLeft",
")",
";",
"return",
"infoTag",
";",
"}",
"private",
"async",
"skipFrameData",
"(",
"frameDataLeft",
")",
"{",
"if",
"(",
"frameDataLeft",
"<",
"0",
")",
"throw",
"new",
"Error",
"(",
"'frame-data-left cannot be negative'",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"frameDataLeft",
")",
";",
"this",
".",
"countSkipFrameData",
"+=",
"frameDataLeft",
";",
"}",
"private",
"areAllSame",
"(",
"array",
")",
"{",
"const",
"first",
"=",
"array",
"[",
"0",
"]",
";",
"return",
"array",
".",
"every",
"(",
"element",
"=>",
"{",
"return",
"element",
"===",
"first",
";",
"}",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33705,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
33705,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
33705,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33704,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
33704,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661836 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"ITokenizer",
",",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"util",
"from",
"'../../common/Util'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:musepack:sv8'",
")",
";",
"const",
"PacketKey",
"=",
"new",
"Token",
".",
"StringType",
"(",
"2",
",",
"'binary'",
")",
";",
"interface",
"IVarSize",
"{",
"len",
":",
"number",
";",
"value",
":",
"number",
";",
"}",
"export",
"interface",
"IPacketHeader",
"{",
"key",
":",
"string",
";",
"payloadLength",
":",
"number",
";",
"}",
"/**\n * Stream Header Packet\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */",
"interface",
"IStreamHeader1",
"{",
"crc",
":",
"number",
";",
"streamVersion",
":",
"number",
";",
"}",
"/**\n * Stream Header Packet part 1\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */",
"const",
"SH_part1",
"=",
"{",
"len",
":",
"5",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"return",
"{",
"crc",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"streamVersion",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Stream Header Packet\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */",
"interface",
"IStreamHeader3",
"{",
"sampleFrequency",
":",
"number",
";",
"maxUsedBands",
":",
"number",
";",
"channelCount",
":",
"number",
";",
"msUsed",
":",
"boolean",
";",
"audioBlockFrames",
":",
"number",
";",
"}",
"/**\n * Stream Header Packet part 3\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */",
"const",
"SH_part3",
"=",
"{",
"len",
":",
"2",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"return",
"{",
"sampleFrequency",
":",
"[",
"44100",
",",
"48000",
",",
"37800",
",",
"32000",
"]",
"[",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"0",
",",
"3",
")",
"]",
",",
"maxUsedBands",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
",",
"3",
",",
"5",
")",
",",
"channelCount",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"0",
",",
"4",
")",
"+",
"1",
",",
"msUsed",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"4",
")",
",",
"audioBlockFrames",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"1",
",",
"5",
",",
"3",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Stream Header Packet\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */",
"interface",
"IStreamHeader",
"extends",
"IStreamHeader1",
",",
"IStreamHeader3",
"{",
"sampleCount",
":",
"number",
";",
"beginningOfSilence",
":",
"number",
";",
"}",
"export",
"class",
"StreamReader",
"{",
"public",
"constructor",
"(",
"private",
"tokenizer",
")",
"{",
"}",
"public",
"async",
"readPacketHeader",
"(",
")",
"{",
"const",
"key",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"PacketKey",
")",
";",
"const",
"size",
"=",
"await",
"this",
".",
"readVariableSizeField",
"(",
")",
";",
"return",
"{",
"key",
",",
"payloadLength",
":",
"size",
".",
"value",
"-",
"2",
"-",
"size",
".",
"len",
"}",
";",
"}",
"public",
"async",
"readStreamHeader",
"(",
"size",
")",
"{",
"const",
"streamHeader",
"=",
"{",
"}",
"as",
"any",
";",
"debug",
"(",
"`Reading SH at offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}`",
")",
";",
"const",
"part1",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"SH_part1",
")",
";",
"size",
"-=",
"SH_part1",
".",
"len",
";",
"Object",
".",
"assign",
"(",
"streamHeader",
",",
"part1",
")",
";",
"debug",
"(",
"`SH.streamVersion = ${",
"part1",
".",
"streamVersion",
"}`",
")",
";",
"const",
"sampleCount",
"=",
"await",
"this",
".",
"readVariableSizeField",
"(",
")",
";",
"size",
"-=",
"sampleCount",
".",
"len",
";",
"streamHeader",
".",
"sampleCount",
"=",
"sampleCount",
".",
"value",
";",
"const",
"bs",
"=",
"await",
"this",
".",
"readVariableSizeField",
"(",
")",
";",
"size",
"-=",
"bs",
".",
"len",
";",
"streamHeader",
".",
"beginningOfSilence",
"=",
"bs",
".",
"value",
";",
"const",
"part3",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"SH_part3",
")",
";",
"size",
"-=",
"SH_part3",
".",
"len",
";",
"Object",
".",
"assign",
"(",
"streamHeader",
",",
"part3",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"size",
")",
";",
"return",
"streamHeader",
";",
"}",
"private",
"async",
"readVariableSizeField",
"(",
"len",
"=",
"1",
",",
"hb",
"=",
"0",
")",
"{",
"let",
"n",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"UINT8",
")",
";",
"if",
"(",
"(",
"n",
"&",
"0x80",
")",
"===",
"0",
")",
"{",
"return",
"{",
"len",
",",
"value",
":",
"hb",
"+",
"n",
"}",
";",
"}",
"n",
"&=",
"0x7F",
";",
"n",
"+=",
"hb",
";",
"return",
"this",
".",
"readVariableSizeField",
"(",
"len",
"+",
"1",
",",
"n",
"<<",
"7",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
8749,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4277,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33706,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33706,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
33706,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661837 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../../common/BasicParser'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'../../apev2/APEv2Parser'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../../common/FourCC'",
";",
"import",
"*",
"as",
"SV8",
"from",
"'./StreamVersion8'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:musepack'",
")",
";",
"export",
"class",
"MpcSv8Parser",
"extends",
"BasicParser",
"{",
"private",
"audioLength",
":",
"number",
"=",
"0",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"signature",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"FourCcToken",
")",
";",
"if",
"(",
"signature",
"!==",
"'MPCK'",
")",
"throw",
"new",
"Error",
"(",
"'Invalid Magic number'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'Musepack, SV8'",
")",
";",
"return",
"this",
".",
"parsePacket",
"(",
")",
";",
"}",
"private",
"async",
"parsePacket",
"(",
")",
"{",
"const",
"sv8reader",
"=",
"new",
"SV8",
".",
"StreamReader",
"(",
"this",
".",
"tokenizer",
")",
";",
"do",
"{",
"const",
"header",
"=",
"await",
"sv8reader",
".",
"readPacketHeader",
"(",
")",
";",
"debug",
"(",
"`packet-header key=${",
"header",
".",
"key",
"}, payloadLength=${",
"header",
".",
"payloadLength",
"}`",
")",
";",
"switch",
"(",
"header",
".",
"key",
")",
"{",
"case",
"'SH'",
":",
"const",
"sh",
"=",
"await",
"sv8reader",
".",
"readStreamHeader",
"(",
"header",
".",
"payloadLength",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"sh",
".",
"sampleCount",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"sh",
".",
"sampleFrequency",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"sh",
".",
"sampleCount",
"/",
"sh",
".",
"sampleFrequency",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"sh",
".",
"channelCount",
")",
";",
"break",
";",
"case",
"'AP'",
":",
"this",
".",
"audioLength",
"+=",
"header",
".",
"payloadLength",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"payloadLength",
")",
";",
"break",
";",
"case",
"'RG'",
":",
"case",
"'EI'",
":",
"case",
"'SO'",
":",
"case",
"'ST'",
":",
"case",
"'CT'",
":",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"payloadLength",
")",
";",
"break",
";",
"case",
"'SE'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"this",
".",
"audioLength",
"*",
"8",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"return",
"APEv2Parser",
".",
"tryParseApeHeader",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"`Unexpected header: ${",
"header",
".",
"key",
"}`",
")",
";",
"}",
"}",
"while",
"(",
"true",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
5840,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661838 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"export",
"class",
"BitReader",
"{",
"public",
"pos",
":",
"number",
"=",
"0",
";",
"private",
"dword",
":",
"number",
"=",
"undefined",
";",
"public",
"constructor",
"(",
"private",
"tokenizer",
")",
"{",
"}",
"param",
"bits",
"public",
"async",
"read",
"(",
"bits",
")",
"{",
"while",
"(",
"this",
".",
"dword",
"===",
"undefined",
")",
"{",
"this",
".",
"dword",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"Token",
".",
"UINT32_LE",
")",
";",
"}",
"let",
"out",
"=",
"this",
".",
"dword",
";",
"this",
".",
"pos",
"+=",
"bits",
";",
"if",
"(",
"this",
".",
"pos",
"<",
"32",
")",
"{",
"out",
">>>=",
"(",
"32",
"-",
"this",
".",
"pos",
")",
";",
"return",
"out",
"&",
"(",
"(",
"1",
"<<",
"bits",
")",
"-",
"1",
")",
";",
"}",
"else",
"{",
"this",
".",
"pos",
"-=",
"32",
";",
"if",
"(",
"this",
".",
"pos",
"===",
"0",
")",
"{",
"this",
".",
"dword",
"=",
"undefined",
";",
"return",
"out",
"&",
"(",
"(",
"1",
"<<",
"bits",
")",
"-",
"1",
")",
";",
"}",
"else",
"{",
"this",
".",
"dword",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"Token",
".",
"UINT32_LE",
")",
";",
"if",
"(",
"this",
".",
"pos",
")",
"{",
"out",
"<<=",
"this",
".",
"pos",
";",
"out",
"|=",
"this",
".",
"dword",
">>>",
"(",
"32",
"-",
"this",
".",
"pos",
")",
";",
"}",
"return",
"out",
"&",
"(",
"(",
"1",
"<<",
"bits",
")",
"-",
"1",
")",
";",
"}",
"}",
"}",
"public",
"async",
"ignore",
"(",
"bits",
")",
"{",
"if",
"(",
"this",
".",
"pos",
">",
"0",
")",
"{",
"const",
"remaining",
"=",
"32",
"-",
"this",
".",
"pos",
";",
"this",
".",
"dword",
"=",
"undefined",
";",
"bits",
"-=",
"remaining",
";",
"this",
".",
"pos",
"=",
"0",
";",
"}",
"const",
"remainder",
"=",
"bits",
"%",
"32",
";",
"const",
"numOfWords",
"=",
"(",
"bits",
"-",
"remainder",
")",
"/",
"32",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"numOfWords",
"*",
"4",
")",
";",
"return",
"this",
".",
"read",
"(",
"remainder",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4277,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661839 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../../common/Util'",
";",
"/**\n * MusePack stream version 7 format specification\n * http://trac.musepack.net/musepack/wiki/SV7Specification\n */",
"export",
"interface",
"IHeader",
"{",
"signature",
":",
"string",
";",
"streamMinorVersion",
":",
"number",
";",
"streamMajorVersion",
":",
"number",
";",
"frameCount",
":",
"number",
";",
"intensityStereo",
":",
"boolean",
";",
"midSideStereo",
":",
"boolean",
";",
"maxBand",
":",
"number",
";",
"profile",
":",
"number",
";",
"link",
":",
"number",
";",
"sampleFrequency",
":",
"number",
";",
"maxLevel",
":",
"number",
";",
"titleGain",
":",
"number",
";",
"titlePeak",
":",
"number",
";",
"albumGain",
":",
"number",
";",
"albumPeak",
":",
"number",
";",
"trueGapless",
":",
"boolean",
";",
"lastFrameLength",
":",
"number",
";",
"}",
"/**\n * BASIC STRUCTURE\n */",
"export",
"const",
"Header",
"=",
"{",
"len",
":",
"6",
"*",
"4",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"const",
"header",
"=",
"{",
"signature",
":",
"Buffer",
".",
"from",
"(",
"buf",
")",
".",
"toString",
"(",
"'latin1'",
",",
"off",
",",
"off",
"+",
"3",
")",
",",
"streamMinorVersion",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"0",
",",
"4",
")",
",",
"streamMajorVersion",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"3",
",",
"4",
",",
"4",
")",
",",
"frameCount",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"maxLevel",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"sampleFrequency",
":",
"[",
"44100",
",",
"48000",
",",
"37800",
",",
"32000",
"]",
"[",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"10",
",",
"0",
",",
"2",
")",
"]",
",",
"link",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"10",
",",
"2",
",",
"2",
")",
",",
"profile",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"10",
",",
"4",
",",
"4",
")",
",",
"maxBand",
":",
"util",
".",
"getBitAllignedNumber",
"(",
"buf",
",",
"off",
"+",
"11",
",",
"0",
",",
"6",
")",
",",
"intensityStereo",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"11",
",",
"6",
")",
",",
"midSideStereo",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"11",
",",
"7",
")",
",",
"titlePeak",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"titleGain",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"14",
")",
",",
"albumPeak",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"albumGain",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"18",
")",
",",
"lastFrameLength",
":",
"(",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
">>>",
"20",
")",
"&",
"0x7FF",
",",
"trueGapless",
":",
"util",
".",
"isBitSet",
"(",
"buf",
",",
"off",
"+",
"23",
",",
"0",
")",
"}",
";",
"header",
".",
"lastFrameLength",
"=",
"header",
".",
"trueGapless",
"?",
"(",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"20",
")",
">>>",
"20",
")",
"&",
"0x7FF",
":",
"0",
";",
"return",
"header",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661840 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../../common/BasicParser'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'../../apev2/APEv2Parser'",
";",
"import",
"{",
"BitReader",
"}",
"from",
"'./BitReader'",
";",
"import",
"*",
"as",
"SV7",
"from",
"'./StreamVersion7'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:musepack'",
")",
";",
"export",
"class",
"MpcSv7Parser",
"extends",
"BasicParser",
"{",
"private",
"bitreader",
":",
"BitReader",
";",
"private",
"audioLength",
":",
"number",
"=",
"0",
";",
"private",
"duration",
":",
"number",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"SV7",
".",
"IHeader",
">",
"(",
"SV7",
".",
"Header",
")",
";",
"if",
"(",
"header",
".",
"signature",
"!==",
"'MP+'",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected magic number'",
")",
";",
"debug",
"(",
"`stream-version=${",
"header",
".",
"streamMajorVersion",
"}.${",
"header",
".",
"streamMinorVersion",
"}`",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'Musepack, SV7'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"header",
".",
"sampleFrequency",
")",
";",
"const",
"numberOfSamples",
"=",
"1152",
"*",
"(",
"header",
".",
"frameCount",
"-",
"1",
")",
"+",
"header",
".",
"lastFrameLength",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"numberOfSamples",
")",
";",
"this",
".",
"duration",
"=",
"numberOfSamples",
"/",
"header",
".",
"sampleFrequency",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"this",
".",
"duration",
")",
";",
"this",
".",
"bitreader",
"=",
"new",
"BitReader",
"(",
"this",
".",
"tokenizer",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"header",
".",
"midSideStereo",
"||",
"header",
".",
"intensityStereo",
"?",
"2",
":",
"1",
")",
";",
"const",
"version",
"=",
"await",
"this",
".",
"bitreader",
".",
"read",
"(",
"8",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"(",
"version",
"/",
"100",
")",
".",
"toFixed",
"(",
"2",
")",
")",
";",
"await",
"this",
".",
"skipAudioData",
"(",
"header",
".",
"frameCount",
")",
";",
"debug",
"(",
"`End of audio stream, switching to APEv2, offset=${",
"this",
".",
"tokenizer",
".",
"position",
"}`",
")",
";",
"return",
"APEv2Parser",
".",
"tryParseApeHeader",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"}",
"private",
"async",
"skipAudioData",
"(",
"frameCount",
")",
"{",
"while",
"(",
"frameCount",
"--",
">",
"0",
")",
"{",
"const",
"frameLength",
"=",
"await",
"this",
".",
"bitreader",
".",
"read",
"(",
"20",
")",
";",
"this",
".",
"audioLength",
"+=",
"20",
"+",
"frameLength",
";",
"await",
"this",
".",
"bitreader",
".",
"ignore",
"(",
"frameLength",
")",
";",
"}",
"const",
"lastFrameLength",
"=",
"await",
"this",
".",
"bitreader",
".",
"read",
"(",
"11",
")",
";",
"this",
".",
"audioLength",
"+=",
"lastFrameLength",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"this",
".",
"audioLength",
"/",
"this",
".",
"duration",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661841 | [
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"ITokenParser",
"}",
"from",
"'../ParserFactory'",
";",
"import",
"{",
"AbstractID3Parser",
"}",
"from",
"'../id3v2/AbstractID3Parser'",
";",
"import",
"{",
"MpcSv8Parser",
"}",
"from",
"'./sv8/MpcSv8Parser'",
";",
"import",
"{",
"MpcSv7Parser",
"}",
"from",
"'./sv7/MpcSv7Parser'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:musepack'",
")",
";",
"class",
"MusepackParser",
"extends",
"AbstractID3Parser",
"{",
"public",
"async",
"_parse",
"(",
")",
"{",
"const",
"signature",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"3",
",",
"'binary'",
")",
")",
";",
"let",
"mpcParser",
";",
"switch",
"(",
"signature",
")",
"{",
"case",
"'MP+'",
":",
"{",
"debug",
"(",
"'Musepack stream-version 7'",
")",
";",
"mpcParser",
"=",
"new",
"MpcSv7Parser",
"(",
")",
";",
"break",
";",
"}",
"case",
"'MPC'",
":",
"{",
"debug",
"(",
"'Musepack stream-version 8'",
")",
";",
"mpcParser",
"=",
"new",
"MpcSv8Parser",
"(",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid Musepack signature prefix'",
")",
";",
"}",
"}",
"mpcParser",
".",
"init",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"return",
"mpcParser",
".",
"parse",
"(",
")",
";",
"}",
"}",
"export",
"default",
"MusepackParser",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20348,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661842 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"/**\n * Opus ID Header interface\n * Ref: https://wiki.xiph.org/OggOpus#ID_Header\n */",
"export",
"interface",
"IIdHeader",
"{",
"/**\n * Magic signature: \"OpusHead\" (64 bits)\n */",
"magicSignature",
":",
"string",
";",
"/**\n * Version number (8 bits unsigned): 0x01 for this spec\n */",
"version",
":",
"number",
";",
"/**\n * Channel count 'c' (8 bits unsigned): MUST be > 0\n */",
"channelCount",
":",
"number",
";",
"/**\n * Pre-skip (16 bits unsigned, little endian)\n */",
"preSkip",
":",
"number",
";",
"/**\n * Input sample rate (32 bits unsigned, little endian): informational only\n */",
"inputSampleRate",
":",
"number",
";",
"/**\n * Output gain (16 bits, little endian, signed Q7.8 in dB) to apply when decoding\n */",
"outputGain",
":",
"number",
";",
"/**\n * Channel mapping family (8 bits unsigned)\n * - 0 = one stream: mono or L,R stereo\n * - 1 = channels in vorbis spec order: mono or L,R stereo or ... or FL,C,FR,RL,RR,LFE, ...\n * - 2..254 = reserved (treat as 255)\n * - 255 = no defined channel meaning\n */",
"channelMapping",
":",
"number",
";",
"}",
"/**\n * Opus ID Header parser\n * Ref: https://wiki.xiph.org/OggOpus#ID_Header\n */",
"export",
"class",
"IdHeader",
"implements",
"IGetToken",
"<",
"IIdHeader",
">",
"{",
"constructor",
"(",
"public",
"len",
")",
"{",
"if",
"(",
"len",
"<",
"19",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"ID-header-page 0 should be at least 19 bytes long\"",
")",
";",
"}",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"magicSignature",
":",
"new",
"Token",
".",
"StringType",
"(",
"8",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"version",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"8",
")",
",",
"channelCount",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"9",
")",
",",
"preSkip",
":",
"buf",
".",
"readInt16LE",
"(",
"off",
"+",
"10",
")",
",",
"inputSampleRate",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"12",
")",
",",
"outputGain",
":",
"buf",
".",
"readInt16LE",
"(",
"off",
"+",
"16",
")",
",",
"channelMapping",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"18",
")",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661843 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"IPageHeader",
"}",
"from",
"'../Ogg'",
";",
"import",
"{",
"VorbisParser",
"}",
"from",
"'../vorbis/VorbisParser'",
";",
"import",
"{",
"IOptions",
"}",
"from",
"'../../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../../common/MetadataCollector'",
";",
"import",
"*",
"as",
"Opus",
"from",
"'./Opus'",
";",
"/**\n * Opus parser\n * Internet Engineering Task Force (IETF) - RFC 6716\n * Used by OggParser\n */",
"export",
"class",
"OpusParser",
"extends",
"VorbisParser",
"{",
"private",
"idHeader",
":",
"Opus",
".",
"IIdHeader",
";",
"private",
"lastPos",
":",
"number",
"=",
"-",
"1",
";",
"constructor",
"(",
"metadata",
",",
"options",
",",
"private",
"tokenizer",
")",
"{",
"super",
"(",
"metadata",
",",
"options",
")",
";",
"}",
"param",
"{",
"IPageHeader",
"}",
"header",
"param",
"{",
"Buffer",
"}",
"pageData",
"protected",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"'Opus'",
")",
";",
"this",
".",
"idHeader",
"=",
"new",
"Opus",
".",
"IdHeader",
"(",
"pageData",
".",
"length",
")",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"if",
"(",
"this",
".",
"idHeader",
".",
"magicSignature",
"!==",
"\"OpusHead\"",
")",
"throw",
"new",
"Error",
"(",
"\"Illegal ogg/Opus magic-signature\"",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"this",
".",
"idHeader",
".",
"inputSampleRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"this",
".",
"idHeader",
".",
"channelCount",
")",
";",
"}",
"protected",
"parseFullPage",
"(",
"pageData",
")",
"{",
"const",
"magicSignature",
"=",
"new",
"Token",
".",
"StringType",
"(",
"8",
",",
"'ascii'",
")",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"switch",
"(",
"magicSignature",
")",
"{",
"case",
"'OpusTags'",
":",
"this",
".",
"parseUserCommentList",
"(",
"pageData",
",",
"8",
")",
";",
"this",
".",
"lastPos",
"=",
"this",
".",
"tokenizer",
".",
"position",
"-",
"pageData",
".",
"length",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"public",
"calculateDuration",
"(",
"header",
")",
"{",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
"&&",
"header",
".",
"absoluteGranulePosition",
">=",
"0",
")",
"{",
"const",
"pos_48bit",
"=",
"header",
".",
"absoluteGranulePosition",
"-",
"this",
".",
"idHeader",
".",
"preSkip",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"pos_48bit",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"pos_48bit",
"/",
"48000",
")",
";",
"if",
"(",
"this",
".",
"lastPos",
"!==",
"-",
"1",
"&&",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
"{",
"const",
"dataSize",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"lastPos",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"8",
"*",
"dataSize",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"}",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6865,
null,
630,
null,
null,
4277,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
20349,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
20349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661844 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"util",
"from",
"'../../common/Util'",
";",
"/**\n * Speex Header Packet\n * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000\n */",
"export",
"interface",
"IHeader",
"{",
"/**\n * speex_string, char[] 8\n */",
"speex",
":",
"string",
";",
"/**\n * speex_version, char[] 20\n */",
"version",
":",
"string",
";",
"/**\n * Version id\n */",
"version_id",
":",
"number",
";",
"header_size",
":",
"number",
";",
"rate",
":",
"number",
";",
"mode",
":",
"number",
";",
"mode_bitstream_version",
":",
"number",
";",
"nb_channels",
":",
"number",
";",
"bitrate",
":",
"number",
";",
"frame_size",
":",
"number",
";",
"vbr",
":",
"number",
";",
"frames_per_packet",
":",
"number",
";",
"extra_headers",
":",
"number",
";",
"reserved1",
":",
"number",
";",
"reserved2",
":",
"number",
";",
"}",
"/**\n * Speex Header Packet\n * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000\n */",
"export",
"const",
"Header",
"=",
"{",
"len",
":",
"80",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"return",
"{",
"speex",
":",
"new",
"Token",
".",
"StringType",
"(",
"8",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"0",
")",
",",
"version",
":",
"util",
".",
"trimRightNull",
"(",
"new",
"Token",
".",
"StringType",
"(",
"20",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
")",
",",
"version_id",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"28",
")",
",",
"header_size",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"32",
")",
",",
"rate",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"36",
")",
",",
"mode",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"40",
")",
",",
"mode_bitstream_version",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"44",
")",
",",
"nb_channels",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"48",
")",
",",
"bitrate",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"52",
")",
",",
"frame_size",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"56",
")",
",",
"vbr",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"60",
")",
",",
"frames_per_packet",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"64",
")",
",",
"extra_headers",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"68",
")",
",",
"reserved1",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"72",
")",
",",
"reserved2",
":",
"buf",
".",
"readInt32LE",
"(",
"off",
"+",
"76",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661845 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"{",
"IPageHeader",
"}",
"from",
"'../Ogg'",
";",
"import",
"{",
"VorbisParser",
"}",
"from",
"'../vorbis/VorbisParser'",
";",
"import",
"{",
"IOptions",
"}",
"from",
"'../../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../../common/MetadataCollector'",
";",
"import",
"*",
"as",
"Speex",
"from",
"'./Speex'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:ogg:speex'",
")",
";",
"/**\n * Speex, RFC 5574\n * Ref:\n * https://www.speex.org/docs/manual/speex-manual/\n * https://tools.ietf.org/html/rfc5574\n */",
"export",
"class",
"SpeexParser",
"extends",
"VorbisParser",
"{",
"constructor",
"(",
"metadata",
",",
"options",
",",
"private",
"tokenizer",
")",
"{",
"super",
"(",
"metadata",
",",
"options",
")",
";",
"}",
"param",
"{",
"IPageHeader",
"}",
"header",
"param",
"{",
"Buffer",
"}",
"pageData",
"protected",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
"{",
"debug",
"(",
"'First Ogg/Speex page'",
")",
";",
"const",
"speexHeader",
"=",
"Speex",
".",
"Header",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"`Speex ${",
"speexHeader",
".",
"version",
"}`",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"speexHeader",
".",
"nb_channels",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"speexHeader",
".",
"rate",
")",
";",
"if",
"(",
"speexHeader",
".",
"bitrate",
"!==",
"-",
"1",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"speexHeader",
".",
"bitrate",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6865,
null,
630,
null,
null,
4277,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
20349,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661846 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"/**\n * 6.2 Identification Header\n * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode\n */",
"export",
"interface",
"IIdentificationHeader",
"{",
"id",
":",
"string",
";",
"vmaj",
":",
"number",
";",
"vmin",
":",
"number",
";",
"vrev",
":",
"number",
";",
"vmbw",
":",
"number",
";",
"vmbh",
":",
"number",
";",
"nombr",
":",
"number",
";",
"nqual",
":",
"number",
";",
"}",
"/**\n * 6.2 Identification Header\n * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode\n */",
"export",
"const",
"IdentificationHeader",
"=",
"{",
"len",
":",
"42",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IIdentificationHeader",
"=>",
"{",
"return",
"{",
"id",
":",
"new",
"Token",
".",
"StringType",
"(",
"7",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"vmaj",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"7",
")",
",",
"vmin",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"8",
")",
",",
"vrev",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"9",
")",
",",
"vmbw",
":",
"buf",
".",
"readUInt16BE",
"(",
"off",
"+",
"10",
")",
",",
"vmbh",
":",
"buf",
".",
"readUInt16BE",
"(",
"off",
"+",
"17",
")",
",",
"nombr",
":",
"Token",
".",
"UINT24_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"37",
")",
",",
"nqual",
":",
"buf",
".",
"readUInt8",
"(",
"off",
"+",
"40",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661847 | [
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"{",
"IOptions",
"}",
"from",
"'../../type'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../../common/MetadataCollector'",
";",
"import",
"*",
"as",
"Ogg",
"from",
"'../Ogg'",
";",
"import",
"{",
"IdentificationHeader",
"}",
"from",
"'./Theora'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:ogg:theora'",
")",
";",
"/**\n * Ref:\n * https://theora.org/doc/Theora.pdf\n */",
"export",
"class",
"TheoraParser",
"implements",
"Ogg",
".",
"IPageConsumer",
"{",
"constructor",
"(",
"private",
"metadata",
",",
"options",
",",
"private",
"tokenizer",
")",
"{",
"}",
"param",
"header",
"param",
"pageData",
"public",
"parsePage",
"(",
"header",
",",
"pageData",
")",
"{",
"if",
"(",
"header",
".",
"headerType",
".",
"firstPage",
")",
"{",
"this",
".",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
";",
"}",
"}",
"public",
"flush",
"(",
")",
"{",
"debug",
"(",
"'flush'",
")",
";",
"}",
"public",
"calculateDuration",
"(",
"header",
")",
"{",
"debug",
"(",
"'duration calculation not implemented'",
")",
";",
"}",
"param",
"{",
"IPageHeader",
"}",
"header",
"param",
"{",
"Buffer",
"}",
"pageData",
"protected",
"parseFirstPage",
"(",
"header",
",",
"pageData",
")",
"{",
"debug",
"(",
"'First Ogg/Theora page'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"'Theora'",
")",
";",
"const",
"idHeader",
"=",
"IdentificationHeader",
".",
"get",
"(",
"pageData",
",",
"0",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"idHeader",
".",
"nombr",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6865,
null,
630,
null,
null,
4277,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
12881,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661848 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
",",
"EndOfStreamError",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"VorbisParser",
"}",
"from",
"'./vorbis/VorbisParser'",
";",
"import",
"{",
"OpusParser",
"}",
"from",
"'./opus/OpusParser'",
";",
"import",
"{",
"SpeexParser",
"}",
"from",
"'./speex/SpeexParser'",
";",
"import",
"{",
"TheoraParser",
"}",
"from",
"'./theora/TheoraParser'",
";",
"import",
"*",
"as",
"Ogg",
"from",
"'./Ogg'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:ogg'",
")",
";",
"export",
"class",
"SegmentTable",
"implements",
"IGetToken",
"<",
"Ogg",
".",
"ISegmentTable",
">",
"{",
"private",
"static",
"sum",
"(",
"buf",
",",
"off",
",",
"len",
")",
"{",
"let",
"s",
"=",
"0",
";",
"for",
"(",
"let",
"i",
"=",
"off",
";",
"i",
"<",
"off",
"+",
"len",
";",
"++",
"i",
")",
"{",
"s",
"+=",
"buf",
"[",
"i",
"]",
";",
"}",
"return",
"s",
";",
"}",
"public",
"len",
":",
"number",
";",
"constructor",
"(",
"header",
")",
"{",
"this",
".",
"len",
"=",
"header",
".",
"page_segments",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"totalPageSize",
":",
"SegmentTable",
".",
"sum",
"(",
"buf",
",",
"off",
",",
"this",
".",
"len",
")",
"}",
";",
"}",
"}",
"/**\n * Parser for Ogg logical bitstream framing\n */",
"export",
"class",
"OggParser",
"extends",
"BasicParser",
"{",
"private",
"static",
"Header",
":",
"IGetToken",
"<",
"Ogg",
".",
"IPageHeader",
">",
"=",
"{",
"len",
":",
"27",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"Ogg",
".",
"IPageHeader",
"=>",
"{",
"return",
"{",
"capturePattern",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"version",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"headerType",
":",
"{",
"continued",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"0",
")",
",",
"firstPage",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"1",
")",
",",
"lastPage",
":",
"util",
".",
"getBit",
"(",
"buf",
",",
"off",
"+",
"5",
",",
"2",
")",
"}",
",",
"absoluteGranulePosition",
":",
"Number",
"(",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"6",
")",
")",
",",
"streamSerialNumber",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"14",
")",
",",
"pageSequenceNo",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"18",
")",
",",
"pageChecksum",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"22",
")",
",",
"page_segments",
":",
"Token",
".",
"UINT8",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"26",
")",
"}",
";",
"}",
"}",
";",
"private",
"header",
":",
"Ogg",
".",
"IPageHeader",
";",
"private",
"pageNumber",
":",
"number",
";",
"private",
"pageConsumer",
":",
"Ogg",
".",
"IPageConsumer",
";",
"returns",
"{",
"Promise",
"<",
"void",
">",
"}",
"public",
"async",
"parse",
"(",
")",
"{",
"debug",
"(",
"'pos=%s, parsePage()'",
",",
"this",
".",
"tokenizer",
".",
"position",
")",
";",
"try",
"{",
"let",
"header",
";",
"do",
"{",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Ogg",
".",
"IPageHeader",
">",
"(",
"OggParser",
".",
"Header",
")",
";",
"if",
"(",
"header",
".",
"capturePattern",
"!==",
"'OggS'",
")",
"throw",
"new",
"Error",
"(",
"'Invalid Ogg capture pattern'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'Ogg'",
")",
";",
"this",
".",
"header",
"=",
"header",
";",
"this",
".",
"pageNumber",
"=",
"header",
".",
"pageSequenceNo",
";",
"debug",
"(",
"'page#=%s, Ogg.id=%s'",
",",
"header",
".",
"pageSequenceNo",
",",
"header",
".",
"capturePattern",
")",
";",
"const",
"segmentTable",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Ogg",
".",
"ISegmentTable",
">",
"(",
"new",
"SegmentTable",
"(",
"header",
")",
")",
";",
"debug",
"(",
"'totalPageSize=%s'",
",",
"segmentTable",
".",
"totalPageSize",
")",
";",
"const",
"pageData",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Uint8Array",
">",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"segmentTable",
".",
"totalPageSize",
")",
")",
";",
"debug",
"(",
"'firstPage=%s, lastPage=%s, continued=%s'",
",",
"header",
".",
"headerType",
".",
"firstPage",
",",
"header",
".",
"headerType",
".",
"lastPage",
",",
"header",
".",
"headerType",
".",
"continued",
")",
";",
"if",
"(",
"header",
".",
"headerType",
".",
"firstPage",
")",
"{",
"const",
"id",
"=",
"new",
"Token",
".",
"StringType",
"(",
"7",
",",
"'ascii'",
")",
".",
"get",
"(",
"Buffer",
".",
"from",
"(",
"pageData",
")",
",",
"0",
")",
";",
"switch",
"(",
"id",
")",
"{",
"case",
"'\\x01vorbis'",
":",
"debug",
"(",
"'Set page consumer to Ogg/Vorbis'",
")",
";",
"this",
".",
"pageConsumer",
"=",
"new",
"VorbisParser",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"options",
")",
";",
"break",
";",
"case",
"'OpusHea'",
":",
"debug",
"(",
"'Set page consumer to Ogg/Opus'",
")",
";",
"this",
".",
"pageConsumer",
"=",
"new",
"OpusParser",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"options",
",",
"this",
".",
"tokenizer",
")",
";",
"break",
";",
"case",
"'Speex '",
":",
"debug",
"(",
"'Set page consumer to Ogg/Speex'",
")",
";",
"this",
".",
"pageConsumer",
"=",
"new",
"SpeexParser",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"options",
",",
"this",
".",
"tokenizer",
")",
";",
"break",
";",
"case",
"'fishead'",
":",
"case",
"'\\x00theora'",
":",
"debug",
"(",
"'Set page consumer to Ogg/Theora'",
")",
";",
"this",
".",
"pageConsumer",
"=",
"new",
"TheoraParser",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"options",
",",
"this",
".",
"tokenizer",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"'gg audio-codec not recognized (id='",
"+",
"id",
"+",
"')'",
")",
";",
"}",
"}",
"this",
".",
"pageConsumer",
".",
"parsePage",
"(",
"header",
",",
"pageData",
")",
";",
"}",
"while",
"(",
"!",
"header",
".",
"headerType",
".",
"lastPage",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"instanceof",
"EndOfStreamError",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Last OGG-page is not marked with last-page flag'",
")",
";",
"debug",
"(",
"`End-of-stream`",
")",
";",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Last OGG-page is not marked with last-page flag'",
")",
";",
"if",
"(",
"this",
".",
"header",
")",
"{",
"this",
".",
"pageConsumer",
".",
"calculateDuration",
"(",
"this",
".",
"header",
")",
";",
"}",
"}",
"else",
"if",
"(",
"err",
".",
"message",
".",
"startsWith",
"(",
"'FourCC'",
")",
")",
"{",
"if",
"(",
"this",
".",
"pageNumber",
">",
"0",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Invalid FourCC ID, maybe last OGG-page is not marked with last-page flag'",
")",
";",
"this",
".",
"pageConsumer",
".",
"flush",
"(",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
5,
null,
3,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12881,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12881,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661849 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"IChunkHeader",
"}",
"from",
"'../iff'",
";",
"export",
"{",
"IChunkHeader",
"}",
"from",
"'../iff'",
";",
"/**\n * Common RIFF chunk header\n */",
"export",
"const",
"Header",
"=",
"{",
"len",
":",
"8",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IChunkHeader",
"=>",
"{",
"return",
"{",
"chunkID",
":",
"buf",
".",
"toString",
"(",
"'binary'",
",",
"off",
",",
"off",
"+",
"4",
")",
",",
"chunkSize",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Token to parse RIFF-INFO tag value\n */",
"export",
"class",
"ListInfoTagValue",
"implements",
"IGetToken",
"<",
"string",
">",
"{",
"public",
"len",
":",
"number",
";",
"public",
"constructor",
"(",
"private",
"tagHeader",
")",
"{",
"this",
".",
"len",
"=",
"tagHeader",
".",
"chunkSize",
";",
"this",
".",
"len",
"+=",
"this",
".",
"len",
"&",
"1",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"new",
"Token",
".",
"StringType",
"(",
"this",
".",
"tagHeader",
".",
"chunkSize",
",",
"'ascii'",
")",
".",
"get",
"(",
"buf",
",",
"off",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661850 | [
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"IChunkHeader",
"}",
"from",
"'../iff'",
";",
"/**\n * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx\n */",
"export",
"enum",
"WaveFormat",
"{",
"PCM",
"=",
"0x0001",
",",
"ADPCM",
"=",
"0x0002",
",",
"IEEE_FLOAT",
"=",
"0x0003",
",",
"MPEG_ADTS_AAC",
"=",
"0x1600",
",",
"MPEG_LOAS",
"=",
"0x1602",
",",
"RAW_AAC1",
"=",
"0x00FF",
",",
"DOLBY_AC3_SPDIF",
"=",
"0x0092",
",",
"DVM",
"=",
"0x2000",
",",
"RAW_SPORT",
"=",
"0x0240",
",",
"ESST_AC3",
"=",
"0x0241",
",",
"DRM",
"=",
"0x0009",
",",
"DTS2",
"=",
"0x2001",
",",
"MPEG",
"=",
"0x0050",
"}",
"/**\n * \"fmt\" sub-chunk describes the sound data's format\n * Ref: http://soundfile.sapp.org/doc/WaveFormat\n */",
"export",
"interface",
"IWaveFormat",
"{",
"/**\n * PCM = 1 (i.e. Linear quantization). Values other than 1 indicate some form of compression.\n */",
"wFormatTag",
":",
"WaveFormat",
";",
"/**\n * Mono = 1, Stereo = 2, etc.\n */",
"nChannels",
":",
"number",
";",
"/**\n * 8000, 44100, etc.\n */",
"nSamplesPerSec",
":",
"number",
";",
"nAvgBytesPerSec",
":",
"number",
";",
"nBlockAlign",
":",
"number",
";",
"wBitsPerSample",
":",
"number",
";",
"}",
"/**\n * format chunk; chunk-id is \"fmt \"\n * http://soundfile.sapp.org/doc/WaveFormat/\n */",
"export",
"class",
"Format",
"implements",
"IGetToken",
"<",
"IWaveFormat",
">",
"{",
"public",
"len",
":",
"number",
";",
"public",
"constructor",
"(",
"header",
")",
"{",
"if",
"(",
"header",
".",
"chunkSize",
"<",
"16",
")",
"throw",
"new",
"Error",
"(",
"'Invalid chunk size'",
")",
";",
"this",
".",
"len",
"=",
"header",
".",
"chunkSize",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"wFormatTag",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
")",
",",
"nChannels",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"2",
")",
",",
"nSamplesPerSec",
":",
"buf",
".",
"readUInt32LE",
"(",
"off",
"+",
"4",
")",
",",
"nAvgBytesPerSec",
":",
"buf",
".",
"readUInt32LE",
"(",
"off",
"+",
"8",
")",
",",
"nBlockAlign",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"12",
")",
",",
"wBitsPerSample",
":",
"buf",
".",
"readUInt16LE",
"(",
"off",
"+",
"14",
")",
"}",
";",
"}",
"}",
"export",
"interface",
"IFactChunk",
"{",
"dwSampleLength",
":",
"number",
";",
"}",
"/**\n * Fact chunk; chunk-id is \"fact\"\n * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html\n * http://www.recordingblogs.com/wiki/fact-chunk-of-a-wave-file\n */",
"export",
"class",
"FactChunk",
"implements",
"IGetToken",
"<",
"IFactChunk",
">",
"{",
"public",
"len",
":",
"number",
";",
"public",
"constructor",
"(",
"header",
")",
"{",
"if",
"(",
"header",
".",
"chunkSize",
"<",
"4",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid fact chunk size.'",
")",
";",
"}",
"this",
".",
"len",
"=",
"header",
".",
"chunkSize",
";",
"}",
"public",
"get",
"(",
"buf",
",",
"off",
")",
"{",
"return",
"{",
"dwSampleLength",
":",
"buf",
".",
"readUInt32LE",
"(",
"off",
")",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49868,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661851 | [
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"riff",
"from",
"'../riff/RiffChunk'",
";",
"import",
"*",
"as",
"WaveChunk",
"from",
"'./../wav/WaveChunk'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'../id3v2/ID3v2Parser'",
";",
"import",
"*",
"as",
"util",
"from",
"'../common/Util'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:RIFF'",
")",
";",
"/**\n * Resource Interchange File Format (RIFF) Parser\n *\n * WAVE PCM soundfile format\n *\n * Ref:\n * http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html\n * http://soundfile.sapp.org/doc/WaveFormat\n *\n * ToDo: Split WAVE part from RIFF parser\n */",
"export",
"class",
"WaveParser",
"extends",
"BasicParser",
"{",
"private",
"fact",
":",
"WaveChunk",
".",
"IFactChunk",
";",
"private",
"blockAlign",
":",
"number",
";",
"private",
"header",
":",
"riff",
".",
"IChunkHeader",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"riffHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"riff",
".",
"IChunkHeader",
">",
"(",
"riff",
".",
"Header",
")",
";",
"debug",
"(",
"`pos=${",
"this",
".",
"tokenizer",
".",
"position",
"}, parse: chunkID=${",
"riffHeader",
".",
"chunkID",
"}`",
")",
";",
"if",
"(",
"riffHeader",
".",
"chunkID",
"!==",
"'RIFF'",
")",
"return",
";",
"return",
"this",
".",
"parseRiffChunk",
"(",
"riffHeader",
".",
"chunkSize",
")",
".",
"catch",
"(",
"err",
"=>",
"{",
"if",
"(",
"!",
"(",
"err",
"instanceof",
"strtok3",
".",
"EndOfStreamError",
")",
")",
"{",
"throw",
"err",
";",
"}",
"}",
")",
";",
"}",
"public",
"async",
"parseRiffChunk",
"(",
"chunkSize",
")",
"{",
"const",
"type",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"type",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'WAVE'",
":",
"return",
"this",
".",
"readWaveChunk",
"(",
"chunkSize",
"-",
"FourCcToken",
".",
"len",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"`Unsupported RIFF format: RIFF/${",
"type",
"}`",
")",
";",
"}",
"}",
"public",
"async",
"readWaveChunk",
"(",
"remaining",
")",
"{",
"while",
"(",
"remaining",
">=",
"riff",
".",
"Header",
".",
"len",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"riff",
".",
"IChunkHeader",
">",
"(",
"riff",
".",
"Header",
")",
";",
"remaining",
"-=",
"riff",
".",
"Header",
".",
"len",
"+",
"header",
".",
"chunkSize",
";",
"if",
"(",
"header",
".",
"chunkSize",
">",
"remaining",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Data chunk size exceeds file size'",
")",
";",
"}",
"this",
".",
"header",
"=",
"header",
";",
"debug",
"(",
"`pos=${",
"this",
".",
"tokenizer",
".",
"position",
"}, readChunk: chunkID=RIFF/WAVE/${",
"header",
".",
"chunkID",
"}`",
")",
";",
"switch",
"(",
"header",
".",
"chunkID",
")",
"{",
"case",
"'LIST'",
":",
"await",
"this",
".",
"parseListTag",
"(",
"header",
")",
";",
"break",
";",
"case",
"'fact'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"false",
")",
";",
"this",
".",
"fact",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"WaveChunk",
".",
"FactChunk",
"(",
"header",
")",
")",
";",
"break",
";",
"case",
"'fmt '",
":",
"const",
"fmt",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"WaveChunk",
".",
"IWaveFormat",
">",
"(",
"new",
"WaveChunk",
".",
"Format",
"(",
"header",
")",
")",
";",
"let",
"subFormat",
"=",
"WaveChunk",
".",
"WaveFormat",
"[",
"fmt",
".",
"wFormatTag",
"]",
";",
"if",
"(",
"!",
"subFormat",
")",
"{",
"debug",
"(",
"'WAVE/non-PCM format='",
"+",
"fmt",
".",
"wFormatTag",
")",
";",
"subFormat",
"=",
"'non-PCM ('",
"+",
"fmt",
".",
"wFormatTag",
"+",
"')'",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"subFormat",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"fmt",
".",
"wBitsPerSample",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"fmt",
".",
"nSamplesPerSec",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"fmt",
".",
"nChannels",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"fmt",
".",
"nBlockAlign",
"*",
"fmt",
".",
"nSamplesPerSec",
"*",
"8",
")",
";",
"this",
".",
"blockAlign",
"=",
"fmt",
".",
"nBlockAlign",
";",
"break",
";",
"case",
"'id3 '",
":",
"case",
"'ID3 '",
":",
"const",
"id3_data",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Uint8Array",
">",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"header",
".",
"chunkSize",
")",
")",
";",
"const",
"rst",
"=",
"strtok3",
".",
"fromBuffer",
"(",
"id3_data",
")",
";",
"await",
"new",
"ID3v2Parser",
"(",
")",
".",
"parse",
"(",
"this",
".",
"metadata",
",",
"rst",
",",
"this",
".",
"options",
")",
";",
"break",
";",
"case",
"'data'",
":",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"lossless",
"!==",
"false",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"}",
"let",
"chunkSize",
"=",
"header",
".",
"chunkSize",
";",
"if",
"(",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
")",
"{",
"const",
"calcRemaining",
"=",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
";",
"if",
"(",
"calcRemaining",
"<",
"chunkSize",
")",
"{",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'data chunk length exceeding file length'",
")",
";",
"chunkSize",
"=",
"calcRemaining",
";",
"}",
"}",
"const",
"numberOfSamples",
"=",
"this",
".",
"fact",
"?",
"this",
".",
"fact",
".",
"dwSampleLength",
":",
"(",
"chunkSize",
"===",
"0xffffffff",
"?",
"undefined",
":",
"chunkSize",
"/",
"this",
".",
"blockAlign",
")",
";",
"if",
"(",
"numberOfSamples",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"numberOfSamples",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"numberOfSamples",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfChannels",
"*",
"this",
".",
"blockAlign",
"*",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"chunkSize",
")",
";",
"break",
";",
"default",
":",
"debug",
"(",
"`Ignore chunk: RIFF/${",
"header",
".",
"chunkID",
"} of ${",
"header",
".",
"chunkSize",
"} bytes`",
")",
";",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Ignore chunk: RIFF/'",
"+",
"header",
".",
"chunkID",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"header",
".",
"chunkSize",
")",
";",
"}",
"if",
"(",
"this",
".",
"header",
".",
"chunkSize",
"%",
"2",
"===",
"1",
")",
"{",
"debug",
"(",
"'Read odd padding byte'",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"1",
")",
";",
"}",
"}",
"}",
"public",
"async",
"parseListTag",
"(",
"listHeader",
")",
"{",
"const",
"listType",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"4",
",",
"'binary'",
")",
")",
";",
"debug",
"(",
"'pos=%s, parseListTag: chunkID=RIFF/WAVE/LIST/%s'",
",",
"this",
".",
"tokenizer",
".",
"position",
",",
"listType",
")",
";",
"switch",
"(",
"listType",
")",
"{",
"case",
"'INFO'",
":",
"return",
"this",
".",
"parseRiffInfoTags",
"(",
"listHeader",
".",
"chunkSize",
"-",
"4",
")",
";",
"case",
"'adtl'",
":",
"default",
":",
"this",
".",
"metadata",
".",
"addWarning",
"(",
"'Ignore chunk: RIFF/WAVE/LIST/'",
"+",
"listType",
")",
";",
"debug",
"(",
"'Ignoring chunkID=RIFF/WAVE/LIST/'",
"+",
"listType",
")",
";",
"return",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"listHeader",
".",
"chunkSize",
"-",
"4",
")",
".",
"then",
"(",
")",
";",
"}",
"}",
"private",
"async",
"parseRiffInfoTags",
"(",
"chunkSize",
")",
"{",
"while",
"(",
"chunkSize",
">=",
"8",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"riff",
".",
"IChunkHeader",
">",
"(",
"riff",
".",
"Header",
")",
";",
"const",
"valueToken",
"=",
"new",
"riff",
".",
"ListInfoTagValue",
"(",
"header",
")",
";",
"const",
"value",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"valueToken",
")",
";",
"this",
".",
"addTag",
"(",
"header",
".",
"chunkID",
",",
"util",
".",
"stripNulls",
"(",
"value",
")",
")",
";",
"chunkSize",
"-=",
"(",
"8",
"+",
"valueToken",
".",
"len",
")",
";",
"}",
"if",
"(",
"chunkSize",
"!==",
"0",
")",
"{",
"throw",
"Error",
"(",
"'Illegal remaining size: '",
"+",
"chunkSize",
")",
";",
"}",
"}",
"private",
"addTag",
"(",
"id",
",",
"value",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"'exif'",
",",
"id",
",",
"value",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49868,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25253,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661852 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"/**\n * WavPack Block Header\n *\n * 32-byte little-endian header at the front of every WavPack block\n *\n * Ref:\n * http://www.wavpack.com/WavPack5FileFormat.pdf (page 2/6: 2.0 \"Block Header\")\n */",
"export",
"interface",
"IBlockHeader",
"{",
"BlockID",
":",
"string",
";",
"blockSize",
":",
"number",
";",
"version",
":",
"number",
";",
"blockIndex",
":",
"number",
";",
"totalSamples",
":",
"number",
";",
"blockSamples",
":",
"number",
";",
"flags",
":",
"{",
"bitsPerSample",
":",
"number",
";",
"isMono",
":",
"boolean",
";",
"isHybrid",
":",
"boolean",
";",
"isJointStereo",
":",
"boolean",
";",
"crossChannel",
":",
"boolean",
";",
"hybridNoiseShaping",
":",
"boolean",
";",
"floatingPoint",
":",
"boolean",
";",
"samplingRate",
":",
"number",
";",
"isDSD",
":",
"boolean",
";",
"}",
";",
"crc",
":",
"Uint8Array",
";",
"}",
"export",
"interface",
"IMetadataId",
"{",
"/**\n * metadata function id\n */",
"functionId",
":",
"number",
";",
"/**\n * If true, audio-decoder does not need to understand the metadata field\n */",
"isOptional",
":",
"boolean",
";",
"/**\n * actual data byte length is 1 less\n */",
"isOddSize",
":",
"boolean",
";",
"/**\n * large block (> 255 words)\n */",
"largeBlock",
":",
"boolean",
";",
"}",
"const",
"SampleRates",
"=",
"[",
"6000",
",",
"8000",
",",
"9600",
",",
"11025",
",",
"12000",
",",
"16000",
",",
"22050",
",",
"24000",
",",
"32000",
",",
"44100",
",",
"48000",
",",
"64000",
",",
"88200",
",",
"96000",
",",
"192000",
",",
"-",
"1",
"]",
";",
"export",
"class",
"WavPack",
"{",
"/**\n * WavPack Block Header\n *\n * 32-byte little-endian header at the front of every WavPack block\n *\n * Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 2/6: 2.0 \"Block Header\")\n */",
"public",
"static",
"BlockHeaderToken",
":",
"IGetToken",
"<",
"IBlockHeader",
">",
"=",
"{",
"len",
":",
"32",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"const",
"flags",
"=",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
";",
"const",
"res",
"=",
"{",
"BlockID",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"blockSize",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"version",
":",
"Token",
".",
"UINT16_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"totalSamples",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"blockIndex",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"blockSamples",
":",
"Token",
".",
"UINT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"flags",
":",
"{",
"bitsPerSample",
":",
"(",
"1",
"+",
"WavPack",
".",
"getBitAllignedNumber",
"(",
"flags",
",",
"0",
",",
"2",
")",
")",
"*",
"8",
",",
"isMono",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"2",
")",
",",
"isHybrid",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"3",
")",
",",
"isJointStereo",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"4",
")",
",",
"crossChannel",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"5",
")",
",",
"hybridNoiseShaping",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"6",
")",
",",
"floatingPoint",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"7",
")",
",",
"samplingRate",
":",
"SampleRates",
"[",
"WavPack",
".",
"getBitAllignedNumber",
"(",
"flags",
",",
"23",
",",
"4",
")",
"]",
",",
"isDSD",
":",
"WavPack",
".",
"isBitSet",
"(",
"flags",
",",
"31",
")",
"}",
",",
"crc",
":",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"4",
")",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"28",
")",
"}",
";",
"if",
"(",
"res",
".",
"flags",
".",
"isDSD",
")",
"{",
"res",
".",
"totalSamples",
"*=",
"8",
";",
"}",
"return",
"res",
";",
"}",
"}",
";",
"/**\n * 3.0 Metadata Sub-Blocks\n * Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 4/6: 3.0 \"Metadata Sub-Block\")\n */",
"public",
"static",
"MetadataIdToken",
":",
"IGetToken",
"<",
"IMetadataId",
">",
"=",
"{",
"len",
":",
"1",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
"=>",
"{",
"return",
"{",
"functionId",
":",
"WavPack",
".",
"getBitAllignedNumber",
"(",
"buf",
"[",
"off",
"]",
",",
"0",
",",
"6",
")",
",",
"isOptional",
":",
"WavPack",
".",
"isBitSet",
"(",
"buf",
"[",
"off",
"]",
",",
"5",
")",
",",
"isOddSize",
":",
"WavPack",
".",
"isBitSet",
"(",
"buf",
"[",
"off",
"]",
",",
"6",
")",
",",
"largeBlock",
":",
"WavPack",
".",
"isBitSet",
"(",
"buf",
"[",
"off",
"]",
",",
"7",
")",
"}",
";",
"}",
"}",
";",
"private",
"static",
"isBitSet",
"(",
"flags",
",",
"bitOffset",
")",
"{",
"return",
"WavPack",
".",
"getBitAllignedNumber",
"(",
"flags",
",",
"bitOffset",
",",
"1",
")",
"===",
"1",
";",
"}",
"private",
"static",
"getBitAllignedNumber",
"(",
"flags",
",",
"bitOffset",
",",
"len",
")",
"{",
"return",
"(",
"flags",
">>>",
"bitOffset",
")",
"&",
"(",
"0xffffffff",
">>>",
"(",
"32",
"-",
"len",
")",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661853 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'../apev2/APEv2Parser'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"IBlockHeader",
",",
"IMetadataId",
",",
"WavPack",
"}",
"from",
"'./WavPackToken'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:WavPack'",
")",
";",
"/**\n * WavPack Parser\n */",
"export",
"class",
"WavPackParser",
"extends",
"BasicParser",
"{",
"private",
"audioDataSize",
":",
"number",
";",
"public",
"async",
"parse",
"(",
")",
"{",
"this",
".",
"audioDataSize",
"=",
"0",
";",
"await",
"this",
".",
"parseWavPackBlocks",
"(",
")",
";",
"return",
"APEv2Parser",
".",
"tryParseApeHeader",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"}",
"public",
"async",
"parseWavPackBlocks",
"(",
")",
"{",
"do",
"{",
"const",
"blockId",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
";",
"if",
"(",
"blockId",
"!==",
"'wvpk'",
")",
"break",
";",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IBlockHeader",
">",
"(",
"WavPack",
".",
"BlockHeaderToken",
")",
";",
"if",
"(",
"header",
".",
"BlockID",
"!==",
"'wvpk'",
")",
"throw",
"new",
"Error",
"(",
"'Invalid WavPack Block-ID'",
")",
";",
"debug",
"(",
"`WavPack header blockIndex=${",
"header",
".",
"blockIndex",
"}, len=${",
"WavPack",
".",
"BlockHeaderToken",
".",
"len",
"}`",
")",
";",
"if",
"(",
"header",
".",
"blockIndex",
"===",
"0",
"&&",
"!",
"this",
".",
"metadata",
".",
"format",
".",
"container",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'WavPack'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"!",
"header",
".",
"flags",
".",
"isHybrid",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"header",
".",
"flags",
".",
"bitsPerSample",
")",
";",
"if",
"(",
"!",
"header",
".",
"flags",
".",
"isDSD",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"header",
".",
"flags",
".",
"samplingRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"header",
".",
"totalSamples",
"/",
"header",
".",
"flags",
".",
"samplingRate",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"header",
".",
"flags",
".",
"isMono",
"?",
"1",
":",
"2",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"header",
".",
"totalSamples",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"header",
".",
"flags",
".",
"isDSD",
"?",
"'DSD'",
":",
"'PCM'",
")",
";",
"}",
"const",
"ignoreBytes",
"=",
"header",
".",
"blockSize",
"-",
"(",
"WavPack",
".",
"BlockHeaderToken",
".",
"len",
"-",
"8",
")",
";",
"if",
"(",
"header",
".",
"blockIndex",
"===",
"0",
")",
"{",
"await",
"this",
".",
"parseMetadataSubBlock",
"(",
"header",
",",
"ignoreBytes",
")",
";",
"}",
"else",
"{",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"ignoreBytes",
")",
";",
"}",
"if",
"(",
"header",
".",
"blockSamples",
">",
"0",
")",
"{",
"this",
".",
"audioDataSize",
"+=",
"header",
".",
"blockSize",
";",
"}",
"}",
"while",
"(",
"!",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"||",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
"-",
"this",
".",
"tokenizer",
".",
"position",
">=",
"WavPack",
".",
"BlockHeaderToken",
".",
"len",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"this",
".",
"audioDataSize",
"*",
"8",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"duration",
")",
";",
"}",
"param",
"remainingLength",
"private",
"async",
"parseMetadataSubBlock",
"(",
"header",
",",
"remainingLength",
")",
"{",
"while",
"(",
"remainingLength",
">",
"WavPack",
".",
"MetadataIdToken",
".",
"len",
")",
"{",
"const",
"id",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IMetadataId",
">",
"(",
"WavPack",
".",
"MetadataIdToken",
")",
";",
"const",
"dataSizeInWords",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"id",
".",
"largeBlock",
"?",
"Token",
".",
"UINT24_LE",
":",
"Token",
".",
"UINT8",
")",
";",
"const",
"data",
"=",
"Buffer",
".",
"alloc",
"(",
"dataSizeInWords",
"*",
"2",
"-",
"(",
"id",
".",
"isOddSize",
"?",
"1",
":",
"0",
")",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"data",
")",
";",
"debug",
"(",
"`Metadata Sub-Blocks functionId=0x${",
"id",
".",
"functionId",
".",
"toString",
"(",
"16",
")",
"}, id.largeBlock=${",
"id",
".",
"largeBlock",
"},data-size=${",
"data",
".",
"length",
"}`",
")",
";",
"switch",
"(",
"id",
".",
"functionId",
")",
"{",
"case",
"0x0",
":",
"break",
";",
"case",
"0xe",
":",
"debug",
"(",
"'ID_DSD_BLOCK'",
")",
";",
"const",
"mp",
"=",
"1",
"<<",
"data",
".",
"readUInt8",
"(",
"0",
")",
";",
"const",
"samplingRate",
"=",
"header",
".",
"flags",
".",
"samplingRate",
"*",
"mp",
"*",
"8",
";",
"if",
"(",
"!",
"header",
".",
"flags",
".",
"isDSD",
")",
"throw",
"new",
"Error",
"(",
"'Only expect DSD block if DSD-flag is set'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"samplingRate",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"header",
".",
"totalSamples",
"/",
"samplingRate",
")",
";",
"break",
";",
"case",
"0x24",
":",
"debug",
"(",
"'ID_ALT_TRAILER: trailer for non-wav files'",
")",
";",
"break",
";",
"case",
"0x26",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'audioMD5'",
",",
"data",
")",
";",
"break",
";",
"case",
"0x2f",
":",
"debug",
"(",
"`ID_BLOCK_CHECKSUM: checksum=${",
"data",
".",
"toString",
"(",
"'hex'",
")",
"}`",
")",
";",
"break",
";",
"default",
":",
"debug",
"(",
"`Ignore unsupported meta-sub-block-id functionId=0x${",
"id",
".",
"functionId",
".",
"toString",
"(",
"16",
")",
"}`",
")",
";",
"break",
";",
"}",
"remainingLength",
"-=",
"WavPack",
".",
"MetadataIdToken",
".",
"len",
"+",
"(",
"id",
".",
"largeBlock",
"?",
"Token",
".",
"UINT24_LE",
".",
"len",
":",
"Token",
".",
"UINT8",
".",
"len",
")",
"+",
"dataSizeInWords",
"*",
"2",
";",
"debug",
"(",
"`remainingLength=${",
"remainingLength",
"}`",
")",
";",
"if",
"(",
"id",
".",
"isOddSize",
")",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"1",
")",
";",
"}",
"if",
"(",
"remainingLength",
"!==",
"0",
")",
"throw",
"new",
"Error",
"(",
"'metadata-sub-block should fit it remaining length'",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25255,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25255,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661854 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"/**\n * Common interface for the common chunk DSD header\n */",
"export",
"interface",
"IChunkHeader",
"{",
"/**\n * Chunk ID\n */",
"id",
":",
"string",
";",
"/**\n * Chunk size\n */",
"size",
":",
"bigint",
";",
"}",
"/**\n * Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size\n */",
"export",
"const",
"ChunkHeader",
"=",
"{",
"len",
":",
"12",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IChunkHeader",
"=>",
"{",
"return",
"{",
"id",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"size",
":",
"Token",
".",
"UINT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";",
"/**\n * Interface to DSD payload chunk\n */",
"export",
"interface",
"IDsdChunk",
"{",
"/**\n * Total file size\n */",
"fileSize",
":",
"bigint",
";",
"/**\n * If Metadata doesn’t exist, set 0. If the file has ID3v2 tag, then set the pointer to it.\n * ID3v2 tag should be located in the end of the file.\n */",
"metadataPointer",
":",
"bigint",
";",
"}",
"/**\n * Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size\n */",
"export",
"const",
"DsdChunk",
"=",
"{",
"len",
":",
"16",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IDsdChunk",
"=>",
"{",
"return",
"{",
"fileSize",
":",
"Token",
".",
"INT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"metadataPointer",
":",
"Token",
".",
"INT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
"}",
";",
"}",
"}",
";",
"export",
"enum",
"ChannelType",
"{",
"mono",
"=",
"1",
",",
"stereo",
"=",
"2",
",",
"channels",
"=",
"3",
",",
"quad",
"=",
"4",
",",
"'4 channels'",
"=",
"5",
",",
"'5 channels'",
"=",
"6",
",",
"'5.1 channels'",
"=",
"7",
"}",
"/**\n * Interface to format chunk payload chunk\n */",
"export",
"interface",
"IFormatChunk",
"{",
"/**\n * Version of this file format\n */",
"formatVersion",
":",
"number",
";",
"/**\n * Format ID\n */",
"formatID",
":",
"number",
";",
"/**\n * Channel Type\n */",
"channelType",
":",
"ChannelType",
";",
"/**\n * Channel num\n */",
"channelNum",
":",
"number",
";",
"/**\n * Sampling frequency\n */",
"samplingFrequency",
":",
"number",
";",
"/**\n * Bits per sample\n */",
"bitsPerSample",
":",
"number",
";",
"/**\n * Sample count\n */",
"sampleCount",
":",
"bigint",
";",
"/**\n * Block size per channel\n */",
"blockSizePerChannel",
":",
"number",
";",
"}",
"/**\n * Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size\n */",
"export",
"const",
"FormatChunk",
"=",
"{",
"len",
":",
"40",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IFormatChunk",
"=>",
"{",
"return",
"{",
"formatVersion",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"formatID",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
",",
"channelType",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"8",
")",
",",
"channelNum",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"12",
")",
",",
"samplingFrequency",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"16",
")",
",",
"bitsPerSample",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"20",
")",
",",
"sampleCount",
":",
"Token",
".",
"INT64_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"24",
")",
",",
"blockSizePerChannel",
":",
"Token",
".",
"INT32_LE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"32",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661855 | [
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"AbstractID3Parser",
"}",
"from",
"'../id3v2/AbstractID3Parser'",
";",
"import",
"{",
"ChunkHeader",
",",
"DsdChunk",
",",
"FormatChunk",
",",
"IChunkHeader",
",",
"IDsdChunk",
",",
"IFormatChunk",
"}",
"from",
"'./DsfChunk'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"\"../id3v2/ID3v2Parser\"",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:DSF'",
")",
";",
"/**\n * DSF (dsd stream file) File Parser\n * Ref: https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf\n */",
"export",
"class",
"DsfParser",
"extends",
"AbstractID3Parser",
"{",
"public",
"async",
"_parse",
"(",
")",
"{",
"const",
"p0",
"=",
"this",
".",
"tokenizer",
".",
"position",
";",
"const",
"chunkHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IChunkHeader",
">",
"(",
"ChunkHeader",
")",
";",
"if",
"(",
"chunkHeader",
".",
"id",
"!==",
"'DSD '",
")",
"throw",
"new",
"Error",
"(",
"'Invalid chunk signature'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"'DSF'",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"const",
"dsdChunk",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IDsdChunk",
">",
"(",
"DsdChunk",
")",
";",
"if",
"(",
"dsdChunk",
".",
"metadataPointer",
"===",
"BigInt",
"(",
"0",
")",
")",
"{",
"debug",
"(",
"`No ID3v2 tag present`",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"`expect ID3v2 at offset=${",
"dsdChunk",
".",
"metadataPointer",
"}`",
")",
";",
"await",
"this",
".",
"parseChunks",
"(",
"dsdChunk",
".",
"fileSize",
"-",
"chunkHeader",
".",
"size",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"Number",
"(",
"dsdChunk",
".",
"metadataPointer",
")",
"-",
"this",
".",
"tokenizer",
".",
"position",
"-",
"p0",
")",
";",
"return",
"new",
"ID3v2Parser",
"(",
")",
".",
"parse",
"(",
"this",
".",
"metadata",
",",
"this",
".",
"tokenizer",
",",
"this",
".",
"options",
")",
";",
"}",
"}",
"private",
"async",
"parseChunks",
"(",
"bytesRemaining",
")",
"{",
"while",
"(",
"bytesRemaining",
">=",
"ChunkHeader",
".",
"len",
")",
"{",
"const",
"chunkHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IChunkHeader",
">",
"(",
"ChunkHeader",
")",
";",
"debug",
"(",
"`Parsing chunk name=${",
"chunkHeader",
".",
"id",
"} size=${",
"chunkHeader",
".",
"size",
"}`",
")",
";",
"switch",
"(",
"chunkHeader",
".",
"id",
")",
"{",
"case",
"'fmt '",
":",
"const",
"formatChunk",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IFormatChunk",
">",
"(",
"FormatChunk",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"formatChunk",
".",
"channelNum",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"formatChunk",
".",
"samplingFrequency",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"formatChunk",
".",
"bitsPerSample",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"formatChunk",
".",
"sampleCount",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"Number",
"(",
"formatChunk",
".",
"sampleCount",
")",
"/",
"formatChunk",
".",
"samplingFrequency",
")",
";",
"const",
"bitrate",
"=",
"formatChunk",
".",
"bitsPerSample",
"*",
"formatChunk",
".",
"samplingFrequency",
"*",
"formatChunk",
".",
"channelNum",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"bitrate",
")",
";",
"return",
";",
"default",
":",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"Number",
"(",
"chunkHeader",
".",
"size",
")",
"-",
"ChunkHeader",
".",
"len",
")",
";",
"break",
";",
"}",
"bytesRemaining",
"-=",
"chunkHeader",
".",
"size",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661856 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"{",
"IGetToken",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"IChunkHeader64",
"}",
"from",
"'../iff'",
";",
"export",
"{",
"IChunkHeader64",
"}",
"from",
"'../iff'",
";",
"/**\n * DSDIFF chunk header\n * The data-size encoding is deviating from EA-IFF 85\n * Ref: http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf\n */",
"export",
"const",
"ChunkHeader64",
"=",
"{",
"len",
":",
"12",
",",
"get",
":",
"(",
"buf",
",",
"off",
")",
":",
"IChunkHeader64",
"=>",
"{",
"return",
"{",
"chunkID",
":",
"FourCcToken",
".",
"get",
"(",
"buf",
",",
"off",
")",
",",
"chunkSize",
":",
"Token",
".",
"INT64_BE",
".",
"get",
"(",
"buf",
",",
"off",
"+",
"4",
")",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2519,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661857 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"initDebug",
"from",
"'debug'",
";",
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"FourCcToken",
"}",
"from",
"'../common/FourCC'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'../id3v2/ID3v2Parser'",
";",
"import",
"{",
"ChunkHeader64",
",",
"IChunkHeader64",
"}",
"from",
"'./DsdiffToken'",
";",
"const",
"debug",
"=",
"initDebug",
"(",
"'music-metadata:parser:aiff'",
")",
";",
"/**\n * DSDIFF - Direct Stream Digital Interchange File Format (Phillips)\n *\n * Ref:\n * http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf\n */",
"export",
"class",
"DsdiffParser",
"extends",
"BasicParser",
"{",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"header",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IChunkHeader64",
">",
"(",
"ChunkHeader64",
")",
";",
"if",
"(",
"header",
".",
"chunkID",
"!==",
"'FRM8'",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected chunk-ID'",
")",
";",
"const",
"type",
"=",
"(",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
")",
".",
"trim",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'DSD'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"`DSDIFF/${",
"type",
"}`",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"return",
"this",
".",
"readFmt8Chunks",
"(",
"header",
".",
"chunkSize",
"-",
"BigInt",
"(",
"FourCcToken",
".",
"len",
")",
")",
";",
"default",
":",
"throw",
"Error",
"(",
"`Unsupported DSDIFF type: ${",
"type",
"}`",
")",
";",
"}",
"}",
"private",
"async",
"readFmt8Chunks",
"(",
"remainingSize",
")",
"{",
"while",
"(",
"remainingSize",
">=",
"ChunkHeader64",
".",
"len",
")",
"{",
"const",
"chunkHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IChunkHeader64",
">",
"(",
"ChunkHeader64",
")",
";",
"debug",
"(",
"`Chunk id=${",
"chunkHeader",
".",
"chunkID",
"}`",
")",
";",
"await",
"this",
".",
"readData",
"(",
"chunkHeader",
")",
";",
"remainingSize",
"-=",
"(",
"BigInt",
"(",
"ChunkHeader64",
".",
"len",
")",
"+",
"chunkHeader",
".",
"chunkSize",
")",
";",
"}",
"}",
"private",
"async",
"readData",
"(",
"header",
")",
"{",
"debug",
"(",
"`Reading data of chunk[ID=${",
"header",
".",
"chunkID",
"}, size=${",
"header",
".",
"chunkSize",
"}]`",
")",
";",
"const",
"p0",
"=",
"this",
".",
"tokenizer",
".",
"position",
";",
"switch",
"(",
"header",
".",
"chunkID",
".",
"trim",
"(",
")",
")",
"{",
"case",
"'FVER'",
":",
"const",
"version",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT32_LE",
")",
";",
"debug",
"(",
"`DSDIFF version=${",
"version",
"}`",
")",
";",
"break",
";",
"case",
"'PROP'",
":",
"const",
"propType",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"FourCcToken",
")",
";",
"if",
"(",
"propType",
"!==",
"'SND '",
")",
"throw",
"new",
"Error",
"(",
"'Unexpected PROP-chunk ID'",
")",
";",
"await",
"this",
".",
"handleSoundPropertyChunks",
"(",
"header",
".",
"chunkSize",
"-",
"BigInt",
"(",
"FourCcToken",
".",
"len",
")",
")",
";",
"break",
";",
"case",
"'ID3'",
":",
"const",
"id3_data",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"Uint8Array",
">",
"(",
"new",
"Token",
".",
"Uint8ArrayType",
"(",
"Number",
"(",
"header",
".",
"chunkSize",
")",
")",
")",
";",
"const",
"rst",
"=",
"strtok3",
".",
"fromBuffer",
"(",
"id3_data",
")",
";",
"await",
"new",
"ID3v2Parser",
"(",
")",
".",
"parse",
"(",
"this",
".",
"metadata",
",",
"rst",
",",
"this",
".",
"options",
")",
";",
"break",
";",
"default",
":",
"debug",
"(",
"`Ignore chunk[ID=${",
"header",
".",
"chunkID",
"}, size=${",
"header",
".",
"chunkSize",
"}]`",
")",
";",
"break",
";",
"case",
"'DSD'",
":",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfSamples'",
",",
"Number",
"(",
"header",
".",
"chunkSize",
"*",
"BigInt",
"(",
"8",
")",
"/",
"BigInt",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfChannels",
")",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfSamples",
"/",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
")",
";",
"break",
";",
"}",
"const",
"remaining",
"=",
"header",
".",
"chunkSize",
"-",
"BigInt",
"(",
"this",
".",
"tokenizer",
".",
"position",
"-",
"p0",
")",
";",
"if",
"(",
"remaining",
">",
"0",
")",
"{",
"debug",
"(",
"`After Parsing chunk, remaining ${",
"remaining",
"} bytes`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"Number",
"(",
"remaining",
")",
")",
";",
"}",
"}",
"private",
"async",
"handleSoundPropertyChunks",
"(",
"remainingSize",
")",
"{",
"debug",
"(",
"`Parsing sound-property-chunks, remainingSize=${",
"remainingSize",
"}`",
")",
";",
"while",
"(",
"remainingSize",
">",
"0",
")",
"{",
"const",
"sndPropHeader",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"IChunkHeader64",
">",
"(",
"ChunkHeader64",
")",
";",
"debug",
"(",
"`Sound-property-chunk[ID=${",
"sndPropHeader",
".",
"chunkID",
"}, size=${",
"sndPropHeader",
".",
"chunkSize",
"}]`",
")",
";",
"const",
"p0",
"=",
"this",
".",
"tokenizer",
".",
"position",
";",
"switch",
"(",
"sndPropHeader",
".",
"chunkID",
".",
"trim",
"(",
")",
")",
"{",
"case",
"'FS'",
":",
"const",
"sampleRate",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT32_BE",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"sampleRate",
")",
";",
"break",
";",
"case",
"'CHNL'",
":",
"const",
"numChannels",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT16_BE",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"numChannels",
")",
";",
"await",
"this",
".",
"handleChannelChunks",
"(",
"sndPropHeader",
".",
"chunkSize",
"-",
"BigInt",
"(",
"Token",
".",
"UINT16_BE",
".",
"len",
")",
")",
";",
"break",
";",
"case",
"'CMPR'",
":",
"const",
"compressionIdCode",
"=",
"(",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
")",
".",
"trim",
"(",
")",
";",
"const",
"count",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT8",
")",
";",
"const",
"compressionName",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"new",
"Token",
".",
"StringType",
"(",
"count",
",",
"'ascii'",
")",
")",
";",
"if",
"(",
"compressionIdCode",
"===",
"'DSD'",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'lossless'",
",",
"true",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitsPerSample'",
",",
"1",
")",
";",
"}",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"`${",
"compressionIdCode",
"} (${",
"compressionName",
"})`",
")",
";",
"break",
";",
"case",
"'ABSS'",
":",
"const",
"hours",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT16_BE",
")",
";",
"const",
"minutes",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT8",
")",
";",
"const",
"seconds",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT8",
")",
";",
"const",
"samples",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT32_BE",
")",
";",
"debug",
"(",
"`ABSS ${",
"hours",
"}:${",
"minutes",
"}:${",
"seconds",
"}.${",
"samples",
"}`",
")",
";",
"break",
";",
"case",
"'LSCO'",
":",
"const",
"lsConfig",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"number",
">",
"(",
"Token",
".",
"UINT16_BE",
")",
";",
"debug",
"(",
"`LSCO lsConfig=${",
"lsConfig",
"}`",
")",
";",
"break",
";",
"case",
"'COMT'",
":",
"default",
":",
"debug",
"(",
"`Unknown sound-property-chunk[ID=${",
"sndPropHeader",
".",
"chunkID",
"}, size=${",
"sndPropHeader",
".",
"chunkSize",
"}]`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"Number",
"(",
"sndPropHeader",
".",
"chunkSize",
")",
")",
";",
"}",
"const",
"remaining",
"=",
"sndPropHeader",
".",
"chunkSize",
"-",
"BigInt",
"(",
"this",
".",
"tokenizer",
".",
"position",
"-",
"p0",
")",
";",
"if",
"(",
"remaining",
">",
"0",
")",
"{",
"debug",
"(",
"`After Parsing sound-property-chunk ${",
"sndPropHeader",
".",
"chunkSize",
"}, remaining ${",
"remaining",
"} bytes`",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"Number",
"(",
"remaining",
")",
")",
";",
"}",
"remainingSize",
"-=",
"BigInt",
"(",
"ChunkHeader64",
".",
"len",
")",
"+",
"sndPropHeader",
".",
"chunkSize",
";",
"debug",
"(",
"`Parsing sound-property-chunks, remainingSize=${",
"remainingSize",
"}`",
")",
";",
"}",
"if",
"(",
"this",
".",
"metadata",
".",
"format",
".",
"lossless",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfChannels",
"&&",
"this",
".",
"metadata",
".",
"format",
".",
"bitsPerSample",
")",
"{",
"const",
"bitrate",
"=",
"this",
".",
"metadata",
".",
"format",
".",
"sampleRate",
"*",
"this",
".",
"metadata",
".",
"format",
".",
"numberOfChannels",
"*",
"this",
".",
"metadata",
".",
"format",
".",
"bitsPerSample",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'bitrate'",
",",
"bitrate",
")",
";",
"}",
"}",
"private",
"async",
"handleChannelChunks",
"(",
"remainingSize",
")",
"{",
"debug",
"(",
"`Parsing channel-chunks, remainingSize=${",
"remainingSize",
"}`",
")",
";",
"const",
"channels",
"=",
"[",
"]",
";",
"while",
"(",
"remainingSize",
">=",
"FourCcToken",
".",
"len",
")",
"{",
"const",
"channelId",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"<",
"string",
">",
"(",
"FourCcToken",
")",
";",
"debug",
"(",
"`Channel[ID=${",
"channelId",
"}]`",
")",
";",
"channels",
".",
"push",
"(",
"channelId",
")",
";",
"remainingSize",
"-=",
"BigInt",
"(",
"FourCcToken",
".",
"len",
")",
";",
"}",
"debug",
"(",
"`Channels: ${",
"channels",
".",
"join",
"(",
"', '",
")",
"}`",
")",
";",
"return",
"channels",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
25258,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25258,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25258,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25253,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25258,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
102,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661858 | [
"import",
"{",
"DataType",
",",
"IContainerType",
"}",
"from",
"'./types'",
";",
"/**\n * Elements of document type description\n * Derived from https://github.com/tungol/EBML/blob/master/doctypes/matroska.dtd\n * Extended with:\n * https://www.matroska.org/technical/specs/index.html\n */",
"export",
"const",
"elements",
"=",
"{",
"0x1a45dfa3",
":",
"{",
"name",
":",
"'ebml'",
",",
"container",
":",
"{",
"0x4286",
":",
"{",
"name",
":",
"'ebmlVersion'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x42f7",
":",
"{",
"name",
":",
"'ebmlReadVersion'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x42f2",
":",
"{",
"name",
":",
"'ebmlMaxIDWidth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x42f3",
":",
"{",
"name",
":",
"'ebmlMaxSizeWidth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x4282",
":",
"{",
"name",
":",
"'docType'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4287",
":",
"{",
"name",
":",
"'docTypeVersion'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x4285",
":",
"{",
"name",
":",
"'docTypeReadVersion'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
",",
"0x18538067",
":",
"{",
"name",
":",
"'segment'",
",",
"container",
":",
"{",
"0x114d9b74",
":",
"{",
"name",
":",
"'seekHead'",
",",
"container",
":",
"{",
"0x4dbb",
":",
"{",
"name",
":",
"'seek'",
",",
"container",
":",
"{",
"0x53ab",
":",
"{",
"name",
":",
"'seekId'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x53ac",
":",
"{",
"name",
":",
"'seekPosition'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
"}",
"}",
",",
"0x1549a966",
":",
"{",
"name",
":",
"'info'",
",",
"container",
":",
"{",
"0x73a4",
":",
"{",
"name",
":",
"'uid'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x7384",
":",
"{",
"name",
":",
"'filename'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x3cb923",
":",
"{",
"name",
":",
"'prevUID'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x3c83ab",
":",
"{",
"name",
":",
"'prevFilename'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x3eb923",
":",
"{",
"name",
":",
"'nextUID'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x3e83bb",
":",
"{",
"name",
":",
"'nextFilename'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x2ad7b1",
":",
"{",
"name",
":",
"'timecodeScale'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x4489",
":",
"{",
"name",
":",
"'duration'",
",",
"value",
":",
"DataType",
".",
"float",
"}",
",",
"0x4461",
":",
"{",
"name",
":",
"'dateUTC'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x7ba9",
":",
"{",
"name",
":",
"'title'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4d80",
":",
"{",
"name",
":",
"'muxingApp'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x5741",
":",
"{",
"name",
":",
"'writingApp'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
"}",
"}",
",",
"0x1f43b675",
":",
"{",
"name",
":",
"'cluster'",
",",
"multiple",
":",
"true",
",",
"container",
":",
"{",
"0xe7",
":",
"{",
"name",
":",
"'timecode'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0xa3",
":",
"{",
"name",
":",
"'unknown'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0xa7",
":",
"{",
"name",
":",
"'position'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0xab",
":",
"{",
"name",
":",
"'prevSize'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
"}",
"}",
",",
"0x1654ae6b",
":",
"{",
"name",
":",
"'tracks'",
",",
"container",
":",
"{",
"0xae",
":",
"{",
"name",
":",
"'entries'",
",",
"multiple",
":",
"true",
",",
"container",
":",
"{",
"0xd7",
":",
"{",
"name",
":",
"'trackNumber'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x73c5",
":",
"{",
"name",
":",
"'uid'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x83",
":",
"{",
"name",
":",
"'trackType'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xb9",
":",
"{",
"name",
":",
"'flagEnabled'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x88",
":",
"{",
"name",
":",
"'flagDefault'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x55aa",
":",
"{",
"name",
":",
"'flagForced'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x9c",
":",
"{",
"name",
":",
"'flagLacing'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x6de7",
":",
"{",
"name",
":",
"'minCache'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x6de8",
":",
"{",
"name",
":",
"'maxCache'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x23e383",
":",
"{",
"name",
":",
"'defaultDuration'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x23314f",
":",
"{",
"name",
":",
"'timecodeScale'",
",",
"value",
":",
"DataType",
".",
"float",
"}",
",",
"0x536e",
":",
"{",
"name",
":",
"'name'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x22b59c",
":",
"{",
"name",
":",
"'language'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x86",
":",
"{",
"name",
":",
"'codecID'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x63a2",
":",
"{",
"name",
":",
"'codecPrivate'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x258688",
":",
"{",
"name",
":",
"'codecName'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x3a9697",
":",
"{",
"name",
":",
"'codecSettings'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x3b4040",
":",
"{",
"name",
":",
"'codecInfoUrl'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x26b240",
":",
"{",
"name",
":",
"'codecDownloadUrl'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0xaa",
":",
"{",
"name",
":",
"'codecDecodeAll'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x6fab",
":",
"{",
"name",
":",
"'trackOverlay'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xe0",
":",
"{",
"name",
":",
"'video'",
",",
"container",
":",
"{",
"0x9a",
":",
"{",
"name",
":",
"'flagInterlaced'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x53b8",
":",
"{",
"name",
":",
"'stereoMode'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xb0",
":",
"{",
"name",
":",
"'pixelWidth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xba",
":",
"{",
"name",
":",
"'pixelHeight'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x54b0",
":",
"{",
"name",
":",
"'displayWidth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x54ba",
":",
"{",
"name",
":",
"'displayHeight'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x54b3",
":",
"{",
"name",
":",
"'aspectRatioType'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x2eb524",
":",
"{",
"name",
":",
"'colourSpace'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x2fb523",
":",
"{",
"name",
":",
"'gammaValue'",
",",
"value",
":",
"DataType",
".",
"float",
"}",
"}",
"}",
",",
"0xe1",
":",
"{",
"name",
":",
"'audio'",
",",
"container",
":",
"{",
"0xb5",
":",
"{",
"name",
":",
"'samplingFrequency'",
",",
"value",
":",
"DataType",
".",
"float",
"}",
",",
"0x78b5",
":",
"{",
"name",
":",
"'outputSamplingFrequency'",
",",
"value",
":",
"DataType",
".",
"float",
"}",
",",
"0x9f",
":",
"{",
"name",
":",
"'channels'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x94",
":",
"{",
"name",
":",
"'channels'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x7d7b",
":",
"{",
"name",
":",
"'channelPositions'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x6264",
":",
"{",
"name",
":",
"'bitDepth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
",",
"0x6d80",
":",
"{",
"name",
":",
"'contentEncodings'",
",",
"container",
":",
"{",
"0x6240",
":",
"{",
"name",
":",
"'contentEncoding'",
",",
"container",
":",
"{",
"0x5031",
":",
"{",
"name",
":",
"'order'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x5032",
":",
"{",
"name",
":",
"'scope'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x5033",
":",
"{",
"name",
":",
"'type'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x5034",
":",
"{",
"name",
":",
"'contentEncoding'",
",",
"container",
":",
"{",
"0x4254",
":",
"{",
"name",
":",
"'contentCompAlgo'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x4255",
":",
"{",
"name",
":",
"'contentCompSettings'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
"}",
"}",
",",
"0x5035",
":",
"{",
"name",
":",
"'contentEncoding'",
",",
"container",
":",
"{",
"0x47e1",
":",
"{",
"name",
":",
"'contentEncAlgo'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x47e2",
":",
"{",
"name",
":",
"'contentEncKeyID'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x47e3",
":",
"{",
"name",
":",
"'contentSignature '",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x47e4",
":",
"{",
"name",
":",
"'ContentSigKeyID '",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x47e5",
":",
"{",
"name",
":",
"'contentSigAlgo '",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x47e6",
":",
"{",
"name",
":",
"'contentSigHashAlgo '",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
",",
"0x6264",
":",
"{",
"name",
":",
"'bitDepth'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
",",
"0x1c53bb6b",
":",
"{",
"name",
":",
"'cues'",
",",
"container",
":",
"{",
"0xbb",
":",
"{",
"name",
":",
"'cuePoint'",
",",
"container",
":",
"{",
"0xb3",
":",
"{",
"name",
":",
"'cueTime'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0xb7",
":",
"{",
"name",
":",
"'positions'",
",",
"container",
":",
"{",
"0xf7",
":",
"{",
"name",
":",
"'track'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xf1",
":",
"{",
"name",
":",
"'clusterPosition'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x5378",
":",
"{",
"name",
":",
"'blockNumber'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xea",
":",
"{",
"name",
":",
"'codecState'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xdb",
":",
"{",
"name",
":",
"'reference'",
",",
"container",
":",
"{",
"0x96",
":",
"{",
"name",
":",
"'time'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x97",
":",
"{",
"name",
":",
"'cluster'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x535f",
":",
"{",
"name",
":",
"'number'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0xeb",
":",
"{",
"name",
":",
"'codecState'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
",",
"0xf0",
":",
"{",
"name",
":",
"'relativePosition'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
",",
"0x1941a469",
":",
"{",
"name",
":",
"'attachments'",
",",
"container",
":",
"{",
"0x61a7",
":",
"{",
"name",
":",
"'attachedFiles'",
",",
"multiple",
":",
"true",
",",
"container",
":",
"{",
"0x467e",
":",
"{",
"name",
":",
"'description'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x466e",
":",
"{",
"name",
":",
"'name'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4660",
":",
"{",
"name",
":",
"'mimeType'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x465c",
":",
"{",
"name",
":",
"'data'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x46ae",
":",
"{",
"name",
":",
"'uid'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
"}",
"}",
"}",
"}",
",",
"0x1043a770",
":",
"{",
"name",
":",
"'chapters'",
",",
"container",
":",
"{",
"0x45b9",
":",
"{",
"name",
":",
"'editionEntry'",
",",
"container",
":",
"{",
"0xb6",
":",
"{",
"name",
":",
"'chapterAtom'",
",",
"container",
":",
"{",
"0x73c4",
":",
"{",
"name",
":",
"'uid'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x91",
":",
"{",
"name",
":",
"'timeStart'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x92",
":",
"{",
"name",
":",
"'timeEnd'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x98",
":",
"{",
"name",
":",
"'hidden'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
",",
"0x4598",
":",
"{",
"name",
":",
"'enabled'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x8f",
":",
"{",
"name",
":",
"'track'",
",",
"container",
":",
"{",
"0x89",
":",
"{",
"name",
":",
"'trackNumber'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x80",
":",
"{",
"name",
":",
"'display'",
",",
"container",
":",
"{",
"0x85",
":",
"{",
"name",
":",
"'string'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x437c",
":",
"{",
"name",
":",
"'language '",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x437e",
":",
"{",
"name",
":",
"'country '",
",",
"value",
":",
"DataType",
".",
"string",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
",",
"0x1254c367",
":",
"{",
"name",
":",
"'tags'",
",",
"container",
":",
"{",
"0x7373",
":",
"{",
"name",
":",
"'tag'",
",",
"multiple",
":",
"true",
",",
"container",
":",
"{",
"0x63c0",
":",
"{",
"name",
":",
"'target'",
",",
"container",
":",
"{",
"0x63c5",
":",
"{",
"name",
":",
"'tagTrackUID'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x63c4",
":",
"{",
"name",
":",
"'tagChapterUID'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x63c6",
":",
"{",
"name",
":",
"'tagAttachmentUID'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
",",
"0x63ca",
":",
"{",
"name",
":",
"'targetType'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x68ca",
":",
"{",
"name",
":",
"'targetTypeValue'",
",",
"value",
":",
"DataType",
".",
"uint",
"}",
",",
"0x63c9",
":",
"{",
"name",
":",
"'tagEditionUID'",
",",
"value",
":",
"DataType",
".",
"uid",
"}",
"}",
"}",
",",
"0x67c8",
":",
"{",
"name",
":",
"'simpleTags'",
",",
"multiple",
":",
"true",
",",
"container",
":",
"{",
"0x45a3",
":",
"{",
"name",
":",
"'name'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4487",
":",
"{",
"name",
":",
"'string'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4485",
":",
"{",
"name",
":",
"'binary'",
",",
"value",
":",
"DataType",
".",
"binary",
"}",
",",
"0x447a",
":",
"{",
"name",
":",
"'language'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x447b",
":",
"{",
"name",
":",
"'languageIETF'",
",",
"value",
":",
"DataType",
".",
"string",
"}",
",",
"0x4484",
":",
"{",
"name",
":",
"'default'",
",",
"value",
":",
"DataType",
".",
"bool",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49869,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661859 | [
"import",
"*",
"as",
"Token",
"from",
"'token-types'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"INativeMetadataCollector",
"}",
"from",
"'../common/MetadataCollector'",
";",
"import",
"{",
"IOptions",
",",
"ITrackInfo",
"}",
"from",
"'../type'",
";",
"import",
"{",
"ITokenParser",
"}",
"from",
"'../ParserFactory'",
";",
"import",
"{",
"BasicParser",
"}",
"from",
"'../common/BasicParser'",
";",
"import",
"{",
"DataType",
",",
"IContainerType",
",",
"IHeader",
",",
"IMatroskaDoc",
",",
"ITree",
",",
"TargetType",
",",
"TrackType",
"}",
"from",
"'./types'",
";",
"import",
"*",
"as",
"matroskaDtd",
"from",
"'./MatroskaDtd'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:matroska'",
")",
";",
"/**\n * Extensible Binary Meta Language (EBML) parser\n * https://en.wikipedia.org/wiki/Extensible_Binary_Meta_Language\n * http://matroska.sourceforge.net/technical/specs/rfc/index.html\n *\n * WEBM VP8 AUDIO FILE\n */",
"export",
"class",
"MatroskaParser",
"extends",
"BasicParser",
"{",
"private",
"padding",
":",
"number",
"=",
"0",
";",
"private",
"parserMap",
"=",
"new",
"Map",
"<",
"DataType",
",",
"(",
"e",
":",
"IHeader",
")",
"=>",
"Promise",
"<",
"any",
">",
">",
"(",
")",
";",
"private",
"ebmlMaxIDLength",
"=",
"4",
";",
"private",
"ebmlMaxSizeLength",
"=",
"8",
";",
"constructor",
"(",
")",
"{",
"super",
"(",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"uint",
",",
"e",
"=>",
"this",
".",
"readUint",
"(",
"e",
")",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"string",
",",
"e",
"=>",
"this",
".",
"readString",
"(",
"e",
")",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"binary",
",",
"e",
"=>",
"this",
".",
"readBuffer",
"(",
"e",
")",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"uid",
",",
"async",
"(",
"e",
")",
"=>",
"await",
"this",
".",
"readUint",
"(",
"e",
")",
"===",
"1",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"bool",
",",
"e",
"=>",
"this",
".",
"readFlag",
"(",
"e",
")",
")",
";",
"this",
".",
"parserMap",
".",
"set",
"(",
"DataType",
".",
"float",
",",
"e",
"=>",
"this",
".",
"readFloat",
"(",
"e",
")",
")",
";",
"}",
"param",
"{",
"INativeMetadataCollector",
"}",
"metadata",
"param",
"{",
"ITokenizer",
"}",
"tokenizer",
"param",
"{",
"IOptions",
"}",
"options",
"public",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
"{",
"super",
".",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
";",
"return",
"this",
";",
"}",
"public",
"async",
"parse",
"(",
")",
"{",
"const",
"matroska",
"=",
"await",
"this",
".",
"parseContainer",
"(",
"matroskaDtd",
".",
"elements",
",",
"this",
".",
"tokenizer",
".",
"fileInfo",
".",
"size",
",",
"[",
"]",
")",
"as",
"any",
"as",
"IMatroskaDoc",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'container'",
",",
"`EBML/${",
"matroska",
".",
"ebml",
".",
"docType",
"}`",
")",
";",
"if",
"(",
"matroska",
".",
"segment",
")",
"{",
"const",
"info",
"=",
"matroska",
".",
"segment",
".",
"info",
";",
"if",
"(",
"info",
")",
"{",
"const",
"timecodeScale",
"=",
"info",
".",
"timecodeScale",
"?",
"info",
".",
"timecodeScale",
":",
"1000000",
";",
"const",
"duration",
"=",
"info",
".",
"duration",
"*",
"timecodeScale",
"/",
"1000000000",
";",
"this",
".",
"addTag",
"(",
"'segment:title'",
",",
"info",
".",
"title",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'duration'",
",",
"duration",
")",
";",
"}",
"const",
"audioTracks",
"=",
"matroska",
".",
"segment",
".",
"tracks",
";",
"if",
"(",
"audioTracks",
"&&",
"audioTracks",
".",
"entries",
")",
"{",
"audioTracks",
".",
"entries",
".",
"forEach",
"(",
"entry",
"=>",
"{",
"const",
"stream",
"=",
"{",
"codecName",
":",
"entry",
".",
"codecID",
".",
"replace",
"(",
"'A_'",
",",
"''",
")",
".",
"replace",
"(",
"'V_'",
",",
"''",
")",
",",
"codecSettings",
":",
"entry",
".",
"codecSettings",
",",
"flagDefault",
":",
"entry",
".",
"flagDefault",
",",
"flagLacing",
":",
"entry",
".",
"flagLacing",
",",
"flagEnabled",
":",
"entry",
".",
"flagEnabled",
",",
"language",
":",
"entry",
".",
"language",
",",
"name",
":",
"entry",
".",
"name",
",",
"type",
":",
"entry",
".",
"trackType",
",",
"audio",
":",
"entry",
".",
"audio",
",",
"video",
":",
"entry",
".",
"video",
"}",
";",
"this",
".",
"metadata",
".",
"addStreamInfo",
"(",
"stream",
")",
";",
"}",
")",
";",
"const",
"audioTrack",
"=",
"audioTracks",
".",
"entries",
".",
"filter",
"(",
"entry",
"=>",
"{",
"return",
"entry",
".",
"trackType",
"===",
"TrackType",
".",
"audio",
".",
"valueOf",
"(",
")",
";",
"}",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"cur",
")",
"=>",
"{",
"if",
"(",
"!",
"acc",
")",
"{",
"return",
"cur",
";",
"}",
"if",
"(",
"!",
"acc",
".",
"flagDefault",
"&&",
"cur",
".",
"flagDefault",
")",
"{",
"return",
"cur",
";",
"}",
"if",
"(",
"cur",
".",
"trackNumber",
"&&",
"cur",
".",
"trackNumber",
"<",
"acc",
".",
"trackNumber",
")",
"{",
"return",
"cur",
";",
"}",
"return",
"acc",
";",
"}",
",",
"null",
")",
";",
"if",
"(",
"audioTrack",
")",
"{",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'codec'",
",",
"audioTrack",
".",
"codecID",
".",
"replace",
"(",
"'A_'",
",",
"''",
")",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'sampleRate'",
",",
"audioTrack",
".",
"audio",
".",
"samplingFrequency",
")",
";",
"this",
".",
"metadata",
".",
"setFormat",
"(",
"'numberOfChannels'",
",",
"audioTrack",
".",
"audio",
".",
"channels",
")",
";",
"}",
"if",
"(",
"matroska",
".",
"segment",
".",
"tags",
")",
"{",
"matroska",
".",
"segment",
".",
"tags",
".",
"tag",
".",
"forEach",
"(",
"tag",
"=>",
"{",
"const",
"target",
"=",
"tag",
".",
"target",
";",
"const",
"targetType",
"=",
"target",
".",
"targetTypeValue",
"?",
"TargetType",
"[",
"target",
".",
"targetTypeValue",
"]",
":",
"(",
"target",
".",
"targetType",
"?",
"target",
".",
"targetType",
":",
"'track'",
")",
";",
"tag",
".",
"simpleTags",
".",
"forEach",
"(",
"simpleTag",
"=>",
"{",
"const",
"value",
"=",
"simpleTag",
".",
"string",
"?",
"simpleTag",
".",
"string",
":",
"simpleTag",
".",
"binary",
";",
"this",
".",
"addTag",
"(",
"`${",
"targetType",
"}:${",
"simpleTag",
".",
"name",
"}`",
",",
"value",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
"if",
"(",
"matroska",
".",
"segment",
".",
"attachments",
")",
"{",
"matroska",
".",
"segment",
".",
"attachments",
".",
"attachedFiles",
".",
"filter",
"(",
"file",
"=>",
"file",
".",
"mimeType",
".",
"startsWith",
"(",
"'image/'",
")",
")",
".",
"map",
"(",
"file",
"=>",
"{",
"return",
"{",
"data",
":",
"file",
".",
"data",
",",
"format",
":",
"file",
".",
"mimeType",
",",
"description",
":",
"file",
".",
"description",
",",
"name",
":",
"file",
".",
"name",
"}",
";",
"}",
")",
".",
"forEach",
"(",
"picture",
"=>",
"{",
"this",
".",
"addTag",
"(",
"'picture'",
",",
"picture",
")",
";",
"}",
")",
";",
"}",
"}",
"}",
"}",
"private",
"async",
"parseContainer",
"(",
"container",
",",
"posDone",
",",
"path",
")",
"{",
"const",
"tree",
"=",
"{",
"}",
";",
"while",
"(",
"this",
".",
"tokenizer",
".",
"position",
"<",
"posDone",
")",
"{",
"let",
"element",
";",
"try",
"{",
"element",
"=",
"await",
"this",
".",
"readElement",
"(",
")",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"if",
"(",
"error",
".",
"message",
"===",
"'End-Of-Stream'",
")",
"{",
"break",
";",
"}",
"throw",
"error",
";",
"}",
"const",
"type",
"=",
"container",
"[",
"element",
".",
"id",
"]",
";",
"if",
"(",
"type",
")",
"{",
"debug",
"(",
"`Element: name=${",
"type",
".",
"name",
"}, container=${",
"!",
"!",
"type",
".",
"container",
"}`",
")",
";",
"if",
"(",
"type",
".",
"container",
")",
"{",
"const",
"res",
"=",
"await",
"this",
".",
"parseContainer",
"(",
"type",
".",
"container",
",",
"element",
".",
"len",
">=",
"0",
"?",
"this",
".",
"tokenizer",
".",
"position",
"+",
"element",
".",
"len",
":",
"-",
"1",
",",
"path",
".",
"concat",
"(",
"[",
"type",
".",
"name",
"]",
")",
")",
";",
"if",
"(",
"type",
".",
"multiple",
")",
"{",
"if",
"(",
"!",
"tree",
"[",
"type",
".",
"name",
"]",
")",
"{",
"tree",
"[",
"type",
".",
"name",
"]",
"=",
"[",
"]",
";",
"}",
"(",
"tree",
"[",
"type",
".",
"name",
"]",
"as",
"ITree",
"[",
"]",
")",
".",
"push",
"(",
"res",
")",
";",
"}",
"else",
"{",
"tree",
"[",
"type",
".",
"name",
"]",
"=",
"res",
";",
"}",
"}",
"else",
"{",
"tree",
"[",
"type",
".",
"name",
"]",
"=",
"await",
"this",
".",
"parserMap",
".",
"get",
"(",
"type",
".",
"value",
")",
"(",
"element",
")",
";",
"}",
"}",
"else",
"{",
"switch",
"(",
"element",
".",
"id",
")",
"{",
"case",
"0xec",
":",
"this",
".",
"padding",
"+=",
"element",
".",
"len",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"element",
".",
"len",
")",
";",
"break",
";",
"default",
":",
"debug",
"(",
"`parseEbml: path=${",
"path",
".",
"join",
"(",
"'/'",
")",
"}, unknown element: id=${",
"element",
".",
"id",
".",
"toString",
"(",
"16",
")",
"}`",
")",
";",
"this",
".",
"padding",
"+=",
"element",
".",
"len",
";",
"await",
"this",
".",
"tokenizer",
".",
"ignore",
"(",
"element",
".",
"len",
")",
";",
"}",
"}",
"}",
"return",
"tree",
";",
"}",
"private",
"async",
"readVintData",
"(",
"maxLength",
")",
"{",
"const",
"msb",
"=",
"await",
"this",
".",
"tokenizer",
".",
"peekNumber",
"(",
"Token",
".",
"UINT8",
")",
";",
"let",
"mask",
"=",
"0x80",
";",
"let",
"oc",
"=",
"1",
";",
"while",
"(",
"(",
"msb",
"&",
"mask",
")",
"===",
"0",
")",
"{",
"if",
"(",
"oc",
">",
"maxLength",
")",
"{",
"throw",
"new",
"Error",
"(",
"'VINT value exceeding maximum size'",
")",
";",
"}",
"++",
"oc",
";",
"mask",
">>=",
"1",
";",
"}",
"const",
"id",
"=",
"Buffer",
".",
"alloc",
"(",
"oc",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"id",
")",
";",
"return",
"id",
";",
"}",
"private",
"async",
"readElement",
"(",
")",
"{",
"const",
"id",
"=",
"await",
"this",
".",
"readVintData",
"(",
"this",
".",
"ebmlMaxIDLength",
")",
";",
"const",
"lenField",
"=",
"await",
"this",
".",
"readVintData",
"(",
"this",
".",
"ebmlMaxSizeLength",
")",
";",
"lenField",
"[",
"0",
"]",
"^=",
"0x80",
">>",
"(",
"lenField",
".",
"length",
"-",
"1",
")",
";",
"const",
"nrLen",
"=",
"Math",
".",
"min",
"(",
"6",
",",
"lenField",
".",
"length",
")",
";",
"return",
"{",
"id",
":",
"id",
".",
"readUIntBE",
"(",
"0",
",",
"id",
".",
"length",
")",
",",
"len",
":",
"lenField",
".",
"readUIntBE",
"(",
"lenField",
".",
"length",
"-",
"nrLen",
",",
"nrLen",
")",
"}",
";",
"}",
"private",
"isMaxValue",
"(",
"vintData",
")",
"{",
"if",
"(",
"vintData",
".",
"length",
"===",
"this",
".",
"ebmlMaxSizeLength",
")",
"{",
"for",
"(",
"let",
"n",
"=",
"1",
";",
"n",
"<",
"this",
".",
"ebmlMaxSizeLength",
";",
"++",
"n",
")",
"{",
"if",
"(",
"vintData",
"[",
"n",
"]",
"!==",
"0xff",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"private",
"async",
"readFloat",
"(",
"e",
")",
"{",
"switch",
"(",
"e",
".",
"len",
")",
"{",
"case",
"0",
":",
"return",
"0.0",
";",
"case",
"4",
":",
"return",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"Float32_BE",
")",
";",
"case",
"8",
":",
"return",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"Float64_BE",
")",
";",
"case",
"10",
":",
"return",
"this",
".",
"tokenizer",
".",
"readNumber",
"(",
"Token",
".",
"Float64_BE",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"`Invalid IEEE-754 float length: ${",
"e",
".",
"len",
"}`",
")",
";",
"}",
"}",
"private",
"async",
"readFlag",
"(",
"e",
")",
"{",
"return",
"(",
"await",
"this",
".",
"readUint",
"(",
"e",
")",
")",
"===",
"1",
";",
"}",
"private",
"async",
"readUint",
"(",
"e",
")",
"{",
"const",
"buf",
"=",
"await",
"this",
".",
"readBuffer",
"(",
"e",
")",
";",
"const",
"nrLen",
"=",
"Math",
".",
"min",
"(",
"6",
",",
"e",
".",
"len",
")",
";",
"return",
"buf",
".",
"readUIntBE",
"(",
"e",
".",
"len",
"-",
"nrLen",
",",
"nrLen",
")",
";",
"}",
"private",
"async",
"readString",
"(",
"e",
")",
"{",
"const",
"rawString",
"=",
"await",
"this",
".",
"tokenizer",
".",
"readToken",
"(",
"new",
"Token",
".",
"StringType",
"(",
"e",
".",
"len",
",",
"'utf-8'",
")",
")",
";",
"return",
"rawString",
".",
"replace",
"(",
"/\\00.*$/g",
",",
"''",
")",
";",
"}",
"private",
"async",
"readBuffer",
"(",
"e",
")",
"{",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"e",
".",
"len",
")",
";",
"await",
"this",
".",
"tokenizer",
".",
"readBuffer",
"(",
"buf",
")",
";",
"return",
"buf",
";",
"}",
"private",
"addTag",
"(",
"tagId",
",",
"value",
")",
"{",
"this",
".",
"metadata",
".",
"addTag",
"(",
"'matroska'",
",",
"tagId",
",",
"value",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20348,
null,
6865,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20350,
null,
null,
null,
20320,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20350,
null,
null,
null,
null,
null,
null,
null,
20350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20350,
null,
20350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1271,
null,
null,
null,
13067,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49870,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
49870,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
49869,
null,
3,
null,
5,
null,
null,
null,
3207,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3207,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
3,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2316,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2316,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2316,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2316,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661860 | [
"import",
"{",
"IOptions",
",",
"IAudioMetadata",
",",
"ParserType",
"}",
"from",
"'./type'",
";",
"import",
"{",
"ITokenizer",
"}",
"from",
"'strtok3/lib/core'",
";",
"import",
"*",
"as",
"FileType",
"from",
"'file-type/core'",
";",
"import",
"*",
"as",
"ContentType",
"from",
"'content-type'",
";",
"import",
"*",
"as",
"MimeType",
"from",
"'media-typer'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"INativeMetadataCollector",
",",
"MetadataCollector",
"}",
"from",
"'./common/MetadataCollector'",
";",
"import",
"{",
"AIFFParser",
"}",
"from",
"'./aiff/AiffParser'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'./apev2/APEv2Parser'",
";",
"import",
"{",
"AsfParser",
"}",
"from",
"'./asf/AsfParser'",
";",
"import",
"{",
"FlacParser",
"}",
"from",
"'./flac/FlacParser'",
";",
"import",
"{",
"MP4Parser",
"}",
"from",
"'./mp4/MP4Parser'",
";",
"import",
"{",
"MpegParser",
"}",
"from",
"'./mpeg/MpegParser'",
";",
"import",
"MusepackParser",
"from",
"'./musepack'",
";",
"import",
"{",
"OggParser",
"}",
"from",
"'./ogg/OggParser'",
";",
"import",
"{",
"WaveParser",
"}",
"from",
"'./wav/WaveParser'",
";",
"import",
"{",
"WavPackParser",
"}",
"from",
"'./wavpack/WavPackParser'",
";",
"import",
"{",
"DsfParser",
"}",
"from",
"'./dsf/DsfParser'",
";",
"import",
"{",
"DsdiffParser",
"}",
"from",
"'./dsdiff/DsdiffParser'",
";",
"import",
"{",
"MatroskaParser",
"}",
"from",
"'./matroska/MatroskaParser'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"'music-metadata:parser:factory'",
")",
";",
"export",
"interface",
"ITokenParser",
"{",
"param",
"metadata",
"param",
"tokenizer",
"param",
"options",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"options",
")",
":",
"ITokenParser",
";",
"returns",
"parse",
"(",
")",
":",
"Promise",
"<",
"void",
">",
";",
"}",
"export",
"function",
"parseHttpContentType",
"(",
"contentType",
")",
"{",
"const",
"type",
"=",
"ContentType",
".",
"parse",
"(",
"contentType",
")",
";",
"const",
"mime",
"=",
"MimeType",
".",
"parse",
"(",
"type",
".",
"type",
")",
";",
"return",
"{",
"type",
":",
"mime",
".",
"type",
",",
"subtype",
":",
"mime",
".",
"subtype",
",",
"suffix",
":",
"mime",
".",
"suffix",
",",
"parameters",
":",
"type",
".",
"parameters",
"}",
";",
"}",
"export",
"class",
"ParserFactory",
"{",
"param",
"tokenizer",
"param",
"opts",
"returns",
"public",
"static",
"async",
"parseOnContentType",
"(",
"tokenizer",
",",
"opts",
")",
"{",
"const",
"{",
"mimeType",
",",
"path",
",",
"url",
"}",
"=",
"await",
"tokenizer",
".",
"fileInfo",
";",
"const",
"parserId",
"=",
"ParserFactory",
".",
"getParserIdForMimeType",
"(",
"mimeType",
")",
"||",
"ParserFactory",
".",
"getParserIdForExtension",
"(",
"path",
")",
"||",
"ParserFactory",
".",
"getParserIdForExtension",
"(",
"url",
")",
";",
"if",
"(",
"!",
"parserId",
")",
"{",
"debug",
"(",
"'No parser found for MIME-type / extension: '",
"+",
"mimeType",
")",
";",
"}",
"return",
"this",
".",
"parse",
"(",
"tokenizer",
",",
"parserId",
",",
"opts",
")",
";",
"}",
"public",
"static",
"async",
"parse",
"(",
"tokenizer",
",",
"parserId",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"parserId",
")",
"{",
"debug",
"(",
"'Guess parser on content...'",
")",
";",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"4100",
")",
";",
"await",
"tokenizer",
".",
"peekBuffer",
"(",
"buf",
",",
"{",
"mayBeLess",
":",
"true",
"}",
")",
";",
"if",
"(",
"tokenizer",
".",
"fileInfo",
".",
"path",
")",
"{",
"parserId",
"=",
"this",
".",
"getParserIdForExtension",
"(",
"tokenizer",
".",
"fileInfo",
".",
"path",
")",
";",
"}",
"if",
"(",
"!",
"parserId",
")",
"{",
"const",
"guessedType",
"=",
"await",
"FileType",
".",
"fromBuffer",
"(",
"buf",
")",
";",
"if",
"(",
"!",
"guessedType",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Failed to determine audio format'",
")",
";",
"}",
"debug",
"(",
"`Guessed file type is mime=${",
"guessedType",
".",
"mime",
"}, extension=${",
"guessedType",
".",
"ext",
"}`",
")",
";",
"parserId",
"=",
"ParserFactory",
".",
"getParserIdForMimeType",
"(",
"guessedType",
".",
"mime",
")",
";",
"if",
"(",
"!",
"parserId",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Guessed MIME-type not supported: '",
"+",
"guessedType",
".",
"mime",
")",
";",
"}",
"}",
"}",
"return",
"this",
".",
"_parse",
"(",
"tokenizer",
",",
"parserId",
",",
"opts",
")",
";",
"}",
"param",
"filePath",
"return",
"public",
"static",
"getParserIdForExtension",
"(",
"filePath",
")",
"{",
"if",
"(",
"!",
"filePath",
")",
"return",
";",
"const",
"extension",
"=",
"this",
".",
"getExtension",
"(",
"filePath",
")",
".",
"toLocaleLowerCase",
"(",
")",
"||",
"filePath",
";",
"switch",
"(",
"extension",
")",
"{",
"case",
"'.mp2'",
":",
"case",
"'.mp3'",
":",
"case",
"'.m2a'",
":",
"case",
"'.aac'",
":",
"return",
"'mpeg'",
";",
"case",
"'.ape'",
":",
"return",
"'apev2'",
";",
"case",
"'.mp4'",
":",
"case",
"'.m4a'",
":",
"case",
"'.m4b'",
":",
"case",
"'.m4pa'",
":",
"case",
"'.m4v'",
":",
"case",
"'.m4r'",
":",
"case",
"'.3gp'",
":",
"return",
"'mp4'",
";",
"case",
"'.wma'",
":",
"case",
"'.wmv'",
":",
"case",
"'.asf'",
":",
"return",
"'asf'",
";",
"case",
"'.flac'",
":",
"return",
"'flac'",
";",
"case",
"'.ogg'",
":",
"case",
"'.ogv'",
":",
"case",
"'.oga'",
":",
"case",
"'.ogm'",
":",
"case",
"'.ogx'",
":",
"case",
"'.opus'",
":",
"case",
"'.spx'",
":",
"return",
"'ogg'",
";",
"case",
"'.aif'",
":",
"case",
"'.aiff'",
":",
"case",
"'.aifc'",
":",
"return",
"'aiff'",
";",
"case",
"'.wav'",
":",
"return",
"'riff'",
";",
"case",
"'.wv'",
":",
"case",
"'.wvp'",
":",
"return",
"'wavpack'",
";",
"case",
"'.mpc'",
":",
"return",
"'musepack'",
";",
"case",
"'.dsf'",
":",
"return",
"'dsf'",
";",
"case",
"'.dff'",
":",
"return",
"'dsdiff'",
";",
"case",
"'.mka'",
":",
"case",
"'.mkv'",
":",
"case",
"'.mk3d'",
":",
"case",
"'.mks'",
":",
"case",
"'.webm'",
":",
"return",
"'matroska'",
";",
"}",
"}",
"public",
"static",
"async",
"loadParser",
"(",
"moduleName",
")",
"{",
"switch",
"(",
"moduleName",
")",
"{",
"case",
"'aiff'",
":",
"return",
"new",
"AIFFParser",
"(",
")",
";",
"case",
"'adts'",
":",
"case",
"'mpeg'",
":",
"return",
"new",
"MpegParser",
"(",
")",
";",
"case",
"'apev2'",
":",
"return",
"new",
"APEv2Parser",
"(",
")",
";",
"case",
"'asf'",
":",
"return",
"new",
"AsfParser",
"(",
")",
";",
"case",
"'dsf'",
":",
"return",
"new",
"DsfParser",
"(",
")",
";",
"case",
"'dsdiff'",
":",
"return",
"new",
"DsdiffParser",
"(",
")",
";",
"case",
"'flac'",
":",
"return",
"new",
"FlacParser",
"(",
")",
";",
"case",
"'mp4'",
":",
"return",
"new",
"MP4Parser",
"(",
")",
";",
"case",
"'musepack'",
":",
"return",
"new",
"MusepackParser",
"(",
")",
";",
"case",
"'ogg'",
":",
"return",
"new",
"OggParser",
"(",
")",
";",
"case",
"'riff'",
":",
"return",
"new",
"WaveParser",
"(",
")",
";",
"case",
"'wavpack'",
":",
"return",
"new",
"WavPackParser",
"(",
")",
";",
"case",
"'matroska'",
":",
"return",
"new",
"MatroskaParser",
"(",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"`Unknown parser type: ${",
"moduleName",
"}`",
")",
";",
"}",
"}",
"private",
"static",
"async",
"_parse",
"(",
"tokenizer",
",",
"parserId",
",",
"opts",
"=",
"{",
"}",
")",
"{",
"const",
"parser",
"=",
"await",
"ParserFactory",
".",
"loadParser",
"(",
"parserId",
")",
";",
"const",
"metadata",
"=",
"new",
"MetadataCollector",
"(",
"opts",
")",
";",
"await",
"parser",
".",
"init",
"(",
"metadata",
",",
"tokenizer",
",",
"opts",
")",
".",
"parse",
"(",
")",
";",
"return",
"metadata",
".",
"toCommonMetadata",
"(",
")",
";",
"}",
"private",
"static",
"getExtension",
"(",
"fname",
")",
"{",
"const",
"i",
"=",
"fname",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"return",
"i",
"===",
"-",
"1",
"?",
"''",
":",
"fname",
".",
"slice",
"(",
"i",
")",
";",
"}",
"param",
"httpContentType",
"returns",
"private",
"static",
"getParserIdForMimeType",
"(",
"httpContentType",
")",
"{",
"let",
"mime",
";",
"try",
"{",
"mime",
"=",
"parseHttpContentType",
"(",
"httpContentType",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"debug",
"(",
"`Invalid HTTP Content-Type header value: ${",
"httpContentType",
"}`",
")",
";",
"return",
";",
"}",
"const",
"subType",
"=",
"mime",
".",
"subtype",
".",
"indexOf",
"(",
"'x-'",
")",
"===",
"0",
"?",
"mime",
".",
"subtype",
".",
"substring",
"(",
"2",
")",
":",
"mime",
".",
"subtype",
";",
"switch",
"(",
"mime",
".",
"type",
")",
"{",
"case",
"'audio'",
":",
"switch",
"(",
"subType",
")",
"{",
"case",
"'mp3'",
":",
"case",
"'mpeg'",
":",
"return",
"'mpeg'",
";",
"case",
"'aac'",
":",
"case",
"'aacp'",
":",
"return",
"'adts'",
";",
"case",
"'flac'",
":",
"return",
"'flac'",
";",
"case",
"'ape'",
":",
"case",
"'monkeys-audio'",
":",
"return",
"'apev2'",
";",
"case",
"'mp4'",
":",
"case",
"'m4a'",
":",
"return",
"'mp4'",
";",
"case",
"'ogg'",
":",
"case",
"'opus'",
":",
"case",
"'speex'",
":",
"return",
"'ogg'",
";",
"case",
"'ms-wma'",
":",
"case",
"'ms-wmv'",
":",
"case",
"'ms-asf'",
":",
"return",
"'asf'",
";",
"case",
"'aiff'",
":",
"case",
"'aif'",
":",
"case",
"'aifc'",
":",
"return",
"'aiff'",
";",
"case",
"'vnd.wave'",
":",
"case",
"'wav'",
":",
"case",
"'wave'",
":",
"return",
"'riff'",
";",
"case",
"'wavpack'",
":",
"return",
"'wavpack'",
";",
"case",
"'musepack'",
":",
"return",
"'musepack'",
";",
"case",
"'matroska'",
":",
"case",
"'webm'",
":",
"return",
"'matroska'",
";",
"case",
"'dsf'",
":",
"return",
"'dsf'",
";",
"}",
"break",
";",
"case",
"'video'",
":",
"switch",
"(",
"subType",
")",
"{",
"case",
"'ms-asf'",
":",
"case",
"'ms-wmv'",
":",
"return",
"'asf'",
";",
"case",
"'m4v'",
":",
"case",
"'mp4'",
":",
"return",
"'mp4'",
";",
"case",
"'ogg'",
":",
"return",
"'ogg'",
";",
"case",
"'matroska'",
":",
"case",
"'webm'",
":",
"return",
"'matroska'",
";",
"}",
"break",
";",
"case",
"'application'",
":",
"switch",
"(",
"subType",
")",
"{",
"case",
"'vnd.ms-asf'",
":",
"return",
"'asf'",
";",
"case",
"'ogg'",
":",
"return",
"'ogg'",
";",
"}",
"break",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6865,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12882,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
12882,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7555,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12882,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
12882,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
4277,
null,
12882,
null,
630,
null,
null,
null,
null,
null,
null,
20348,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12882,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661861 | [
"import",
"{",
"IRandomReader",
"}",
"from",
"'../type'",
";",
"/**\n * Provides abstract Uint8Array access via the IRandomRead interface\n */",
"export",
"class",
"RandomUint8ArrayReader",
"implements",
"IRandomReader",
"{",
"public",
"readonly",
"fileSize",
":",
"number",
";",
"constructor",
"(",
"private",
"readonly",
"uint8Array",
")",
"{",
"this",
".",
"fileSize",
"=",
"uint8Array",
".",
"length",
";",
"}",
"param",
"uint8Array",
"param",
"offset",
"param",
"length",
"param",
"position",
"return",
"public",
"async",
"randomRead",
"(",
"uint8Array",
",",
"offset",
",",
"length",
",",
"position",
")",
"{",
"uint8Array",
".",
"set",
"(",
"this",
".",
"uint8Array",
".",
"subarray",
"(",
"position",
",",
"position",
"+",
"length",
")",
",",
"offset",
")",
";",
"return",
"length",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
29,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661862 | [
"import",
"{",
"IRandomReader",
"}",
"from",
"'../type'",
";",
"export",
"const",
"endTag2",
"=",
"'LYRICS200'",
";",
"export",
"async",
"function",
"getLyricsHeaderLength",
"(",
"reader",
")",
"{",
"if",
"(",
"reader",
".",
"fileSize",
">=",
"143",
")",
"{",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"15",
")",
";",
"await",
"reader",
".",
"randomRead",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"length",
",",
"reader",
".",
"fileSize",
"-",
"143",
")",
";",
"const",
"txt",
"=",
"buf",
".",
"toString",
"(",
"'binary'",
")",
";",
"const",
"tag",
"=",
"txt",
".",
"substr",
"(",
"6",
")",
";",
"if",
"(",
"tag",
"===",
"endTag2",
")",
"{",
"return",
"parseInt",
"(",
"txt",
".",
"substr",
"(",
"0",
",",
"6",
")",
",",
"10",
")",
"+",
"15",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
7,
null,
25250,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661863 | [
"import",
"{",
"Readable",
"}",
"from",
"'stream'",
";",
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3/lib/core'",
";",
"import",
"{",
"ParserFactory",
"}",
"from",
"'./ParserFactory'",
";",
"import",
"{",
"IAudioMetadata",
",",
"INativeTagDict",
",",
"IOptions",
",",
"IPicture",
",",
"IPrivateOptions",
",",
"IRandomReader",
",",
"ITag",
"}",
"from",
"'./type'",
";",
"import",
"{",
"RandomUint8ArrayReader",
"}",
"from",
"'./common/RandomUint8ArrayReader'",
";",
"import",
"{",
"APEv2Parser",
"}",
"from",
"'./apev2/APEv2Parser'",
";",
"import",
"{",
"hasID3v1Header",
"}",
"from",
"'./id3v1/ID3v1Parser'",
";",
"import",
"{",
"getLyricsHeaderLength",
"}",
"from",
"'./lyrics3/Lyrics3'",
";",
"export",
"{",
"IFileInfo",
"}",
"from",
"'strtok3/lib/core'",
";",
"param",
"stream",
"param",
"options",
"param",
"fileInfo",
"returns",
"export",
"function",
"parseStream",
"(",
"stream",
",",
"fileInfo",
"?",
",",
"options",
"=",
"{",
"}",
")",
"{",
"return",
"parseFromTokenizer",
"(",
"strtok3",
".",
"fromStream",
"(",
"stream",
",",
"typeof",
"fileInfo",
"===",
"'string'",
"?",
"{",
"mimeType",
":",
"fileInfo",
"}",
":",
"fileInfo",
")",
",",
"options",
")",
";",
"}",
"param",
"uint8Array",
"param",
"fileInfo",
"param",
"options",
"returns",
"export",
"async",
"function",
"parseBuffer",
"(",
"uint8Array",
",",
"fileInfo",
"?",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"bufferReader",
"=",
"new",
"RandomUint8ArrayReader",
"(",
"uint8Array",
")",
";",
"await",
"scanAppendingHeaders",
"(",
"bufferReader",
",",
"options",
")",
";",
"const",
"tokenizer",
"=",
"strtok3",
".",
"fromBuffer",
"(",
"uint8Array",
",",
"typeof",
"fileInfo",
"===",
"'string'",
"?",
"{",
"mimeType",
":",
"fileInfo",
"}",
":",
"fileInfo",
")",
";",
"return",
"parseFromTokenizer",
"(",
"tokenizer",
",",
"options",
")",
";",
"}",
"param",
"tokenizer",
"param",
"options",
"returns",
"export",
"function",
"parseFromTokenizer",
"(",
"tokenizer",
",",
"options",
"?",
")",
"{",
"return",
"ParserFactory",
".",
"parseOnContentType",
"(",
"tokenizer",
",",
"options",
")",
";",
"}",
"param",
"nativeTags",
"returns",
"export",
"function",
"orderTags",
"(",
"nativeTags",
")",
"{",
"const",
"tags",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"tag",
"of",
"nativeTags",
")",
"{",
"(",
"tags",
"[",
"tag",
".",
"id",
"]",
"=",
"(",
"tags",
"[",
"tag",
".",
"id",
"]",
"||",
"[",
"]",
")",
")",
".",
"push",
"(",
"tag",
".",
"value",
")",
";",
"}",
"return",
"tags",
";",
"}",
"param",
"rating",
"returns",
"export",
"function",
"ratingToStars",
"(",
"rating",
")",
"{",
"return",
"rating",
"===",
"undefined",
"?",
"0",
":",
"1",
"+",
"Math",
".",
"round",
"(",
"rating",
"*",
"4",
")",
";",
"}",
"param",
"pictures",
"return",
"export",
"function",
"selectCover",
"(",
"pictures",
"?",
")",
"{",
"return",
"pictures",
"?",
"pictures",
".",
"reduce",
"(",
"(",
"acc",
",",
"cur",
")",
"=>",
"{",
"if",
"(",
"cur",
".",
"name",
"&&",
"cur",
".",
"name",
".",
"toLowerCase",
"(",
")",
"in",
"[",
"'front'",
",",
"'cover'",
",",
"'cover (front)'",
"]",
")",
"return",
"cur",
";",
"return",
"acc",
";",
"}",
")",
":",
"null",
";",
"}",
"export",
"async",
"function",
"scanAppendingHeaders",
"(",
"randomReader",
",",
"options",
"=",
"{",
"}",
")",
"{",
"let",
"apeOffset",
"=",
"randomReader",
".",
"fileSize",
";",
"if",
"(",
"await",
"hasID3v1Header",
"(",
"randomReader",
")",
")",
"{",
"apeOffset",
"-=",
"128",
";",
"const",
"lyricsLen",
"=",
"await",
"getLyricsHeaderLength",
"(",
"randomReader",
")",
";",
"apeOffset",
"-=",
"lyricsLen",
";",
"}",
"options",
".",
"apeHeader",
"=",
"await",
"APEv2Parser",
".",
"findApeFooterOffset",
"(",
"randomReader",
",",
"apeOffset",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
357,
null,
null,
null,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
29,
null,
null,
null,
null,
630,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25253,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
49851,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
22604,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
1271,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
11507,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25250,
null,
0,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661864 | [
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"{",
"IRandomReader",
"}",
"from",
"'../type'",
";",
"/**\n * Provides abstract file access via the IRandomRead interface\n */",
"export",
"class",
"RandomFileReader",
"implements",
"IRandomReader",
"{",
"private",
"readonly",
"fd",
":",
"number",
";",
"constructor",
"(",
"filePath",
",",
"public",
"fileSize",
")",
"{",
"this",
".",
"fd",
"=",
"fs",
".",
"openSync",
"(",
"filePath",
",",
"'r'",
")",
";",
"}",
"param",
"buffer",
"{",
"Buffer",
"}",
"param",
"offset",
"{",
"number",
"}",
"param",
"length",
"{",
"number",
"}",
"param",
"position",
"{",
"number",
"}",
"return",
"{",
"Promise",
"<",
"number",
">",
"}",
"public",
"randomRead",
"(",
"buffer",
",",
"offset",
",",
"length",
",",
"position",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"read",
"(",
"this",
".",
"fd",
",",
"buffer",
",",
"offset",
",",
"length",
",",
"position",
",",
"(",
"err",
",",
"bytesRead",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"reject",
"(",
"err",
")",
";",
"}",
"else",
"{",
"resolve",
"(",
"bytesRead",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}",
"public",
"close",
"(",
")",
"{",
"fs",
".",
"closeSync",
"(",
"this",
".",
"fd",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
12,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
4,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
243,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661865 | [
"import",
"*",
"as",
"Stream",
"from",
"'stream'",
";",
"import",
"*",
"as",
"strtok3",
"from",
"'strtok3'",
";",
"import",
"*",
"as",
"Core",
"from",
"'./core'",
";",
"import",
"{",
"ParserFactory",
"}",
"from",
"'./ParserFactory'",
";",
"import",
"{",
"IAudioMetadata",
",",
"IOptions",
"}",
"from",
"'./type'",
";",
"import",
"*",
"as",
"_debug",
"from",
"'debug'",
";",
"import",
"{",
"RandomFileReader",
"}",
"from",
"'./common/RandomFileReader'",
";",
"export",
"{",
"IAudioMetadata",
",",
"IOptions",
",",
"ITag",
",",
"INativeTagDict",
",",
"ICommonTagsResult",
",",
"IFormat",
",",
"IPicture",
",",
"IRatio",
",",
"IChapter",
"}",
"from",
"'./type'",
";",
"const",
"debug",
"=",
"_debug",
"(",
"\"music-metadata:parser\"",
")",
";",
"export",
"{",
"parseFromTokenizer",
",",
"parseBuffer",
",",
"IFileInfo",
",",
"selectCover",
"}",
"from",
"'./core'",
";",
"param",
"stream",
"param",
"fileInfo",
"param",
"options",
"returns",
"export",
"async",
"function",
"parseStream",
"(",
"stream",
",",
"fileInfo",
"?",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"tokenizer",
"=",
"await",
"strtok3",
".",
"fromStream",
"(",
"stream",
",",
"typeof",
"fileInfo",
"===",
"'string'",
"?",
"{",
"mimeType",
":",
"fileInfo",
"}",
":",
"fileInfo",
")",
";",
"return",
"Core",
".",
"parseFromTokenizer",
"(",
"tokenizer",
",",
"options",
")",
";",
"}",
"param",
"filePath",
"param",
"options",
"returns",
"export",
"async",
"function",
"parseFile",
"(",
"filePath",
",",
"options",
"=",
"{",
"}",
")",
"{",
"debug",
"(",
"`parseFile: ${",
"filePath",
"}`",
")",
";",
"const",
"fileTokenizer",
"=",
"await",
"strtok3",
".",
"fromFile",
"(",
"filePath",
")",
";",
"const",
"fileReader",
"=",
"new",
"RandomFileReader",
"(",
"filePath",
",",
"fileTokenizer",
".",
"fileInfo",
".",
"size",
")",
";",
"try",
"{",
"await",
"Core",
".",
"scanAppendingHeaders",
"(",
"fileReader",
",",
"options",
")",
";",
"}",
"finally",
"{",
"fileReader",
".",
"close",
"(",
")",
";",
"}",
"try",
"{",
"const",
"parserName",
"=",
"ParserFactory",
".",
"getParserIdForExtension",
"(",
"filePath",
")",
";",
"if",
"(",
"!",
"parserName",
")",
"debug",
"(",
"' Parser could not be determined by file extension'",
")",
";",
"return",
"await",
"ParserFactory",
".",
"parse",
"(",
"fileTokenizer",
",",
"parserName",
",",
"options",
")",
";",
"}",
"finally",
"{",
"await",
"fileTokenizer",
".",
"close",
"(",
")",
";",
"}",
"}",
"param",
"nativeTags",
"returns",
"export",
"const",
"orderTags",
"=",
"Core",
".",
"orderTags",
";",
"param",
"rating",
"returns",
"export",
"const",
"ratingToStars",
"=",
"Core",
".",
"ratingToStars",
";",
"/**\n * Define default module exports\n */",
"export",
"default",
"{",
"parseStream",
",",
"parseFile",
",",
"parseFromTokenizer",
":",
"Core",
".",
"parseFromTokenizer",
",",
"parseBuffer",
":",
"Core",
".",
"parseBuffer",
",",
"selectCover",
":",
"Core",
".",
"selectCover",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
359,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
31035,
null,
null,
null,
null,
630,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12882,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661866 | [
"import",
"*",
"as",
"mm",
"from",
"'../../lib'",
";",
"import",
"*",
"as",
"util",
"from",
"'util'",
";",
"(",
"async",
"(",
")",
"=>",
"{",
"try",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"'../test/samples/MusicBrainz-multiartist [id3v2.4].V2.mp3'",
")",
";",
"console",
".",
"log",
"(",
"util",
".",
"inspect",
"(",
"metadata",
",",
"{",
"showHidden",
":",
"false",
",",
"depth",
":",
"null",
"}",
")",
")",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"console",
".",
"error",
"(",
"error",
".",
"message",
")",
";",
"}",
"}",
")",
"(",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661867 | [
"import",
"*",
"as",
"Stream",
"from",
"'stream'",
";",
"import",
"*",
"as",
"https",
"from",
"'https'",
";",
"import",
"*",
"as",
"http",
"from",
"'http'",
";",
"export",
"interface",
"IHttpResponse",
"{",
"headers",
":",
"{",
"[",
"id",
"]",
":",
"string",
";",
"}",
";",
"stream",
":",
"Stream",
".",
"Readable",
";",
"}",
"export",
"interface",
"IHttpClient",
"{",
"get",
":",
"(",
"url",
":",
"string",
")",
"=>",
"Promise",
"<",
"IHttpResponse",
">",
";",
"}",
"export",
"class",
"HttpClient",
"implements",
"IHttpClient",
"{",
"public",
"get",
"(",
"url",
")",
"{",
"return",
"new",
"Promise",
"<",
"IHttpResponse",
">",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"request",
"=",
"(",
"(",
"url",
".",
"startsWith",
"(",
"'https'",
")",
"?",
"https",
":",
"http",
")",
"as",
"typeof",
"http",
")",
".",
"get",
"(",
"url",
")",
";",
"request",
".",
"on",
"(",
"'response'",
",",
"resp",
"=>",
"{",
"resolve",
"(",
"{",
"headers",
":",
"resp",
".",
"headers",
"as",
"any",
",",
"stream",
":",
"resp",
"}",
")",
";",
"}",
")",
";",
"request",
".",
"on",
"(",
"'abort'",
",",
"(",
")",
"=>",
"{",
"reject",
"(",
"new",
"Error",
"(",
"'abort'",
")",
")",
";",
"}",
")",
";",
"request",
".",
"on",
"(",
"'error'",
",",
"err",
"=>",
"{",
"reject",
"(",
"err",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
4,
null,
null,
null,
null,
1148,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
300,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
25,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661868 | [
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"{",
"IAudioMetadata",
",",
"IOptions",
"}",
"from",
"'../lib/type'",
";",
"type",
"ParseFileMethod",
"=",
"(",
"filePath",
":",
"string",
",",
"mimeType",
"?",
":",
"string",
",",
"options",
"?",
":",
"IOptions",
")",
"=>",
"Promise",
"<",
"IAudioMetadata",
">",
";",
"interface",
"IParser",
"{",
"description",
":",
"string",
";",
"initParser",
":",
"ParseFileMethod",
";",
"}",
"/**\n * Helps looping through different input styles\n */",
"export",
"const",
"Parsers",
"=",
"[",
"{",
"description",
":",
"'parseFile'",
",",
"initParser",
":",
"(",
"filePath",
",",
"mimeType",
"?",
",",
"options",
"?",
")",
"=>",
"{",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"options",
")",
";",
"}",
"}",
",",
"{",
"description",
":",
"'parseStream'",
",",
"initParser",
":",
"(",
"filePath",
",",
"mimeType",
"?",
",",
"options",
"?",
")",
"=>",
"{",
"const",
"stream",
"=",
"fs",
".",
"createReadStream",
"(",
"filePath",
")",
";",
"return",
"mm",
".",
"parseStream",
"(",
"stream",
",",
"{",
"mimeType",
"}",
",",
"options",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"stream",
".",
"close",
"(",
")",
";",
"return",
"metadata",
";",
"}",
")",
";",
"}",
"}",
",",
"{",
"description",
":",
"'parseBuffer'",
",",
"initParser",
":",
"(",
"filePath",
",",
"mimeType",
"?",
",",
"options",
"?",
")",
"=>",
"{",
"const",
"buffer",
"=",
"fs",
".",
"readFileSync",
"(",
"filePath",
")",
";",
"const",
"array",
"=",
"new",
"Uint8Array",
"(",
"buffer",
")",
";",
"return",
"mm",
".",
"parseBuffer",
"(",
"array",
",",
"{",
"mimeType",
"}",
",",
"options",
")",
";",
"}",
"}",
"]",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
630,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
630,
null,
null,
null,
null,
null,
1027,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
630,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661869 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"describe",
"(",
"'Asynchronous observer updates'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"flacFilePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'flac.flac'",
")",
";",
"it",
"(",
"'decode a FLAC audio file'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"eventTags",
"=",
"[",
"]",
";",
"await",
"mm",
".",
"parseFile",
"(",
"flacFilePath",
",",
"{",
"observer",
":",
"(",
"event",
"=>",
"{",
"eventTags",
".",
"push",
"(",
"event",
".",
"tag",
")",
";",
"switch",
"(",
"typeof",
"event",
".",
"tag",
".",
"value",
")",
"{",
"case",
"'number'",
":",
"case",
"'string'",
":",
"case",
"'boolean'",
":",
"break",
";",
"default",
":",
"event",
".",
"tag",
".",
"value",
"=",
"null",
";",
"}",
"}",
")",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"eventTags",
",",
"[",
"{",
"id",
":",
"'container'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"'FLAC'",
"}",
",",
"{",
"id",
":",
"'codec'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"'FLAC'",
"}",
",",
"{",
"id",
":",
"'lossless'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"true",
"}",
",",
"{",
"id",
":",
"'numberOfChannels'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"2",
"}",
",",
"{",
"id",
":",
"'bitsPerSample'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"16",
"}",
",",
"{",
"id",
":",
"'sampleRate'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"44100",
"}",
",",
"{",
"id",
":",
"'duration'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"271.7733333333333",
"}",
",",
"{",
"id",
":",
"'album'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'Congratulations'",
"}",
",",
"{",
"id",
":",
"'artists'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'MGMT'",
"}",
",",
"{",
"id",
":",
"'artist'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'MGMT'",
"}",
",",
"{",
"id",
":",
"'comment'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'EAC-Secure Mode=should ignore equal sign'",
"}",
",",
"{",
"id",
":",
"'genre'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'Alt. Rock'",
"}",
",",
"{",
"id",
":",
"'title'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'Brian Eno'",
"}",
",",
"{",
"id",
":",
"'date'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"'2010'",
"}",
",",
"{",
"id",
":",
"'picture'",
",",
"type",
":",
"'common'",
",",
"value",
":",
"null",
"}",
",",
"{",
"id",
":",
"'bitrate'",
",",
"type",
":",
"'format'",
",",
"value",
":",
"3529.912181720061",
"}",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661870 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"/**\n * Ensure the mapping of native comment field to the common comment field is done correctly\n * Ref: https://github.com/Borewit/music-metadata/issues/50\n */",
"describe",
"(",
"\"Mapping of common comment tag\"",
",",
"(",
")",
"=>",
"{",
"const",
"samples",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"describe",
"(",
"\"Vorbis\"",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"\"FLAC/Vorbis\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.flac\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"should map ogg/Vorbis\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.ogg\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"\"APEv2 header\"",
",",
"async",
"(",
")",
"=>",
"{",
"it",
"(",
"\"Monkey's Audio / APEv2\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.ape\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"WavPack / APEv2\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"'wavpack'",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.wv\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"\"ID3v2.3 header\"",
",",
"async",
"(",
")",
"=>",
"{",
"it",
"(",
"\"MP3 / ID3v2.3\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer [id3v2.3].V2.mp3\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"RIFF/WAVE/PCM / ID3v2.3\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer [id3v2.3].wav\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"\"ID3v2.4 header\"",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"\"MP3/ID3v2.4 header\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"\"MusicBrainz - Beth Hart - Sinner's Prayer [id3v2.4].V2.mp3\"",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"should parse AIFF/ID3v2.4 audio file\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer [id3v2.4].aiff\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"\"should map M4A / (Apple) iTunes header\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.m4a\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Medieval CUE Splitter (www.medieval.it)\"",
",",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"should map WMA/ASF header\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samples",
",",
"\"MusicBrainz - Beth Hart - Sinner's Prayer.wma\"",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"\"Test 123\"",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661871 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"{",
"commonTags",
",",
"isSingleton",
"}",
"from",
"'../lib/common/GenericTagTypes'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"{",
"CombinedTagMapper",
"}",
"from",
"'../lib/common/CombinedTagMapper'",
";",
"import",
"{",
"joinArtists",
"}",
"from",
"'../lib/common/MetadataCollector'",
";",
"import",
"{",
"parseHttpContentType",
"}",
"from",
"'../lib/ParserFactory'",
";",
"describe",
"(",
"'GenericTagMap'",
",",
"(",
")",
"=>",
"{",
"const",
"combinedTagMapper",
"=",
"new",
"CombinedTagMapper",
"(",
")",
";",
"it",
"(",
"'Check if each native tag, is mapped to a valid common type'",
",",
"(",
")",
"=>",
"{",
"assert",
".",
"isDefined",
"(",
"commonTags",
")",
";",
"for",
"(",
"const",
"nativeType",
"in",
"combinedTagMapper",
".",
"tagMappers",
")",
"{",
"const",
"tagMapper",
"=",
"combinedTagMapper",
".",
"tagMappers",
"[",
"nativeType",
"]",
";",
"for",
"(",
"const",
"nativeTag",
"in",
"tagMapper",
".",
"tagMap",
")",
"{",
"const",
"commonType",
"=",
"tagMapper",
".",
"tagMap",
"[",
"nativeTag",
"]",
";",
"assert",
".",
"isDefined",
"(",
"commonTags",
"[",
"commonType",
"]",
",",
"'Unknown common tagTypes in mapping '",
"+",
"nativeType",
"+",
"'.'",
"+",
"nativeTag",
"+",
"' => '",
"+",
"commonType",
")",
";",
"}",
"}",
"}",
")",
";",
"it",
"(",
"'should be able to distinct singletons'",
",",
"(",
")",
"=>",
"{",
"assert",
".",
"ok",
"(",
"isSingleton",
"(",
"'title'",
")",
",",
"'common tag \"title\" is a singleton'",
")",
";",
"assert",
".",
"ok",
"(",
"isSingleton",
"(",
"'artist'",
")",
",",
"'common tag \"artist\" is a singleton'",
")",
";",
"assert",
".",
"ok",
"(",
"!",
"isSingleton",
"(",
"'artists'",
")",
",",
"'common tag \"artists\" is not a singleton'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'common.artist / common.artists mapping'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should be able to join artists'",
",",
"(",
")",
"=>",
"{",
"assert",
".",
"equal",
"(",
"joinArtists",
"(",
"[",
"'David Bowie'",
"]",
")",
",",
"'David Bowie'",
")",
";",
"assert",
".",
"equal",
"(",
"joinArtists",
"(",
"[",
"'David Bowie'",
",",
"'Stevie Ray Vaughan'",
"]",
")",
",",
"'David Bowie & Stevie Ray Vaughan'",
")",
";",
"assert",
".",
"equal",
"(",
"joinArtists",
"(",
"[",
"'David Bowie'",
",",
"'Queen'",
",",
"'Mick Ronson'",
"]",
")",
",",
"'David Bowie, Queen & Mick Ronson'",
")",
";",
"}",
")",
";",
"it",
"(",
"'parse RIFF tags'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'issue-89 no-artist.aiff'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artists",
",",
"[",
"'Beth Hart'",
",",
"'Joe Bonamassa'",
"]",
",",
"'common.artists directly via WM/ARTISTS'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Beth Hart & Joe Bonamassa'",
",",
"'common.artist derived from common.artists'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Convert rating'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should convert rating to stars'",
",",
"(",
")",
"=>",
"{",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"undefined",
")",
",",
"0",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"0",
")",
",",
"1",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"0.1",
")",
",",
"1",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"0.2",
")",
",",
"2",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"0.5",
")",
",",
"3",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"0.75",
")",
",",
"4",
")",
";",
"assert",
".",
"equal",
"(",
"mm",
".",
"ratingToStars",
"(",
"1",
")",
",",
"5",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'function selectCover()'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"multiCoverFiles",
"=",
"[",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer [id3v2.3].V2.mp3'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer [id3v2.3].wav'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer [id3v2.4].V2.mp3'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer [id3v2.4].aiff'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.ape'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.flac'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.m4a'",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.ogg'",
",",
"'id3v2.4.mp3'",
",",
"'issue-266.flac'",
",",
"'monkeysaudio.ape'",
"]",
";",
"it",
"(",
"'Should pick the front cover'",
",",
"async",
"(",
")",
"=>",
"{",
"for",
"(",
"const",
"multiCoverFile",
"of",
"multiCoverFiles",
")",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"multiCoverFile",
")",
";",
"const",
"{",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"isTrue",
"(",
"common",
".",
"picture",
".",
"length",
">",
"1",
")",
";",
"const",
"cover",
"=",
"mm",
".",
"selectCover",
"(",
"common",
".",
"picture",
")",
";",
"if",
"(",
"cover",
".",
"type",
")",
"{",
"assert",
".",
"equal",
"(",
"cover",
".",
"type",
",",
"'Cover (front)'",
",",
"'cover.type'",
")",
";",
"}",
"else",
"{",
"assert",
".",
"equal",
"(",
"cover",
".",
"data",
",",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
",",
"'First picture if no type is defined'",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'MimeType'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should be able to decode basic MIME-types'",
",",
"(",
")",
"=>",
"{",
"const",
"mime",
"=",
"parseHttpContentType",
"(",
"'audio/mpeg'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"type",
",",
"'audio'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"subtype",
",",
"'mpeg'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to decode MIME-type parameters'",
",",
"(",
")",
"=>",
"{",
"{",
"const",
"mime",
"=",
"parseHttpContentType",
"(",
"'message/external-body; access-type=URL'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"type",
",",
"'message'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"subtype",
",",
"'external-body'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"mime",
".",
"parameters",
",",
"{",
"'access-type'",
":",
"'URL'",
"}",
")",
";",
"}",
"{",
"const",
"mime",
"=",
"parseHttpContentType",
"(",
"'Text/HTML;Charset=\"utf-8\"'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"type",
",",
"'text'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"subtype",
",",
"'html'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"mime",
".",
"parameters",
",",
"{",
"charset",
":",
"'utf-8'",
"}",
")",
";",
"}",
"}",
")",
";",
"it",
"(",
"'should be able to decode MIME-type suffix'",
",",
"(",
")",
"=>",
"{",
"const",
"mime",
"=",
"parseHttpContentType",
"(",
"'application/xhtml+xml'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"type",
",",
"'application'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"subtype",
",",
"'xhtml'",
")",
";",
"assert",
".",
"equal",
"(",
"mime",
".",
"suffix",
",",
"'xml'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
28981,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661872 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"it",
"(",
"\"should handle concurrent parsing of pictures\"",
",",
"(",
")",
"=>",
"{",
"const",
"files",
"=",
"[",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'flac.flac'",
")",
",",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'flac-bug.flac'",
")",
"]",
";",
"return",
"Promise",
".",
"all",
"<",
"any",
">",
"(",
"files",
".",
"map",
"(",
"file",
"=>",
"{",
"return",
"mm",
".",
"parseFile",
"(",
"file",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"const",
"data",
"=",
"fs",
".",
"readFileSync",
"(",
"file",
"+",
"'.jpg'",
")",
";",
"t",
".",
"deepEqual",
"(",
"result",
".",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
",",
"data",
",",
"'check picture'",
")",
";",
"}",
")",
";",
"}",
")",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661873 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"{",
"ID3v24TagMapper",
"}",
"from",
"'../lib/id3v2/ID3v24TagMapper'",
";",
"import",
"{",
"VorbisTagMapper",
"}",
"from",
"'../lib/ogg/vorbis/VorbisTagMapper'",
";",
"describe",
"(",
"'Discogs mappings'",
",",
"(",
")",
"=>",
"{",
"const",
"discogs_tags",
"=",
"[",
"'DISCOGS_ARTIST_ID'",
",",
"'DISCOGS_ARTISTS'",
",",
"'DISCOGS_ARTIST_NAME'",
",",
"'DISCOGS_ALBUM_ARTISTS'",
",",
"'DISCOGS_CATALOG'",
",",
"'DISCOGS_COUNTRY'",
",",
"'DISCOGS_DATE'",
",",
"'DISCOGS_LABEL'",
",",
"'DISCOGS_LABEL_ID'",
",",
"'DISCOGS_MASTER_RELEASE_ID'",
",",
"'DISCOGS_RATING'",
",",
"'DISCOGS_RELEASED'",
",",
"'DISCOGS_RELEASE_ID'",
",",
"'DISCOGS_VOTES'",
"]",
";",
"describe",
"(",
"'Mapping definitions'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should map ID3v2.3/ID3v2.4 tags'",
",",
"(",
")",
"=>",
"{",
"const",
"mapper",
"=",
"new",
"ID3v24TagMapper",
"(",
")",
";",
"for",
"(",
"const",
"tag",
"of",
"discogs_tags",
")",
"{",
"const",
"tagName",
"=",
"'TXXX:'",
"+",
"tag",
";",
"assert",
".",
"isDefined",
"(",
"mapper",
".",
"tagMap",
"[",
"tagName",
"]",
",",
"'Discogs/ID3v2.4 tag: '",
"+",
"tagName",
")",
";",
"}",
"}",
")",
";",
"it",
"(",
"'should map Vorbis/FLAC tags'",
",",
"(",
")",
"=>",
"{",
"const",
"mapper",
"=",
"new",
"VorbisTagMapper",
"(",
")",
";",
"for",
"(",
"const",
"tag",
"of",
"discogs_tags",
")",
"{",
"assert",
".",
"isDefined",
"(",
"mapper",
".",
"tagMap",
"[",
"tag",
"]",
",",
"'Discog/Vorbis tag: '",
"+",
"tag",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Track mapping: Beth Hart - Sinner\\'s Prayer'",
",",
"(",
")",
"=>",
"{",
"function",
"checkTags",
"(",
"metadata",
",",
"tagType",
",",
"getTagName",
")",
"{",
"const",
"native",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"tagType",
"]",
")",
";",
"const",
"common",
"=",
"metadata",
".",
"common",
";",
"let",
"tagName",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Don\\'t Explain'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Beth Hart, Joe Bonamassa'",
",",
"'common.artist'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_RELEASE_ID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'4204665'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"discogs_release_id",
",",
"4204665",
",",
"+",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_release_id'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_ARTIST_ID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'389157'",
",",
"'900313'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"discogs_artist_id",
",",
"[",
"389157",
",",
"900313",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_artist_id'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_ALBUM_ARTISTS'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'Beth Hart'",
",",
"'Joe Bonamassa'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Beth Hart'",
",",
"'Joe Bonamassa'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.artists'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_VOTES'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'9'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"discogs_votes",
",",
"9",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_votes'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'STYLE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'Blues Rock'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"switch",
"(",
"tagType",
")",
"{",
"case",
"'id3v23'",
":",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Rock;Blues'",
",",
"'Blues Rock'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
".",
"TCON",
",",
"[",
"'Rock;Blues'",
"]",
",",
"tagType",
"+",
"'/TCON'",
")",
";",
"break",
";",
"case",
"'vorbis'",
":",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Rock'",
",",
"'Blues'",
",",
"'Blues Rock'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
".",
"GENRE",
",",
"[",
"'Rock'",
",",
"'Blues'",
"]",
",",
"tagType",
"+",
"'/GENRE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
".",
"STYLE",
",",
"[",
"'Blues Rock'",
"]",
",",
"tagType",
"+",
"'/STYLE'",
")",
";",
"break",
";",
"}",
"}",
"it",
"(",
"'ID3v2.3/ID3v2.4'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'Discogs - Beth Hart - Sinner\\'s Prayer [id3v2.3].mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"const",
"{",
"common",
",",
"format",
"}",
"=",
"metadata",
";",
"assert",
".",
"ok",
"(",
"metadata",
".",
"common",
",",
"'should include common tags'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"duration",
",",
"2.1681632653061222",
",",
"'format.duration'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"156000",
",",
"1000",
",",
"'format.bitrate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Don\\'t Explain'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Beth Hart, Joe Bonamassa'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
"[",
"'TXXX:DISCOGS_RELEASE_ID'",
"]",
",",
"[",
"'4204665'",
"]",
",",
"'id3v23/TXXX:DISCOGS_RELEASE_ID'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"discogs_release_id",
",",
"4204665",
",",
"'id3v23/TXXX:DISCOGS_RELEASE_ID: => common.discogs_release_id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
"[",
"'TXXX:CATALOGID'",
"]",
",",
"[",
"'PRAR931391'",
"]",
",",
"'id3v23/TXXX:CATALOGID: PRAR931391'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"catalognumber",
",",
"[",
"'PRAR931391'",
"]",
",",
"'id3v23/TXXX:CATALOGID => common.catalognumber'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TCON",
",",
"[",
"'Rock;Blues'",
"]",
",",
"'id3v23/TCON'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
"[",
"'TXXX:STYLE'",
"]",
",",
"[",
"'Blues Rock'",
"]",
",",
"'id3v23/TXXX:STYLE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Rock;Blues'",
",",
"'Blues Rock'",
"]",
",",
"'id3v23/TXXX:STYLE => common.genre'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Vorbis/FLAC'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'Discogs - Beth Hart - Sinner\\'s Prayer [APEv2].flac'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"function",
"checkNative",
"(",
"id3v23",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"id3v23",
"[",
"'TXXX:CATALOGID'",
"]",
",",
"'PRAR931391'",
")",
";",
"}",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"ok",
"(",
"metadata",
".",
"common",
",",
"'should include common tags'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
")",
";",
"const",
"format",
"=",
"metadata",
".",
"format",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"duration",
",",
"2.1229931972789116",
",",
"'format.duration'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"checkTags",
"(",
"metadata",
",",
"'vorbis'",
",",
"tag",
"=>",
"tag",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Track mapping: Yasmin Levy - Mi Korasón.flac\\''",
",",
"(",
")",
"=>",
"{",
"function",
"checkTags",
"(",
"metadata",
",",
"tagType",
",",
"getTagName",
")",
"{",
"const",
"native",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"tagType",
"]",
")",
";",
"const",
"common",
"=",
"metadata",
".",
"common",
";",
"const",
"discogs_tags_found",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"tag",
"in",
"native",
")",
"{",
"if",
"(",
"tag",
".",
"lastIndexOf",
"(",
"'DISCOGS_'",
",",
"0",
")",
">=",
"0",
")",
"{",
"discogs_tags",
".",
"push",
"(",
"tag",
")",
";",
"}",
"}",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Sentir'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Yasmin Levy'",
",",
"'common.artist'",
")",
";",
"for",
"(",
"const",
"tag",
"of",
"discogs_tags_found",
")",
"{",
"assert",
".",
"isTrue",
"(",
"discogs_tags",
".",
"indexOf",
"(",
"tag",
")",
"!==",
"-",
"1",
",",
"'Discog/Vorbis tag: '",
"+",
"tag",
")",
";",
"}",
"let",
"tagName",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_RELEASE_ID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'3520814'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"discogs_release_id",
",",
"3520814",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_release_id'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_MASTER_RELEASE_ID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'461710'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"discogs_master_release_id",
",",
"461710",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_master_release_id'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_ARTIST_ID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'467650'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"discogs_artist_id",
",",
"[",
"467650",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.discogs_artist_id'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_ARTIST_NAME'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'Yasmin Levy'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Yasmin Levy'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.artists'",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_DATE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'2009'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"tagName",
"=",
"getTagName",
"(",
"'DISCOGS_CATALOG'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"tagName",
"]",
",",
"[",
"'450010'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"catalognumber",
",",
"[",
"'450010'",
"]",
",",
"tagType",
"+",
"'/'",
"+",
"tagName",
"+",
"' => common.catalognumber'",
")",
";",
"}",
"it",
"(",
"'Vorbis/FLAC tags'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'Discogs - Yasmin Levy - Mi Korasón.flac'",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
")",
";",
"assert",
".",
"ok",
"(",
"metadata",
".",
"common",
",",
"'should include common tags'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
")",
";",
"checkTags",
"(",
"metadata",
",",
"'vorbis'",
",",
"tag",
"=>",
"tag",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
2,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
36824,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
2,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
36824,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661874 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"describe",
"(",
"'Parse Philips DSDIFF'",
",",
"(",
")",
"=>",
"{",
"const",
"dsdiffamplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'dsdiff'",
")",
";",
"it",
"(",
"'parse: DSD64.dff'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"dsdiffamplePath",
",",
"'DSD64.dff'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'DSDIFF/DSD'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"lossless",
",",
"true",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"1",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"2822400",
",",
"'format.sampleRate [Hz]'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"300800",
",",
"'format.numberOfSamples'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"duration",
",",
"300800",
"/",
"2822400",
",",
"'format.duration'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitrate",
",",
"5644800",
",",
"'format.bitrate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'TAG headers'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'CANTUS (Tove Ramlo-Ystad) & Frode Fjellheim'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Kyrie'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'SPES'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Choral'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"4",
",",
"of",
":",
"12",
"}",
",",
"'common.track'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661875 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"import",
"{",
"IFormat",
"}",
"from",
"'../lib'",
";",
"describe",
"(",
"'Parse ADTS/AAC'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'aac'",
")",
";",
"function",
"checkFormat",
"(",
"format",
",",
"dataFormat",
",",
"codec",
",",
"codecProfile",
",",
"sampleRate",
",",
"channels",
",",
"bitrate",
",",
"samples",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"dataFormat",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"codec",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"codecProfile",
",",
"'format.codecProfile'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"sampleRate",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"channels",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"bitrate",
",",
"500",
",",
"'format.bitrate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"samples",
",",
"`format.numberOfSamples = ${",
"samples",
"} samples`",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"samples",
"/",
"sampleRate",
",",
"0.1",
",",
"'format.duration'",
")",
";",
"}",
"describe",
"(",
"'parse: adts-mpeg4.aac AAC-LC, 16.0 kHz, 2 channels, 3 kBit'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'adts-mpeg4.aac'",
")",
",",
"'audio/aac'",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"'ADTS/MPEG-4'",
",",
"'AAC'",
",",
"'AAC LC'",
",",
"16000",
",",
"1",
",",
"20399",
",",
"256000",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'parse: adts-mpeg4-2.aac: AAC-LC, 44.1 kHz, 2 channels'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'adts-mpeg4-2.aac'",
")",
",",
"'audio/aac'",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"'ADTS/MPEG-4'",
",",
"'AAC'",
",",
"'AAC LC'",
",",
"44100",
",",
"2",
",",
"128000",
",",
"14336",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
10350,
null,
2,
null,
2,
null,
2,
null,
3,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661876 | [
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"describe",
"(",
"'Parse AIFF (Audio Interchange File Format)'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'aiff'",
")",
";",
"const",
"ULAW",
"=",
"'ITU-T G.711 mu-law'",
";",
"function",
"checkFormat",
"(",
"format",
",",
"compressionType",
",",
"sampleRate",
",",
"channels",
",",
"bitsPerSample",
",",
"samples",
")",
"{",
"const",
"lossless",
"=",
"compressionType",
"===",
"'PCM'",
";",
"const",
"dataFormat",
"=",
"lossless",
"?",
"'AIFF'",
":",
"'AIFF-C'",
";",
"const",
"duration",
"=",
"samples",
"/",
"format",
".",
"sampleRate",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"dataFormat",
",",
"`format.container = '${",
"dataFormat",
"}'`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"lossless",
",",
"`format.lossless = ${",
"lossless",
"}`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"sampleRate",
",",
"`format.sampleRate = ${",
"sampleRate",
"} kHz`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"bitsPerSample",
",",
"`format.bitsPerSample = ${",
"bitsPerSample",
"} bit`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"channels",
",",
"`format.numberOfChannels = ${",
"channels",
"} channels`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"samples",
",",
"`format.numberOfSamples = ${",
"samples",
"} samples`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"duration",
",",
"`format.duration = ${",
"duration",
"} sec.`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"compressionType",
",",
"`format.codec = ${",
"compressionType",
"}`",
")",
";",
"}",
"describe",
"(",
"'Parse AIFF'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'M1F1-int8-AFsp.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"'PCM'",
",",
"8000",
",",
"2",
",",
"8",
",",
"23493",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse AIFF-C'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'M1F1-AlawC-AFsp.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"'Alaw 2:1'",
",",
"8000",
",",
"2",
",",
"16",
",",
"23493",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse perverse Files'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'AIFF-C file (9 samples) with an odd length intermediate chunk'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Pmiscck.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"9",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'AIFF-C file with 0 samples (no SSND chunk)'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Pnossnd.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"0",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'AIFF-C file (9 samples), SSND chunk has a 5 byte offset to the data and trailing junk in the SSND chunk'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Poffset.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"9",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'AIFF-C file (9 samples) with SSND chunk ahead of the COMM chunk'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Porder.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"9",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'AIFF-C file (9 samples) with trailing junk after the FORM chunk'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Ptjunk.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"9",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'AIFF-C file (9 samples) with COMM chunk declaring 92 bytes (1 byte longer than actual file length), SSND with 9 bytes, missing trailing fill byte'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Fnonull.aif'",
")",
",",
"'audio/aiff'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"ULAW",
",",
"8000",
",",
"1",
",",
"16",
",",
"9",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'Parse tag \"(c) \"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'No Sanctuary Here.aiff'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'AIFF'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Hdtracks 2020 Hi-Res Sampler'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Chris Jones'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodersettings",
",",
"'Lavf58.29.100'",
",",
"'common.encodersettings'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2020",
",",
"'common.year'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
4,
null,
29903,
null,
2,
null,
3,
null,
3,
null,
3,
null,
3,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661877 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"describe",
"(",
"'Parse APE (Monkey\\'s Audio)'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 [kHz]'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"1.2134240362811792",
",",
"'duration [sec]'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'07. Shadow On The Sun'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Audioslave'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Audioslave'",
",",
"'Chris Cornell'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"albumartist",
",",
"undefined",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Audioslave'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2002",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Alternative'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"7",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"3",
",",
"of",
":",
"null",
"}",
",",
"'common.disk'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture 0 format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"48658",
",",
"'common.picture 0 length'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture 1 format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"data",
".",
"length",
",",
"48658",
",",
"'common.picture 1 length'",
")",
";",
"}",
"function",
"checkNative",
"(",
"ape",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"ENSEMBLE",
",",
"[",
"'Audioslave'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"Artist",
",",
"[",
"'Audioslave'",
",",
"'Chris Cornell'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"ape",
"[",
"'Cover Art (Front)'",
"]",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"48658",
",",
"'raw cover art (front) length'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"ape",
"[",
"'Cover Art (Back)'",
"]",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"48658",
",",
"'raw cover art (front) length'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'monkeysaudio.ape'",
")",
",",
"'audio/ape'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
",",
"'metadata should be defined'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
",",
"'metadata.native should be defined'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
".",
"APEv2",
",",
"'metadata.native.APEv2 should be defined'",
")",
";",
"checkNative",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"APEv2",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse APEv2 header'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'Handle APEv2 with item count to high(issue #331)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-331.apev2.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"quality",
"}",
"=",
"metadata",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"'CBR'",
",",
"'format.codecProfile'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME 3.99r'",
",",
"'format.codecProfile'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"348.421",
",",
"1",
"/",
"500",
",",
"'format.duration'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.4'",
",",
"'APEv2'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"320000",
",",
"'format.bitrate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Criminal Vibes'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Push The Feeling On (Groove Phenomenon Remix)'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"quality",
".",
"warnings",
".",
"filter",
"(",
"warning",
"=>",
"{",
"return",
"warning",
".",
"message",
"===",
"'APEv2 Tag-header: 1 items remaining, but no more tag data to read.'",
";",
"}",
")",
".",
"length",
",",
"1",
",",
"'quality.warnings'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661878 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"GUID",
"from",
"'../lib/asf/GUID'",
";",
"import",
"{",
"AsfUtil",
"}",
"from",
"'../lib/asf/AsfUtil'",
";",
"import",
"{",
"DataType",
"}",
"from",
"'../lib/asf/AsfObject'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"describe",
"(",
"'Parse ASF'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'GUID'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should construct GUID from string'",
",",
"(",
")",
"=>",
"{",
"const",
"Header_GUID",
"=",
"Buffer",
".",
"from",
"(",
"[",
"0x30",
",",
"0x26",
",",
"0xB2",
",",
"0x75",
",",
"0x8E",
",",
"0x66",
",",
"0xCF",
",",
"0x11",
",",
"0xA6",
",",
"0xD9",
",",
"0x00",
",",
"0xAA",
",",
"0x00",
",",
"0x62",
",",
"0xCE",
",",
"0x6C",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"GUID",
".",
"HeaderObject",
".",
"toBin",
"(",
")",
",",
"Header_GUID",
")",
";",
"}",
")",
";",
"it",
"(",
"'should construct GUID from string'",
",",
"(",
")",
"=>",
"{",
"const",
"guid_data",
"=",
"Buffer",
".",
"from",
"(",
"[",
"48",
",",
"38",
",",
"178",
",",
"117",
",",
"142",
",",
"102",
",",
"207",
",",
"17",
",",
"166",
",",
"217",
",",
"0",
",",
"170",
",",
"0",
",",
"98",
",",
"206",
",",
"108",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"GUID",
".",
"fromBin",
"(",
"guid_data",
")",
".",
"str",
",",
"'75B22630-668E-11CF-A6D9-00AA0062CE6C'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Trying Buffer.readUIntLE(0, 8)\n * Where 8 is 2 bytes longer then maximum allowed of 6\n */",
"it",
"(",
"'should be able to roughly decode a 64-bit QWord'",
",",
"(",
")",
"=>",
"{",
"const",
"tests",
"=",
"[",
"{",
"raw",
":",
"'\\xFF\\x00\\x00\\x00\\x00\\x00\\x00\\x00'",
",",
"expected",
":",
"0xFF",
",",
"description",
":",
"'8-bit'",
"}",
",",
"{",
"raw",
":",
"'\\xFF\\xFF\\x00\\x00\\x00\\x00\\x00\\x00'",
",",
"expected",
":",
"0xFFFF",
",",
"description",
":",
"'16-bit'",
"}",
",",
"{",
"raw",
":",
"'\\xFF\\xFF\\xFF\\xFF\\x00\\x00\\x00\\x00'",
",",
"expected",
":",
"0xFFFFFFFF",
",",
"description",
":",
"'32-bit'",
"}",
",",
"{",
"raw",
":",
"'\\xFF\\xFF\\xFF\\xFF\\xFF\\x00\\x00\\x00'",
",",
"expected",
":",
"0xFFFFFFFFFF",
",",
"description",
":",
"'40-bit'",
"}",
",",
"{",
"raw",
":",
"'\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\x00\\x00'",
",",
"expected",
":",
"0xFFFFFFFFFFFF",
",",
"description",
":",
"'48-bit'",
"}",
",",
"{",
"raw",
":",
"'\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\x0F\\x00'",
",",
"expected",
":",
"0xFFFFFFFFFFFFF",
",",
"description",
":",
"'52-bit'",
"}",
"]",
";",
"tests",
".",
"forEach",
"(",
"test",
"=>",
"{",
"const",
"buf",
"=",
"Buffer",
".",
"from",
"(",
"test",
".",
"raw",
",",
"'binary'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"Number",
"(",
"AsfUtil",
".",
"getParserForAttr",
"(",
"DataType",
".",
"QWord",
")",
"(",
"buf",
")",
")",
",",
"test",
".",
"expected",
",",
"test",
".",
"description",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'parse'",
",",
"(",
")",
"=>",
"{",
"const",
"asfFilePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'asf'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'ASF/audio'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Windows Media Audio 9.1'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"243.306",
",",
"1",
"/",
"10000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"192639",
",",
"'format.bitrate'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Don\\'t Bring Me Down'",
",",
"'common.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Electric Light Orchestra'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"albumartist",
",",
"'Electric Light Orchestra'",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Discovery'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2001",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"9",
",",
"of",
":",
"null",
"}",
",",
"'common.track 9/0'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.disk 0/0'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Rock'",
"]",
",",
"'common.genre'",
")",
";",
"}",
"function",
"checkNative",
"(",
"native",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"'WM/AlbumTitle'",
"]",
",",
"[",
"'Discovery'",
"]",
",",
"'native: WM/AlbumTitle'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"'WM/BeatsPerMinute'",
"]",
",",
"[",
"117",
"]",
",",
"'native: WM/BeatsPerMinute'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
".",
"REPLAYGAIN_TRACK_GAIN",
",",
"[",
"'-4.7 dB'",
"]",
",",
"'native: REPLAYGAIN_TRACK_GAIN'",
")",
";",
"}",
"describe",
"(",
"'should decode an ASF audio file (.wma)'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"asfFilePath",
",",
"'asf.wma'",
")",
",",
"'audio/x-ms-wma'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
",",
"'metadata'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
",",
"'metadata.native'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
".",
"asf",
",",
"'should include native ASF tags'",
")",
";",
"checkNative",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"asf",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should decode picture from'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"asfFilePath",
",",
"'issue_57.wma'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/x-ms-wma'",
")",
";",
"const",
"asf",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"asf",
")",
";",
"assert",
".",
"exists",
"(",
"asf",
"[",
"'WM/Picture'",
"]",
"[",
"0",
"]",
",",
"'ASF WM/Picture should be set'",
")",
";",
"const",
"nativePicture",
"=",
"asf",
"[",
"'WM/Picture'",
"]",
"[",
"0",
"]",
";",
"assert",
".",
"exists",
"(",
"nativePicture",
".",
"data",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Related issue: https://github.com/Borewit/music-metadata/issues/68\n */",
"it",
"(",
"'should be able to parse truncated .wma file'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"asfFilePath",
",",
"'13 Thirty Dirty Birds.wma'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'ASF/audio'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Windows Media Audio 9'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"14.466",
",",
"1",
"/",
"10000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"128639",
",",
"1",
",",
"'format.bitrate'",
")",
";",
"const",
"asf",
"=",
"mm",
".",
"orderTags",
"(",
"native",
".",
"asf",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Thirty Dirty Birds'",
",",
"'metadata.common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'The Red Hot Chili Peppers'",
",",
"'metadata.common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"date",
",",
"'2003'",
",",
"'metadata.common.date'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"label",
",",
"[",
"'Capitol'",
"]",
",",
"'metadata.common.label'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"13",
",",
"'metadata.common.track.no'",
")",
";",
"assert",
".",
"exists",
"(",
"asf",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661879 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"describe",
"(",
"'Parse Sony DSF (DSD Stream File)'",
",",
"(",
")",
"=>",
"{",
"const",
"dsfSamplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'dsf'",
")",
";",
"it",
"(",
"'parse: 2L-110_stereo-5644k-1b_04.dsf'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"dsfFilePath",
"=",
"path",
".",
"join",
"(",
"dsfSamplePath",
",",
"'2L-110_stereo-5644k-1b_04_0.1-sec.dsf'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"dsfFilePath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'DSF'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"lossless",
",",
"true",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfChannels",
",",
"2",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"bitsPerSample",
",",
"1",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"5644800",
")",
";",
"assert",
".",
"strictEqual",
"(",
"Number",
"(",
"metadata",
".",
"format",
".",
"numberOfSamples",
")",
",",
"564480",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"0.1",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"bitrate",
",",
"11289600",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'Kyrie'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'CANTUS (Tove Ramlo-Ystad) & Frode Fjellheim'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"metadata",
".",
"common",
".",
"track",
",",
"{",
"no",
":",
"4",
",",
"of",
":",
"12",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661880 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"const",
"t",
"=",
"assert",
";",
"describe",
"(",
"'Parse FLAC'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"flacFilePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'flac'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'FLAC'",
",",
"'format.container'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'FLAC'",
",",
"'format.codec'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"271.7733333333333",
",",
"'format.duration'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample = 16 bit'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Brian Eno'",
",",
"'common.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'MGMT'",
"]",
",",
"'common.artists'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"undefined",
",",
"'common.albumartist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Congratulations'",
",",
"'common.album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2010",
",",
"'common.year'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"7",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.disk'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Alt. Rock'",
"]",
",",
"'genre'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture format'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"175668",
",",
"'common.picture length'",
")",
";",
"}",
"function",
"checkNative",
"(",
"vorbis",
")",
"{",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"TITLE",
",",
"[",
"'Brian Eno'",
"]",
",",
"'vorbis.TITLE'",
")",
";",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"ARTIST",
",",
"[",
"'MGMT'",
"]",
",",
"'vorbis.ARTIST'",
")",
";",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"DATE",
",",
"[",
"'2010'",
"]",
",",
"'vorbis.DATE'",
")",
";",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"TRACKNUMBER",
",",
"[",
"'07'",
"]",
",",
"'vorbis.TRACKNUMBER'",
")",
";",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"GENRE",
",",
"[",
"'Alt. Rock'",
"]",
",",
"'vorbis.GENRE'",
")",
";",
"t",
".",
"deepEqual",
"(",
"vorbis",
".",
"COMMENT",
",",
"[",
"'EAC-Secure Mode=should ignore equal sign'",
"]",
",",
"'vorbis.COMMENT'",
")",
";",
"const",
"pic",
"=",
"vorbis",
".",
"METADATA_BLOCK_PICTURE",
"[",
"0",
"]",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"type",
",",
"'Cover (front)'",
",",
"'raw METADATA_BLOCK_PICTUREtype'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"format",
",",
"'image/jpeg'",
",",
"'raw METADATA_BLOCK_PICTURE format'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"description",
",",
"''",
",",
"'raw METADATA_BLOCK_PICTURE description'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"width",
",",
"450",
",",
"'raw METADATA_BLOCK_PICTURE width'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"height",
",",
"450",
",",
"'raw METADATA_BLOCK_PICTURE height'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"colour_depth",
",",
"24",
",",
"'raw METADATA_BLOCK_PICTURE colour depth'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"indexed_color",
",",
"0",
",",
"'raw METADATA_BLOCK_PICTURE indexed_color'",
")",
";",
"t",
".",
"strictEqual",
"(",
"pic",
".",
"data",
".",
"length",
",",
"175668",
",",
"'raw METADATA_BLOCK_PICTURE length'",
")",
";",
"}",
"describe",
"(",
"'decode flac.flac'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'flac.flac'",
")",
",",
"'audio/flac'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"checkNative",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"vorbis",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should be able to recognize a ID3v2 tag header prefixing a FLAC file'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'a kind of magic.flac'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/flac'",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'vorbis'",
",",
"'ID3v1'",
"]",
",",
"'File has 3 tag types: \"vorbis\", \"ID3v2.3\" & \"ID3v1\"'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should be able to determine the bit-rate'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'04 Long Drive.flac'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/flac'",
")",
";",
"assert",
".",
"approximately",
"(",
"496000",
",",
"metadata",
".",
"format",
".",
"bitrate",
",",
"500",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'handle corrupt FLAC data'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should handle a corrupt data'",
",",
"(",
")",
"=>",
"{",
"const",
"emptyStreamSize",
"=",
"10",
"*",
"1024",
";",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"emptyStreamSize",
")",
".",
"fill",
"(",
"0",
")",
";",
"const",
"tmpFilePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'zeroes.flac'",
")",
";",
"fs",
".",
"writeFileSync",
"(",
"tmpFilePath",
",",
"buf",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"(",
")",
"=>",
"{",
"return",
"parser",
".",
"initParser",
"(",
"tmpFilePath",
",",
"'audio/flac'",
")",
".",
"then",
"(",
"(",
")",
"=>",
"{",
"t",
".",
"fail",
"(",
"'Should reject'",
")",
";",
"fs",
".",
"unlinkSync",
"(",
"tmpFilePath",
")",
";",
"}",
")",
".",
"catch",
"(",
"err",
"=>",
"{",
"t",
".",
"strictEqual",
"(",
"err",
".",
"message",
",",
"'FourCC contains invalid characters'",
")",
";",
"return",
"fs",
".",
"unlinkSync",
"(",
"tmpFilePath",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Issue: https://github.com/Borewit/music-metadata/issues/266\n */",
"it",
"(",
"'Support Vorbis METADATA_BLOCK_PICTURE tags'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue-266.flac'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"metadata",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'FLAC'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
")",
";",
"const",
"vorbis",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"vorbis",
")",
";",
"assert",
".",
"isDefined",
"(",
"vorbis",
".",
"METADATA_BLOCK_PICTURE",
",",
"'expect a Vorbis METADATA_BLOCK_PICTURE tag'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"METADATA_BLOCK_PICTURE",
".",
"length",
",",
"2",
",",
"'expect 2 Vorbis METADATA_BLOCK_PICTURE tags'",
")",
";",
"assert",
".",
"isDefined",
"(",
"common",
".",
"picture",
",",
"'common.picture'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
".",
"length",
",",
"2",
",",
"'common.picture.length'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'ommon.picture[0].format'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"107402",
",",
"'ommon.picture[0].data.length'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'ommon.picture[1].format'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"data",
".",
"length",
",",
"215889",
",",
"'ommon.picture[1].data.length'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle FLAC with undefined duration (number of samples == 0)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"flacFilePath",
",",
"'test-unknown-duration.flac'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"isUndefined",
"(",
"format",
".",
"duration",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Support additional Vorbis comment TAG mapping \"ALMBUM ARTIST\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"flacFilePath",
",",
"'14. Samuel L. Jackson and John Travolta - Personality Goes a Long Way.flac'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'FLAC'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'FLAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Various Artists'",
",",
"'common.albumartist'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661881 | [
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"describe",
"(",
"'Matroska formats'",
",",
"(",
")",
"=>",
"{",
"const",
"matroskaSamplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'matroska'",
")",
";",
"function",
"verifyTrackSolidGround",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Solid Ground'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Poxfil'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artistsort",
",",
"'Poxfil'",
",",
"'common.artistsort'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"label",
",",
"[",
"'blocSonic'",
"]",
",",
"'common.label'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"musicbrainz_albumid",
",",
"'abf39f57-0b01-4b51-9c1e-b21e8ada5091'",
",",
"'common.musicbrainz_albumid'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_artistid",
",",
"[",
"'ee315b01-df5e-451e-8cd6-90a9f1faaf51'",
"]",
",",
"'common.musicbrainz_artistid'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"musicbrainz_recordingid",
",",
"'209dbf50-509d-4ac3-aec5-e96da99dfdd9'",
",",
"'common.musicbrainz_recordingid'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"2",
",",
"of",
":",
"10",
"}",
",",
"'common.track'",
")",
";",
"}",
"describe",
"(",
"'Matroska audio (.mka)'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'parse: \"alac-in-matroska-short.mka\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"mkaPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'alac-in-matroska-short.mka'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"mkaPath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/matroska'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'ALAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"196608",
"/",
"41000",
",",
"1",
"/",
"100000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"41000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"}",
")",
";",
"it",
"(",
"'parse: \"02 - Poxfil - Solid Ground (5 sec).mka\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"mkaPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'02 - Poxfil - Solid Ground (5 sec).mka'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"mkaPath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/matroska'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"221184",
"/",
"44100",
",",
"1",
"/",
"100000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"verifyTrackSolidGround",
"(",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'WebM'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'parse: \"big-buck-bunny_trailer-short.vp8.webm\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"webmPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'big-buck-bunny_trailer-short.vp8.webm'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"webmPath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/webm'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'VORBIS'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"7.143",
",",
"1",
"/",
"100000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Big Buck Bunny'",
",",
"'common.title'",
")",
";",
"assert",
".",
"isDefined",
"(",
"common",
".",
"picture",
",",
"'common.picture'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture[0].format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"description",
",",
"'Poster'",
",",
"'common.picture[0].description'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"name",
",",
"'Big buck bunny poster.jpg'",
",",
"'common.picture[0].name'",
")",
";",
"}",
")",
";",
"it",
"(",
"'parse: \"02 - Poxfil - Solid Ground (5 sec).opus.webm\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"webmPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'02 - Poxfil - Solid Ground (5 sec).opus.webm'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"webmPath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/webm'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'OPUS'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"5.006509896",
",",
"1",
"/",
"100000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Solid Ground'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Poxfil'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"2",
",",
"of",
":",
"10",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodedby",
",",
"'Max 0.8b'",
",",
"'common.encodersettings'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodersettings",
",",
"'--bitrate 96 --vbr'",
",",
"'common.encodersettings'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should parse \"My Baby Boy.webm\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'My Baby Boy.webm'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/webm'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'OPUS'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'My Baby Boy'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'theAngelcy'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'theAngelcy'",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"2",
",",
"of",
":",
"13",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"1",
"}",
",",
"'common.disk'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Folk'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodedby",
",",
"'opusenc from opus-tools 0.2'",
",",
"'common.encodersettings'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodersettings",
",",
"'--bitrate 96 --vbr'",
",",
"'common.encodersettings'",
")",
";",
"}",
")",
";",
"it",
"(",
"'shoud ignore trailing null characters'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"webmPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'fixture-null.webm'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"webmPath",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/webm'",
",",
"'format.container'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Multiple audio tracks'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'parse: \"matroska-test-w1-test5-short.mkv\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"mkvPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'matroska-test-w1-test5-short.mkv'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"mkvPath",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'EBML/matroska'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'matroska'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"3.417",
",",
"1",
"/",
"100000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"title",
",",
"'Elephant Dreams'",
",",
"'common.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Matroska Test Files - Wave 1'",
",",
"'common.album'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse Matroska Stream'",
",",
"(",
")",
"=>",
"{",
"const",
"mkvPath",
"=",
"path",
".",
"join",
"(",
"matroskaSamplePath",
",",
"'stream.weba'",
")",
";",
"it",
"(",
"'Parse stream'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"mkvPath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'EBML/webm'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'OPUS'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"1",
",",
"'format.numberOfChannels'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661882 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"describe",
"(",
"'Parse MP3 files'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"mp3SamplePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
")",
";",
"describe",
"(",
"'Test patterns for ISO/MPEG '",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'ISO/MPEG 1 Layer 1'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"samples",
"=",
"[",
"{",
"filename",
":",
"'fl1.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"32000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl2.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl3.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl4.mp1'",
",",
"bitRate",
":",
"32",
",",
"sampleRate",
":",
"32000",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'fl5.mp1'",
",",
"bitRate",
":",
"448",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl6.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl7.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl8.mp1'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
"]",
";",
"for",
"(",
"const",
"sample",
"of",
"samples",
")",
"{",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'layer1'",
",",
"sample",
".",
"filename",
")",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 1'",
",",
"`'${",
"sample",
".",
"filename",
"}' format.codec`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"sample",
".",
"bitRate",
"*",
"1000",
",",
"`'${",
"sample",
".",
"filename",
"}' format.bitrate`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"sample",
".",
"sampleRate",
",",
"`'${",
"sample",
".",
"filename",
"}' format.sampleRate`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"sample",
".",
"channels",
",",
"`'${",
"sample",
".",
"filename",
"}' format.channels`",
")",
";",
"}",
"}",
")",
";",
"it",
"(",
"'ISO/MPEG 1 Layer 2'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"samples",
"=",
"[",
"{",
"filename",
":",
"'fl10.mp2'",
",",
"bitRate",
":",
"192",
",",
"sampleRate",
":",
"32000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl11.mp2'",
",",
"bitRate",
":",
"192",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl12.mp2'",
",",
"bitRate",
":",
"192",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl13.mp2'",
",",
"bitRate",
":",
"32",
",",
"sampleRate",
":",
"32000",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'fl14.mp2'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl15.mp2'",
",",
"bitRate",
":",
"384",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'fl16.mp2'",
",",
"bitRate",
":",
"256",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"2",
"}",
"]",
";",
"for",
"(",
"const",
"sample",
"of",
"samples",
")",
"{",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'layer2'",
",",
"sample",
".",
"filename",
")",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 2'",
",",
"`'${",
"sample",
".",
"filename",
"}' format.codec`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"sample",
".",
"bitRate",
"*",
"1000",
",",
"`'${",
"sample",
".",
"filename",
"}' format.bitrate`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"sample",
".",
"sampleRate",
",",
"`'${",
"sample",
".",
"filename",
"}' format.sampleRate`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"sample",
".",
"channels",
",",
"`'${",
"sample",
".",
"filename",
"}' format.channels`",
")",
";",
"}",
"}",
")",
";",
"it",
"(",
"'ISO/MPEG 1 Layer 3'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"samples",
"=",
"[",
"{",
"filename",
":",
"'compl.mp3'",
",",
"bitRate",
":",
"64",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'he_32khz.mp3'",
",",
"sampleRate",
":",
"32000",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'he_44khz.mp3'",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'he_48khz.mp3'",
",",
"sampleRate",
":",
"48000",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'he_mode.mp3'",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'hecommon.mp3'",
",",
"bitRate",
":",
"128",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
",",
"{",
"filename",
":",
"'si.mp3'",
",",
"bitRate",
":",
"64",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'si.mp3'",
",",
"bitRate",
":",
"64",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'si_huff.mp3'",
",",
"bitRate",
":",
"64",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"1",
"}",
",",
"{",
"filename",
":",
"'sin1k0db.mp3'",
",",
"bitRate",
":",
"128",
",",
"sampleRate",
":",
"44100",
",",
"channels",
":",
"2",
"}",
"]",
";",
"for",
"(",
"const",
"sample",
"of",
"samples",
")",
"{",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'layer3'",
",",
"sample",
".",
"filename",
")",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"`'${",
"sample",
".",
"filename",
"}' format.codec`",
")",
";",
"if",
"(",
"sample",
".",
"bitRate",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"sample",
".",
"bitRate",
"*",
"1000",
",",
"`'${",
"sample",
".",
"filename",
"}' format.bitrate`",
")",
";",
"}",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"sample",
".",
"sampleRate",
",",
"`'${",
"sample",
".",
"filename",
"}' format.sampleRate`",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"sample",
".",
"channels",
",",
"`'${",
"sample",
".",
"filename",
"}' format.channels`",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should handle audio-frame-header-bug'",
",",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'audio-frame-header-bug.mp3'",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"assert",
".",
"approximately",
"(",
"result",
".",
"format",
".",
"duration",
",",
"200.5",
",",
"1",
"/",
"10",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to parse: Sleep Away.mp3'",
",",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'Sleep Away.mp3'",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Sleep Away'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Bob Acri'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"composer",
",",
"[",
"'Robert R. Acri'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Jazz'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
".",
"length",
",",
"1",
",",
"'should contain the cover'",
")",
";",
"const",
"picture",
"=",
"common",
".",
"picture",
"[",
"0",
"]",
";",
"assert",
".",
"strictEqual",
"(",
"picture",
".",
"description",
",",
"'thumbnail'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"picture",
".",
"format",
",",
"'image/jpeg'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"picture",
".",
"data",
".",
"length",
",",
"27852",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to handle empty ID3v2 tag'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'issue-381.mp3'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle empty picture tag'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'empty-picture-tag.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Frankie And Johnny'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Sam Cooke'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Greatest Hits'",
",",
"'common.album,'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"21",
",",
"of",
":",
"null",
"}",
",",
"'common.track,'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"year",
",",
"1998",
",",
"'common.year,'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"picture",
",",
"'common.picturh'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Empty picture tag found'",
"}",
"]",
",",
"'quality.warnings includes Empty picture tag found'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle preceeding ADTS frame with (invalid) frame length of 0 bytes'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'adts-0-frame.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"'V2'",
",",
"'format.codecProfile'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME 3.97b'",
",",
"'format.tool'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Jan Pillemann Otze'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Mickie Krause'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"217.86",
",",
"0.005",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Able to handle corrupt LAME header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-554.mp3'",
")",
";",
"const",
"{",
"format",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 2 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"817.92",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"22050",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Corrupt LAME header'",
"}",
"]",
",",
"'quality.warnings includes: \\'Corrupt LAME header\\''",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should handle incomplete MP3 file'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'incomplete.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"61.73",
",",
"1",
"/",
"100",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 2 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"22050",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"64000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"it",
"(",
"'should decode from a file'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Duration flag behaviour'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'MP3/CBR without Xing header'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'Sleep Away.mp3'",
")",
";",
"describe",
"(",
"'duration=false'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"isUndefined",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"'Don\\'t expect a duration'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'duration=true'",
",",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"200.5",
",",
"1",
"/",
"10",
",",
"'Expect a duration'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'MP3 with APEv2 footer header'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should be able to parse APEv2 header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_56.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'MPEG'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'APEv2'",
",",
"'ID3v1'",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to parse APEv1 header\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-362.apev1.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'APEv2'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Do They Know It\\'s Christmas?'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Band Aid'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Band Aid'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Now That\\'s What I Call Xmas'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2006",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'TunNORM'",
",",
"' 0000080E 00000AA9 00002328 000034F4 0002BF65 0002BF4E 000060AC 0000668F 0002BF4E 00033467'",
"]",
",",
"'common.comment'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'General Holiday'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"2",
",",
"'common.track.no'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to parse APEv2 header followed by a Lyrics3v2 header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'APEv2+Lyrics3v2.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'MPEG'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'APEv2'",
",",
"'ID3v1'",
"]",
")",
";",
"const",
"ape",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"APEv2",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"MP3GAIN_MINMAX",
",",
"[",
"'131,189'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"REPLAYGAIN_TRACK_GAIN",
",",
"[",
"'+0.540000 dB'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"REPLAYGAIN_TRACK_PEAK",
",",
"[",
"'0.497886'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ape",
".",
"MP3GAIN_UNDO",
",",
"[",
"'+004,+004,N'",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Handle Xing header'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'Handle Xing header, without LAME extension'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'Solace.mp3'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Lame extension'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'track peak'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'lame-peak.mp3'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"'CBR'",
",",
"'format.codecProfile'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME 3.99r'",
",",
"'format.tool'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"trackPeakLevel",
",",
"0.21857",
",",
"5",
"/",
"1000000",
",",
"'format.trackPeakLevel'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"trackGain",
",",
"6.8",
",",
"'format.trackGain'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"format",
".",
"albumGain",
",",
"'format.albumGain'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle invalid LAME version'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3SamplePath",
",",
"'issue-828.mp3'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME ZyK! '",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11507,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661883 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"const",
"t",
"=",
"assert",
";",
"describe",
"(",
"'Parse MPEG-4 files with iTunes metadata'",
",",
"(",
")",
"=>",
"{",
"const",
"_samples",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"mp4Samples",
"=",
"path",
".",
"join",
"(",
"_samples",
",",
"'mp4'",
")",
";",
"describe",
"(",
"'Parse MPEG-4 files (.m4a)'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"lossless",
",",
"false",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'M4A/isom/iso2'",
",",
"'container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'iTunes'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"2.206",
",",
"1",
"/",
"500",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"148000",
",",
"500",
",",
"'Calculate bit-rate'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Voodoo People (Pendulum Remix)'",
",",
"'title'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'The Prodigy'",
",",
"'artist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Pendulum'",
",",
"'albumartist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Voodoo People'",
",",
"'album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2005",
",",
"'year'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"1",
",",
"'track no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"12",
",",
"'track of'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"no",
",",
"1",
",",
"'disk no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"of",
",",
"1",
",",
"'disk of'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"genre",
"[",
"0",
"]",
",",
"'Electronic'",
",",
"'genre'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture 0 format'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"196450",
",",
"'picture 0 length'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture 1 format'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"1",
"]",
".",
"data",
".",
"length",
",",
"196450",
",",
"'picture 1 length'",
")",
";",
"}",
"function",
"checkNativeTags",
"(",
"native",
")",
"{",
"t",
".",
"ok",
"(",
"native",
",",
"'Native m4a tags should be present'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"trkn",
",",
"[",
"'1/12'",
"]",
",",
"'m4a.trkn'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"disk",
",",
"[",
"'1/1'",
"]",
",",
"'m4a.disk'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"tmpo",
",",
"[",
"0",
"]",
",",
"'m4a.tmpo'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"gnre",
",",
"[",
"'Electronic'",
"]",
",",
"'m4a.gnre'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"stik",
",",
"[",
"1",
"]",
",",
"'m4a.stik'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©alb'",
"]",
",",
"[",
"'Voodoo People'",
"]",
",",
"'m4a.©alb'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"aART",
",",
"[",
"'Pendulum'",
"]",
",",
"'m4a.aART'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©ART'",
"]",
",",
"[",
"'The Prodigy'",
"]",
",",
"'m4a.©ART'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©cmt'",
"]",
",",
"[",
"'(Pendulum Remix)'",
"]",
",",
"'m4a.©cmt'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©wrt'",
"]",
",",
"[",
"'Liam Howlett'",
"]",
",",
"'m4a.©wrt'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'----:com.apple.iTunes:iTunNORM'",
"]",
",",
"[",
"' 0000120A 00001299 00007365 0000712F 0002D88B 0002D88B 00007F2B 00007F2C 0003C770 0001F5C7'",
"]",
",",
"'m4a.----:com.apple.iTunes:iTunNORM'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©nam'",
"]",
",",
"[",
"'Voodoo People (Pendulum Remix)'",
"]",
",",
"'m4a.©nam'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©too'",
"]",
",",
"[",
"'Lavf52.36.0'",
"]",
",",
"'m4a.©too'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
"[",
"'©day'",
"]",
",",
"[",
"'2005'",
"]",
",",
"'m4a.@day'",
")",
";",
"t",
".",
"isDefined",
"(",
"native",
".",
"covr",
")",
";",
"t",
".",
"strictEqual",
"(",
"native",
".",
"covr",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'m4a.covr.format'",
")",
";",
"t",
".",
"strictEqual",
"(",
"native",
".",
"covr",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"196450",
",",
"'m4a.covr.data.length'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'id4.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mp4'",
")",
";",
"const",
"native",
"=",
"metadata",
".",
"native",
".",
"iTunes",
";",
"t",
".",
"ok",
"(",
"native",
",",
"'Native m4a tags should be present'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"checkNativeTags",
"(",
"mm",
".",
"orderTags",
"(",
"native",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Ref: https://github.com/Borewit/music-metadata/issues/74\n */",
"describe",
"(",
"'should decode 8-byte unsigned integer'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-74.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mp4'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'isom/iso2/mp41'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"isDefined",
"(",
"native",
".",
"iTunes",
",",
"'Native m4a tags should be present'",
")",
";",
"assert",
".",
"isAtLeast",
"(",
"native",
".",
"iTunes",
".",
"length",
",",
"1",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Live at Tom\\'s Bullpen in Dover, DE (2016-04-30)'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"albumartist",
",",
"'They Say We\\'re Sinking'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'youtube rip\\r\\nSource: https://www.youtube.com/playlist?list=PLZ4QPxwBgg9TfsFVAArOBfuve_0e7zQaV'",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Ref: https://github.com/Borewit/music-metadata/issues/79\n */",
"describe",
"(",
"'should be able to extract the composer and artist'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-79.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mp4'",
")",
";",
"const",
"{",
"common",
",",
"format",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Uprising'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"composer",
",",
"[",
"'Muse'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Muse'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Rock'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"date",
",",
"'2009'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodedby",
",",
"'iTunes 8.2.0.23, QuickTime 7.6.2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"1",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"null",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse MPEG-4 Audio Book files (.m4b)'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'audio book from issue issue #127'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-127.m4b'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mp4'",
")",
";",
"const",
"{",
"common",
",",
"format",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'M4A/3gp5/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'GloriesIreland00-12_librivox'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Joseph Dunn'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Audiobook'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodedby",
",",
"'Chapter and Verse V 1.5'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"null",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'https://archive.org/details/glories_of_ireland_1801_librivox'",
"]",
")",
";",
"const",
"iTunes",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"iTunes",
")",
";",
"assert",
".",
"deepEqual",
"(",
"iTunes",
".",
"stik",
",",
"[",
"2",
"]",
",",
"'iTunes.stik = 2 = Audiobook'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse chapters'",
",",
"async",
"(",
")",
"=>",
"{",
"/**\n * Source audio-book: https://librivox.org/the-babys-songbook-by-walter-crane/\n */",
"describe",
"(",
"'BabysSongbook_librivox.m4b'",
",",
"async",
"(",
")",
"=>",
"{",
"function",
"checkMetadata",
"(",
"metadata",
")",
"{",
"const",
"{",
"common",
",",
"format",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'M4A/3gp5/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"991.213",
",",
"1",
"/",
"500",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Babys Songbook'",
",",
"'common.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Walter Crane'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Audiobook'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"encodedby",
",",
"'Chapter and Verse V 1.5'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.disk'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"comment",
",",
"'common.comment'",
")",
";",
"const",
"iTunes",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"iTunes",
")",
";",
"assert",
".",
"deepEqual",
"(",
"iTunes",
".",
"stik",
",",
"[",
"2",
"]",
",",
"'iTunes.stik = 2 = Audiobook'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"chapters",
",",
"[",
"{",
"sampleOffset",
":",
"45056",
",",
"title",
":",
"'01 - Baby\\'s Opera: 01 - Girls and Boys'",
"}",
",",
"{",
"sampleOffset",
":",
"2695168",
",",
"title",
":",
"'02 - Baby\\'s Opera: 02 - The Mulberry Bush'",
"}",
",",
"{",
"sampleOffset",
":",
"5083136",
",",
"title",
":",
"'03 - Baby\\'s Opera: 03 - Oranges and Lemons'",
"}",
",",
"{",
"sampleOffset",
":",
"8352768",
",",
"title",
":",
"'04 - Baby\\'s Opera: 04 - St. Paul\\'s Steeple'",
"}",
",",
"{",
"sampleOffset",
":",
"10544128",
",",
"title",
":",
"'05 - Baby\\'s Opera: 05 - My Lady\\'s Garden'",
"}",
",",
"{",
"sampleOffset",
":",
"12284928",
",",
"title",
":",
"'06 - Baby\\'s Opera: 12 - Dickory Dock'",
"}",
",",
"{",
"sampleOffset",
":",
"14125056",
",",
"title",
":",
"'07 - Baby\\'s Opera: 22 - Baa!Baa!Black Sheep'",
"}",
",",
"{",
"sampleOffset",
":",
"16410624",
",",
"title",
":",
"'08 - Baby\\'s Bouquet: 01 - Dedication and Polly put the Kettle On'",
"}",
",",
"{",
"sampleOffset",
":",
"19068928",
",",
"title",
":",
"'09 - Baby\\'s Bouquet: 02 - Hot Cross Buns'",
"}",
",",
"{",
"sampleOffset",
":",
"21685248",
",",
"title",
":",
"'10 - Baby\\'s Bouquet: 03 - The Little Woman and the Pedlar'",
"}",
",",
"{",
"sampleOffset",
":",
"30461952",
",",
"title",
":",
"'11 - Baby\\'s Bouquet: 04 - The Little Disaster'",
"}",
",",
"{",
"sampleOffset",
":",
"37761024",
",",
"title",
":",
"'12 - Baby\\'s Bouquet: 05 - The Old Woman of Norwich'",
"}",
",",
"{",
"sampleOffset",
":",
"39628800",
",",
"title",
":",
"'13 - Baby\\'s Bouquet: 12 - Lucy Locket'",
"}",
",",
"{",
"sampleOffset",
":",
"41500672",
",",
"title",
":",
"'14 - Baby\\'s Bouquet: 18 - The North Wind & the Robin'",
"}",
"]",
")",
";",
"}",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'BabysSongbook_librivox.m4b'",
")",
";",
"it",
"(",
"'from a file'",
",",
"async",
"(",
")",
"=>",
"{",
"let",
"metadata",
";",
"const",
"stream",
"=",
"fs",
".",
"createReadStream",
"(",
"filePath",
")",
";",
"try",
"{",
"metadata",
"=",
"await",
"mm",
".",
"parseStream",
"(",
"stream",
",",
"{",
"mimeType",
":",
"'audio/mp4'",
"}",
",",
"{",
"includeChapters",
":",
"true",
"}",
")",
";",
"}",
"finally",
"{",
"stream",
".",
"close",
"(",
")",
";",
"}",
"checkMetadata",
"(",
"metadata",
")",
";",
"}",
")",
";",
"it",
"(",
"'from a stream'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"stream",
"=",
"fs",
".",
"createReadStream",
"(",
"filePath",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseStream",
"(",
"stream",
",",
"{",
"mimeType",
":",
"'audio/mp4'",
"}",
",",
"{",
"includeChapters",
":",
"true",
"}",
")",
";",
"stream",
".",
"close",
"(",
")",
";",
"checkMetadata",
"(",
"metadata",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse MPEG-4 Video (.mp4)'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'Parse TV episode'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'Mr. Pickles S02E07 My Dear Boy.mp4'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'video/mp4'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'My Dear Boy'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"tvEpisode",
",",
"7",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"tvEpisodeId",
",",
"'017'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"tvSeason",
",",
"2",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"tvShow",
",",
"'Mr. Pickles'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'MPEG-4/AAC+AC-3+CEA-608'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Mr. Pickles'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artists",
",",
"[",
"'Mr. Pickles'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"albumartist",
",",
"'Mr. Pickles'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"copyright",
",",
"'© & TM - Cartoon Network - 2016'",
")",
";",
"const",
"iTunes",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"iTunes",
")",
";",
"assert",
".",
"deepEqual",
"(",
"iTunes",
".",
"stik",
",",
"[",
"10",
"]",
",",
"'iTunes.stik = 10 = TV Show'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should support extended atom header'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-133.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'video/mp4'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Handle dashed atom-ID\\'s'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-151.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'video/mp4'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'MPEG-4/AAC+MP4S'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"album",
",",
"'We Don`t Need to Whisper'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"albumartist",
",",
"'Angels and Airwaves'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Angels and Airwaves'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artists",
",",
"[",
"'Angels and Airwaves'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"bpm",
",",
"89",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"genre",
",",
"[",
"'Rock'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'Distraction'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse Trumpsta (Djuro Remix)'",
",",
"(",
")",
"=>",
"{",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'01. Trumpsta (Djuro Remix).m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/m4a'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"album",
",",
"'Trumpsta (Remixes)'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"albumartist",
",",
"'Contiez'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Contiez'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artists",
",",
"[",
"'Contiez'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'Trumpsta (Djuro Remix)'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Related issue: https://github.com/Borewit/music-metadata/issues/318\n */",
"it",
"(",
"'Be able to handle garbage behind mdat root atom'",
",",
"async",
"(",
")",
"=>",
"{",
"/**\n * Sample file with 1024 zeroes appended\n */",
"const",
"m4aFile",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-318.m4a'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"m4aFile",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"quality",
"}",
"=",
"metadata",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'iTunes'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Tool'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Fear Inoculum'",
",",
"'common.title'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Error at offset=117501: box.id=0'",
"}",
"]",
",",
"'check for warning regarding box.id=0'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle box.id = 0000'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-387.m4a'",
")",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"224.00290249433107",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"1",
"/",
"200",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Chris Brown'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Look At Me Now'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Look At Me Now (feat. Lil Wayne & Busta Rhymes) - Single'",
",",
"'common.album'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Extract creation and modified time'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'Apple voice memo.m4a'",
")",
";",
"const",
"{",
"format",
",",
"quality",
",",
"common",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'M4A/isom/mp42'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"1.024",
",",
"1",
"/",
"2000",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"creationTime",
".",
"toISOString",
"(",
")",
",",
"'2021-01-02T17:42:46.000Z'",
",",
"'format.modificationTime'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"modificationTime",
".",
"toISOString",
"(",
")",
",",
"'2021-01-02T17:43:25.000Z'",
",",
"'format.modificationTime'",
")",
";",
"const",
"iTunes",
"=",
"mm",
".",
"orderTags",
"(",
"native",
".",
"iTunes",
")",
";",
"assert",
".",
"strictEqual",
"(",
"iTunes",
".",
"date",
"[",
"0",
"]",
",",
"'2021-01-02T17:42:05Z'",
",",
"'moov.udta.date'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Select the audio track from mp4'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-744.mp4'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'isom/iso2/mp41'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"360.8",
",",
"1",
"/",
"20",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle 0 length box'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp4Samples",
",",
"'issue-749.m4a'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"1563.16",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"'S2E32 : Audio'",
",",
"common",
".",
"title",
",",
"'common.title'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
1027,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1027,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661884 | [
"import",
"{",
"Readable",
"}",
"from",
"\"stream\"",
";",
"/**\n * A mock readable-stream, using string to read from\n */",
"export",
"class",
"SourceStream",
"extends",
"Readable",
"{",
"constructor",
"(",
"private",
"buf",
")",
"{",
"super",
"(",
")",
";",
"}",
"public",
"_read",
"(",
")",
"{",
"this",
".",
"push",
"(",
"this",
".",
"buf",
")",
";",
"this",
".",
"push",
"(",
"null",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661885 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"SourceStream",
"}",
"from",
"'./util'",
";",
"import",
"{",
"ID3v24TagMapper",
"}",
"from",
"'../lib/id3v2/ID3v24TagMapper'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"const",
"t",
"=",
"assert",
";",
"describe",
"(",
"'Parse MPEG'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should parse MPEG-1 Audio Layer II '",
",",
"async",
"(",
")",
"=>",
"{",
"/**\n * No errors found in file.\n *\n * ---------------------------\n * MPEG-length: 8359\n * Sample-rate: 44100\n * frame_size: 418\n * Samples per frame 1152\n *\n * Summary:\n * ===============\n * Total number of frames: 20, unpadded: 1, padded: 19\n * File is CBR. Bitrate of each frame is 128 kbps.\n * Exact length: 00:00\n *\n * FooBar: 22559 samples\n * Audacity: 23040 samples (assumed to be correct)\n *\n * Using CBR calculation: 23392.29375; same as Mutagen\n */",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'1971 - 003 - Sweet - Co-Co - CannaPower.mp2'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'Tags: ID3v1 & ID3v2.3'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container = MPEG'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 2'",
",",
"'format.codec = MPEG-1 Audio Layer II'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"bitrate",
",",
"128000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfSamples",
",",
"23040",
",",
"'format.numberOfSamples = 23040'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"0.5224489795918368",
",",
"'duration [seconds]'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'MPEG frame sync efficiency'",
",",
"(",
")",
"=>",
"{",
"const",
"emptyStreamSize",
"=",
"5",
"*",
"1024",
"*",
"1024",
";",
"const",
"buf",
"=",
"Buffer",
".",
"alloc",
"(",
"emptyStreamSize",
")",
".",
"fill",
"(",
"0",
")",
";",
"it",
"(",
"'should sync efficient from a stream'",
",",
"async",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"10000",
")",
";",
"const",
"streamReader",
"=",
"new",
"SourceStream",
"(",
"buf",
")",
";",
"await",
"mm",
".",
"parseStream",
"(",
"streamReader",
",",
"{",
"mimeType",
":",
"'audio/mpeg'",
"}",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should sync efficient, from a file'",
",",
"async",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"10000",
")",
";",
"const",
"tmpFilePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'zeroes.mp3'",
")",
";",
"fs",
".",
"writeFileSync",
"(",
"tmpFilePath",
",",
"buf",
")",
";",
"try",
"{",
"await",
"mm",
".",
"parseFile",
"(",
"tmpFilePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"}",
"finally",
"{",
"fs",
".",
"unlinkSync",
"(",
"tmpFilePath",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'mpeg parsing fails for irrelevant attributes #14'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should decode 04 - You Don\\'t Know.mp3'",
",",
"async",
"function",
"(",
")",
"{",
"/**\n * File has id3v2.3 & id3v1 tags\n * First frame is 224 kbps, rest 320 kbps\n * After id3v2.3, lots of 0 padding\n */",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'04 - You Don\\'t Know.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"9098496",
",",
"'format.numberOfSamples'",
")",
";",
"t",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"206.3",
",",
"1",
"/",
"10",
",",
"'format.duration'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"320000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'You Don\\'t Know'",
",",
"'common.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'common.artists'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Reel Big Fish'",
",",
"'common.albumartist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Why Do They Rock So Hard?'",
",",
"'common.album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"1998",
",",
"'common.year'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"4",
",",
"'common.track.no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"no",
",",
"null",
",",
"'common.disk.no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"of",
",",
"null",
",",
"'common.disk.of'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Ska-Punk'",
"]",
",",
"'common.genre'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'Jive'",
"]",
",",
"'common.genre'",
")",
";",
"}",
"function",
"checkID3v1",
"(",
"id3v1",
")",
"{",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"artist",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'id3v1.artist'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"title",
",",
"[",
"'You Don\\'t Know'",
"]",
",",
"'id3v1.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"album",
",",
"[",
"'Why Do They Rock So Hard?'",
"]",
",",
"'id3v1.album'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"year",
",",
"[",
"'1998'",
"]",
",",
"'(id3v1.year'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"track",
",",
"[",
"4",
"]",
",",
"'id3v1.track'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v1",
".",
"comment",
",",
"[",
"'000010DF 00000B5A 00007784'",
"]",
",",
"'id3v1.comment'",
")",
";",
"}",
"function",
"checkID3v23",
"(",
"id3v23",
")",
"{",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE2",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'native: TPE2'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TIT2",
",",
"[",
"'You Don\\'t Know'",
"]",
",",
"'native: TIT2'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TALB",
",",
"[",
"'Why Do They Rock So Hard?'",
"]",
",",
"'native: TALB'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE1",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'native: TPE1'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TCON",
",",
"[",
"'Ska-Punk'",
"]",
",",
"'native: TCON'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TYER",
",",
"[",
"'1998'",
"]",
",",
"'native: TYER'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TCOM",
",",
"[",
"'CA'",
"]",
",",
"'native: TCOM'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"TRCK",
",",
"[",
"'04'",
"]",
",",
"'native: TRCK'",
")",
";",
"t",
".",
"deepEqual",
"(",
"id3v23",
".",
"COMM",
",",
"[",
"{",
"description",
":",
"''",
",",
"language",
":",
"'eng'",
",",
"text",
":",
"'Jive'",
"}",
"]",
",",
"'native: COMM'",
")",
";",
"}",
"const",
"result",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"checkFormat",
"(",
"result",
".",
"format",
")",
";",
"checkCommon",
"(",
"result",
".",
"common",
")",
";",
"checkID3v23",
"(",
"mm",
".",
"orderTags",
"(",
"result",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
")",
";",
"checkID3v1",
"(",
"mm",
".",
"orderTags",
"(",
"result",
".",
"native",
".",
"ID3v1",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'should decode 07 - I\\'m Cool.mp3'",
",",
"async",
"function",
"(",
")",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'07 - I\\'m Cool.mp3'",
")",
";",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.type'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"200.9",
",",
"1",
"/",
"10",
",",
"'format.duration'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"320000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'I\\'m Cool'",
",",
"'common.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'common.artists'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Reel Big Fish'",
",",
"'common.albumartist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Why Do They Rock So Hard?'",
",",
"'common.album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"1998",
",",
"'common.year'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"7",
",",
"'common.track.no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"no",
",",
"null",
",",
"'common.disk.no'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"of",
",",
"null",
",",
"'common.disk.of'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Ska-Punk'",
"]",
",",
"'common.genre'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'Jive'",
"]",
",",
"'common.genre'",
")",
";",
"}",
"function",
"checkID3v23",
"(",
"native",
")",
"{",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TPE2",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'native: TPE2'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TIT2",
",",
"[",
"'I\\'m Cool'",
"]",
",",
"'native: TIT2'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TALB",
",",
"[",
"'Why Do They Rock So Hard?'",
"]",
",",
"'native: TALB'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TPE1",
",",
"[",
"'Reel Big Fish'",
"]",
",",
"'native: TPE1'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TCON",
",",
"[",
"'Ska-Punk'",
"]",
",",
"'native: TCON'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TYER",
",",
"[",
"'1998'",
"]",
",",
"'native: TYER'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TCOM",
",",
"[",
"'CA'",
"]",
",",
"'native: TCOM'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"TRCK",
",",
"[",
"'07'",
"]",
",",
"'native: TRCK'",
")",
";",
"t",
".",
"deepEqual",
"(",
"native",
".",
"COMM",
",",
"[",
"{",
"description",
":",
"''",
",",
"language",
":",
"'eng'",
",",
"text",
":",
"'Jive'",
"}",
"]",
",",
"'native: COMM'",
")",
";",
"}",
"const",
"result",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"checkFormat",
"(",
"result",
".",
"format",
")",
";",
"checkCommon",
"(",
"result",
".",
"common",
")",
";",
"checkID3v23",
"(",
"mm",
".",
"orderTags",
"(",
"result",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Related to issue #38\n */",
"describe",
"(",
"'Handle corrupt MPEG-frames'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should handle corrupt frame causing negative frame data left'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'outofbounds.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.type'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"320000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"const",
"issueDir",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"/**\n * Related to issue #39\n */",
"describe",
"(",
"'Multiple ID3 tags: ID3v2.3, ID3v2.4 & ID3v1'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
",",
"expectedDuration",
")",
"{",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v2.4'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"expectedDuration",
",",
"'format.duration'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"320000",
",",
"'format.bitrate = 160 kbit/sec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"it",
"(",
"'should parse multiple tag headers: ID3v2.3, ID3v2.4 & ID3v1'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"issueDir",
",",
"'id3-multi-02.mp3'",
")",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"230.29551020408164",
")",
";",
"}",
")",
";",
"/**\n * Test on multiple headers: ID3v1, ID3v2.3, ID3v2.4 & ID3v2.4 ( 2x ID3v2.4 !! )\n */",
"it",
"(",
"'should decode mp3_01 with 2x ID3v2.4 header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"issueDir",
",",
"'id3-multi-01.mp3'",
")",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
",",
"0.1306122448979592",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Test decoding popularimeter\n */",
"describe",
"(",
"'POPM decoding'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'check mapping function'",
",",
"(",
")",
"=>",
"{",
"assert",
".",
"deepEqual",
"(",
"ID3v24TagMapper",
".",
"toRating",
"(",
"{",
"email",
":",
"'[email protected]'",
",",
"rating",
":",
"0",
"}",
")",
",",
"{",
"source",
":",
"'[email protected]'",
",",
"rating",
":",
"undefined",
"}",
",",
"'unknown rating'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ID3v24TagMapper",
".",
"toRating",
"(",
"{",
"email",
":",
"'[email protected]'",
",",
"rating",
":",
"1",
"}",
")",
",",
"{",
"source",
":",
"'[email protected]'",
",",
"rating",
":",
"0",
"/",
"255",
"}",
",",
"'lowest rating'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"ID3v24TagMapper",
".",
"toRating",
"(",
"{",
"email",
":",
"'[email protected]'",
",",
"rating",
":",
"255",
"}",
")",
",",
"{",
"source",
":",
"'[email protected]'",
",",
"rating",
":",
"1",
"}",
",",
"'highest rating'",
")",
";",
"}",
")",
";",
"it",
"(",
"'from \\'Yeahs-It\\'s Blitz!.mp3\\''",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"issueDir",
",",
"'02-Yeahs-It\\'s Blitz! 2.mp3'",
")",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"const",
"idv23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"idv23",
".",
"POPM",
"[",
"0",
"]",
",",
"{",
"email",
":",
"'no@email'",
",",
"rating",
":",
"128",
",",
"counter",
":",
"0",
"}",
",",
"'ID3v2.3 POPM'",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"common",
".",
"rating",
"[",
"0",
"]",
".",
"rating",
",",
"0.5",
",",
"1",
"/",
"(",
"2",
"*",
"254",
")",
",",
"'Common rating'",
")",
";",
"}",
")",
";",
"it",
"(",
"'from \\'id3v2-lyrics.mp3\\''",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"issueDir",
",",
"'id3v2-lyrics.mp3'",
")",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"const",
"idv23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"idv23",
".",
"POPM",
"[",
"0",
"]",
",",
"{",
"email",
":",
"'MusicBee'",
",",
"rating",
":",
"255",
",",
"counter",
":",
"0",
"}",
",",
"'ID3v2.3 POPM'",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"common",
".",
"rating",
"[",
"0",
"]",
".",
"rating",
",",
"1",
",",
"0",
",",
"'Common rating'",
")",
";",
"}",
")",
";",
"it",
"(",
"'decode POPM without a counter field'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"issueDir",
",",
"'issue-100.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"idv23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"idv23",
".",
"POPM",
"[",
"0",
"]",
",",
"{",
"counter",
":",
"undefined",
",",
"email",
":",
"'Windows Media Player 9 Series'",
",",
"rating",
":",
"255",
"}",
",",
"'ID3v2.3 POPM'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Calculate / read duration'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'VBR read from Xing header'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"issueDir",
",",
"'id3v2-xheader.mp3'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
",",
"{",
"duration",
":",
"false",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"0.4963265306122449",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'VBR: based on frame count if duration flag is set'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"issueDir",
",",
"'Dethklok-mergeTagHeaders.mp3'",
")",
";",
"const",
"buffer",
"=",
"fs",
".",
"readFileSync",
"(",
"filePath",
")",
";",
"const",
"stream",
"=",
"new",
"SourceStream",
"(",
"buffer",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseStream",
"(",
"stream",
",",
"{",
"mimeType",
":",
"'audio/mpeg'",
"}",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"34.66",
",",
"5",
"/",
"1000",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'It should be able to decode MPEG 2.5 Layer III'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"issueDir",
",",
"'mp3'",
",",
"'issue-347.mp3'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 2.5 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"'CBR'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"1",
",",
"'format.numberOfChannels'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"8000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29905,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29905,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661886 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"describe",
"(",
"'Parse Musepack (.mpc)'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'mpc'",
")",
";",
"describe",
"(",
"'Parse Musepack, SV7 with APEv2 header'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'apev2.sv7.mpc'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/musepac'",
")",
";",
"const",
"format",
"=",
"metadata",
".",
"format",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'Musepack, SV7'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"11940",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"269649",
",",
"1",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'1.15'",
")",
";",
"const",
"common",
"=",
"metadata",
".",
"common",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'God Inside'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Faze Action'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Broad Souls'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"date",
",",
"'2004-05-03'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"barcode",
",",
"'802085273528'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"catalognumber",
",",
"[",
"'LUNECD35'",
"]",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"media",
",",
"'CD'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"releasecountry",
",",
"'GB'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"9",
",",
"of",
":",
"10",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Handle APEv1 TAG header (no header, only footer)'",
",",
"(",
")",
"=>",
"{",
"/**\n * In this sample the APEv2 header is not present, only the APEv2 footer\n */",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'apev2-no-header.sv7.mpc'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/musepac'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'Musepack, SV7'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"44100",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfSamples",
",",
"11940",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"format",
".",
"bitrate",
",",
"269649",
",",
"1",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'1.15'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'God Inside'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Faze Action'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"album",
",",
"'Broad Souls'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"date",
",",
"'2004'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"track",
",",
"{",
"no",
":",
"9",
",",
"of",
":",
"null",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parse Musepack, SV8 with APEv2 header'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'bach-goldberg-variatians-05.sv8.mpc'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/musepac'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'Musepack, SV8'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"48000",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfSamples",
",",
"24000",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfChannels",
",",
"2",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"0.5",
",",
"1",
"/",
"2000",
")",
";",
"assert",
".",
"approximately",
"(",
"metadata",
".",
"format",
".",
"bitrate",
",",
"32368",
",",
"1",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'Goldberg Variations, BWV 988: Variatio 4 a 1 Clav.'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Johann Sebastian Bach'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"artists",
",",
"[",
"'Johann Sebastian Bach'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"isrc",
",",
"[",
"'QMNYZ1200005'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"license",
",",
"'https://creativecommons.org/publicdomain/zero/1.0/'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"album",
",",
"'Open Goldberg Variations'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"date",
",",
"'2012-05-28'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"track",
",",
"{",
"no",
":",
"5",
",",
"of",
":",
"32",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
36824,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661887 | [
"import",
"{",
"assert",
",",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"IdHeader",
"}",
"from",
"'../lib/ogg/opus/Opus'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"describe",
"(",
"'Parse Ogg'",
",",
"function",
"(",
")",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"oggSamplePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'ogg'",
")",
";",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"function",
"check_Nirvana_In_Bloom_commonTags",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'In Bloom'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Nirvana'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Nirvana'",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Nevermind'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"1991",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"2",
",",
"of",
":",
"12",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"1",
"}",
",",
"'common.disk'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Grunge'",
",",
"'Alternative'",
"]",
",",
"'genre'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"30966",
",",
"'picture length'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"barcode",
",",
"'0720642442524'",
",",
"'common.barcode (including leading zero)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"asin",
",",
"'B000003TA4'",
",",
"'common.asin'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"catalognumber",
",",
"[",
"'GED24425'",
"]",
",",
"'common.asin'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"isrc",
",",
"[",
"'USGF19942502'",
"]",
",",
"'common.isrc'",
")",
";",
"}",
"function",
"check_Nirvana_In_Bloom_VorbisTags",
"(",
"vorbis",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"TRACKNUMBER",
",",
"[",
"'2'",
"]",
",",
"'vorbis.TRACKNUMBER'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"TRACKTOTAL",
",",
"[",
"'12'",
"]",
",",
"'vorbis.TRACKTOTAL'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"ALBUM",
",",
"[",
"'Nevermind'",
"]",
",",
"'vorbis.ALBUM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"COMMENT",
",",
"[",
"'Nirvana\\'s Greatest Album'",
"]",
",",
"'vorbis.COMMENT'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"GENRE",
",",
"[",
"'Grunge'",
",",
"'Alternative'",
"]",
",",
"'vorbis.GENRE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"TITLE",
",",
"[",
"'In Bloom'",
"]",
",",
"'vorbis.TITLE'",
")",
";",
"const",
"cover",
"=",
"vorbis",
".",
"METADATA_BLOCK_PICTURE",
"[",
"0",
"]",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"format",
",",
"'image/jpeg'",
",",
"'vorbis.METADATA_BLOCK_PICTURE format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"type",
",",
"'Cover (front)'",
",",
"'vorbis.METADATA_BLOCK_PICTURE tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"data",
".",
"length",
",",
"30966",
",",
"'vorbis.METADATA_BLOCK_PICTURE length'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"data",
"[",
"0",
"]",
",",
"255",
",",
"'vorbis.METADATA_BLOCK_PICTURE data 0'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"data",
"[",
"1",
"]",
",",
"216",
",",
"'vorbis.METADATA_BLOCK_PICTURE data 1'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"data",
"[",
"cover",
".",
"data",
".",
"length",
"-",
"1",
"]",
",",
"217",
",",
"'vorbis.METADATA_BLOCK_PICTURE data -1'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"cover",
".",
"data",
"[",
"cover",
".",
"data",
".",
"length",
"-",
"2",
"]",
",",
"255",
",",
"'vorbis.METADATA_BLOCK_PICTURE data -2'",
")",
";",
"}",
"describe",
"(",
"'Parsing Ogg/Vorbis'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'decode: Nirvana - In Bloom - 2-sec.ogg'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Nirvana - In Bloom - 2-sec.ogg'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"2.0",
",",
"'format.duration = 2.0 sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels = 2 (stereo)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"64000",
",",
"'bitrate = 64 kbit/sec'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/ogg'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"check_Nirvana_In_Bloom_VorbisTags",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"vorbis",
")",
")",
";",
"check_Nirvana_In_Bloom_commonTags",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should handle page not finalized with the lastPage flag'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_62.ogg'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"22050",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels = 2 (stereo)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"56000",
",",
"'bitrate = 64 kbit/sec'",
")",
";",
"assert",
".",
"isDefined",
"(",
"common",
".",
"title",
",",
"'should provide: metadata.common.title'",
")",
";",
"assert",
".",
"equal",
"(",
"common",
".",
"title",
",",
"'Al-Fatihah'",
",",
"'metadata.common.title'",
")",
";",
"assert",
".",
"equal",
"(",
"common",
".",
"artist",
",",
"'Mishary Alafasi - www.TvQuran.com'",
",",
"'metadata.common.artist'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Invalid FourCC ID, maybe last OGG-page is not marked with last-page flag'",
"}",
"]",
")",
";",
"}",
")",
";",
"/**\n * Related issue: https://github.com/Borewit/music-metadata/issues/70\n */",
"it",
"(",
"'should not fail on an Ogg/Vorbis \\'Setup header\\''",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_70.ogg'",
")",
";",
"const",
"{",
"format",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'Ogg'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Vorbis I'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"const",
"vorbis",
"=",
"mm",
".",
"orderTags",
"(",
"native",
".",
"vorbis",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"ALBUM",
",",
"[",
"'Dropsonde'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"ARTIST",
",",
"[",
"'Biosphere'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
"[",
"'ALBUM ARTIST'",
"]",
",",
"[",
"'Biosphere'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"ORGANIZATION",
",",
"[",
"'Touch UK'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"DATE",
",",
"[",
"'2006'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"RATING",
",",
"[",
"'-1'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"REPLAYGAIN_TRACK_PEAK",
",",
"[",
"'0.999969'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"REPLAYGAIN_TRACK_GAIN",
",",
"[",
"'0.440000 dB'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"vorbis",
".",
"REPLAYGAIN_ALBUM_GAIN",
",",
"[",
"'0.440000 dB'",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parsing Ogg/Opus'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'components'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'IdHeader should throw error if data is shorter than header'",
",",
"(",
")",
"=>",
"{",
"try",
"{",
"const",
"idHeader",
"=",
"new",
"IdHeader",
"(",
"18",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"expect",
"(",
"err",
".",
"message",
")",
".",
"to",
".",
"equal",
"(",
"'ID-header-page 0 should be at least 19 bytes long'",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'decode: Nirvana - In Bloom - 2-sec.opus'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Nirvana - In Bloom - 2-sec.opus'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'vorbis'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"96000",
",",
"'format.numberOfSamples = 96000'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"2.0",
",",
"1",
"/",
"200",
",",
"'format.duration = 2.0 sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels = 2 (stereo)'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/ogg'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"check_Nirvana_In_Bloom_VorbisTags",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"vorbis",
")",
")",
";",
"check_Nirvana_In_Bloom_commonTags",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Parsing Ogg/Speex'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'decode: \\'female_scrub.spx\\''",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'female_scrub.spx'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'Ogg'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Speex 1.0beta1'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"8000",
",",
"'format.sampleRate = 8 kHz'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/ogg'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'check for ogg-multipage-metadata-bug'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'ogg-multipagemetadata-bug.ogg'",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"title",
",",
"'Modestep - To The Stars (Break the Noize & The Autobots Remix)'",
",",
"'title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"artist",
",",
"'Break The Noize & The Autobots'",
",",
"'artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"albumartist",
",",
"'Modestep'",
",",
"'albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"album",
",",
"'To The Stars'",
",",
"'album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"date",
",",
"'2011-01-01'",
",",
"'year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"track",
".",
"no",
",",
"2",
",",
"'track no'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"track",
".",
"of",
",",
"5",
",",
"'track of'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"disk",
".",
"no",
",",
"1",
",",
"'disk no'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"disk",
".",
"of",
",",
"1",
",",
"'disk of'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"genre",
"[",
"0",
"]",
",",
"'Dubstep'",
",",
"'genre'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"result",
".",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"207439",
",",
"'picture length'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Calculate duration'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'with proper last page header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"oggSamplePath",
",",
"'last-page.oga'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'Ogg'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Opus'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"253440",
",",
"'format.numberOfSamples'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"5.28",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"it",
"(",
"'with no last page'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"oggSamplePath",
",",
"'no-last-page.oga'",
")",
";",
"const",
"{",
"format",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'Ogg'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'Opus'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"16000",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"270720",
",",
"'format.numberOfSamples'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"5.64",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Last OGG-page is not marked with last-page flag'",
"}",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661888 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"IFormat",
",",
"INativeTagDict",
"}",
"from",
"'../lib/type'",
";",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"describe",
"(",
"'Parse RIFF/WAVE audio format'",
",",
"(",
")",
"=>",
"{",
"const",
"wavSamples",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'wav'",
")",
";",
"function",
"checkExifTags",
"(",
"exif",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IART",
",",
"[",
"'Beth Hart & Joe Bonamassa'",
"]",
",",
"'exif.IART'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ICRD",
",",
"[",
"'2011'",
"]",
",",
"'exif.ICRD'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"INAM",
",",
"[",
"'Sinner\\'s Prayer'",
"]",
",",
"'exif.INAM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IPRD",
",",
"[",
"'Don\\'t Explain'",
"]",
",",
"'exif.IPRD'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ITRK",
",",
"[",
"'1/10'",
"]",
",",
"'exif.ITRK'",
")",
";",
"}",
"/**\n * Looks like RIFF/WAV not fully supported yet in MusicBrainz Picard: https://tickets.metabrainz.org/browse/PICARD-653?jql=text%20~%20%22RIFF%22.\n * This file has been fixed with Mp3Tag to have a valid ID3v2.3 tag\n */",
"it",
"(",
"'should parse LIST-INFO (EXIF)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer [id3v2.3].wav'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"filename",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"true",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'exif'",
",",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes = [\\'exif\\', \\'ID3v2.3\\']'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"16",
",",
"'format.bitsPerSample = 16 bits'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels = 2 channels'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"93624",
",",
"'format.numberOfSamples = 93624'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"2.1229931972789116",
",",
"'format.duration = ~2.123 seconds (checked with Adobe Audition)'",
")",
";",
"}",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkExifTags",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"exif",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'should be able to handle complex nested chunk structures'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_75.wav'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should map RIFF tags to common'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'riff_adobe_audition.wav'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"const",
"format",
"=",
"metadata",
".",
"format",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"true",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"24",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"13171",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"duration",
",",
"0.27439583333333334",
",",
"'~2.274 (checked with Adobe Audition)'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'exif'",
"]",
")",
";",
"const",
"exif",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"exif",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IART",
",",
"[",
"'Wolfgang Amadeus Mozart'",
"]",
",",
"'exif.IART: Original Artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ICMS",
",",
"[",
"'Louis Walker'",
"]",
",",
"'exif.ICMS: Commissioned'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ICMT",
",",
"[",
"'Comments here!'",
"]",
",",
"'exif.ICMT: Comments'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ICOP",
",",
"[",
"'Copyright 2018'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ICRD",
",",
"[",
"'2018-04-26T13:26:19-05:00'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IENG",
",",
"[",
"'Engineer'",
"]",
",",
"'exif.IENG: Engineer'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IARL",
",",
"[",
"'https://github.com/borewit/music-metadata'",
"]",
",",
"'exif.IARL: Archival Location'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IGNR",
",",
"[",
"'Blues'",
"]",
",",
"'exif.IGNR: Genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IKEY",
",",
"[",
"'neat; cool; riff; tags'",
"]",
",",
"'exif.IKEY: Keywords'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IMED",
",",
"[",
"'CD'",
"]",
",",
"'exif.IMED: Original Medium'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"INAM",
",",
"[",
"'The Magic Flute'",
"]",
",",
"'exif.INAM: Display Title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"IPRD",
",",
"[",
"'La clemenzo di Tito'",
"]",
",",
"'exif.IPRD: Product'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ISBJ",
",",
"[",
"'An opera in two acts'",
"]",
",",
"'exif.ISBJ: Subject'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ISFT",
",",
"[",
"'Adobe Audition CC 2018.1 (Macintosh)'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ISRC",
",",
"[",
"'Foo Bar'",
"]",
",",
"'exif.ISRC Source Supplier'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"exif",
".",
"ITCH",
",",
"[",
"'Technician'",
"]",
",",
"'exif.ITCH: Technician'",
")",
";",
"const",
"common",
"=",
"metadata",
".",
"common",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Wolfgang Amadeus Mozart'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"title",
",",
"'The Magic Flute'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'La clemenzo di Tito'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"date",
",",
"'2018-04-26T13:26:19-05:00'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"year",
",",
"2018",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"encodedby",
",",
"'Adobe Audition CC 2018.1 (Macintosh)'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'Comments here!'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Blues'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"engineer",
",",
"[",
"'Engineer'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"technician",
",",
"[",
"'Technician'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"media",
",",
"'CD'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should handle be able to handle odd chunk & padding'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue-161.wav'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"format",
"=",
"metadata",
".",
"format",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"true",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"48000",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"24",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"363448",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"format",
".",
"numberOfSamples",
"/",
"format",
".",
"sampleRate",
",",
"'file\\'s duration'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'non-PCM'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should parse Microsoft 4-bit ADPCM encoded'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue-92.wav'",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"const",
"format",
"=",
"metadata",
".",
"format",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'ADPCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"22050",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitsPerSample",
",",
"4",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"4660260",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"format",
".",
"numberOfSamples",
"/",
"format",
".",
"sampleRate",
",",
"'file\\'s duration is 3\\'31\"'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should handle missing chunk-size'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"wavSamples",
",",
"'ffmpeg-missing-chunksize.wav'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"27648",
"/",
"44100",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should handle odd list-type ID in LIST chunk'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"wavSamples",
",",
"'odd-list-type.wav'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"3",
"/",
"44100",
",",
"1",
"/",
"20000",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"it",
"(",
"'Duration despite wrong chunk size'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"wavSamples",
",",
"'issue-819.wav'",
")",
";",
"const",
"{",
"format",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WAVE'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"2478",
"/",
"16000",
",",
"5",
"/",
"1000",
",",
"'format.duration'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
22604,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
36824,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
10350,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661889 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"const",
"t",
"=",
"assert",
";",
"describe",
"(",
"'Parse WavPack (audio/x-wavpack)'",
",",
"(",
")",
"=>",
"{",
"const",
"wavpackSamplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'wavpack'",
")",
";",
"describe",
"(",
"'codec: WavPack'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WavPack'",
",",
"'format.container'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'APEv2'",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"2.123",
",",
"1",
"/",
"1000",
",",
"'format.duration'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'PCM'",
",",
"'format.codecProfile'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Sinner\\'s Prayer'",
",",
"'common.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Beth Hart'",
",",
"'Joe Bonamassa'",
"]",
",",
"'common.artist'",
")",
";",
"}",
"const",
"wv1",
"=",
"path",
".",
"join",
"(",
"wavpackSamplePath",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.wv'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"wv1",
",",
"'audio/x-wavpack'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'codec: DSD128'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WavPack'",
",",
"'format.container'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'DSD'",
",",
"'format.codecProfile'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"564480",
",",
"'format.numberOfSamples'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"5644800",
",",
"'format.sampleRate'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"0.1",
",",
"'format.duration'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
"const",
"wv1",
"=",
"path",
".",
"join",
"(",
"wavpackSamplePath",
",",
"'DSD128.wv'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"wv1",
",",
"'audio/x-wavpack'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'codec: DSD128 compressed'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'WavPack'",
",",
"'format.container'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'DSD'",
",",
"'format.codecProfile'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"numberOfSamples",
",",
"564480",
",",
"'format.numberOfSamples'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"5644800",
",",
"'format.sampleRate'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"0.1",
",",
"'format.duration'",
")",
";",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"approximately",
"(",
"format",
".",
"bitrate",
",",
"4810400",
",",
"1",
")",
";",
"}",
"const",
"wv1",
"=",
"path",
".",
"join",
"(",
"wavpackSamplePath",
",",
"'DSD128 high compression.wv'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"wv1",
",",
"'audio/x-wavpack'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661890 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"{",
"parseStream",
"}",
"from",
"'../lib'",
";",
"import",
"{",
"IHttpClient",
",",
"HttpClient",
"}",
"from",
"'./http-client'",
";",
"import",
"{",
"IFileInfo",
"}",
"from",
"'strtok3'",
";",
"interface",
"IHttpClientTest",
"{",
"readonly",
"name",
":",
"string",
";",
"client",
":",
"IHttpClient",
";",
"}",
"const",
"clients",
"=",
"[",
"{",
"name",
":",
"'http'",
",",
"client",
":",
"new",
"HttpClient",
"(",
")",
"}",
"]",
";",
"describe",
"(",
"'HTTP streaming'",
",",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"15",
"*",
"1000",
")",
";",
"this",
".",
"retries",
"(",
"3",
")",
";",
"describe",
"(",
"'Stream HTTP using different clients'",
",",
"(",
")",
"=>",
"{",
"clients",
".",
"forEach",
"(",
"test",
"=>",
"{",
"describe",
"(",
"`HTTP client: ${",
"test",
".",
"name",
"}`",
",",
"(",
")",
"=>",
"{",
"[",
"true",
",",
"false",
"]",
".",
"forEach",
"(",
"hasContentLength",
"=>",
"{",
"it",
"(",
"`Should be able to parse M4A ${",
"hasContentLength",
"?",
"'with'",
":",
"'without'",
"} content-length specified`",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"url",
"=",
"'http://builds.tokyo.s3.amazonaws.com/sample.m4a'",
";",
"const",
"response",
"=",
"await",
"test",
".",
"client",
".",
"get",
"(",
"url",
")",
";",
"const",
"fileInfo",
"=",
"{",
"mimeType",
":",
"response",
".",
"headers",
"[",
"'content-type'",
"]",
"}",
";",
"if",
"(",
"hasContentLength",
")",
"{",
"fileInfo",
".",
"size",
"=",
"parseInt",
"(",
"response",
".",
"headers",
"[",
"'content-length'",
"]",
",",
"10",
")",
";",
"}",
"const",
"tags",
"=",
"await",
"parseStream",
"(",
"response",
".",
"stream",
",",
"fileInfo",
")",
";",
"if",
"(",
"response",
".",
"stream",
".",
"destroy",
")",
"{",
"response",
".",
"stream",
".",
"destroy",
"(",
")",
";",
"}",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"format",
".",
"container",
",",
"'M4A/mp42/isom'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"format",
".",
"codec",
",",
"'MPEG-4/AAC'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"format",
".",
"lossless",
",",
"false",
")",
";",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"common",
".",
"title",
",",
"'Super Mario Galaxy \"Into The Galaxy\"'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"common",
".",
"artist",
",",
"'club nintendo CD \"SUPER MARIO GALAXY\"より'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"tags",
".",
"common",
".",
"album",
",",
"'SUPER MARIO GALAXY ORIGINAL SOUNDTRACK'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
7570,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8096,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661891 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Parsers",
"}",
"from",
"'./metadata-parsers'",
";",
"describe",
"(",
"'Parsing MPEG / ID3v1'",
",",
"(",
")",
"=>",
"{",
"const",
"fileBloodSugar",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'id3v1_Blood_Sugar.mp3'",
")",
";",
"describe",
"(",
"'should be able to read an ID3v1 tag'",
",",
"(",
")",
"=>",
"{",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"160000",
",",
"'format.bitrate = 160 kbit/sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"241920",
"/",
"format",
".",
"sampleRate",
",",
"'format.duration'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Blood Sugar'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Pendulum'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Blood Sugar (Single)'",
",",
"'common.album'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"albumartist",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2007",
",",
"'common.year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"1",
",",
"'common.track.no = 1 (ID3v1 tag)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of = null'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Electronic'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'abcdefg'",
"]",
",",
"'common.comment'",
")",
";",
"}",
"/**\n * 241920 samples\n */",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"(",
")",
"=>",
"{",
"return",
"parser",
".",
"initParser",
"(",
"fileBloodSugar",
",",
"'audio/mpeg'",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'it should skip id3v1 header if options.skipPostHeaders is set'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'07 - I\\'m Cool.mp3'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"function",
"(",
")",
"{",
"this",
".",
"timeout",
"(",
"15000",
")",
";",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
",",
"{",
"skipPostHeaders",
":",
"true",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should handle MP3 without any tags'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'silence-2s-16000 [no-tags].CBR-128.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"2.088",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 2 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"16000",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"128000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'should decode ID3v1.0 with undefined tags'",
",",
"(",
")",
"=>",
"{",
"/**\n * Kept 25 frames from original MP3; concatenated copied last 128 bytes to restore ID3v1.0 header\n */",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'Luomo - Tessio (Spektre Remix) ID3v10.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"33.38448979591837",
",",
"'format.duration (checked with foobar)'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Luomo - Tessio (Spektre Remix)'",
",",
"'common.title'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"artist",
",",
"'common.artist'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"album",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"undefined",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"year",
",",
"'common.year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"null",
",",
"'common.track.no = null'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of = null'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"genre",
",",
"'common.genre'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"comment",
",",
"'common.comment'",
")",
";",
"}",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
",",
"'should provide metadata'",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * Related issue: https://github.com/Borewit/music-metadata/issues/69\n */",
"it",
"(",
"'should respect null terminated tag values correctly'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'issue_69.mp3'",
")",
";",
"Parsers",
".",
"forEach",
"(",
"parser",
"=>",
"{",
"it",
"(",
"parser",
".",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"parser",
".",
"initParser",
"(",
"filePath",
",",
"'audio/mpeg'",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"id3v1",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"ID3v1",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v1",
".",
"title",
",",
"[",
"'Skupinove foto'",
"]",
",",
"'id3v1.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v1",
".",
"artist",
",",
"[",
"'Pavel Dobes'",
"]",
",",
"'id3v1.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v1",
".",
"album",
",",
"[",
"'Skupinove foto'",
"]",
",",
"'id3v1.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v1",
".",
"year",
",",
"[",
"'1988'",
"]",
",",
"'id3v1.year'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661892 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"it",
"(",
"\"should decode id3v2-duration-allframes\"",
",",
"(",
")",
"=>",
"{",
"/**\n * Audacity: 64512 samples (counts 56 frames??)\n * ---------------------------\n * MPEG-length:\t 47647\n * Sample-rate:\t 44100\n * frame_size:\t 835\n * Samples per frame\t1152\n *\n * Summary:\n * ===============\n * Total number of frames: 57, unpadded: 5, padded: 52\n * File is CBR. Bitrate of each frame is 256 kbps.\n * Exact length: 00:01\n */",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"'id3v2-duration-allframes.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"t",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"256000",
",",
"'format.bitrate'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"57",
"*",
"1152",
"/",
"format",
".",
"sampleRate",
",",
"'format.duration (test duration=true)'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"t",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME 3.98.4'",
",",
"'format.tool'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Turkish Rondo'",
",",
"'common.album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Piano Classics'",
",",
"'common.title'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"0",
",",
"'common.year'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Aubrey Hilliard'",
",",
"'common.artist'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"composer",
",",
"[",
"'Mozart'",
"]",
",",
"'common.composer'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Classical'",
"]",
",",
"'common.genre'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.disk'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"picture",
",",
"undefined",
",",
"'common.picture'",
")",
";",
"}",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"checkFormat",
"(",
"result",
".",
"format",
")",
";",
"checkCommon",
"(",
"result",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661893 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"it",
"(",
"\"should be able to read id3v2 files with lyrics\"",
",",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'id3v2-lyrics.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"lyrics",
",",
"[",
"'The way we\\'re living makes no sense'",
",",
"'Take me back to the age of innocence'",
",",
"'I wanna go back then'",
",",
"'Take me back to the age of innocence'",
",",
"'Back to the age of innocence'",
",",
"'When clockwork fixed by lights and books'",
",",
"'When singers wrote songs instead of hooks'",
",",
"'When the value wasn\\'t in the price'",
",",
"'When the fight for life was in the civil rights'",
",",
"'When we could live life through a screen'",
",",
"'When everything you knew was as good as it seems'",
",",
"'When the only worry was the concept of sin'",
",",
"'When did it begin?'",
",",
"'I wonder if I could,'",
",",
"'Go back to old Hollywood'",
",",
"'When presidents dropped blonde bombshells'",
",",
"'Instead of creating the perfect hell'",
",",
"'The way we\\'re living makes no sense'",
",",
"'Take me back to the age of innocence'",
",",
"'I wanna go back then'",
",",
"'Take me back to the age of innocence'",
",",
"'Back to the age of innocence'",
",",
"'When pharmaceuticals were there to make life beautiful'",
",",
"'When the way that we were born was more than suitable'",
",",
"'When everybody thought they could make a difference'",
",",
"'And you couldn\\'t get your pics within an instance'",
",",
"'I wonder if I could,'",
",",
"'Go back to old Hollywood'",
",",
"'When presidents dropped blonde bombshells'",
",",
"'Instead of creating the perfect hell'",
",",
"'The way we\\'re living makes no sense'",
",",
"'Take me back to the age of innocence'",
",",
"'I wanna go back then'",
",",
"'Take me back to the age of innocence'",
",",
"'Back to the age of innocence'",
",",
"'I wanna get older, don\\'t fight my age'",
",",
"'Take me back to those simpler days'",
",",
"'I wonder how it all happened'",
",",
"'I wanna get older, don\\'t fight my age'",
",",
"'Don\\'t wanna be the shade of a scalpel\\'s blade'",
",",
"'So please tell me, please tell me'",
",",
"'What ever happened? Happened?'",
",",
"'I wonder if I could,'",
",",
"'Go back to old Hollywood'",
",",
"'When presidents dropped blonde bombshells'",
",",
"'Instead of creating their lives to hell'",
",",
"'The way we\\'re living makes no sense'",
",",
"'Take me back, take me back'",
",",
"'To the age of innocence'",
",",
"'I wanna go back then'",
",",
"'Take me back, take me back'",
",",
"'To the age of innocence'",
",",
"'Back to the age of innocence'",
",",
"'I wanna get older, don\\'t fight my age'",
",",
"'Take me back to those simpler days'",
",",
"'I wonder how it all happened'",
",",
"'I wanna get older, don\\'t fight my age'",
",",
"'Don\\'t wanna be the page on the scalpel\\'s blade'",
",",
"'So please tell me, please tell me'",
",",
"'What ever happened?'",
",",
"'Happened?'",
"]",
",",
"'Check lyrics'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661894 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"it",
"(",
"'invalid \"Date\" frame should not cause crash'",
",",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'bug-id3v2-unknownframe.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"t",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'One'",
",",
"'common.title'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Coheed And Cambria'",
",",
"'common.artist'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Year Of The Black Rainbow'",
",",
"'common.album'",
")",
";",
"t",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2010",
",",
"'common.year'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"t",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Progressive Rock'",
"]",
",",
"'common.genre'",
")",
";",
"}",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661895 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"it",
"(",
"\"decode id3v2-utf16\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'id3v2-utf16.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"{",
"common",
"}",
"=",
"metadata",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Redial (Feat. LeafRunner and Nowacking)'",
",",
"'title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'YourEnigma'",
",",
"'artist 0'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2014",
",",
"'year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture 0 format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"214219",
",",
"'picture 0 length'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"slice",
"(",
"0",
",",
"2",
")",
",",
"Buffer",
".",
"from",
"(",
"[",
"0xFF",
",",
"0xD8",
"]",
")",
",",
"'picture 0 JFIF magic header'",
")",
";",
"const",
"native",
"=",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
";",
"assert",
".",
"ok",
"(",
"native",
",",
"'Native id3v2.3 tags should be present'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"0",
"]",
",",
"{",
"id",
":",
"'TIT2'",
",",
"value",
":",
"'Redial (Feat. LeafRunner and Nowacking)'",
"}",
",",
"\"['ID3v2.4'].TIT2\"",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"1",
"]",
",",
"{",
"id",
":",
"'TPE1'",
",",
"value",
":",
"'YourEnigma'",
"}",
",",
"\"['ID3v2.4'].TIT2\"",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"2",
"]",
",",
"{",
"id",
":",
"'TYER'",
",",
"value",
":",
"'2014'",
"}",
",",
"\"['ID3v2.4'].TYER\"",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661896 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"const",
"t",
"=",
"assert",
";",
"it",
"(",
"\"should be able to read id3v2 files with extended headers\"",
",",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'id3v2-xheader.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
".",
"then",
"(",
"metadata",
"=>",
"{",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"numberOfSamples",
",",
"10944",
",",
"'format.numberOfSamples'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"22050",
",",
"'format.sampleRate'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"format",
".",
"duration",
",",
"10944",
"/",
"metadata",
".",
"format",
".",
"sampleRate",
",",
"'format.duration'",
")",
";",
"t",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'title'",
",",
"'common.title'",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"track",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.track'",
")",
";",
"t",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"disk",
",",
"{",
"no",
":",
"null",
",",
"of",
":",
"null",
"}",
",",
"'common.disk'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2040,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661897 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'../lib/id3v2/ID3v2Parser'",
";",
"import",
"{",
"parseGenre",
"}",
"from",
"'../lib/id3v2/FrameParser'",
";",
"describe",
"(",
"'ID3v2Parser'",
",",
"(",
")",
"=>",
"{",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"const",
"mp3Path",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
")",
";",
"it",
"(",
"'should be able to remove unsynchronisation bytes from buffer'",
",",
"(",
")",
"=>",
"{",
"const",
"expected",
"=",
"Buffer",
".",
"from",
"(",
"[",
"0xFF",
",",
"0xD8",
",",
"0xFF",
",",
"0xE0",
",",
"0x00",
"]",
")",
";",
"const",
"sample",
"=",
"Buffer",
".",
"from",
"(",
"[",
"0xFF",
",",
"0xD8",
",",
"0xFF",
",",
"0x00",
",",
"0xE0",
",",
"0x00",
"]",
")",
";",
"const",
"output",
"=",
"ID3v2Parser",
".",
"removeUnsyncBytes",
"(",
"sample",
")",
";",
"assert",
".",
"deepEqual",
"(",
"output",
",",
"expected",
",",
"'bytes'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should normalize ID3v2.2 comments correctly'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_66.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"id3v22",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.2'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TP1",
",",
"[",
"'RushJet1'",
"]",
",",
"'[\\'ID3v2.2\\'].TP1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TRK",
",",
"[",
"'2/15'",
"]",
",",
"'[\\'ID3v2.2\\'].TRK'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TYE",
",",
"[",
"'2011'",
"]",
",",
"'[\\'ID3v2.2\\'].TYE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunPGAP'",
"]",
",",
"[",
"'0'",
"]",
",",
"'[\\'ID3v2.2\\'][\\'COM:iTunPGAP\\']'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TEN",
",",
"[",
"'iTunes 10.2.2.14'",
"]",
",",
"'[\\'ID3v2.2\\'].TEN'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunNORM'",
"]",
",",
"[",
"' 00000308 00000000 00001627 00000000 00006FD6 00000000 00007F21 00000000 0000BE68 00000000'",
"]",
",",
"'COM:iTunNORM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunSMPB'",
"]",
",",
"[",
"' 00000000 00000210 00000811 000000000043E1DF 00000000 001EBD63 00000000 00000000 00000000 00000000 00000000 00000000'",
"]",
",",
"'id3v22.TYE[\\'COM:iTunSMPB\\']'",
")",
";",
"assert",
".",
"isDefined",
"(",
"id3v22",
".",
"PIC",
",",
"'[\\'ID3v2.2\\'].PIC'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TCO",
",",
"[",
"'Chiptune'",
"]",
",",
"'[\\'ID3v2.2\\'].TCO'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TAL",
",",
"[",
"'Forgotten Music'",
"]",
",",
"'[\\'ID3v2.2\\'].TAL'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TT2",
",",
"[",
"'Ancient Ruin Adventure'",
"]",
",",
"'[\\'ID3v2.2\\'].TT2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"COM",
",",
"[",
"'UBI025, 23.05.2011, http://ubiktune.org/releases/ubi025-rushjet1-forgotten-music'",
"]",
",",
"'[\\'ID3v2.2\\'][\\'COM\\']'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"[",
"'UBI025, 23.05.2011, http://ubiktune.org/releases/ubi025-rushjet1-forgotten-music'",
"]",
",",
"'common.comment'",
")",
";",
"}",
")",
";",
"it",
"(",
"'should decode file \\'id3v2.2.mp3\\''",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'id3v2.2.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"title",
",",
"'You Are The One'",
",",
"'title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"artist",
",",
"'Shiny Toy Guns'",
",",
"'artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"album",
",",
"'We Are Pilots'",
",",
"'album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"year",
",",
"2006",
",",
"'year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"track",
".",
"no",
",",
"1",
",",
"'track no'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"track",
".",
"of",
",",
"11",
",",
"'track of'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"common",
".",
"genre",
",",
"[",
"'Alternative'",
"]",
",",
"'genre'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"99738",
",",
"'picture length'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"metadata",
".",
"common",
".",
"gapless",
",",
"false",
",",
"'common.gapless'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"metadata",
".",
"common",
".",
"comment",
",",
"'common.comment'",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.2'",
"]",
",",
"'Native id3v2.2 tags should be present'",
")",
";",
"const",
"id3v22",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.2'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TP1",
",",
"[",
"'Shiny Toy Guns'",
"]",
",",
"'[\\'ID3v2.2\\'].TP1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TRK",
",",
"[",
"'1/11'",
"]",
",",
"'[\\'ID3v2.2\\'].TRK'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TYE",
",",
"[",
"'2006'",
"]",
",",
"'[\\'ID3v2.2\\'].TYE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunPGAP'",
"]",
",",
"[",
"'0'",
"]",
",",
"'[\\'ID3v2.2\\'][\\'COM:iTunPGAP\\']'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TEN",
",",
"[",
"'iTunes v7.0.2.16'",
"]",
",",
"'[\\'ID3v2.2\\'].TEN'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunNORM'",
"]",
",",
"[",
"' 0000299C 0000291D 0000DBE0 0000D6BA 0003C378 0003C2C1 0000902A 00008F1B 00012FC6 00015FBC'",
"]",
",",
"'COM:iTunNORM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunSMPB'",
"]",
",",
"[",
"' 00000000 00000210 00000AD4 0000000000B6499C 00000000 006327AD 00000000 00000000 00000000 00000000 00000000 00000000'",
"]",
",",
"'id3v22.TYE[\\'COM:iTunSMPB\\']'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
"[",
"'COM:iTunes_CDDB_IDs'",
"]",
",",
"[",
"'11+3ABC77F16B8A2F0F1E1A1EBAB868A98F+8210091'",
"]",
",",
"'COM:iTunes_CDDB_IDs'",
")",
";",
"assert",
".",
"isDefined",
"(",
"id3v22",
".",
"PIC",
",",
"'[\\'ID3v2.2\\'].PIC'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TCO",
",",
"[",
"'Alternative'",
"]",
",",
"'[\\'ID3v2.2\\'].TCO'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TAL",
",",
"[",
"'We Are Pilots'",
"]",
",",
"'[\\'ID3v2.2\\'].TAL'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"TT2",
",",
"[",
"'You Are The One'",
"]",
",",
"'[\\'ID3v2.2\\'].TT2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v22",
".",
"ULT",
",",
"[",
"{",
"description",
":",
"''",
",",
"language",
":",
"'eng'",
",",
"text",
":",
"'Black rose & a radio fire\\nits so contagious\\nsuch something changing my mind\\nim gonna take whats evil\\n\\nYour cover melting inside\\nwith wide eyes you tremble\\nkissing over & over again\\nyour god knows his faithful\\n\\nI try - to digest my pride\\nbut passions grip i fear\\nwhen i climb - into shallow vats of wine\\ni think i almost hear - but its not clear\\n\\nYou are the one\\nyou\\'ll never be alone again\\nyou\\'re more then in my head - your more\\n\\nSpin faster shouting out loud\\nyou cant steal whats paid for\\nsuch something hurting again\\nmurder son shes painful\\n\\nYou so believe your own lies\\non my skin your fingers\\nrunaway until the last time\\nwere gonna lose forever\\n\\nwhen you try - don\\'t try to say you wont\\ntry to crawl into my head\\nwhen you cry - cause it\\'s all built up inside\\nyour tears already said - already said\\n\\nYou\\'ll never be alone again'",
"}",
"]",
",",
"'[\\'ID3v2.2\\'].ULT'",
")",
";",
"}",
")",
";",
"it",
"(",
"'05 I Believe You.mp3'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"mp3Path",
",",
"'issue-641.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"const",
"pics",
"=",
"common",
".",
"picture",
";",
"assert",
".",
"strictEqual",
"(",
"pics",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'picture format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"pics",
"[",
"0",
"]",
".",
"type",
",",
"'Cover (front)'",
",",
"'picture type'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Tag mapping'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"\"TBP (beats per minute)\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'Betty Lou.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Betty Lou'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'The Hub Caps'",
",",
"'common.artist,'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"bpm",
",",
"177",
",",
"'common.bpm,'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Post parse genre'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should be able to parse genres'",
",",
"(",
")",
"=>",
"{",
"const",
"tests",
"=",
"{",
"Electronic",
":",
"[",
"'Electronic'",
"]",
",",
"'(52)(RX)'",
":",
"[",
"'Electronic'",
",",
"'Remix'",
"]",
",",
"'(52)(CR)'",
":",
"[",
"'Electronic'",
",",
"'Cover'",
"]",
",",
"'(0)'",
":",
"[",
"'Blues'",
"]",
",",
"'(0)(1)(2)'",
":",
"[",
"'Blues'",
",",
"'Classic Rock'",
",",
"'Country'",
"]",
",",
"'(0)(160)(2)'",
":",
"[",
"'Blues'",
",",
"'Electroclash'",
",",
"'Country'",
"]",
",",
"'(0)(192)(2)'",
":",
"[",
"'Blues'",
",",
"'Country'",
"]",
",",
"'(0)(255)(2)'",
":",
"[",
"'Blues'",
",",
"'Country'",
"]",
",",
"'(4)Eurodisco'",
":",
"[",
"'Disco'",
",",
"'Eurodisco'",
"]",
",",
"'(4)Eurodisco(0)Mopey'",
":",
"[",
"'Disco'",
",",
"'Eurodisco'",
",",
"'Blues'",
",",
"'Mopey'",
"]",
",",
"'(RX)(CR)'",
":",
"[",
"'Remix'",
",",
"'Cover'",
"]",
",",
"'1stuff'",
":",
"[",
"'1stuff'",
"]",
",",
"'RX/CR'",
":",
"[",
"'RX/CR'",
"]",
",",
"'((52)(RX)'",
":",
"[",
"'(52)'",
",",
"'Remix'",
"]",
",",
"'((52)((RX)'",
":",
"[",
"'(52)(RX)'",
"]",
",",
"52",
":",
"[",
"'Electronic'",
"]",
"}",
";",
"for",
"(",
"const",
"test",
"in",
"tests",
")",
"{",
"assert",
".",
"deepStrictEqual",
"(",
"parseGenre",
"(",
"test",
")",
",",
"tests",
"[",
"test",
"]",
",",
"`parse genre: \"${",
"test",
"}\"`",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661898 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"ID3v2Parser",
"}",
"from",
"'../lib/id3v2/ID3v2Parser'",
";",
"import",
"*",
"as",
"strtok",
"from",
"'strtok3'",
";",
"import",
"{",
"MetadataCollector",
"}",
"from",
"'../lib/common/MetadataCollector'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"const",
"samplePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
")",
";",
"describe",
"(",
"'Extract metadata from ID3v2.3 header'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should parse a raw ID3v2.3 header'",
",",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'MusicBrainz - Beth Hart - Sinner\\'s Prayer.id3v23'",
")",
";",
"const",
"metadata",
"=",
"new",
"MetadataCollector",
"(",
"{",
"}",
")",
";",
"return",
"strtok",
".",
"fromFile",
"(",
"filePath",
")",
".",
"then",
"(",
"tokenizer",
"=>",
"{",
"return",
"new",
"ID3v2Parser",
"(",
")",
".",
"parse",
"(",
"metadata",
",",
"tokenizer",
",",
"{",
"}",
")",
".",
"then",
"(",
"(",
")",
"=>",
"{",
"assert",
".",
"strictEqual",
"(",
"33",
",",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
".",
"length",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"isDefined",
"(",
"id3v23",
".",
"UFID",
",",
"'check if ID3v2.3-UFID is set'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'parse a ID3v2.3'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'id3v2.3.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
",",
"'format.type'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"0.7836734693877551",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"128000",
",",
"'format.bitrate = 128 kbit/sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"tool",
",",
"'LAME 3.98r'",
",",
"'format.tool'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codecProfile",
",",
"'CBR'",
",",
"'format.codecProfile'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Home'",
",",
"'common.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'Explosions In The Sky'",
",",
"'Another'",
",",
"'And Another'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"'Soundtrack'",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'Friday Night Lights [Original Movie Soundtrack]'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2004",
",",
"'common.year'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"no",
",",
"5",
",",
"'common.track.no'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"no",
",",
"1",
",",
"'common.disk.no'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"disk",
".",
"of",
",",
"1",
",",
"'common.disk.of'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"genre",
"[",
"0",
"]",
",",
"'Soundtrack'",
",",
"'common.genre'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"80938",
",",
"'common.picture length'",
")",
";",
"}",
"function",
"checkID3v1",
"(",
"id3v11",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"title",
",",
"[",
"'Home'",
"]",
",",
"'id3v11.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"album",
",",
"[",
"'Friday Night Lights [Original'",
"]",
",",
"'id3v11.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"artist",
",",
"[",
"'Explosions In The Sky/Another/'",
"]",
",",
"'id3v11.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"genre",
",",
"[",
"'Soundtrack'",
"]",
",",
"'id3v11.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"track",
",",
"[",
"5",
"]",
",",
"'id3v11.track'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v11",
".",
"year",
",",
"[",
"'2004'",
"]",
",",
"'id3v11.year'",
")",
";",
"}",
"function",
"checkID3v23",
"(",
"id3v23",
")",
"{",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TALB",
",",
"[",
"'Friday Night Lights [Original Movie Soundtrack]'",
"]",
",",
"'native: TALB'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE1",
",",
"[",
"'Explosions In The Sky'",
",",
"'Another'",
",",
"'And Another'",
"]",
",",
"'native: TPE1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE2",
",",
"[",
"'Soundtrack'",
"]",
",",
"'native: TPE2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TCOM",
",",
"[",
"'Explosions in the Sky'",
"]",
",",
"'native: TCOM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPOS",
",",
"[",
"'1/1'",
"]",
",",
"'native: TPOS'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TCON",
",",
"[",
"'Soundtrack'",
"]",
",",
"'native: TCON'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TIT2",
",",
"[",
"'Home'",
"]",
",",
"'native: TIT2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TRCK",
",",
"[",
"'5'",
"]",
",",
"'native: TRCK'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TYER",
",",
"[",
"'2004'",
"]",
",",
"'native: TYER'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
"[",
"'TXXX:PERFORMER'",
"]",
",",
"[",
"'Explosions In The Sky'",
"]",
",",
"'native: TXXX:PERFORMER'",
")",
";",
"const",
"apic",
"=",
"id3v23",
".",
"APIC",
"[",
"0",
"]",
";",
"assert",
".",
"strictEqual",
"(",
"apic",
".",
"format",
",",
"'image/jpeg'",
",",
"'raw APIC format'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"apic",
".",
"type",
",",
"'Cover (front)'",
",",
"'raw APIC tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"apic",
".",
"description",
",",
"''",
",",
"'raw APIC description'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"apic",
".",
"data",
".",
"length",
",",
"80938",
",",
"'raw APIC length'",
")",
";",
"}",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"checkFormat",
"(",
"metadata",
".",
"format",
")",
";",
"checkCommon",
"(",
"metadata",
".",
"common",
")",
";",
"checkID3v1",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
".",
"ID3v1",
")",
")",
";",
"checkID3v23",
"(",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
")",
";",
"}",
")",
";",
"describe",
"(",
"'corrupt header / tags'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should decode corrupt ID3v2.3 header: \\'Strawberry\\''",
",",
"(",
")",
"=>",
"{",
"/**\n * Kept 25 frames from original MP3; concatenated copied last 128 bytes to restore ID3v1.0 header\n */",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'04-Strawberry.mp3'",
")",
";",
"function",
"checkFormat",
"(",
"format",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"duration",
",",
"247.84979591836733",
",",
"'format.duration'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"lossless",
",",
"false",
",",
"'format.lossless'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate = 44.1 kHz'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"128000",
",",
"'format.bitrate = 128 bit/sec'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"numberOfChannels",
",",
"2",
",",
"'format.numberOfChannels 2 (stereo)'",
")",
";",
"}",
"function",
"checkCommon",
"(",
"common",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Strawberry'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Union Youth'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'The Royal Gene'",
",",
"'common.album'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"albumartist",
",",
"undefined",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"year",
",",
"2002",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"4",
",",
"of",
":",
"null",
"}",
",",
"'common.track = 4/?'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"track",
".",
"of",
",",
"null",
",",
"'common.track.of = null'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Alternative'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"isUndefined",
"(",
"common",
".",
"comment",
",",
"'common.comment'",
")",
";",
"}",
"return",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
".",
"then",
"(",
"result",
"=>",
"{",
"checkFormat",
"(",
"result",
".",
"format",
")",
";",
"checkCommon",
"(",
"result",
".",
"common",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'should decode PeakValue without data'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'issue_56.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'APEv2'",
",",
"'ID3v1'",
"]",
",",
"'format.tagTypes'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"/**\n * id3v2.4 defines that multiple T* values are separated by 0x00\n * id3v2.3 defines that multiple T* values are separated by /\n * Related issue: https://github.com/Borewit/music-metadata/issues/52\n * Specification: http://id3.org/id3v2.3.0#line-290\n */",
"it",
"(",
"'slash delimited fields'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'Their - They\\'re - Therapy - 1sec.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"isDefined",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
",",
"'Expect ID3v2.3 tag'",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TIT2",
",",
"[",
"'Their / They\\'re / Therapy'",
"]",
",",
"'id3v23.TIT2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE1",
",",
"[",
"'Their'",
",",
"'They\\'re'",
",",
"'There'",
"]",
",",
"'id3v23.TPE1'",
")",
";",
"}",
")",
";",
"it",
"(",
"'null delimited fields (non-standard)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'null-separator.id3v2.3.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes'",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"TPE1",
",",
"[",
"'2 Unlimited2'",
",",
"'Ray'",
",",
"'Anita'",
"]",
",",
"'null separated id3v23.TPE1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artists",
",",
"[",
"'2 Unlimited2'",
",",
"'Ray'",
",",
"'Anita'",
"]",
",",
"'common.artists'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"comment",
",",
"[",
"'[DJSet]'",
",",
"'[All]'",
"]",
",",
"'common.comment'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Dance'",
",",
"'Classics'",
"]",
",",
"'common.genre'",
")",
";",
"[",
"'TPE1'",
",",
"'TCOM'",
",",
"'TCON'",
"]",
".",
"forEach",
"(",
"tag",
"=>",
"{",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"`ID3v2.3 ${",
"tag",
"} uses non standard null-separator.`",
"}",
"]",
",",
"`expect warning: null separator ID3v2.3 ${",
"tag",
"}`",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'4.2.1 Text information frames'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'TCON: Content type (genres)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'tcon.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 2 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Electronic'",
",",
"'Pop-Folk'",
"]",
",",
"'common.genre'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'Decode frames'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'4.3.1 WCOM: Commercial information'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'id3v2-lyrics.mp3'",
")",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"WCOM",
"[",
"0",
"]",
",",
"'http://www.amazon.com/Rotation-Cute-What-We-Aim/dp/B0018QCXAU%3FSubscriptionId%3D0R6CGKPJ3EKNPQBPYJR2%26tag%3Dsoftpointer-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0018QCXAU\u0000'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'4.3.2 WXXX: User defined URL link frame'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'decoding #1'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'bug-unkown encoding.mp3'",
")",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v23",
".",
"WXXX",
"[",
"0",
"]",
",",
"{",
"description",
":",
"'Tempa at bleep'",
",",
"url",
":",
"'http://www.bleep.com/tempa'",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'decoding #2'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-453.mp3'",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"deepEqual",
"(",
"metadata",
".",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
",",
"'ID3v1'",
"]",
")",
";",
"const",
"id3",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3",
".",
"WXXX",
"[",
"0",
"]",
",",
"{",
"description",
":",
"'あ'",
",",
"url",
":",
"'https://www.example.com'",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'4.5 MCDI: Music CD identifier'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'04-Strawberry.mp3'",
")",
")",
";",
"const",
"id3v23",
"=",
"mm",
".",
"orderTags",
"(",
"metadata",
".",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"equal",
"(",
"id3v23",
".",
"MCDI",
"[",
"0",
"]",
".",
"length",
",",
"804",
",",
"'TOC'",
")",
";",
"}",
")",
";",
"it",
"(",
"'4.16 GEOB: General encapsulated object'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-406-geob.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"native",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"tagTypes",
",",
"[",
"'ID3v2.3'",
"]",
",",
"'format.tagTypes'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'test'",
",",
"'common.title'",
")",
";",
"const",
"id3v2",
"=",
"mm",
".",
"orderTags",
"(",
"native",
"[",
"'ID3v2.3'",
"]",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v2",
".",
"GEOB",
"[",
"0",
"]",
".",
"type",
",",
"'application/octet-stream'",
",",
"'ID3v2.GEOB[0].type'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v2",
".",
"GEOB",
"[",
"0",
"]",
".",
"filename",
",",
"''",
",",
"'ID3v2.GEOB[0].filename'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"id3v2",
".",
"GEOB",
"[",
"0",
"]",
".",
"description",
",",
"'Serato Overview'",
",",
"'ID3v2.GEOB[0].description'",
")",
";",
"}",
")",
";",
"describe",
"(",
"'TXXX'",
",",
"async",
"(",
")",
"=>",
"{",
"it",
"(",
"'Handle empty TXXX'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"format",
",",
"quality",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-471.mp3'",
")",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"approximately",
"(",
"format",
".",
"duration",
",",
"309.629387755102",
",",
"1",
"/",
"200",
",",
"'format.duration'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"sampleRate",
",",
"44100",
",",
"'format.sampleRate'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"bitrate",
",",
"128000",
",",
"'format.bitrate'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'id3v2.3 header has empty tag type=TXXX'",
"}",
"]",
",",
"'quality.warnings includes: \\'id3v2.3 header has empty tag type=TXXX\\''",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'Between Worlds'",
",",
"'common.title'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"artist",
",",
"'Roger Subirana'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"album",
",",
"'XII'",
",",
"'common.album'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'PRIV'",
",",
"async",
"(",
")",
"=>",
"{",
"it",
"(",
"'Handle empty PRIV tag'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-691.mp3'",
")",
";",
"const",
"{",
"format",
",",
"common",
",",
"quality",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"container",
",",
"'MPEG'",
",",
"'format.container'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"format",
".",
"codec",
",",
"'MPEG 1 Layer 3'",
",",
"'format.codec'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'id3v2.3 header has empty tag type=PRIV'",
"}",
",",
"{",
"message",
":",
"'Invalid ID3v2.3 frame-header-ID: \\u0000\\u0000\\u0000\\u0000'",
"}",
"]",
",",
"'quality.warnings includes'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'Handle ID32.2 tag ID\\'s in ID32.3 header'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"samplePath",
",",
"'mp3'",
",",
"'issue-795.mp3'",
")",
";",
"const",
"{",
"native",
",",
"quality",
",",
"common",
"}",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
")",
";",
"assert",
".",
"isDefined",
"(",
"native",
"[",
"'ID3v2.3'",
"]",
",",
"'native[\\'ID3v2.3\\']'",
")",
";",
"const",
"ids",
"=",
"native",
"[",
"'ID3v2.3'",
"]",
".",
"map",
"(",
"tag",
"=>",
"{",
"return",
"tag",
".",
"id",
";",
"}",
")",
";",
"assert",
".",
"deepStrictEqual",
"(",
"ids",
",",
"[",
"'TP1\\u0000'",
",",
"'TP2\\u0000'",
",",
"'TAL\\u0000'",
",",
"'TEN\\u0000'",
",",
"'TIT2'",
"]",
",",
"'Decode id3v2.3 TAG names'",
")",
";",
"assert",
".",
"includeDeepMembers",
"(",
"quality",
".",
"warnings",
",",
"[",
"{",
"message",
":",
"'Invalid ID3v2.3 frame-header-ID: TP1\\u0000'",
"}",
",",
"{",
"message",
":",
"'Invalid ID3v2.3 frame-header-ID: TP2\\u0000'",
"}",
",",
"{",
"message",
":",
"'Invalid ID3v2.3 frame-header-ID: TAL\\u0000'",
"}",
",",
"{",
"message",
":",
"'Invalid ID3v2.3 frame-header-ID: TEN\\u0000'",
"}",
"]",
",",
"'Warning invalid ID: TP1\\u0000, TP2\\u0000, TAL\\u0000 & TEN\\u0000'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"common",
".",
"title",
",",
"'FDP (Clean Edit)'",
",",
"'common.title'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
29903,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
661899 | [
"import",
"{",
"assert",
"}",
"from",
"'chai'",
";",
"import",
"*",
"as",
"mm",
"from",
"'../lib'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"it",
"(",
"'should MusicBrainz tags with id3v2.4'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"filename",
"=",
"'id3v2.4-musicbrainz.mp3'",
";",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'samples'",
",",
"filename",
")",
";",
"const",
"metadata",
"=",
"await",
"mm",
".",
"parseFile",
"(",
"filePath",
",",
"{",
"duration",
":",
"true",
"}",
")",
";",
"const",
"{",
"common",
",",
"format",
"}",
"=",
"metadata",
";",
"assert",
".",
"deepEqual",
"(",
"format",
".",
"duration",
",",
"0.7836734693877551",
",",
"'format.duration'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"title",
",",
"'Home'",
",",
"'common.title'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"artist",
",",
"'Explosions in the Sky'",
",",
"'common.artist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"albumartist",
",",
"'Explosions in the Sky'",
",",
"'common.albumartist'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"album",
",",
"'Friday Night Lights: Original Motion Picture Soundtrack'",
",",
"'common.album'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"year",
",",
"2004",
",",
"'common.year'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"date",
",",
"'2004-10-12'",
",",
"'common.date'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"track",
",",
"{",
"no",
":",
"5",
",",
"of",
":",
"14",
"}",
",",
"'common.track'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"disk",
",",
"{",
"no",
":",
"1",
",",
"of",
":",
"1",
"}",
",",
"'common.disk'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"genre",
",",
"[",
"'Soundtrack'",
",",
"'OST'",
"]",
",",
"'common.genre'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"format",
",",
"'image/jpeg'",
",",
"'common.picture 0 format'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"picture",
"[",
"0",
"]",
".",
"data",
".",
"length",
",",
"75818",
",",
"'common.picture 0 length'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"barcode",
",",
"'602498644102'",
",",
"'common.barcode'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"isrc",
",",
"[",
"'USUG10400421'",
"]",
",",
"'common.isrc'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"label",
",",
"[",
"'Hip-O Records'",
"]",
",",
"'common.label'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"catalognumber",
",",
"[",
"'B0003663-02'",
"]",
",",
"'common.catalognumber'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"releasecountry",
",",
"'US'",
",",
"'common.releasecountry'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"media",
",",
"'CD'",
",",
"'common.media'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_artistid",
",",
"[",
"'4236acde-2ce2-441c-a3d4-38d55f1b5474'",
"]",
",",
"'MusicBrainz Artist Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_recordingid",
",",
"'84851150-a196-48fa-ada5-1a012b1cd9ed'",
",",
"'MusicBrainz Recording Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_albumartistid",
",",
"[",
"'4236acde-2ce2-441c-a3d4-38d55f1b5474'",
"]",
",",
"'MusicBrainz Release Artist Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_releasegroupid",
",",
"'afe7c5d8-f8bc-32cf-b77d-8fb8561989a7'",
",",
"'MusicBrainz Release Group Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_albumid",
",",
"'2644f258-0619-4beb-a150-0c0069ca6699'",
",",
"'MusicBrainz Release Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"common",
".",
"musicbrainz_trackid",
",",
"'d87d56d0-9bd3-3199-8ff3-d03dff3abb13'",
",",
"'MusicBrainz Track Id'",
")",
";",
"const",
"native",
"=",
"metadata",
".",
"native",
"[",
"'ID3v2.4'",
"]",
";",
"assert",
".",
"ok",
"(",
"native",
",",
"'Native id3v2.4 tags should be present'",
")",
";",
"let",
"i",
"=",
"0",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TIT2'",
",",
"value",
":",
"'Home'",
"}",
",",
"'[\\'ID3v2.4\\'].TIT2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TPE1'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TPE1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TRCK'",
",",
"value",
":",
"'5/14'",
"}",
",",
"'[\\'ID3v2.4\\'].TRCK'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TALB'",
",",
"value",
":",
"'Friday Night Lights: Original Motion Picture Soundtrack'",
"}",
",",
"'[\\'ID3v2.4\\'].TALB'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TPOS'",
",",
"value",
":",
"'1/1'",
"}",
",",
"'[\\'ID3v2.4\\'].TPOS'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TDRC'",
",",
"value",
":",
"'2004-10-12'",
"}",
",",
"'[\\'ID3v2.4\\'].TDRC'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TCON'",
",",
"value",
":",
"'Soundtrack'",
"}",
",",
"'[\\'ID3v2.4\\'].TCON #1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TCON'",
",",
"value",
":",
"'OST'",
"}",
",",
"'[\\'ID3v2.4\\'].TCON #2'",
")",
";",
"{",
"const",
"picTag",
"=",
"native",
"[",
"i",
"++",
"]",
";",
"assert",
".",
"strictEqual",
"(",
"picTag",
".",
"id",
",",
"'APIC'",
",",
"'[\\'ID3v2.4\\'].APIC #1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"picTag",
".",
"value",
".",
"format",
",",
"'image/jpeg'",
",",
"'[\\'ID3v2.4\\'].APIC #1 format'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"picTag",
".",
"value",
".",
"type",
",",
"'Cover (front)'",
",",
"'[\\'ID3v2.4\\'].APIC #1 tagTypes'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"picTag",
".",
"value",
".",
"description",
",",
"''",
",",
"'[\\'ID3v2.4\\'].APIC #1 description'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"picTag",
".",
"value",
".",
"data",
".",
"length",
",",
"75818",
",",
"'[\\'ID3v2.4\\'].APIC #1 length'",
")",
";",
"}",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'PRIV'",
",",
"value",
":",
"{",
"data",
":",
"Buffer",
".",
"from",
"(",
"[",
"0x02",
",",
"0x00",
",",
"0x00",
",",
"0x00",
"]",
")",
",",
"owner_identifier",
":",
"'AverageLevel'",
"}",
"}",
",",
"'[\\'ID3v2.4\\'].PRIV.AverageLevel'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'PRIV'",
",",
"value",
":",
"{",
"data",
":",
"Buffer",
".",
"from",
"(",
"[",
"0x08",
",",
"0x00",
",",
"0x00",
",",
"0x00",
"]",
")",
",",
"owner_identifier",
":",
"'PeakValue'",
"}",
"}",
",",
"'[\\'ID3v2.4\\'].PRIV.PeakValue'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TCOM'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TCOM'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TDOR'",
",",
"value",
":",
"'2004-10-12'",
"}",
",",
"'[\\'ID3v2.4\\'].TDOR'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TIPL'",
",",
"value",
":",
"{",
"producer",
":",
"[",
"'Brian Grazer'",
",",
"'Brian Reitzell'",
",",
"'Peter Berg'",
"]",
"}",
"}",
",",
"'[\\'ID3v2.4\\'].TIPL'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TMED'",
",",
"value",
":",
"'CD'",
"}",
",",
"'[\\'ID3v2.4\\'].TIPL'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TPE2'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TPE2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TPUB'",
",",
"value",
":",
"'Hip-O Records'",
"}",
",",
"'[\\'ID3v2.4\\'].TPUB'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TSO2'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TSO2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TSOP'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TSOP'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TSRC'",
",",
"value",
":",
"'USUG10400421'",
"}",
",",
"'[\\'ID3v2.4\\'].TSRC'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:ASIN'",
",",
"value",
":",
"'B000649YAM'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:ASIN'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:Artists'",
",",
"value",
":",
"'Explosions in the Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:Artists'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:BARCODE'",
",",
"value",
":",
"'602498644102'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:BARCODE'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:CATALOGNUMBER'",
",",
"value",
":",
"'B0003663-02'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:CATALOGNUMBER'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Artist Id'",
",",
"value",
":",
"'4236acde-2ce2-441c-a3d4-38d55f1b5474'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Artist Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Id'",
",",
"value",
":",
"'2644f258-0619-4beb-a150-0c0069ca6699'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Release Country'",
",",
"value",
":",
"'US'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Release Country'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Status'",
",",
"value",
":",
"'official'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Status'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Type'",
",",
"value",
":",
"'album'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Type #1'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Album Type'",
",",
"value",
":",
"'soundtrack'",
"}",
",",
"'[\\'ID3v2.4\\'].TXXX:MusicBrainz Album Type #2'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Artist Id'",
",",
"value",
":",
"'4236acde-2ce2-441c-a3d4-38d55f1b5474'",
"}",
",",
"'[\\'ID3v2.4\\'].MusicBrainz Artist Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Release Group Id'",
",",
"value",
":",
"'afe7c5d8-f8bc-32cf-b77d-8fb8561989a7'",
"}",
",",
"'[\\'ID3v2.4\\'].MusicBrainz Release Group Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:MusicBrainz Release Track Id'",
",",
"value",
":",
"'d87d56d0-9bd3-3199-8ff3-d03dff3abb13'",
"}",
",",
"'[\\'ID3v2.4\\'].MusicBrainz Release Track Id'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:PERFORMER'",
",",
"value",
":",
"'Explosions In The Sky'",
"}",
",",
"'[\\'ID3v2.4\\'].PERFORMER'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:SCRIPT'",
",",
"value",
":",
"'Latn'",
"}",
",",
"'[\\'ID3v2.4\\'].\\'SCRIPT'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'TXXX:originalyear'",
",",
"value",
":",
"'2004'",
"}",
",",
"'[\\'ID3v2.4\\'].\\'originalyear'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"++",
"]",
",",
"{",
"id",
":",
"'UFID'",
",",
"value",
":",
"{",
"identifier",
":",
"Buffer",
".",
"from",
"(",
"[",
"0x38",
",",
"0x34",
",",
"0x38",
",",
"0x35",
",",
"0x31",
",",
"0x31",
",",
"0x35",
",",
"0x30",
",",
"0x2d",
",",
"0x61",
",",
"0x31",
",",
"0x39",
",",
"0x36",
",",
"0x2d",
",",
"0x34",
",",
"0x38",
",",
"0x66",
",",
"0x61",
",",
"0x2d",
",",
"0x61",
",",
"0x64",
",",
"0x61",
",",
"0x35",
",",
"0x2d",
",",
"0x31",
",",
"0x61",
",",
"0x30",
",",
"0x31",
",",
"0x32",
",",
"0x62",
",",
"0x31",
",",
"0x63",
",",
"0x64",
",",
"0x39",
",",
"0x65",
",",
"0x64",
"]",
")",
",",
"owner_identifier",
":",
"'http://musicbrainz.org'",
"}",
"}",
",",
"'[\\'ID3v2.4\\'].UFID'",
")",
";",
"assert",
".",
"deepEqual",
"(",
"native",
"[",
"i",
"]",
",",
"undefined",
",",
"'End of metadata'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |