more fine grained discarding of packets

Originally committed as revision 4051 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2005-03-17 01:25:01 +00:00
parent cc973ecbe7
commit f3356e9c9e
11 changed files with 46 additions and 17 deletions
+7 -3
View File
@@ -1222,14 +1222,18 @@ av_log(s, AV_LOG_DEBUG, "fs:%lld fc:%d ft:%d kf:%d pts:%lld size:%d mul:%d lsb:%
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code, int frame_type, int64_t frame_start){
AVFormatContext *s= nut->avf;
ByteIOContext *bc = &s->pb;
int size, stream_id, key_frame;
int64_t pts;
int size, stream_id, key_frame, discard;
int64_t pts, last_IP_pts;
size= decode_frame_header(nut, &key_frame, &pts, &stream_id, frame_code, frame_type, frame_start);
if(size < 0)
return -1;
if(s->streams[ stream_id ]->discard){
discard= s->streams[ stream_id ]->discard;
last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
if( (discard >= AVDISCARD_NONKEY && !key_frame)
||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|| discard >= AVDISCARD_ALL){
url_fskip(bc, size);
return 1;
}