static int rtsp_read_packet(AVFormatContext *s,

                            AVPacket *pkt)

{

    RTSPState *rt = s->priv_data;

    RTSPStream *rtsp_st;

    int ret, len;

    uint8_t buf[RTP_MAX_PACKET_LENGTH];



    /* get next frames from the same RTP packet */

    if (rt->cur_rtp) {

        ret = rtp_parse_packet(rt->cur_rtp, pkt, NULL, 0);

        if (ret == 0) {

            rt->cur_rtp = NULL;

            return 0;

        } else if (ret == 1) {

            return 0;

        } else {

            rt->cur_rtp = NULL;

        }

    }



    /* read next RTP packet */

 redo:

    switch(rt->protocol) {

    default:

    case RTSP_PROTOCOL_RTP_TCP:

        len = tcp_read_packet(s, &rtsp_st, buf, sizeof(buf));

        break;

    case RTSP_PROTOCOL_RTP_UDP:

    case RTSP_PROTOCOL_RTP_UDP_MULTICAST:

        len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf));

        if (rtsp_st->rtp_ctx)

            rtp_check_and_send_back_rr(rtsp_st->rtp_ctx, len);

        break;

    }

    if (len < 0)

        return AVERROR_IO;

    ret = rtp_parse_packet(rtsp_st->rtp_ctx, pkt, buf, len);

    if (ret < 0)

        goto redo;

    if (ret == 1) {

        /* more packets may follow, so we save the RTP context */

        rt->cur_rtp = rtsp_st->rtp_ctx;

    }

    return 0;

}

static int rtsp_read_packet(AVFormatContext *s,

                            AVPacket *pkt)

{

    RTSPState *rt = s->priv_data;

    RTSPStream *rtsp_st;

    int ret, len;

    uint8_t buf[RTP_MAX_PACKET_LENGTH];



    

    if (rt->cur_rtp) {

        ret = rtp_parse_packet(rt->cur_rtp, pkt, NULL, 0);

        if (ret == 0) {

            rt->cur_rtp = NULL;

            return 0;

        } else if (ret == 1) {

            return 0;

        } else {

            rt->cur_rtp = NULL;

        }

    }



    

 redo:

    switch(rt->protocol) {

    default:

    case RTSP_PROTOCOL_RTP_TCP:

        len = tcp_read_packet(s, &rtsp_st, buf, sizeof(buf));

        break;

    case RTSP_PROTOCOL_RTP_UDP:

    case RTSP_PROTOCOL_RTP_UDP_MULTICAST:

        len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf));

        if (rtsp_st->rtp_ctx)

            rtp_check_and_send_back_rr(rtsp_st->rtp_ctx, len);

        break;

    }

    if (len < 0)

        return AVERROR_IO;

    ret = rtp_parse_packet(rtsp_st->rtp_ctx, pkt, buf, len);

    if (ret < 0)

        goto redo;

    if (ret == 1) {

        

        rt->cur_rtp = rtsp_st->rtp_ctx;

    }

    return 0;

}

        if (rtsp_st->rtp_ctx)
static int FUNC_0(AVFormatContext *VAR_0,

                            AVPacket *VAR_1)

{

    RTSPState *rt = VAR_0->priv_data;

    RTSPStream *rtsp_st;

    int VAR_2, VAR_3;

    uint8_t buf[RTP_MAX_PACKET_LENGTH];



    

    if (rt->cur_rtp) {

        VAR_2 = rtp_parse_packet(rt->cur_rtp, VAR_1, NULL, 0);

        if (VAR_2 == 0) {

            rt->cur_rtp = NULL;

            return 0;

        } else if (VAR_2 == 1) {

            return 0;

        } else {

            rt->cur_rtp = NULL;

        }

    }



    

 redo:

    switch(rt->protocol) {

    default:

    case RTSP_PROTOCOL_RTP_TCP:

        VAR_3 = tcp_read_packet(VAR_0, &rtsp_st, buf, sizeof(buf));

        break;

    case RTSP_PROTOCOL_RTP_UDP:

    case RTSP_PROTOCOL_RTP_UDP_MULTICAST:

        VAR_3 = udp_read_packet(VAR_0, &rtsp_st, buf, sizeof(buf));

        if (rtsp_st->rtp_ctx)

            rtp_check_and_send_back_rr(rtsp_st->rtp_ctx, VAR_3);

        break;

    }

    if (VAR_3 < 0)

        return AVERROR_IO;

    VAR_2 = rtp_parse_packet(rtsp_st->rtp_ctx, VAR_1, buf, VAR_3);

    if (VAR_2 < 0)

        goto redo;

    if (VAR_2 == 1) {

        

        rt->cur_rtp = rtsp_st->rtp_ctx;

    }

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{ RTSPState *rt = VAR_0->priv_data; RTSPStream *rtsp_st; int VAR_2, VAR_3; uint8_t buf[RTP_MAX_PACKET_LENGTH]; if (rt->cur_rtp) { VAR_2 = rtp_parse_packet(rt->cur_rtp, VAR_1, NULL, 0); if (VAR_2 == 0) { rt->cur_rtp = NULL; return 0; } else if (VAR_2 == 1) { return 0; } else { rt->cur_rtp = NULL; } } redo:
switch(rt->protocol) { default:
case RTSP_PROTOCOL_RTP_TCP:
VAR_3 = tcp_read_packet(VAR_0, &rtsp_st, buf, sizeof(buf)); break; case RTSP_PROTOCOL_RTP_UDP:
case RTSP_PROTOCOL_RTP_UDP_MULTICAST:
VAR_3 = udp_read_packet(VAR_0, &rtsp_st, buf, sizeof(buf)); if (rtsp_st->rtp_ctx)
rtp_check_and_send_back_rr(rtsp_st->rtp_ctx, VAR_3); break; } if (VAR_3 < 0)
return AVERROR_IO; VAR_2 = rtp_parse_packet(rtsp_st->rtp_ctx, VAR_1, buf, VAR_3); if (VAR_2 < 0)
goto redo; if (VAR_2 == 1) { rt->cur_rtp = rtsp_st->rtp_ctx; } return 0; }