[Ffmpeg-cvslog] r7057 - trunk/libavformat/nutdec.c
michael
subversion
Tue Nov 14 14:32:15 CET 2006
Author: michael
Date: Tue Nov 14 14:32:14 2006
New Revision: 7057
Modified:
trunk/libavformat/nutdec.c
Log:
seeking with index
Modified: trunk/libavformat/nutdec.c
==============================================================================
--- trunk/libavformat/nutdec.c (original)
+++ trunk/libavformat/nutdec.c Tue Nov 14 14:32:14 2006
@@ -633,7 +633,7 @@
s->data_offset= pos-8;
- if(0 &&!url_is_streamed(bc)){
+ if(!url_is_streamed(bc)){
int64_t orig_pos= url_ftell(bc);
find_and_decode_index(nut);
url_fseek(bc, orig_pos, SEEK_SET);
@@ -694,16 +694,6 @@
stc->last_pts= *pts;
stc->last_key_frame= flags&FLAG_KEY; //FIXME change to last flags
- if(flags&FLAG_KEY){
- av_add_index_entry(
- s->streams[*stream_id],
- nut->last_syncpoint_pos,
- *pts,
- 0,
- 0,
- AVINDEX_KEYFRAME);
- }
-
return size;
}
@@ -846,6 +836,14 @@
syncpoint_t *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
int64_t pos, pos2, ts;
+ if(st->index_entries){
+ int index= av_index_search_timestamp(st, pts, flags);
+ if(index<0)
+ return -1;
+
+ pos2= st->index_entries[index].pos;
+ ts = st->index_entries[index].timestamp;
+ }else{
av_tree_find(nut->syncpoints, &dummy, sp_pts_cmp, next_node);
av_log(s, AV_LOG_DEBUG, "%Ld-%Ld %Ld-%Ld\n", next_node[0]->pos, next_node[1]->pos,
next_node[0]->ts , next_node[1]->ts);
@@ -866,12 +864,13 @@
sp= av_tree_find(nut->syncpoints, &dummy, sp_pos_cmp, NULL);
assert(sp);
-
- av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", sp->back_ptr);
- pos= find_startcode(&s->pb, SYNCPOINT_STARTCODE, sp->back_ptr - 15);
+ pos2= sp->back_ptr - 15;
+ }
+ av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
+ pos= find_startcode(&s->pb, SYNCPOINT_STARTCODE, pos2);
url_fseek(&s->pb, pos, SEEK_SET);
av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
- if(sp->back_ptr - 15 > pos || sp->back_ptr < pos){
+ if(pos2 > pos || pos2 + 15 < pos){
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
}
return 0;
More information about the ffmpeg-cvslog
mailing list