get_buffer(rtsp_gb, buf, len);
ret = url_read(rt->rtsp_hd, buf, len); if (ret != len) return AVERROR_IO;
static int tcp_read_packet(AVFormatContext *s,                           AVPacket *pkt){    RTSPState *rt = s->priv_data;    ByteIOContext *rtsp_gb = &rt->rtsp_gb;    int c, id, len, i, ret;    AVStream *st;    RTSPStream *rtsp_st;    char buf[RTP_MAX_PACKET_LENGTH]; redo:    for(;;) {        c = url_fgetc(rtsp_gb);        if (c == URL_EOF)            return AVERROR_IO;        if (c == '$')            break;    }    id = get_byte(rtsp_gb);    len = get_be16(rtsp_gb);    if (len > RTP_MAX_PACKET_LENGTH || len < 12)        goto redo;    /* get the data */    get_buffer(rtsp_gb, buf, len);        /* find the matching stream */    for(i = 0; i < s->nb_streams; i++) {        st = s->streams[i];        rtsp_st = st->priv_data;        if (i >= rtsp_st->interleaved_min &&             i <= rtsp_st->interleaved_max)             goto found;    }    goto redo; found:    ret = rtp_parse_packet(rtsp_st->ic, pkt, buf, len);    if (ret < 0)        goto redo;    pkt->stream_index = i;    return ret;}