if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {  delta_timestamp = timestamp - s->last_rtcp_timestamp;  pkt->pts = s->last_rtcp_ntp_time + delta_timestamp;
switch(st->codec.codec_id) { case CODEC_ID_MP2: case CODEC_ID_MPEG1VIDEO: if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) { int64_t addend;   delta_timestamp = timestamp - s->last_rtcp_timestamp;  addend = (s->last_rtcp_ntp_time - s->first_rtcp_ntp_time) >> 14; addend = (addend * 5625) >> 14; pkt->pts = addend + delta_timestamp; } break; default:  break;
int rtp_parse_packet(AVFormatContext *s1, AVPacket *pkt,                      const unsigned char *buf, int len){    RTPContext *s = s1->priv_data;    unsigned int ssrc, h;    int payload_type, seq, delta_timestamp;    AVStream *st;    uint32_t timestamp;        if (len < 12)        return -1;    if ((buf[0] & 0xc0) != (RTP_VERSION << 6))        return -1;    if (buf[1] >= 200 && buf[1] <= 204) {        rtcp_parse_packet(s1, buf, len);        return -1;    }    payload_type = buf[1] & 0x7f;    seq  = (buf[2] << 8) | buf[3];    timestamp = decode_be32(buf + 4);    ssrc = decode_be32(buf + 8);        if (s->payload_type < 0) {        s->payload_type = payload_type;                if (payload_type == RTP_PT_MPEG2TS) {            /* XXX: special case : not a single codec but a whole stream */            return -1;        } else {            st = av_new_stream(s1, 0);            if (!st)                return -1;            rtp_get_codec_info(&st->codec, payload_type);        }    }    /* NOTE: we can handle only one payload type */    if (s->payload_type != payload_type)        return -1;#if defined(DEBUG) || 1    if (seq != ((s->seq + 1) & 0xffff)) {        printf("RTP: PT=%02x: bad cseq %04x expected=%04x\n",                payload_type, seq, ((s->seq + 1) & 0xffff));    }    s->seq = seq;#endif    len -= 12;    buf += 12;    st = s1->streams[0];    switch(st->codec.codec_id) {    case CODEC_ID_MP2:        /* better than nothing: skip mpeg audio RTP header */        if (len <= 4)            return -1;        h = decode_be32(buf);        len -= 4;        buf += 4;        av_new_packet(pkt, len);        memcpy(pkt->data, buf, len);        break;    case CODEC_ID_MPEG1VIDEO:        /* better than nothing: skip mpeg audio RTP header */        if (len <= 4)            return -1;        h = decode_be32(buf);        buf += 4;        len -= 4;        if (h & (1 << 26)) {            /* mpeg2 */            if (len <= 4)                return -1;            buf += 4;            len -= 4;        }        av_new_packet(pkt, len);        memcpy(pkt->data, buf, len);        break;    default:        av_new_packet(pkt, len);        memcpy(pkt->data, buf, len);        break;    }    if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {        /* compute pts from timestamp with received ntp_time */        delta_timestamp = timestamp - s->last_rtcp_timestamp;        /* XXX: do conversion, but not needed for mpeg at 90 KhZ */        pkt->pts = s->last_rtcp_ntp_time + delta_timestamp;    }    return 0;}