static int ogg_save(AVFormatContext *s)

{

    struct ogg *ogg = s->priv_data;

    struct ogg_state *ost =

        av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));

    int i;

    ost->pos = avio_tell (s->pb);

    ost->curidx = ogg->curidx;

    ost->next = ogg->state;

    ost->nstreams = ogg->nstreams;

    memcpy(ost->streams, ogg->streams, ogg->nstreams * sizeof(*ogg->streams));



    for (i = 0; i < ogg->nstreams; i++){

        struct ogg_stream *os = ogg->streams + i;

        os->buf = av_malloc (os->bufsize);

        memset (os->buf, 0, os->bufsize);

        memcpy (os->buf, ost->streams[i].buf, os->bufpos);

    }



    ogg->state = ost;



    return 0;

}

static int ogg_save(AVFormatContext *s)

{

    struct ogg *ogg = s->priv_data;

    struct ogg_state *ost =

        av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));

    int i;

    ost->pos = avio_tell (s->pb);

    ost->curidx = ogg->curidx;

    ost->next = ogg->state;

    ost->nstreams = ogg->nstreams;

    memcpy(ost->streams, ogg->streams, ogg->nstreams * sizeof(*ogg->streams));



    for (i = 0; i < ogg->nstreams; i++){

        struct ogg_stream *os = ogg->streams + i;

        os->buf = av_malloc (os->bufsize);

        memset (os->buf, 0, os->bufsize);

        memcpy (os->buf, ost->streams[i].buf, os->bufpos);

    }



    ogg->state = ost;



    return 0;

}

        os->buf = av_malloc (os->bufsize);         memset (os->buf, 0, os->bufsize);
static int FUNC_0(AVFormatContext *VAR_0)

{

    struct VAR_1 *VAR_1 = VAR_0->priv_data;

    struct ogg_state *VAR_2 =

        av_malloc(sizeof (*VAR_2) + (VAR_1->nstreams-1) * sizeof (*VAR_1->streams));

    int VAR_3;

    VAR_2->pos = avio_tell (VAR_0->pb);

    VAR_2->curidx = VAR_1->curidx;

    VAR_2->next = VAR_1->state;

    VAR_2->nstreams = VAR_1->nstreams;

    memcpy(VAR_2->streams, VAR_1->streams, VAR_1->nstreams * sizeof(*VAR_1->streams));



    for (VAR_3 = 0; VAR_3 < VAR_1->nstreams; VAR_3++){

        struct ogg_stream *VAR_4 = VAR_1->streams + VAR_3;

        VAR_4->buf = av_malloc (VAR_4->bufsize);

        memset (VAR_4->buf, 0, VAR_4->bufsize);

        memcpy (VAR_4->buf, VAR_2->streams[VAR_3].buf, VAR_4->bufpos);

    }



    VAR_1->state = VAR_2;



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ struct VAR_1 *VAR_1 = VAR_0->priv_data; struct ogg_state *VAR_2 =
av_malloc(sizeof (*VAR_2) + (VAR_1->nstreams-1) * sizeof (*VAR_1->streams)); int VAR_3; VAR_2->pos = avio_tell (VAR_0->pb); VAR_2->curidx = VAR_1->curidx; VAR_2->next = VAR_1->state; VAR_2->nstreams = VAR_1->nstreams; memcpy(VAR_2->streams, VAR_1->streams, VAR_1->nstreams * sizeof(*VAR_1->streams)); for (VAR_3 = 0; VAR_3 < VAR_1->nstreams; VAR_3++){ struct ogg_stream *VAR_4 = VAR_1->streams + VAR_3; VAR_4->buf = av_malloc (VAR_4->bufsize); memset (VAR_4->buf, 0, VAR_4->bufsize); memcpy (VAR_4->buf, VAR_2->streams[VAR_3].buf, VAR_4->bufpos); } VAR_1->state = VAR_2; return 0; }