MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_frame

Function decode_frame

libavformat/nutdec.c:724–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722}
723
724static 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
764static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
765{

Callers 1

nut_read_packetFunction · 0.70

Calls 5

url_fskipFunction · 0.85
av_new_packetFunction · 0.85
url_ftellFunction · 0.85
get_bufferFunction · 0.85
decode_frame_headerFunction · 0.70

Tested by

no test coverage detected