关于MP4 uuid box

关于MP4 uuid box

    uuid box是MP4中用户可以自定义的一种box,由header和body组成。
    对于uuid header而言,包括了size、type、usertype组成,其中usertype仅在uuid box存在。size、type、usertype的大小分别为4、4、16字节。usertype来存放第三方自行定义的该uuid的类型。也就是说uuid header的大小为24个字节

public class Mp4Box {
    public int headSize = 8;
    public int size;
    public String type;
    public long largeSize;
    public boolean hasSubBox = true;
    public int index;
    public long end;

    public Mp4Box(byte[] byteBuffer, int start) {
        this.index = start;
        size = getSize(byteBuffer);
        end = start + size;
        type = getType(byteBuffer);
        if (type.equals("uuid")) {
            headSize += 16;
        }

        if (size == 1) {
            largeSize = getLongFromBuffer(byteBuffer);
            end = start + largeSize;
            headSize += 8;
        } else if (size == 0) {
            //box extends to the end of file
        }
}

    下面是写的一个uuid的box,其中usertype为1,data中存放的数据为11。

avio_wb32(os->out, 28);//size
			ffio_wfourcc(pb, "uuid");//type
			avio_wb32(pb, 0x00);//usertype
			avio_wb32(pb, 0x00);
			avio_wb32(pb, 0x00);
			avio_wb32(pb, 0x01);
			avio_wb32(pb, 0x11);//data

    解析出来的MP4中的uuid为下图所示

uuid box

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值