mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
skip non keyframes after seeking between syncpoint and the first keyframe
Originally committed as revision 7099 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
c873bc17bf
commit
0a3b575bc7
@ -704,11 +704,15 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
|
|||||||
if(size < 0)
|
if(size < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (flags & FLAG_KEY)
|
||||||
|
nut->stream[stream_id].skip_until_key_frame=0;
|
||||||
|
|
||||||
discard= s->streams[ stream_id ]->discard;
|
discard= s->streams[ stream_id ]->discard;
|
||||||
last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
|
last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
|
||||||
if( (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))
|
if( (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))
|
||||||
||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|
||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|
||||||
|| discard >= AVDISCARD_ALL){
|
|| discard >= AVDISCARD_ALL
|
||||||
|
|| nut->stream[stream_id].skip_until_key_frame){
|
||||||
url_fskip(bc, size);
|
url_fskip(bc, size);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -813,6 +817,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
|
|||||||
syncpoint_t nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE};
|
syncpoint_t nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE};
|
||||||
syncpoint_t *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
|
syncpoint_t *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
|
||||||
int64_t pos, pos2, ts;
|
int64_t pos, pos2, ts;
|
||||||
|
int i;
|
||||||
|
|
||||||
if(st->index_entries){
|
if(st->index_entries){
|
||||||
int index= av_index_search_timestamp(st, pts, flags);
|
int index= av_index_search_timestamp(st, pts, flags);
|
||||||
@ -851,6 +856,9 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
|
|||||||
if(pos2 > pos || pos2 + 15 < pos){
|
if(pos2 > pos || pos2 + 15 < pos){
|
||||||
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
|
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
|
||||||
}
|
}
|
||||||
|
for(i=0; i<s->nb_streams; i++)
|
||||||
|
nut->stream[i].skip_until_key_frame=1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user