1 Star 0 Fork 0

wangzhankun/untrunc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
codec_gpmd.cpp 963 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include "codec.h"
#include <set>
#include <iostream>
using namespace std;
Match Codec::gpmdMatch(const unsigned char *start, int maxlength) {
Match match;
set<string> fourcc = {"DEVC", "DVID", "DVNM", "STRM", "STNM", "RMRK", "SCAL",
"SIUN", "UNIT", "TYPE", "TSMP", "TIMO", "EMPT"};
if(!fourcc.count(string((char *)start, 4)))
return match;
match.chances = 1<<20;
match.length = (readBE<int32_t>(start + 4) & 0xffff) + 8;
return match;
}
Match Codec::gpmdSearch(const unsigned char *start, int maxlength) {
Match match;
const unsigned char *end = start + maxlength - 8;
const unsigned char *current = start;
set<string> fourcc = {"DEVC", "DVID", "DVNM", "STRM", "STNM", "RMRK", "SCAL",
"SIUN", "UNIT", "TYPE", "TSMP", "TIMO", "EMPT"};
while(current < end) {
if(fourcc.count(string((char *)current, 4))) {
match.chances = 1<<20;
match.offset = current - start;
return match;
}
current++;
}
return match;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangzhankun/untrunc.git
git@gitee.com:wangzhankun/untrunc.git
wangzhankun
untrunc
untrunc
master

搜索帮助