MKV parser and quick seek.

1: seek the File's problem.

 

文件各个部分介绍:

The Metaseek section contains an index of where all of the other groups are in the file are located, such as the Track information, Chapters, Tags, Cues, Attachments, and so on. This element isn't technicaly required, but you would have to search the entire file to find all of the other Level 1 elements if you did not have it. This is because any of the items can occur in any order. For instance you could have the chapters section in the middle of the Clusters. This is part of the flexibility of EBML and Matroksa.

 

 

The Track section has basic information about each of the tracks.

 

The Clusters section has all of the Clusters. These contain all of the video frames and audio for each track.

 

解码关键:

判断标志位size. 例如:1A 45 DF A3   1A = 0001 1010 . size = 4. (000 +1)

Element ID coded with an UTF-8 like system :

bits, big-endian
1xxx xxxx - Class A IDs (2^7 -1 possible values) (base 0x8X)
01xx xxxx xxxx xxxx - Class B IDs (2^14-1 possible values) (base 0x4X 0xXX)
001x xxxx xxxx xxxx xxxx xxxx - Class C IDs (2^21-1 possible values) (base 0x2X 0xXX 0xXX)
0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - Class D IDs (2^28-1 possible values) (base 0x1X 0xXX 0xXX 0xXX)

 

同样道理。 计算data size.

比如:1A 45 DF A3 A3 . size = 1010 0011  size =  1,  value = 10 0011= 35!

 

Data size, in octets, is also coded with an UTF-8 like system :

bits, big-endian
1xxx xxxx - value 0 to 2^7-2
01xx xxxx xxxx xxxx - value 0 to 2^14-2
001x xxxx xxxx xxxx xxxx xxxx - value 0 to 2^21-2
0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^28-2
0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^35-2
0000 01xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^42-2
0000 001x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^49-2
0000 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^56-2

MKV 文件格式类似一个单链表。顺序解析方便。
但是seek就很不方便。
Meta seek infomation 往往没有实际意义。


Header
Meta Seek Information
Segment Information
Track
Chapters
Clusters
Cueing Data
Attachment
Tagging

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值