[MPlayer-dev-eng] NUT cleanup
Oded Shimon
ods15 at ods15.dyndns.org
Tue Sep 6 12:20:30 CEST 2005
On Tue, Sep 06, 2005 at 03:23:03AM +0200, Michael Niedermayer wrote:
> Hi
>
> On Mon, Sep 05, 2005 at 10:36:06PM +0300, Oded Shimon wrote:
> > On Mon, Sep 05, 2005 at 02:59:46PM -0400, Rich Felker wrote:
> > > On Mon, Sep 05, 2005 at 09:43:47PM +0300, Oded Shimon wrote:
> [...]
> >
> > New patch.
>
> comments added, feel free to apply the hunks with "ok" unless of
> course there are objections from someone
Well, you approoved half the stuff and half not, and since some of this
patch cross-depends I can't half-commit it.
> note, a lack of a ok doesnt mean i disagree, just that iam not sure /
> too tired ATM ...
> resend the remaining and ill write some meaningfull comments or more
> oks
Here are all the chunks I see you haven't ok'ed.
> [...]
> > @@ -313,11 +324,8 @@
> > SHOULD be set to <=32768 or at least <=65536 unless there is a very
> > good reason to set it higher
> >
> > -stream_id[FIXME]
> > +stream_id
> > Stream identifier
> > - Note: streams with a lower relative class MUST have a lower relative id
> > - so a stream with class 0 MUST always have an id which is lower than any
> > - stream with class > 0
> > stream_id MUST be < stream_count
> >
> > stream_class
>
> ok
Please not that I did not remove the restriction altogether, I just moved
it a few lines lower...
> [...]
> > @@ -490,6 +496,11 @@
> > 2 consecutive index entries if they are more than max_index_distance
> > apart
> >
> > +index_ptr
> > + length in bytes from the first bytes of the first index startcode
> > + to the first byte of the index_ptr. If there is no index, index_ptr
> > + MUST be zero.
> > +
> > id
> > the id of the type/name pair, so it's more compact
> > 0 means end
>
> ok
I changed this now, it points to the first byte of the end_startcode, not
first byte of index_ptr.
This is all that's left that you haven't ok'ed... ok this stuff, anf I'll
apply the patch:
(this is NOT a valid patch, just chunks from the previous patch...)
@@ -204,9 +208,10 @@
index_startcode f(64)
packet header
stream_id v
+ last_pts v
index_length v
for(i=0; i<index_length; i++){
- index_timestamp v
+ index_pts v
index_position v
}
reserved_bytes
@@ -234,19 +239,21 @@
sync_point:
frame_startcode f(64)
- global_timestamp v
+ global_pts v
Complete definition:
file:
file_id_string
- while(!eof && next_code != index_startcode){
+ while(next_code != end_startcode && next_code != index_startcode){
main_header
@@ -258,16 +265,18 @@
}
}
}
- index
-
+ while(next_code != end_startcode){
+ index
+ }
+ end_startcode f(64)
+ index_ptr v
@@ -292,6 +301,8 @@
0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48)
info_startcode
0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)
+end_startcode
+ 0xE8154EDB2A7CULL + (((uint64_t)('N'<<8) + 'E')<<48)
version
NUT version. The current value is 2.
@@ -327,6 +335,8 @@
3 metadata
Note: the remaining values are reserved and MUST NOT be used
a demuxer MUST ignore streams with reserved classes
+ Note: stream_class MUST be bigger or equal to the stream_class of
+ the previous stream.
fourcc
identification for the codec
@@@@@@
-global_timestamp
- timestamp in global_time_base units
- when a global_timestamp is encountered the last_timestamp of all
+global_pts
+ pts in global_time_base units
+ when a global_pts is encountered the last_pts of all
streams is set to the following:
- ln= global_time_base_denom*time_base_nom
- sn= global_timestamp
- d1= global_time_base_nom
- d2= time_base_denom
- last_timestamp= (ln/d1*sn + ln%d1*sn/d1)/d2
+ ln= global_time_base_nom*time_base_denom
+ sn= global_pts
+ d1= global_time_base_denom
+ d2= time_base_nom
+ last_pts= (ln/d1*sn + ln%d1*sn/d1)/d2
Note: this calculation MUST be done with unsigned 64 bit integers, and
is equivalent to (ln*sn)/(d1*d2) but this would require a 96bit integer
-coded_timestamp
- if coded_timestamp < (1<<msb_timestamp_shift) then it is an lsb
- timestamp, otherwise it is a full timestamp + (1<<msb_timestamp_shift)
- lsb timestamps are converted to full timesamps by:
- mask = (1<<msb_timestamp_shift)-1;
- delta= last_timestamp - mask/2
- timestamp= ((timestamp_lsb-delta)&mask) + delta
- a full timestamp MUST be used if there is no reference timestamp
- available after the last frame_startcode with the current stream_id
+coded_pts
+ if coded_pts < (1<<msb_pts_shift) then it is an lsb
+ pts, otherwise it is a full pts + (1<<msb_pts_shift)
+ lsb pts is converted to a full pts by:
+ mask = (1<<msb_pts_shift)-1;
+ delta= last_pts - mask/2
+ pts= ((pts_lsb-delta)&mask) + delta
@@ -478,9 +478,15 @@
checksum
adler32 checksum
+ checksum is calculated for the area pointed to by forward_ptr not
+ including the checksum itself (from first byte after the
+ forward_ptr until last byte before the checksum).
-index_timestamp
- value of the timestamp of a keyframe relative to the last keyframe
+last_pts
+ The starting pts of the last frame
+
+index_pts
+ value of the pts of a keyframe relative to the last keyframe
stored in this index
index_position
@@ -490,6 +496,11 @@
2 consecutive index entries if they are more than max_index_distance
apart
+index_ptr
+ length in bytes from the first bytes of the first index startcode
+ to the first byte of the end_startcode. If there is no index,
+ index_ptr MUST be zero.
+
id
the id of the type/name pair, so it's more compact
0 means end
@@ -601,6 +614,10 @@
headers starting at offset 2^x for each x players SHOULD end their search from
a particular offset when any startcode is found (including syncpoint)
+ Semantic requirements
+
+If more than one stream of a given stream class is present, each one MUST
+have info tags specifying disposition, and if applicable, language.
Sample code (GPL, & untested)
P.S. I removes mncf.txt from CVS.. There seemed to be a pretty solid
agreement on that.
- ods15
More information about the MPlayer-dev-eng
mailing list