[MPlayer-dev-eng] NUT seeking
Oded Shimon
ods15 at ods15.dyndns.org
Wed Dec 21 19:58:13 CET 2005
On Mon, Dec 19, 2005 at 08:57:10AM +0200, Oded Shimon wrote:
> On Mon, Dec 19, 2005 at 08:47:56AM +0200, Oded Shimon wrote:
> > Rich's goals for seeking:
> > - finding the previous keyframe for a given stream before a given timestamp
> > - finding the latest point X such that if you start decoding at X you can
> > have all relevant information for the set of streams you're interested in
> > at a given timestamp
> >
> > I think my goals are similar... A syncpoint index would not satisfy these
> > goals, it can only help you with all streams.
> > I'm no longer sure what the problem was...
>
> Either way, here's my proposal for syncpoint index:
>
> index:
> items v
> for (i = 0; i < items; i++)
> pos v
> pts v
>
> items - ALL the syncpoints in the file.
> pts is obviously in global timebase
>
> pos and pts - relative to last values. (starting at 0, 0)
>
> however - pos is NOT the position of the syncpoint to match 'pts'
> timestamp, it is the position of the syncpoint pointed to by the back_ptr.
> Also for compression, pos is real_pos/8.
>
> So, if you want to seek to P, you find in the index the highest pts lower
> than P, seek to position pointed to by 'pos', read possibly 7 bytes of
> trash till you get to the syncpoint, and then play.
Here's my patch for this, with one change from what I decribed above - not
EVERY syncpoint should be written in index, only those with a different
back_ptr.
max_index_distance is now obsolete...
I also noticed one apperantely very obsolete piece in the goals section,
says index can be repeated...
Somebody PLEASE comment on this patch (micheal, rich, whoever). If not,
I'll take it as you all agree with it and commit...
- ods15
-------------- next part --------------
Index: DOCS/tech/mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.85
diff -u -r1.85 mpcf.txt
--- DOCS/tech/mpcf.txt 18 Nov 2005 16:28:26 -0000 1.85
+++ DOCS/tech/mpcf.txt 21 Dec 2005 18:52:10 -0000
@@ -27,7 +27,7 @@
Error resistant
seeking / playback without an index
- headers & index can be repeated
+ headers can be repeated
damaged files can be played back with minimal data loss and fast
resync times
@@ -134,7 +134,6 @@
version v
stream_count v
max_distance v
- max_index_distance v
global_time_base_nom v
global_time_base_denom v
for(i=0; i<256; ){
@@ -221,7 +220,6 @@
index:
index_startcode f(64)
packet header
- stream_id v
max_pts v
index_length v
for(i=0; i<index_length; i++){
@@ -283,9 +281,7 @@
}
}
if (next_code == index_startcode){
- while(!eof){
- index
- }
+ index
index_ptr u(64)
}
@@ -342,13 +338,6 @@
good reason to set it higher, otherwise reasonable error recovery will
be impossible
-max_index_distance
- max distance of keyframes which are represented in the index, the
- distance between consecutive entries A and B may only be larger if
- there are no keyframes within this stream between A and B
- SHOULD be set to <=32768 or at least <=65536 unless there is a very
- good reason to set it higher
-
stream_id
Stream identifier
stream_id MUST be < stream_count
@@ -508,23 +497,24 @@
forward_ptr until last byte before the checksum).
max_pts
- The highest pts in the stream.
+ The highest pts in the entire file in global timebase.
index_pts
- value of the pts of a keyframe relative to the last keyframe
+ value of the pts of a syncpoint relative to the last syncpoint
stored in this index
index_position
- position in bytes of the first byte of a keyframe, relative to the
- last keyframe stored in this index
- there MUST be no keyframe with the same stream_id as this index between
- two consecutive index entries if they are more than max_index_distance
- apart
+ relative to last index_position, starting at 0
+ real position is index_position*8
+ real position is begginning of syncpoint pointed to by the back_ptr of
+ the syncpoint described in this index entry.
+ All syncpoints which point to a different syncpoint in their back_ptr
+ MUST be written in the index.
index_ptr
- Length in bytes from the first byte of the first index startcode
- to the first byte of the index_ptr. If there is no index, index_ptr
- MUST NOT be written.
+ Length in bytes from the first byte of the index startcode to the first
+ byte of the index_ptr. If there is no index, index_ptr MUST NOT be
+ written.
id
the ID of the type/name pair, so it is more compact
More information about the MPlayer-dev-eng
mailing list