[NUT-devel] [PATCH] nut: Add per frame sidedata and metadata
Michael Niedermayer
michaelni at gmx.at
Thu Mar 28 16:12:23 CET 2013
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
docs/nut.txt | 116 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 88 insertions(+), 28 deletions(-)
diff --git a/docs/nut.txt b/docs/nut.txt
index 7969e3c..4a2f2b7 100644
--- a/docs/nut.txt
+++ b/docs/nut.txt
@@ -1,5 +1,5 @@
==================================
-NUT Open Container Format 20080202
+NUT Open Container Format 20130327
==================================
@@ -255,6 +255,7 @@ main_header:
tmp_stream=0
tmp_match=1-(1<<62)
tmp_head_idx= 0;
+ tmp_sm_size = 0;
for(i=0; i<256; ){
tmp_flag v
tmp_fields v
@@ -269,7 +270,8 @@ main_header:
else count= tmp_mul - tmp_size
if(tmp_fields>6) tmp_match s
if(tmp_fields>7) tmp_head_idx v
- for(j=8; j<tmp_fields; j++){
+ if(tmp_fields>8) tmp_sm_size v
+ for(j=9; j<tmp_fields; j++){
tmp_reserved[i] v
}
for(j=0; j<count && i<256; j++, i++){
@@ -286,6 +288,7 @@ main_header:
reserved_count[i]= tmp_res;
match_time_delta[i]= tmp_match;
header_idx[i]= tmp_head_idx;
+ sm_data_size[i]= tmp_sm_size;
}
}
header_count_minus1 v
@@ -344,13 +347,55 @@ frame:
}
if(frame_flags&FLAG_RESERVED)
frame_res v
- for(i=0; i<frame_res; i++)
+ if(frame_flags&FLAG_SM_DATA)
+ sm_data_size v
+ for(i=0; i<frame_res - !(frame_flags&FLAG_SM_DATA); i++)
reserved v
if(frame_flags&FLAG_CHECKSUM){
checksum u(32)
}
data
+data:
+ frame_data
+ if (sm_data_size>0) {
+ side_data
+ meta_data
+ }
+
+side_data
+ sm_data
+
+meta_data
+ sm_data
+
+sm_data:
+ count v
+ for(i=0; i<count; i++){
+ name vb
+ value s
+ if (value==-1){
+ type= "UTF-8"
+ value vb
+ }else if (value==-2){
+ type vb
+ value vb
+ }else if (value==-3){
+ type= "s"
+ value s
+ }else if (value==-4){
+ type= "t"
+ value t
+ }else if (value<-4){
+ type= "r"
+ value.den= -value-4
+ value.num s
+ }else{
+ type= "v"
+ }
+ }
+
+
index:
max_pts t
syncpoints v
@@ -399,30 +444,7 @@ info_packet:
until 2006-11-04.)
chapter_start t
chapter_len v
- count v
- for(i=0; i<count; i++){
- name vb
- value s
- if (value==-1){
- type= "UTF-8"
- value vb
- }else if (value==-2){
- type vb
- value vb
- }else if (value==-3){
- type= "s"
- value s
- }else if (value==-4){
- type= "t"
- value t
- }else if (value<-4){
- type= "r"
- value.den= -value-4
- value.num s
- }else{
- type= "v"
- }
- }
+ meta_data
reserved_bytes
syncpoint:
@@ -643,6 +665,7 @@ flags[frame_code], frame_flags (v)
otherwise data_size_msb is 0.
6 FLAG_CHECKSUM If set, the frame header contains a checksum.
7 FLAG_RESERVED If set, reserved_count is coded in the frame header.
+ 8 FLAG_SM_DATA If set, sm_data_size is coded in the frame header.
10 FLAG_HEADER_IDX If set, header_idx is coded in the frame header.
11 FLAG_MATCH_TIME If set, match_time_delta is coded in the frame
header
@@ -690,7 +713,44 @@ pts_delta[frame_code] (s)
MUST be <16384 and >-16384.
reserved_count[frame_code] (v)
- MUST be <256.
+ Muxers supporting FLAG_SM_DATA MUST set the reserved_count to 1
+ if side data is in use in order to be compatible with older demuxers
+ Demuxers MUST support any value from 0 to 255.
+
+sidedata_size[frame_code] (v)
+ Size in bytes at the end inside data which represent frame sidedata and
+ frame metadata.
+
+sm_data / side_data / meta_data
+ This data structure is used both in frames for per frame side and metadata
+ as well as info tags for metadata covering the whole file, a stream
+ chapter or other.
+ Metadata is data that is about the actual data and generally not essential
+ for correct presentation
+ Sidedata is semantically part of the data and essential for its correct
+ presentation. The same syntax is used by both for simplicity.
+ Types of per frame side data:
+ "Channels", "ChannelLayout", "SampleRate", "Width", "Height"
+ This frame changes the number of channels, the channel layout, ... to
+ the given value (v)
+ If used in any frame of a stream then every keyframe of the stream
+ SHOULD carry such sidedata to allow seeking.
+ "Extradata", "Palette"
+ This frame changes the codec_specific_data or palette to the given
+ value (vb)
+ If used in any frame of a stream then every keyframe of the stream
+ SHOULD carry such sidedata to allow seeking.
+ "CodecSpecificSide<num>"
+ Codec specific side data, equivalent to matroskas BlockAdditional (vb)
+ the "<num>" should be replaced by a number identifying the type of
+ side data, it is equivalent/equal to BlockAddId in matroska.
+ "SkipStart", "SkipEnd"
+ The decoder should skip/drop the specified number of samples at the
+ start/end of this frame (v)
+ "UserData<identifer here>"
+ User specific side data, the "<identifer here>" should be replaced
+ by a globally unique identifer of the project that
+ uses/creates/understands the side data. For example "UserDataFFmpeg"
data_size
data_size = data_size_lsb + data_size_msb * data_size_mul ;
--
1.7.9.5
More information about the NUT-devel
mailing list