1 Star 0 Fork 0

我的身份要低调/h264Analysis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Decoder.js 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
我的身份要低调 提交于 2022-04-06 09:14 +08:00 . sps pps parse
import { writeLog } from "./Log.js";
import { PpsParser, SpsParser } from "./Parser.js";
export function resolveUnit(header, body) {
const t = header & 0x1f;
switch (t) {
case 1:
writeLog("NALU_TYPE_SLICE");
removeEBSP(body);
break;
case 2:
writeLog("NALU_TYPE_DPA");
break;
case 3:
writeLog("NALU_TYPE_DPB");
break;
case 4:
writeLog("NALU_TYPE_DPC");
break;
case 5:
writeLog("NALU_TYPE_IDR");
removeEBSP(body);
break;
case 6:
writeLog("NALU_TYPE_SEI");
break;
case 7:
writeLog("NALU_TYPE_SPS");
removeEBSP(body);
const sps = SpsParser(body);
console.log(sps);
break;
case 8:
writeLog("NALU_TYPE_PPS");
removeEBSP(body);
PpsParser(body);
break;
case 9:
writeLog("NALU_TYPE_AUD");
break;
}
}
function removeEBSP(payload) {
/**
* 0x 00 00 03 00
* 0x 00 00 03 01
* 0x 00 00 03 02
* 0x 00 00 03 03
*/
let index = 2,
removePosIndexs = [];
const length = payload.length;
while (index <= length - 1) {
if (payload[index] === 3) {
if (
payload[index - 2] === 0 &&
payload[index - 1] === 0 &&
(payload[index + 1] === 0 || payload[index + 1] === 1 || payload[index + 1] === 2 || payload[index + 1] === 3)
) {
} else {
}
}
index++;
}
if (removePosIndexs.length === 0) {
return payload;
} else {
const newPayload = new Uint8Array(length - removePosIndexs.length);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/sunkingsss/h264-analysis.git
git@gitee.com:sunkingsss/h264-analysis.git
sunkingsss
h264-analysis
h264Analysis
master

搜索帮助