AVStream *st = s->streams[stream_index];
AVStream *st = s->streams[pkt->stream_index]; int size= pkt->size; uint8_t *buf= pkt->data;
static int mpegts_write_packet(AVFormatContext *s, int stream_index,                               const uint8_t *buf, int size, int64_t pts1){    AVStream *st = s->streams[stream_index];    MpegTSWriteStream *ts_st = st->priv_data;    int len;    while (size > 0) {        len = DEFAULT_PES_PAYLOAD_SIZE - ts_st->payload_index;        if (len > size)            len = size;        memcpy(ts_st->payload + ts_st->payload_index, buf, len);        buf += len;        size -= len;        ts_st->payload_index += len;        if (ts_st->payload_pts == AV_NOPTS_VALUE)            ts_st->payload_pts = pts1;        if (ts_st->payload_index >= DEFAULT_PES_PAYLOAD_SIZE) {            mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,                             ts_st->payload_pts);            ts_st->payload_pts = AV_NOPTS_VALUE;            ts_st->payload_index = 0;        }    }    return 0;}