int av_write_trailer(AVFormatContext *s)

{

    int ret;

    

    while(s->packet_buffer){

        int ret;

        AVPacketList *pktl= s->packet_buffer;



//av_log(s, AV_LOG_DEBUG, "write_trailer st:%d dts:%lld\n", pktl->pkt.stream_index, pktl->pkt.dts);

        truncate_ts(s->streams[pktl->pkt.stream_index], &pktl->pkt);

        ret= s->oformat->write_packet(s, &pktl->pkt);

        

        s->packet_buffer= pktl->next;        



        av_free_packet(&pktl->pkt);

        av_freep(&pktl);

        

        if(ret<0)

            return ret;

    }



    ret = s->oformat->write_trailer(s);

    av_freep(&s->priv_data);

    return ret;

}

int av_write_trailer(AVFormatContext *s)

{

    int ret;

    

    while(s->packet_buffer){

        int ret;

        AVPacketList *pktl= s->packet_buffer;





        truncate_ts(s->streams[pktl->pkt.stream_index], &pktl->pkt);

        ret= s->oformat->write_packet(s, &pktl->pkt);

        

        s->packet_buffer= pktl->next;        



        av_free_packet(&pktl->pkt);

        av_freep(&pktl);

        

        if(ret<0)

            return ret;

    }



    ret = s->oformat->write_trailer(s);

    av_freep(&s->priv_data);

    return ret;

}

int FUNC_0(AVFormatContext *VAR_0)

{

    int VAR_2;

    

    while(VAR_0->packet_buffer){

        int VAR_2;

        AVPacketList *pktl= VAR_0->packet_buffer;





        truncate_ts(VAR_0->streams[pktl->pkt.stream_index], &pktl->pkt);

        VAR_2= VAR_0->oformat->write_packet(VAR_0, &pktl->pkt);

        

        VAR_0->packet_buffer= pktl->next;        



        av_free_packet(&pktl->pkt);

        av_freep(&pktl);

        

        if(VAR_2<0)

            return VAR_2;

    }



    VAR_2 = VAR_0->oformat->write_trailer(VAR_0);

    av_freep(&VAR_0->priv_data);

    return VAR_2;

}

int FUNC_0(AVFormatContext *VAR_0)
{ int VAR_2; while(VAR_0->packet_buffer){ int VAR_2; AVPacketList *pktl= VAR_0->packet_buffer; truncate_ts(VAR_0->streams[pktl->pkt.stream_index], &pktl->pkt); VAR_2= VAR_0->oformat->write_packet(VAR_0, &pktl->pkt); VAR_0->packet_buffer= pktl->next; av_free_packet(&pktl->pkt); av_freep(&pktl); if(VAR_2<0)
return VAR_2; } VAR_2 = VAR_0->oformat->write_trailer(VAR_0); av_freep(&VAR_0->priv_data); return VAR_2; }