matroskadec: after seeking, skip up to the desired timestamp instead of

the desired stream

Originally committed as revision 15282 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2008-09-09 12:01:51 +00:00
parent f14a201b32
commit 20f7466550
2 changed files with 17 additions and 17 deletions

View File

@ -210,7 +210,7 @@ typedef struct {
/* What to skip before effectively reading a packet. */
int skip_to_keyframe;
AVStream *skip_to_stream;
uint64_t skip_to_timecode;
} MatroskaDemuxContext;
typedef struct {
@ -1467,7 +1467,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
}
if (matroska->skip_to_keyframe) {
if (!is_keyframe || st != matroska->skip_to_stream)
if (!is_keyframe || timecode < matroska->skip_to_timecode)
return res;
matroska->skip_to_keyframe = 0;
}
@ -1706,7 +1706,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
matroska->skip_to_stream = st;
matroska->skip_to_timecode = st->index_entries[index].timestamp;
matroska->done = 0;
av_update_cur_dts(s, st, st->index_entries[index].timestamp);
return 0;

View File

@ -2958,53 +2958,53 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st:-1 ts:-1.000000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st:-1 ts:1.894167 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:301414 size:27927 flags:1
ret: 0 st: 0 ts:0.788000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.800000 pts:0.800000 pos:259148 size:10844 flags:0
ret: 0 st: 0 ts:-0.317000 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 1 ts:2.577000 flags:0
ret:-5
ret: 0 st: 1 ts:1.471000 flags:1
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:28603 size:208 flags:1
ret: 0 st: 1 dts:0.993000 pts:0.993000 pos:329564 size:209 flags:1
ret: 0 st:-1 ts:0.365002 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.400000 pts:0.400000 pos:128831 size:9787 flags:0
ret: 0 st:-1 ts:-0.740831 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 ts:2.153000 flags:0
ret:-5
ret: 0 st: 0 ts:1.048000 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:301414 size:27927 flags:1
ret: 0 st: 1 ts:-0.058000 flags:0
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:28603 size:208 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 1 ts:2.836000 flags:1
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:28603 size:208 flags:1
ret: 0 st: 1 dts:0.993000 pts:0.993000 pos:329564 size:209 flags:1
ret: 0 st:-1 ts:1.730004 flags:0
ret:-5
ret: 0 st:-1 ts:0.624171 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.600000 pts:0.600000 pos:200790 size:11166 flags:0
ret: 0 st: 0 ts:-0.482000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 ts:2.413000 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:301414 size:27927 flags:1
ret: 0 st: 1 ts:1.307000 flags:0
ret:-5
ret: 0 st: 1 ts:0.201000 flags:1
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:28603 size:208 flags:1
ret: 0 st: 1 dts:0.183000 pts:0.183000 pos:72875 size:209 flags:1
ret: 0 st:-1 ts:-0.904994 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st:-1 ts:1.989173 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:301414 size:27927 flags:1
ret: 0 st: 0 ts:0.883000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.920000 pts:0.920000 pos:290795 size:10395 flags:0
ret: 0 st: 0 ts:-0.222000 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 1 ts:2.672000 flags:0
ret:-5
ret: 0 st: 1 ts:1.566000 flags:1
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:28603 size:208 flags:1
ret: 0 st: 1 dts:0.993000 pts:0.993000 pos:329564 size:209 flags:1
ret: 0 st:-1 ts:0.460008 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:149428 size:27442 flags:1
ret: 0 st:-1 ts:-0.645825 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:478 size:28118 flags:1
----------------