st->codec = avcodec_alloc_context(); memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
static int read_ffserver_streams(AVFormatContext *s, const char *filename){    int i, err;    AVFormatContext *ic;    err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL);    if (err < 0)        return err;    /* copy stream format */    s->nb_streams = ic->nb_streams;    for(i=0;i<ic->nb_streams;i++) {        AVStream *st;        st = av_mallocz(sizeof(AVStream));        memcpy(st, ic->streams[i], sizeof(AVStream));        s->streams[i] = st;    }    av_close_input_file(ic);    return 0;}