static int mpegts_write_end(AVFormatContext *s)

{

    MpegTSWrite *ts = s->priv_data;

    MpegTSWriteStream *ts_st;

    MpegTSService *service;

    AVStream *st;

    int i;



    /* flush current packets */

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

        st = s->streams[i];

        ts_st = st->priv_data;

        if (ts_st->payload_index > 0) {

            mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,

                             ts_st->payload_pts);

        }

    }

    put_flush_packet(&s->pb);

        

    for(i = 0; i < ts->nb_services; i++) {

        service = ts->services[i];

        av_freep(&service->provider_name);

        av_freep(&service->name);

        av_free(service);

    }

    av_free(ts->services);



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

        st = s->streams[i];

        av_free(st->priv_data);

    }

    return 0;

}

static int mpegts_write_end(AVFormatContext *s)

{

    MpegTSWrite *ts = s->priv_data;

    MpegTSWriteStream *ts_st;

    MpegTSService *service;

    AVStream *st;

    int i;



    

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

        st = s->streams[i];

        ts_st = st->priv_data;

        if (ts_st->payload_index > 0) {

            mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,

                             ts_st->payload_pts);

        }

    }

    put_flush_packet(&s->pb);

        

    for(i = 0; i < ts->nb_services; i++) {

        service = ts->services[i];

        av_freep(&service->provider_name);

        av_freep(&service->name);

        av_free(service);

    }

    av_free(ts->services);



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

        st = s->streams[i];

        av_free(st->priv_data);

    }

    return 0;

}

    for(i = 0; i < s->nb_streams; i++) {         st = s->streams[i];         av_free(st->priv_data);
static int FUNC_0(AVFormatContext *VAR_0)

{

    MpegTSWrite *ts = VAR_0->priv_data;

    MpegTSWriteStream *ts_st;

    MpegTSService *service;

    AVStream *st;

    int VAR_1;



    

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

        st = VAR_0->streams[VAR_1];

        ts_st = st->priv_data;

        if (ts_st->payload_index > 0) {

            mpegts_write_pes(VAR_0, st, ts_st->payload, ts_st->payload_index,

                             ts_st->payload_pts);

        }

    }

    put_flush_packet(&VAR_0->pb);

        

    for(VAR_1 = 0; VAR_1 < ts->nb_services; VAR_1++) {

        service = ts->services[VAR_1];

        av_freep(&service->provider_name);

        av_freep(&service->name);

        av_free(service);

    }

    av_free(ts->services);



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

        st = VAR_0->streams[VAR_1];

        av_free(st->priv_data);

    }

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ MpegTSWrite *ts = VAR_0->priv_data; MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st; int VAR_1; for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { st = VAR_0->streams[VAR_1]; ts_st = st->priv_data; if (ts_st->payload_index > 0) { mpegts_write_pes(VAR_0, st, ts_st->payload, ts_st->payload_index,
ts_st->payload_pts); } } put_flush_packet(&VAR_0->pb); for(VAR_1 = 0; VAR_1 < ts->nb_services; VAR_1++) { service = ts->services[VAR_1]; av_freep(&service->provider_name); av_freep(&service->name); av_free(service); } av_free(ts->services); for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { st = VAR_0->streams[VAR_1]; av_free(st->priv_data); } return 0; }