Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

music-metadata

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

music-metadata - npm Package Compare versions

Comparing version 0.9.6 to 0.9.7

5

lib/asf/AsfObject.d.ts

@@ -68,2 +68,3 @@ /// <reference types="node" />

abstract get(buf: Buffer, off: number): T;
protected postProcessTag(tags: ITag[], name: string, valueType: number, data: any): void;
}

@@ -205,3 +206,3 @@ export declare class IgnoreObjectState extends State<any> {

reserved2: number;
extensionData: Buffer;
extensionDataSize: number;
}

@@ -215,3 +216,3 @@ /**

len: number;
constructor(header: IAsfObjectHeader);
constructor();
get(buf: Buffer, off: number): IHeaderExtensionObject;

@@ -218,0 +219,0 @@ }

30

lib/asf/AsfObject.js

@@ -81,2 +81,14 @@ // ASF Objects

}
State.prototype.postProcessTag = function (tags, name, valueType, data) {
if (name === "WM/Picture") {
tags.push({ id: name, value: WmPictureToken.fromBuffer(data) });
}
else {
var parseAttr = Util_2.Util.getParserForAttr(valueType);
if (!parseAttr) {
throw new Error("unexpected value headerType: " + valueType);
}
tags.push({ id: name, value: parseAttr(data) });
}
};
return State;

@@ -154,3 +166,3 @@ }());

var HeaderExtensionObject = /** @class */ (function () {
function HeaderExtensionObject(header) {
function HeaderExtensionObject() {
this.len = 22;

@@ -163,4 +175,3 @@ }

reserved2: buf.readUInt16LE(off + 16),
extensionData: new Token.BufferType(dataSize).get(buf, off + 20)
// ToDo
extensionDataSize: buf.readUInt32LE(off + 18)
};

@@ -224,7 +235,3 @@ };

pos += valueLen;
var parseAttr = Util_2.Util.getParserForAttr(valueType);
if (!parseAttr) {
throw new Error("unexpected value headerType: " + valueType);
}
tags.push({ id: name_1, value: parseAttr(value) });
this.postProcessTag(tags, name_1, valueType, value);
}

@@ -305,8 +312,3 @@ return tags;

}
if (name_2 === "WM/Picture") {
tags.push({ id: name_2, value: WmPictureToken.fromBuffer(data) });
}
else {
tags.push({ id: name_2, value: parseAttr(data) });
}
this.postProcessTag(tags, name_2, dataType, data);
}

@@ -313,0 +315,0 @@ return tags;

@@ -18,3 +18,2 @@ import { INativeAudioMetadata, IOptions } from "../index";

private tokenizer;
private numberOfObjectHeaders;
private tags;

@@ -25,3 +24,4 @@ private warnings;

private paresTopLevelHeaderObject();
private parseObjectHeader();
private parseObjectHeader(numberOfObjectHeaders);
private parseExtensionObject(extensionSize);
}

@@ -31,7 +31,6 @@ 'use strict';

}
_this.numberOfObjectHeaders = header.numberOfHeaderObjects;
return _this.parseObjectHeader();
return _this.parseObjectHeader(header.numberOfHeaderObjects);
});
};
AsfParser.prototype.parseObjectHeader = function () {
AsfParser.prototype.parseObjectHeader = function (numberOfObjectHeaders) {
var _this = this;

@@ -52,4 +51,4 @@ // Parse common header of the ASF Object (3.1)

case AsfObject.HeaderExtensionObject.guid.str:// 3.4
return _this.tokenizer.readToken(new AsfObject.HeaderExtensionObject(header)).then(function () {
return _this.parseObjectHeader();
return _this.tokenizer.readToken(new AsfObject.HeaderExtensionObject()).then(function (extHeader) {
return _this.parseExtensionObject(extHeader.extensionDataSize);
});

@@ -63,6 +62,43 @@ case AsfObject.ContentDescriptionObjectState.guid.str:// 3.10

_this.tags = _this.tags.concat(tags);
return header.objectSize;
});
case GUID_1.default.CodecListObject.str:
// ToDo?
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len);
case GUID_1.default.StreamBitratePropertiesObject.str:
// ToDo?
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len);
case GUID_1.default.PaddingObject.str:
// ToDo: register bytes pad
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len);
default:
_this.warnings.push("Ignore ASF-Object-GUID: " + header.objectId.str);
// console.log("Ignore ASF-Object-GUID: %s", header.objectId.str);
return _this.tokenizer.readToken(new AsfObject.IgnoreObjectState(header));
}
}).then(function () {
--numberOfObjectHeaders;
if (numberOfObjectHeaders > 0) {
return _this.parseObjectHeader(numberOfObjectHeaders);
}
else {
// done
return {
format: _this.format,
native: {
asf: _this.tags
}
};
}
});
};
AsfParser.prototype.parseExtensionObject = function (extensionSize) {
var _this = this;
// Parse common header of the ASF Object (3.1)
return this.tokenizer.readToken(AsfObject.HeaderObjectToken).then(function (header) {
// Parse data part of the ASF Object
switch (header.objectId.str) {
case AsfObject.ExtendedStreamPropertiesObjectState.guid.str:// 4.1
return _this.tokenizer.readToken(new AsfObject.ExtendedStreamPropertiesObjectState(header)).then(function (cd) {
return null;
return header.objectSize;
});

@@ -72,2 +108,3 @@ case AsfObject.MetadataObjectState.guid.str:// 4.7

_this.tags = _this.tags.concat(tags);
return header.objectSize;
});

@@ -77,6 +114,11 @@ case AsfObject.MetadataLibraryObjectState.guid.str:// 4.8

_this.tags = _this.tags.concat(tags);
return header.objectSize;
});
case GUID_1.default.PaddingObject.str:
// ToDo: register bytes pad
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len);
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len).then(function () { return header.objectSize; });
case GUID_1.default.CompatibilityObject.str:
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len).then(function () { return header.objectSize; });
case GUID_1.default.ASF_Index_Placeholder_Object.str:
return _this.tokenizer.ignore(header.objectSize - AsfObject.HeaderObjectToken.len).then(function () { return header.objectSize; });
default:

@@ -87,14 +129,10 @@ _this.warnings.push("Ignore ASF-Object-GUID: " + header.objectId.str);

}
}).then(function () {
if (--_this.numberOfObjectHeaders > 0) {
return _this.parseObjectHeader();
}).then(function (objectSize) {
extensionSize -= objectSize;
if (extensionSize > 0) {
return _this.parseExtensionObject(extensionSize);
}
else {
// done
return {
format: _this.format,
native: {
asf: _this.tags
}
};
return 0;
}

@@ -101,0 +139,0 @@ });

@@ -62,2 +62,3 @@ /// <reference types="node" />

static BinaryMedia: GUID;
static ASF_Index_Placeholder_Object: GUID;
static fromBin(bin: Buffer, offset?: number): GUID;

@@ -64,0 +65,0 @@ /**

@@ -99,3 +99,3 @@ "use strict";

GUID.TimecodeIndexParametersObject = new GUID("F55E496D-9797-4B5D-8C8B-604DFE9BFB24");
GUID.CompatibilityObject = new GUID("75B22630-668E-11CF-A6D9-00AA0062CE6C");
GUID.CompatibilityObject = new GUID("26F18B5D-4584-47EC-9F5F-0E651F0452C9");
GUID.AdvancedContentEncryptionObject = new GUID("43058533-6981-49E6-9B74-AD12CB86D58C");

@@ -110,4 +110,5 @@ // 10.4 Stream Properties Object Stream Type GUIDs

GUID.BinaryMedia = new GUID("3AFB65E2-47EF-40F2-AC2C-70A90D71D343");
GUID.ASF_Index_Placeholder_Object = new GUID("D9AADE20-7C17-4F9C-BC28-8555DD98E2A2");
return GUID;
}());
exports.default = GUID;

@@ -166,2 +166,3 @@ "use strict";

tag.value = tag.value.data.length === 4 ? tag.value.data.readUInt32LE() : null;
// ToDo: flag warning if: tag.value === null
break;

@@ -168,0 +169,0 @@ default:

{
"name": "music-metadata",
"description": "Streaming music metadata parser for node and the browser.",
"version": "0.9.6",
"version": "0.9.7",
"author": {

@@ -6,0 +6,0 @@ "name": "Borewit",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc