Logo Search packages:      
Sourcecode: blender version File versions  Download package

int av_write_trailer ( AVFormatContext *  s  ) 

Write the stream trailer to an output media file and free the file private data.

Parameters:
s media file handle
Returns:
0 if OK. AVERROR_xxx if error.

Definition at line 2549 of file utils.c.

References av_freep(), and av_interleave_packet().

{
    int ret, i;

    for(;;){
        AVPacket pkt;
        ret= av_interleave_packet(s, &pkt, NULL, 1);
        if(ret<0) //FIXME cleanup needed for ret<0 ?
            goto fail;
        if(!ret)
            break;

        truncate_ts(s->streams[pkt.stream_index], &pkt);
        ret= s->oformat->write_packet(s, &pkt);

        av_free_packet(&pkt);

        if(ret<0)
            goto fail;
        if(url_ferror(&s->pb))
            goto fail;
    }

    if(s->oformat->write_trailer)
        ret = s->oformat->write_trailer(s);
fail:
    if(ret == 0)
       ret=url_ferror(&s->pb);
    for(i=0;i<s->nb_streams;i++)
        av_freep(&s->streams[i]->priv_data);
    av_freep(&s->priv_data);
    return ret;
}


Generated by  Doxygen 1.6.0   Back to index