gif_image_write_header(pb, width, height, NULL);
gif_image_write_header(pb, width, height, loop_count, NULL);
static int gif_write_header(AVFormatContext *s){    GIFContext *gif = s->priv_data;    ByteIOContext *pb = &s->pb;    AVCodecContext *enc, *video_enc;    int i, width, height/*, rate*/;/* XXX: do we reject audio streams or just ignore them ?    if(s->nb_streams > 1)        return -1;*/    gif->time = 0;    gif->file_time = 0;    video_enc = NULL;    for(i=0;i<s->nb_streams;i++) {        enc = &s->streams[i]->codec;        if (enc->codec_type != CODEC_TYPE_AUDIO)            video_enc = enc;    }    if (!video_enc) {        av_free(gif);        return -1;    } else {        width = video_enc->width;        height = video_enc->height;//        rate = video_enc->time_base.den;    }    /* XXX: is it allowed ? seems to work so far... */    video_enc->pix_fmt = PIX_FMT_RGB24;    gif_image_write_header(pb, width, height, NULL);    put_flush_packet(&s->pb);    return 0;}