UINT8 *buf, int size)
UINT8 *buf, int size, int force_pts)
static int avi_write_packet(AVFormatContext *s, int stream_index,                            UINT8 *buf, int size){    AVIContext *avi = s->priv_data;    ByteIOContext *pb = &s->pb;    AVIIndex *idx;    unsigned char tag[5];    unsigned int flags;    AVCodecContext *enc;        enc = &s->streams[stream_index]->codec;    tag[0] = '0';    tag[1] = '0' + stream_index;    if (enc->codec_type == CODEC_TYPE_VIDEO) {        tag[2] = 'd';        tag[3] = 'c';        flags = enc->key_frame ? 0x10 : 0x00;    } else {        tag[2] = 'w';        tag[3] = 'b';        flags = 0x10;    }    if (enc->codec_type == CODEC_TYPE_AUDIO)        avi->audio_strm_length[stream_index] += size;    if (!url_is_streamed(&s->pb)) {        idx = malloc(sizeof(AVIIndex));        memcpy(idx->tag, tag, 4);        idx->flags = flags;        idx->pos = url_ftell(pb) - avi->movi_list;        idx->len = size;        idx->next = NULL;        if (!avi->last)            avi->first = idx;        else            avi->last->next = idx;        avi->last = idx;    }        put_buffer(pb, tag, 4);    put_le32(pb, size);    put_buffer(pb, buf, size);    if (size & 1)        put_byte(pb, 0);    put_flush_packet(pb);    return 0;}