fprintf(stderr, "ogg_write_header\n") ;
static int ogg_write_header(AVFormatContext *avfcontext) {    OggContext *context ;    AVCodecContext *avccontext ;    vorbis_info vi ;    vorbis_dsp_state vd ;    vorbis_comment vc ;    vorbis_block vb ;    ogg_packet header, header_comm, header_code ;     int n ;        fprintf(stderr, "ogg_write_header\n") ;        if(!(context = malloc(sizeof(OggContext))))	return -1 ;    avfcontext->priv_data = context ;        srand(time(NULL));    ogg_stream_init(&context->os, rand());        for(n = 0 ; n < avfcontext->nb_streams ; n++) {	avccontext = &avfcontext->streams[n]->codec ;	/* begin vorbis specific code */			vorbis_info_init(&vi) ;	/* code copied from libavcodec/oggvorbis.c */	if(oggvorbis_init_encoder(&vi, avccontext) < 0) {	    fprintf(stderr, "ogg_write_header: init_encoder failed") ;	    return -1 ;	}	vorbis_analysis_init(&vd, &vi) ;	vorbis_block_init(&vd, &vb) ;		vorbis_comment_init(&vc) ;	vorbis_comment_add_tag(&vc, "encoder", "ffmpeg") ;	if(*avfcontext->title)	    vorbis_comment_add_tag(&vc, "title", avfcontext->title) ;	vorbis_analysis_headerout(&vd, &vc, &header,				  &header_comm, &header_code) ;	ogg_stream_packetin(&context->os, &header) ;	ogg_stream_packetin(&context->os, &header_comm) ;	ogg_stream_packetin(&context->os, &header_code) ;  		vorbis_comment_clear(&vc) ;	/* end of vorbis specific code */	context->header_written = 0 ;	context->base_packet_no = 0 ;    }        return 0 ;}