static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){

    AVFormatContext *s= nut->avf;

    ByteIOContext *bc = &s->pb;

    int size, stream_id, flags, discard;

    int64_t pts, last_IP_pts;



    size= decode_frame_header(nut, &flags, &pts, &stream_id, frame_code);

    if(size < 0)

        return -1;



    if (flags & FLAG_KEY)

        nut->stream[stream_id].skip_until_key_frame=0;



    discard= s->streams[ stream_id ]->discard;

    last_IP_pts= s->streams[ stream_id ]->last_IP_pts;

    if(  (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))

       ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)

       || discard >= AVDISCARD_ALL

       || nut->stream[stream_id].skip_until_key_frame){

        url_fskip(bc, size);

        return 1;

    }



    av_get_packet(bc, pkt, size);

    pkt->stream_index = stream_id;

    if (flags & FLAG_KEY)

        pkt->flags |= PKT_FLAG_KEY;

    pkt->pts = pts;



    return 0;

}

static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){

    AVFormatContext *s= nut->avf;

    ByteIOContext *bc = &s->pb;

    int size, stream_id, flags, discard;

    int64_t pts, last_IP_pts;



    size= decode_frame_header(nut, &flags, &pts, &stream_id, frame_code);

    if(size < 0)

        return -1;



    if (flags & FLAG_KEY)

        nut->stream[stream_id].skip_until_key_frame=0;



    discard= s->streams[ stream_id ]->discard;

    last_IP_pts= s->streams[ stream_id ]->last_IP_pts;

    if(  (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))

       ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)

       || discard >= AVDISCARD_ALL

       || nut->stream[stream_id].skip_until_key_frame){

        url_fskip(bc, size);

        return 1;

    }



    av_get_packet(bc, pkt, size);

    pkt->stream_index = stream_id;

    if (flags & FLAG_KEY)

        pkt->flags |= PKT_FLAG_KEY;

    pkt->pts = pts;



    return 0;

}

static int FUNC_0(NUTContext *VAR_0, AVPacket *VAR_1, int VAR_2){

    AVFormatContext *s= VAR_0->avf;

    ByteIOContext *bc = &s->pb;

    int VAR_3, VAR_4, VAR_5, VAR_6;

    int64_t pts, last_IP_pts;



    VAR_3= decode_frame_header(VAR_0, &VAR_5, &pts, &VAR_4, VAR_2);

    if(VAR_3 < 0)

        return -1;



    if (VAR_5 & FLAG_KEY)

        VAR_0->stream[VAR_4].skip_until_key_frame=0;



    VAR_6= s->streams[ VAR_4 ]->VAR_6;

    last_IP_pts= s->streams[ VAR_4 ]->last_IP_pts;

    if(  (VAR_6 >= AVDISCARD_NONKEY && !(VAR_5 & FLAG_KEY))

       ||(VAR_6 >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)

       || VAR_6 >= AVDISCARD_ALL

       || VAR_0->stream[VAR_4].skip_until_key_frame){

        url_fskip(bc, VAR_3);

        return 1;

    }



    av_get_packet(bc, VAR_1, VAR_3);

    VAR_1->stream_index = VAR_4;

    if (VAR_5 & FLAG_KEY)

        VAR_1->VAR_5 |= PKT_FLAG_KEY;

    VAR_1->pts = pts;



    return 0;

}

static int FUNC_0(NUTContext *VAR_0, AVPacket *VAR_1, int VAR_2){ AVFormatContext *s= VAR_0->avf; ByteIOContext *bc = &s->pb; int VAR_3, VAR_4, VAR_5, VAR_6; int64_t pts, last_IP_pts; VAR_3= decode_frame_header(VAR_0, &VAR_5, &pts, &VAR_4, VAR_2); if(VAR_3 < 0)
return -1; if (VAR_5 & FLAG_KEY)
VAR_0->stream[VAR_4].skip_until_key_frame=0; VAR_6= s->streams[ VAR_4 ]->VAR_6; last_IP_pts= s->streams[ VAR_4 ]->last_IP_pts; if(  (VAR_6 >= AVDISCARD_NONKEY && !(VAR_5 & FLAG_KEY))
||(VAR_6 >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|| VAR_6 >= AVDISCARD_ALL
|| VAR_0->stream[VAR_4].skip_until_key_frame){ url_fskip(bc, VAR_3); return 1; } av_get_packet(bc, VAR_1, VAR_3); VAR_1->stream_index = VAR_4; if (VAR_5 & FLAG_KEY)
VAR_1->VAR_5 |= PKT_FLAG_KEY; VAR_1->pts = pts; return 0; }