static int ogg_restore(AVFormatContext *s, int discard)

{

    struct ogg *ogg = s->priv_data;

    AVIOContext *bc = s->pb;

    struct ogg_state *ost = ogg->state;

    int i;



    if (!ost)

        return 0;



    ogg->state = ost->next;



    if (!discard){

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

            av_free (ogg->streams[i].buf);



        avio_seek (bc, ost->pos, SEEK_SET);

        ogg->curidx = ost->curidx;

        ogg->nstreams = ost->nstreams;

        memcpy(ogg->streams, ost->streams,

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

    }



    av_free (ost);



    return 0;

}

static int ogg_restore(AVFormatContext *s, int discard)

{

    struct ogg *ogg = s->priv_data;

    AVIOContext *bc = s->pb;

    struct ogg_state *ost = ogg->state;

    int i;



    if (!ost)

        return 0;



    ogg->state = ost->next;



    if (!discard){

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

            av_free (ogg->streams[i].buf);



        avio_seek (bc, ost->pos, SEEK_SET);

        ogg->curidx = ost->curidx;

        ogg->nstreams = ost->nstreams;

        memcpy(ogg->streams, ost->streams,

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

    }



    av_free (ost);



    return 0;

}

        memcpy(ogg->streams, ost->streams,                ost->nstreams * sizeof(*ogg->streams));
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)

{

    struct VAR_2 *VAR_2 = VAR_0->priv_data;

    AVIOContext *bc = VAR_0->pb;

    struct ogg_state *VAR_3 = VAR_2->state;

    int VAR_4;



    if (!VAR_3)

        return 0;



    VAR_2->state = VAR_3->next;



    if (!VAR_1){

        for (VAR_4 = 0; VAR_4 < VAR_2->nstreams; VAR_4++)

            av_free (VAR_2->streams[VAR_4].buf);



        avio_seek (bc, VAR_3->pos, SEEK_SET);

        VAR_2->curidx = VAR_3->curidx;

        VAR_2->nstreams = VAR_3->nstreams;

        memcpy(VAR_2->streams, VAR_3->streams,

               VAR_3->nstreams * sizeof(*VAR_2->streams));

    }



    av_free (VAR_3);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{ struct VAR_2 *VAR_2 = VAR_0->priv_data; AVIOContext *bc = VAR_0->pb; struct ogg_state *VAR_3 = VAR_2->state; int VAR_4; if (!VAR_3)
return 0; VAR_2->state = VAR_3->next; if (!VAR_1){ for (VAR_4 = 0; VAR_4 < VAR_2->nstreams; VAR_4++) av_free (VAR_2->streams[VAR_4].buf); avio_seek (bc, VAR_3->pos, SEEK_SET); VAR_2->curidx = VAR_3->curidx; VAR_2->nstreams = VAR_3->nstreams; memcpy(VAR_2->streams, VAR_3->streams,
VAR_3->nstreams * sizeof(*VAR_2->streams)); } av_free (VAR_3); return 0; }