music-metadata 7.13.1 → 7.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  ![Node.js CI](https://github.com/Borewit/music-metadata/workflows/Node.js%20CI/badge.svg)
2
- [![Build status](https://ci.appveyor.com/api/projects/status/tgtqynlon8t99qq5/branch/master?svg=true)](https://ci.appveyor.com/project/Borewit/music-metadata/branch/master)
2
+ [![Build status](https://ci.appveyor.com/api/projects/status/tgtqynlon8t99qq5/branch/commonjs?svg=true)](https://ci.appveyor.com/project/Borewit/music-metadata/branch/commonjs)
3
3
  [![NPM version](https://img.shields.io/npm/v/music-metadata.svg)](https://npmjs.org/package/music-metadata)
4
4
  [![npm downloads](http://img.shields.io/npm/dm/music-metadata.svg)](https://npmcharts.com/compare/music-metadata,jsmediatags,musicmetadata,node-id3,mp3-parser,id3-parser,wav-file-info?start=600)
5
- [![Coverage Status](https://coveralls.io/repos/github/Borewit/music-metadata/badge.svg?branch=master)](https://coveralls.io/github/Borewit/music-metadata?branch=master)
5
+ [![Coverage Status](https://coveralls.io/repos/github/Borewit/music-metadata/badge.svg?branch=commonjs)](https://coveralls.io/github/Borewit/music-metadata?branch=commonjs)
6
6
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/57d731b05c9e41889a2a17cb4b0384d7)](https://app.codacy.com/app/Borewit/music-metadata?utm_source=github.com&utm_medium=referral&utm_content=Borewit/music-metadata&utm_campaign=Badge_Grade_Dashboard)
7
- [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/music-metadata.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/music-metadata/context:javascript)
8
- [![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/music-metadata.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/music-metadata/alerts/)
7
+ [![CodeQL](https://github.com/Borewit/music-metadata/actions/workflows/codeql-analysis.yml/badge.svg?branch=commonjs)](https://github.com/Borewit/music-metadata/actions/workflows/codeql-analysis.yml)
9
8
  [![DeepScan grade](https://deepscan.io/api/teams/5165/projects/6938/branches/61821/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=6938&bid=61821)
10
9
  [![Known Vulnerabilities](https://snyk.io/test/github/Borewit/music-metadata/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/music-metadata?targetFile=package.json)
11
10
  [![Discord](https://img.shields.io/discord/460524735235883049.svg)](https://discord.gg/KyBr6sb)
@@ -1,4 +1,4 @@
1
- import { CommonTagMapper } from '../common/GenericTagMapper.js';
1
+ import { CommonTagMapper } from '../common/GenericTagMapper';
2
2
  export declare class AiffTagMapper extends CommonTagMapper {
3
3
  constructor();
4
4
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AiffTagMapper = void 0;
4
- const GenericTagMapper_js_1 = require("../common/GenericTagMapper.js");
4
+ const GenericTagMapper_1 = require("../common/GenericTagMapper");
5
5
  /**
6
6
  * ID3v1 tag mappings
7
7
  */
@@ -11,7 +11,7 @@ const tagMap = {
11
11
  '(c) ': 'copyright',
12
12
  ANNO: 'comment'
13
13
  };
14
- class AiffTagMapper extends GenericTagMapper_js_1.CommonTagMapper {
14
+ class AiffTagMapper extends GenericTagMapper_1.CommonTagMapper {
15
15
  constructor() {
16
16
  super(['AIFF'], tagMap);
17
17
  }
package/lib/mp4/Atom.js CHANGED
@@ -55,8 +55,10 @@ class Atom {
55
55
  return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining));
56
56
  case 'meta': // Metadata Atom, ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8
57
57
  // meta has 4 bytes of padding, ignore
58
- await tokenizer.ignore(4);
59
- return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - 4);
58
+ const peekHeader = await tokenizer.peekToken(AtomToken.Header);
59
+ const paddingLength = peekHeader.name === 'hdlr' ? 0 : 4;
60
+ await tokenizer.ignore(paddingLength);
61
+ return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - paddingLength);
60
62
  case 'mdhd': // Media header atom
61
63
  case 'mvhd': // 'movie' => 'mvhd': movie header atom; child of Movie Atom
62
64
  case 'tkhd':
@@ -99,7 +99,12 @@ class WaveParser extends BasicParser_1.BasicParser {
99
99
  this.metadata.setFormat('numberOfSamples', numberOfSamples);
100
100
  this.metadata.setFormat('duration', numberOfSamples / this.metadata.format.sampleRate);
101
101
  }
102
- this.metadata.setFormat('bitrate', this.metadata.format.numberOfChannels * this.blockAlign * this.metadata.format.sampleRate); // ToDo: check me
102
+ if (this.metadata.format.codec === 'ADPCM') { // ADPCM is 4 bits lossy encoding resulting in 352kbps
103
+ this.metadata.setFormat('bitrate', 352000);
104
+ }
105
+ else {
106
+ this.metadata.setFormat('bitrate', this.blockAlign * this.metadata.format.sampleRate * 8);
107
+ }
103
108
  await this.tokenizer.ignore(header.chunkSize);
104
109
  break;
105
110
  case 'bext': // Broadcast Audio Extension chunk https://tech.ebu.ch/docs/tech/tech3285.pdf
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "music-metadata",
3
3
  "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
- "version": "7.13.1",
4
+ "version": "7.13.3",
5
5
  "author": {
6
6
  "name": "Borewit",
7
7
  "url": "https://github.com/Borewit"