basic vp9 codec string parsing

This commit is contained in:
Muaz Ahmad 2023-09-14 12:17:51 +05:00
parent 20d6bf56fb
commit 4478cf5958

View file

@ -60,6 +60,8 @@ class MP4Tree {
const media_sample = this.read_next_head().name; const media_sample = this.read_next_head().name;
if (media_sample == 'avc1') { if (media_sample == 'avc1') {
this.parse_avc1(); this.parse_avc1();
} else if (media_sample == 'vp09') {
this.parse_vp09();
} else if (media_sample == 'mp4a') { } else if (media_sample == 'mp4a') {
this.parse_mp4a(); this.parse_mp4a();
} else if (media_sample == 'Opus') { } else if (media_sample == 'Opus') {
@ -82,6 +84,15 @@ class MP4Tree {
this.codecs.push('avc1.' + avc_profile); this.codecs.push('avc1.' + avc_profile);
} }
parse_vp09() {
this.parse_into('vp09', 86);
this.parse_into('vpcC', 12);
const profile = this.data.getUint8(this.idx).toString().padStart(2, "0");
const level = this.data.getUint8(this.idx + 1).toString();
const depth = (this.data.getUint8(this.idx + 2) & 0xf0).toString().padStart(2, "0");
this.codecs.push(["vp09", profile, level, depth].join('.'));
}
parse_mp4a() { parse_mp4a() {
this.parse_into('mp4a', 36); // 28 bytes of subboxes with unclear offsets this.parse_into('mp4a', 36); // 28 bytes of subboxes with unclear offsets
this.parse_into('esds', 12); this.parse_into('esds', 12);