| 722 | } |
| 723 | |
| 724 | static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ |
| 725 | AVFormatContext *s= nut->avf; |
| 726 | ByteIOContext *bc = s->pb; |
| 727 | int size, stream_id, discard; |
| 728 | int64_t pts, last_IP_pts; |
| 729 | StreamContext *stc; |
| 730 | uint8_t header_idx; |
| 731 | |
| 732 | size= decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code); |
| 733 | if(size < 0) |
| 734 | return -1; |
| 735 | |
| 736 | stc= &nut->stream[stream_id]; |
| 737 | |
| 738 | if (stc->last_flags & FLAG_KEY) |
| 739 | stc->skip_until_key_frame=0; |
| 740 | |
| 741 | discard= s->streams[ stream_id ]->discard; |
| 742 | last_IP_pts= s->streams[ stream_id ]->last_IP_pts; |
| 743 | if( (discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) |
| 744 | ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) |
| 745 | || discard >= AVDISCARD_ALL |
| 746 | || stc->skip_until_key_frame){ |
| 747 | url_fskip(bc, size); |
| 748 | return 1; |
| 749 | } |
| 750 | |
| 751 | av_new_packet(pkt, size + nut->header_len[header_idx]); |
| 752 | memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); |
| 753 | pkt->pos= url_ftell(bc); //FIXME |
| 754 | get_buffer(bc, pkt->data + nut->header_len[header_idx], size); |
| 755 | |
| 756 | pkt->stream_index = stream_id; |
| 757 | if (stc->last_flags & FLAG_KEY) |
| 758 | pkt->flags |= AV_PKT_FLAG_KEY; |
| 759 | pkt->pts = pts; |
| 760 | |
| 761 | return 0; |
| 762 | } |
| 763 | |
| 764 | static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 765 | { |
no test coverage detected