static int mpeg_mux_end(AVFormatContext *ctx)

{

    StreamInfo *stream;

    int i;



    /* flush each packet */

    for(i=0;i<ctx->nb_streams;i++) {

        stream = ctx->streams[i]->priv_data;

        if (stream->buffer_ptr > 0) {

            if (i == (ctx->nb_streams - 1)) 

                flush_packet(ctx, i, 1);

            else

                flush_packet(ctx, i, 0);

        }

    }



    /* write the end header */

    //put_be32(&ctx->pb, ISO_11172_END_CODE);

    //put_flush_packet(&ctx->pb);



    for(i=0;i<ctx->nb_streams;i++)

        av_freep(&ctx->streams[i]->priv_data);



    return 0;

}

static int mpeg_mux_end(AVFormatContext *ctx)

{

    StreamInfo *stream;

    int i;



    

    for(i=0;i<ctx->nb_streams;i++) {

        stream = ctx->streams[i]->priv_data;

        if (stream->buffer_ptr > 0) {

            if (i == (ctx->nb_streams - 1)) 

                flush_packet(ctx, i, 1);

            else

                flush_packet(ctx, i, 0);

        }

    }



    

    

    



    for(i=0;i<ctx->nb_streams;i++)

        av_freep(&ctx->streams[i]->priv_data);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)

{

    StreamInfo *stream;

    int VAR_1;



    

    for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) {

        stream = VAR_0->streams[VAR_1]->priv_data;

        if (stream->buffer_ptr > 0) {

            if (VAR_1 == (VAR_0->nb_streams - 1)) 

                flush_packet(VAR_0, VAR_1, 1);

            else

                flush_packet(VAR_0, VAR_1, 0);

        }

    }



    

    

    



    for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++)

        av_freep(&VAR_0->streams[VAR_1]->priv_data);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ StreamInfo *stream; int VAR_1; for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) { stream = VAR_0->streams[VAR_1]->priv_data; if (stream->buffer_ptr > 0) { if (VAR_1 == (VAR_0->nb_streams - 1))
flush_packet(VAR_0, VAR_1, 1); else
flush_packet(VAR_0, VAR_1, 0); } } for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) av_freep(&VAR_0->streams[VAR_1]->priv_data); return 0; }