comparison nut.c @ 708:d79164865a7c libavformat

more fine grained discarding of packets
author michael
date Thu, 17 Mar 2005 01:25:01 +0000
parents 2f5f4578a076
children ee513d354673
comparison
equal deleted inserted replaced
707:cc612862d461 708:d79164865a7c
1220 } 1220 }
1221 1221
1222 static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code, int frame_type, int64_t frame_start){ 1222 static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code, int frame_type, int64_t frame_start){
1223 AVFormatContext *s= nut->avf; 1223 AVFormatContext *s= nut->avf;
1224 ByteIOContext *bc = &s->pb; 1224 ByteIOContext *bc = &s->pb;
1225 int size, stream_id, key_frame; 1225 int size, stream_id, key_frame, discard;
1226 int64_t pts; 1226 int64_t pts, last_IP_pts;
1227 1227
1228 size= decode_frame_header(nut, &key_frame, &pts, &stream_id, frame_code, frame_type, frame_start); 1228 size= decode_frame_header(nut, &key_frame, &pts, &stream_id, frame_code, frame_type, frame_start);
1229 if(size < 0) 1229 if(size < 0)
1230 return -1; 1230 return -1;
1231 1231
1232 if(s->streams[ stream_id ]->discard){ 1232 discard= s->streams[ stream_id ]->discard;
1233 last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
1234 if( (discard >= AVDISCARD_NONKEY && !key_frame)
1235 ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
1236 || discard >= AVDISCARD_ALL){
1233 url_fskip(bc, size); 1237 url_fskip(bc, size);
1234 return 1; 1238 return 1;
1235 } 1239 }
1236 1240
1237 av_new_packet(pkt, size); 1241 av_new_packet(pkt, size);