@ahmedrowaihi/mediabunny 1.65.2-beta.693 → 1.65.2-beta.694
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/mediabunny.cjs +14 -2
- package/dist/bundles/mediabunny.min.cjs +32 -32
- package/dist/bundles/mediabunny.min.mjs +33 -33
- package/dist/bundles/mediabunny.mjs +14 -2
- package/dist/bundles/mediabunny.node.cjs +14 -2
- package/dist/modules/src/codec.d.ts +2 -1
- package/dist/modules/src/codec.d.ts.map +1 -1
- package/dist/modules/src/codec.js +13 -2
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts +2 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.js +9 -1
- package/dist/modules/src/matroska/matroska-demuxer.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-demuxer.js +5 -1
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/media-source.js +4 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.d.ts +2 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +3 -0
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/codec.ts +17 -1
- package/src/isobmff/isobmff-demuxer.ts +10 -0
- package/src/matroska/matroska-demuxer.ts +5 -0
- package/src/media-source.ts +4 -0
- package/src/mpeg-ts/mpeg-ts-demuxer.ts +5 -0
|
@@ -8659,6 +8659,7 @@ var Mediabunny = (() => {
|
|
|
8659
8659
|
hevcCodecInfo: null,
|
|
8660
8660
|
vp9CodecInfo: null,
|
|
8661
8661
|
av1CodecInfo: null,
|
|
8662
|
+
mpeg2CodecInfo: null,
|
|
8662
8663
|
proresCodecInfo: null,
|
|
8663
8664
|
proresFormat: null,
|
|
8664
8665
|
hdrStaticMetadata: null,
|
|
@@ -11059,6 +11060,9 @@ var Mediabunny = (() => {
|
|
|
11059
11060
|
} else if (this.internalTrack.info.codec === "prores" && !this.internalTrack.info.proresCodecInfo) {
|
|
11060
11061
|
const firstPacket = await this.getFirstPacket({});
|
|
11061
11062
|
this.internalTrack.info.proresCodecInfo = firstPacket && extractProresCodecInfoFromPacket(firstPacket.data);
|
|
11063
|
+
} else if (this.internalTrack.info.codec === "mpeg2" && !this.internalTrack.info.mpeg2CodecInfo) {
|
|
11064
|
+
const firstPacket = await this.getFirstPacket({});
|
|
11065
|
+
this.internalTrack.info.mpeg2CodecInfo = firstPacket && extractMpeg2CodecInfoFromPacket(firstPacket.data);
|
|
11062
11066
|
}
|
|
11063
11067
|
if (!colorSpaceIsComplete(this.internalTrack.info.colorSpace)) {
|
|
11064
11068
|
const colorSpace = extractColorSpace(this.internalTrack.info);
|
|
@@ -14366,7 +14370,7 @@ var Mediabunny = (() => {
|
|
|
14366
14370
|
}
|
|
14367
14371
|
return this.decoderConfigPromise ??= (async () => {
|
|
14368
14372
|
let firstPacket = null;
|
|
14369
|
-
const needsPacketForAdditionalInfo = this.internalTrack.info.codec === "vp9" || this.internalTrack.info.codec === "av1" || this.internalTrack.info.codec === "prores" || this.internalTrack.info.codec === "avc" && !this.internalTrack.info.codecDescription || this.internalTrack.info.codec === "hevc" && !this.internalTrack.info.codecDescription;
|
|
14373
|
+
const needsPacketForAdditionalInfo = this.internalTrack.info.codec === "vp9" || this.internalTrack.info.codec === "av1" || this.internalTrack.info.codec === "prores" || this.internalTrack.info.codec === "mpeg2" || this.internalTrack.info.codec === "avc" && !this.internalTrack.info.codecDescription || this.internalTrack.info.codec === "hevc" && !this.internalTrack.info.codecDescription;
|
|
14370
14374
|
if (needsPacketForAdditionalInfo) {
|
|
14371
14375
|
firstPacket = await this.getFirstPacket({});
|
|
14372
14376
|
}
|
|
@@ -14384,6 +14388,7 @@ var Mediabunny = (() => {
|
|
|
14384
14388
|
hevcCodecInfo: this.internalTrack.info.codec === "hevc" && firstPacket ? extractHevcDecoderConfigurationRecord(firstPacket.data) : null,
|
|
14385
14389
|
vp9CodecInfo: this.internalTrack.info.codec === "vp9" && firstPacket ? extractVp9CodecInfoFromPacket(firstPacket.data) : null,
|
|
14386
14390
|
av1CodecInfo: this.internalTrack.info.codec === "av1" && firstPacket ? extractAv1CodecInfoFromPacket(firstPacket.data) : null,
|
|
14391
|
+
mpeg2CodecInfo: this.internalTrack.info.codec === "mpeg2" && firstPacket ? extractMpeg2CodecInfoFromPacket(firstPacket.data) : null,
|
|
14387
14392
|
proresCodecInfo: this.internalTrack.info.codec === "prores" && firstPacket ? extractProresCodecInfoFromPacket(firstPacket.data) : null,
|
|
14388
14393
|
proresFormat: this.internalTrack.info.proresFormat
|
|
14389
14394
|
};
|
|
@@ -18483,6 +18488,7 @@ var Mediabunny = (() => {
|
|
|
18483
18488
|
decoderConfig: null,
|
|
18484
18489
|
avcCodecInfo: null,
|
|
18485
18490
|
hevcCodecInfo: null,
|
|
18491
|
+
mpeg2CodecInfo: null,
|
|
18486
18492
|
colorSpace: {
|
|
18487
18493
|
primaries: null,
|
|
18488
18494
|
transfer: null,
|
|
@@ -18705,6 +18711,7 @@ var Mediabunny = (() => {
|
|
|
18705
18711
|
if (!info) {
|
|
18706
18712
|
continue;
|
|
18707
18713
|
}
|
|
18714
|
+
elementaryStream.info.mpeg2CodecInfo = info;
|
|
18708
18715
|
elementaryStream.info.width = info.width;
|
|
18709
18716
|
elementaryStream.info.height = info.height;
|
|
18710
18717
|
elementaryStream.info.squarePixelWidth = info.width;
|
|
@@ -18730,6 +18737,7 @@ var Mediabunny = (() => {
|
|
|
18730
18737
|
hevcCodecInfo: elementaryStream.info.hevcCodecInfo,
|
|
18731
18738
|
vp9CodecInfo: null,
|
|
18732
18739
|
av1CodecInfo: null,
|
|
18740
|
+
mpeg2CodecInfo: elementaryStream.info.mpeg2CodecInfo,
|
|
18733
18741
|
proresFormat: null
|
|
18734
18742
|
}),
|
|
18735
18743
|
codedWidth: elementaryStream.info.width,
|
|
@@ -36188,6 +36196,7 @@ var Mediabunny = (() => {
|
|
|
36188
36196
|
hevcCodecInfo: this.encodingConfig.codec === "hevc" && !meta.decoderConfig.description ? extractHevcDecoderConfigurationRecord(packet.data) : null,
|
|
36189
36197
|
vp9CodecInfo: this.encodingConfig.codec === "vp9" ? extractVp9CodecInfoFromPacket(packet.data) : null,
|
|
36190
36198
|
av1CodecInfo: this.encodingConfig.codec === "av1" ? extractAv1CodecInfoFromPacket(packet.data) : null,
|
|
36199
|
+
mpeg2CodecInfo: this.encodingConfig.codec === "mpeg2" ? extractMpeg2CodecInfoFromPacket(packet.data) : null,
|
|
36191
36200
|
proresFormat: null
|
|
36192
36201
|
// Can't be encoded by WebCodecs
|
|
36193
36202
|
});
|
|
@@ -38468,6 +38477,7 @@ var Mediabunny = (() => {
|
|
|
38468
38477
|
hevcCodecInfo,
|
|
38469
38478
|
vp9CodecInfo,
|
|
38470
38479
|
av1CodecInfo,
|
|
38480
|
+
mpeg2CodecInfo,
|
|
38471
38481
|
proresFormat
|
|
38472
38482
|
} = trackInfo;
|
|
38473
38483
|
if (codec === "avc") {
|
|
@@ -38604,7 +38614,7 @@ var Mediabunny = (() => {
|
|
|
38604
38614
|
} else if (codec === "prores") {
|
|
38605
38615
|
return proresFormat ?? "apch";
|
|
38606
38616
|
} else if (codec === "mpeg2") {
|
|
38607
|
-
return mpeg2CodecString(
|
|
38617
|
+
return mpeg2CodecString(mpeg2ObjectTypeFromProfile(mpeg2CodecInfo?.profileAndLevelIndication ?? null));
|
|
38608
38618
|
} else if (codec !== null) {
|
|
38609
38619
|
assertNever(codec);
|
|
38610
38620
|
}
|
|
@@ -38955,8 +38965,10 @@ var Mediabunny = (() => {
|
|
|
38955
38965
|
};
|
|
38956
38966
|
var MPEG2_OBJECT_TYPES = [96, 97, 98, 99, 100, 101, 106];
|
|
38957
38967
|
var MPEG2_OBJECT_TYPE_MAIN = 97;
|
|
38968
|
+
var MPEG2_OBJECT_TYPE_422 = 101;
|
|
38958
38969
|
var isMpeg2ObjectType = (objectType) => MPEG2_OBJECT_TYPES.includes(objectType);
|
|
38959
38970
|
var mpeg2CodecString = (objectType) => `mp4v.${objectType.toString(16)}`;
|
|
38971
|
+
var mpeg2ObjectTypeFromProfile = (profileAndLevelIndication) => profileAndLevelIndication !== null && (profileAndLevelIndication & 128) !== 0 && (profileAndLevelIndication >> 4 & 7) === 0 ? MPEG2_OBJECT_TYPE_422 : MPEG2_OBJECT_TYPE_MAIN;
|
|
38960
38972
|
var mpeg2ObjectTypeOf = (codecString) => {
|
|
38961
38973
|
const match = /^mp4v\.([0-9a-fA-F]{2})$/.exec(codecString);
|
|
38962
38974
|
const objectType = match ? parseInt(match[1], 16) : null;
|