1 /*****************************************************************************
2 * vorbis.c: vorbis decoder/encoder/packetizer module making use of libvorbis.
3 *****************************************************************************
4 * Copyright (C) 2001-2003 VideoLAN
7 * Authors: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
28 #include <vlc/decoder.h>
29 #include <vlc/input.h>
34 #ifdef MODULE_NAME_IS_tremor
35 #include <tremor/ivorbiscodec.h>
38 #include <vorbis/codec.h>
41 #ifdef HAVE_VORBIS_VORBISENC_H
42 # include <vorbis/vorbisenc.h>
43 # ifndef OV_ECTL_RATEMANAGE_AVG
44 # define OV_ECTL_RATEMANAGE_AVG 0x0
50 /*****************************************************************************
51 * decoder_sys_t : vorbis decoder descriptor
52 *****************************************************************************/
56 vlc_bool_t b_packetizer;
66 vorbis_info vi; /* struct that stores all the static vorbis bitstream
68 vorbis_comment vc; /* struct that stores all the bitstream user
70 vorbis_dsp_state vd; /* central working state for the packet->PCM
72 vorbis_block vb; /* local working space for packet->PCM decode */
77 audio_date_t end_date;
78 int i_last_block_size;
82 static int pi_channels_maps[7] =
86 AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
87 AOUT_CHAN_CENTER | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
88 AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT
89 | AOUT_CHAN_REARRIGHT,
90 AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
91 | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
92 AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
93 | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE
96 /****************************************************************************
98 ****************************************************************************/
99 static int OpenDecoder ( vlc_object_t * );
100 static int OpenPacketizer( vlc_object_t * );
101 static void CloseDecoder ( vlc_object_t * );
102 static void *DecodeBlock ( decoder_t *, block_t ** );
104 static void *ProcessPacket ( decoder_t *, ogg_packet *, block_t ** );
106 static aout_buffer_t *DecodePacket ( decoder_t *, ogg_packet * );
107 static block_t *SendPacket( decoder_t *, ogg_packet *, block_t * );
109 static void ParseVorbisComments( decoder_t * );
111 #ifdef MODULE_NAME_IS_tremor
112 static void Interleave ( int32_t *, const int32_t **, int, int );
114 static void Interleave ( float *, const float **, int, int );
117 #ifndef MODULE_NAME_IS_tremor
118 static int OpenEncoder ( vlc_object_t * );
119 static void CloseEncoder ( vlc_object_t * );
120 static block_t *Headers ( encoder_t * );
121 static block_t *Encode ( encoder_t *, aout_buffer_t * );
124 /*****************************************************************************
126 *****************************************************************************/
127 #define ENC_QUALITY_TEXT N_("Encoding quality")
128 #define ENC_QUALITY_LONGTEXT N_( \
129 "Allows you to specify a quality between 1 (low) and 10 (high), instead " \
130 "of specifying a particular bitrate. This will produce a VBR stream." )
131 #define ENC_MAXBR_TEXT N_("Maximum encoding bitrate")
132 #define ENC_MAXBR_LONGTEXT N_( \
133 "Allows you to specify a maximum bitrate in kbps. " \
134 "Useful for streaming applications." )
135 #define ENC_MINBR_TEXT N_("Minimum encoding bitrate")
136 #define ENC_MINBR_LONGTEXT N_( \
137 "Allows you to specify a minimum bitrate in kbps. " \
138 "Useful for encoding for a fixed-size channel." )
142 set_description( _("Vorbis audio decoder") );
143 #ifdef MODULE_NAME_IS_tremor
144 set_capability( "decoder", 90 );
146 set_capability( "decoder", 100 );
148 set_callbacks( OpenDecoder, CloseDecoder );
151 set_description( _("Vorbis audio packetizer") );
152 set_capability( "packetizer", 100 );
153 set_callbacks( OpenPacketizer, CloseDecoder );
155 #ifndef MODULE_NAME_IS_tremor
156 # define ENC_CFG_PREFIX "sout-vorbis-"
158 set_description( _("Vorbis audio encoder") );
159 set_capability( "encoder", 100 );
160 set_callbacks( OpenEncoder, CloseEncoder );
162 add_integer( ENC_CFG_PREFIX "quality", 0, NULL, ENC_QUALITY_TEXT,
163 ENC_QUALITY_LONGTEXT, VLC_FALSE );
164 add_integer( ENC_CFG_PREFIX "max-bitrate", 0, NULL, ENC_MAXBR_TEXT,
165 ENC_MAXBR_LONGTEXT, VLC_FALSE );
166 add_integer( ENC_CFG_PREFIX "min-bitrate", 0, NULL, ENC_MINBR_TEXT,
167 ENC_MINBR_LONGTEXT, VLC_FALSE );
172 #ifndef MODULE_NAME_IS_tremor
173 static const char *ppsz_enc_options[] = {
174 "quality", "max-bitrate", "min-bitrate", NULL
178 /*****************************************************************************
179 * OpenDecoder: probe the decoder and return score
180 *****************************************************************************/
181 static int OpenDecoder( vlc_object_t *p_this )
183 decoder_t *p_dec = (decoder_t*)p_this;
184 decoder_sys_t *p_sys;
186 if( p_dec->fmt_in.i_codec != VLC_FOURCC('v','o','r','b') )
191 /* Allocate the memory needed to store the decoder's structure */
192 if( ( p_dec->p_sys = p_sys =
193 (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
195 msg_Err( p_dec, "out of memory" );
200 aout_DateSet( &p_sys->end_date, 0 );
201 p_sys->b_packetizer = VLC_FALSE;
202 p_sys->i_headers = 0;
204 /* Take care of vorbis init */
205 vorbis_info_init( &p_sys->vi );
206 vorbis_comment_init( &p_sys->vc );
208 /* Set output properties */
209 p_dec->fmt_out.i_cat = AUDIO_ES;
210 #ifdef MODULE_NAME_IS_tremor
211 p_dec->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
213 p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
217 p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
219 p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
225 static int OpenPacketizer( vlc_object_t *p_this )
227 decoder_t *p_dec = (decoder_t*)p_this;
229 int i_ret = OpenDecoder( p_this );
231 if( i_ret == VLC_SUCCESS )
233 p_dec->p_sys->b_packetizer = VLC_TRUE;
234 p_dec->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
240 /****************************************************************************
241 * DecodeBlock: the whole thing
242 ****************************************************************************
243 * This function must be fed with ogg packets.
244 ****************************************************************************/
245 static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
247 decoder_sys_t *p_sys = p_dec->p_sys;
248 ogg_packet oggpacket;
250 if( !pp_block ) return NULL;
254 /* Block to Ogg packet */
255 oggpacket.packet = (*pp_block)->p_buffer;
256 oggpacket.bytes = (*pp_block)->i_buffer;
260 if( p_sys->b_packetizer ) return NULL;
262 /* Block to Ogg packet */
263 oggpacket.packet = NULL;
267 oggpacket.granulepos = -1;
270 oggpacket.packetno = 0;
272 if( p_sys->i_headers == 0 )
274 /* Take care of the initial Vorbis header */
276 oggpacket.b_o_s = 1; /* yes this actually is a b_o_s packet :) */
277 if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc,
280 msg_Err( p_dec, "this bitstream does not contain Vorbis "
282 block_Release( *pp_block );
287 /* Setup the format */
288 p_dec->fmt_out.audio.i_rate = p_sys->vi.rate;
289 p_dec->fmt_out.audio.i_channels = p_sys->vi.channels;
290 p_dec->fmt_out.audio.i_physical_channels =
291 p_dec->fmt_out.audio.i_original_channels =
292 pi_channels_maps[p_sys->vi.channels];
293 p_dec->fmt_out.i_bitrate = p_sys->vi.bitrate_nominal;
295 aout_DateInit( &p_sys->end_date, p_sys->vi.rate );
297 msg_Dbg( p_dec, "channels:%d samplerate:%ld bitrate:%ld",
298 p_sys->vi.channels, p_sys->vi.rate,
299 p_sys->vi.bitrate_nominal );
301 return ProcessPacket( p_dec, &oggpacket, pp_block );
304 if( p_sys->i_headers == 1 )
306 /* The next packet in order is the comments header */
307 if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc, &oggpacket )
310 msg_Err( p_dec, "2nd Vorbis header is corrupted" );
311 block_Release( *pp_block );
316 ParseVorbisComments( p_dec );
318 return ProcessPacket( p_dec, &oggpacket, pp_block );
321 if( p_sys->i_headers == 2 )
323 /* The next packet in order is the codebooks header
324 We need to watch out that this packet is not missing as a
325 missing or corrupted header is fatal. */
326 if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc, &oggpacket )
329 msg_Err( p_dec, "3rd Vorbis header is corrupted" );
330 block_Release( *pp_block );
335 if( !p_sys->b_packetizer )
337 /* Initialize the Vorbis packet->PCM decoder */
338 vorbis_synthesis_init( &p_sys->vd, &p_sys->vi );
339 vorbis_block_init( &p_sys->vd, &p_sys->vb );
342 return ProcessPacket( p_dec, &oggpacket, pp_block );
345 return ProcessPacket( p_dec, &oggpacket, pp_block );
348 /*****************************************************************************
349 * ProcessPacket: processes a Vorbis packet.
350 *****************************************************************************/
351 static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
354 decoder_sys_t *p_sys = p_dec->p_sys;
355 block_t *p_block = *pp_block;
357 /* Date management */
358 if( p_block && p_block->i_pts > 0 &&
359 p_block->i_pts != aout_DateGet( &p_sys->end_date ) )
361 aout_DateSet( &p_sys->end_date, p_block->i_pts );
364 if( !aout_DateGet( &p_sys->end_date ) )
366 /* We've just started the stream, wait for the first PTS. */
367 if( p_block ) block_Release( p_block );
371 *pp_block = NULL; /* To avoid being fed the same packet again */
373 if( p_sys->b_packetizer )
375 return SendPacket( p_dec, p_oggpacket, p_block );
379 aout_buffer_t *p_aout_buffer;
381 if( p_sys->i_headers >= 3 )
382 p_aout_buffer = DecodePacket( p_dec, p_oggpacket );
384 p_aout_buffer = NULL;
388 block_Release( p_block );
390 return p_aout_buffer;
394 /*****************************************************************************
395 * DecodePacket: decodes a Vorbis packet.
396 *****************************************************************************/
397 static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
399 decoder_sys_t *p_sys = p_dec->p_sys;
402 #ifdef MODULE_NAME_IS_tremor
408 if( p_oggpacket->bytes &&
409 vorbis_synthesis( &p_sys->vb, p_oggpacket ) == 0 )
410 vorbis_synthesis_blockin( &p_sys->vd, &p_sys->vb );
412 /* **pp_pcm is a multichannel float vector. In stereo, for
413 * example, pp_pcm[0] is left, and pp_pcm[1] is right. i_samples is
414 * the size of each channel. Convert the float values
415 * (-1.<=range<=1.) to whatever PCM format and write it out */
417 if( ( i_samples = vorbis_synthesis_pcmout( &p_sys->vd, &pp_pcm ) ) > 0 )
420 aout_buffer_t *p_aout_buffer;
423 p_dec->pf_aout_buffer_new( p_dec, i_samples );
425 if( p_aout_buffer == NULL ) return NULL;
427 /* Interleave the samples */
428 #ifdef MODULE_NAME_IS_tremor
429 Interleave( (int32_t *)p_aout_buffer->p_buffer,
430 (const int32_t **)pp_pcm, p_sys->vi.channels, i_samples );
432 Interleave( (float *)p_aout_buffer->p_buffer,
433 (const float **)pp_pcm, p_sys->vi.channels, i_samples );
436 /* Tell libvorbis how many samples we actually consumed */
437 vorbis_synthesis_read( &p_sys->vd, i_samples );
439 /* Date management */
440 p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
441 p_aout_buffer->end_date = aout_DateIncrement( &p_sys->end_date,
443 return p_aout_buffer;
451 /*****************************************************************************
452 * SendPacket: send an ogg dated packet to the stream output.
453 *****************************************************************************/
454 static block_t *SendPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
457 decoder_sys_t *p_sys = p_dec->p_sys;
458 int i_block_size, i_samples;
460 i_block_size = vorbis_packet_blocksize( &p_sys->vi, p_oggpacket );
461 if( i_block_size < 0 ) i_block_size = 0; /* non audio packet */
462 i_samples = ( p_sys->i_last_block_size + i_block_size ) >> 2;
463 p_sys->i_last_block_size = i_block_size;
465 /* Date management */
466 p_block->i_dts = p_block->i_pts = aout_DateGet( &p_sys->end_date );
468 if( p_sys->i_headers >= 3 )
469 p_block->i_length = aout_DateIncrement( &p_sys->end_date, i_samples ) -
472 p_block->i_length = 0;
477 /*****************************************************************************
478 * ParseVorbisComments: FIXME should be done in demuxer
479 *****************************************************************************/
480 static void ParseVorbisComments( decoder_t *p_dec )
482 input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
484 char *psz_name, *psz_value, *psz_comment;
485 while ( i < p_dec->p_sys->vc.comments )
487 psz_comment = strdup( p_dec->p_sys->vc.user_comments[i] );
490 msg_Warn( p_dec, "out of memory" );
493 psz_name = psz_comment;
494 psz_value = strchr( psz_comment, '=' );
499 input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"),
500 psz_name, psz_value );
507 /*****************************************************************************
508 * Interleave: helper function to interleave channels
509 *****************************************************************************/
510 static void Interleave(
511 #ifdef MODULE_NAME_IS_tremor
512 int32_t *p_out, const int32_t **pp_in,
514 float *p_out, const float **pp_in,
516 int i_nb_channels, int i_samples )
520 for ( j = 0; j < i_samples; j++ )
522 for ( i = 0; i < i_nb_channels; i++ )
524 p_out[j * i_nb_channels + i] = pp_in[i][j];
529 /*****************************************************************************
530 * CloseDecoder: vorbis decoder destruction
531 *****************************************************************************/
532 static void CloseDecoder( vlc_object_t *p_this )
534 decoder_t *p_dec = (decoder_t *)p_this;
535 decoder_sys_t *p_sys = p_dec->p_sys;
537 if( !p_sys->b_packetizer && p_sys->i_headers >= 3 )
539 vorbis_block_clear( &p_sys->vb );
540 vorbis_dsp_clear( &p_sys->vd );
543 vorbis_comment_clear( &p_sys->vc );
544 vorbis_info_clear( &p_sys->vi ); /* must be called last */
549 #if defined(HAVE_VORBIS_VORBISENC_H) && !defined(MODULE_NAME_IS_tremor)
551 /*****************************************************************************
552 * encoder_sys_t : theora encoder descriptor
553 *****************************************************************************/
564 vorbis_info vi; /* struct that stores all the static vorbis bitstream
566 vorbis_comment vc; /* struct that stores all the bitstream user
568 vorbis_dsp_state vd; /* central working state for the packet->PCM
570 vorbis_block vb; /* local working space for packet->PCM decode */
572 int i_last_block_size;
582 /*****************************************************************************
583 * OpenEncoder: probe the encoder and return score
584 *****************************************************************************/
585 static int OpenEncoder( vlc_object_t *p_this )
587 encoder_t *p_enc = (encoder_t *)p_this;
588 encoder_sys_t *p_sys;
589 int i_quality, i_min_bitrate, i_max_bitrate;
592 if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') &&
598 /* Allocate the memory needed to store the decoder's structure */
599 if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
601 msg_Err( p_enc, "out of memory" );
604 p_enc->p_sys = p_sys;
606 p_enc->pf_header = Headers;
607 p_enc->pf_encode_audio = Encode;
608 p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2');
609 p_enc->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
611 sout_ParseCfg( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
613 var_Get( p_enc, ENC_CFG_PREFIX "quality", &val );
614 i_quality = val.i_int;
615 if( i_quality > 10 ) i_quality = 10;
616 if( i_quality < 0 ) i_quality = 0;
617 var_Get( p_enc, ENC_CFG_PREFIX "max-bitrate", &val );
618 i_max_bitrate = val.i_int;
619 var_Get( p_enc, ENC_CFG_PREFIX "min-bitrate", &val );
620 i_min_bitrate = val.i_int;
622 /* Initialize vorbis encoder */
623 vorbis_info_init( &p_sys->vi );
628 if( vorbis_encode_setup_vbr( &p_sys->vi,
629 p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate,
632 vorbis_info_clear( &p_sys->vi );
633 free( p_enc->p_sys );
634 msg_Err( p_enc, "VBR mode initialisation failed" );
638 /* Do we have optional hard quality restrictions? */
639 if( i_max_bitrate > 0 || i_min_bitrate > 0 )
641 struct ovectl_ratemanage_arg ai;
642 vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_GET, &ai );
644 ai.bitrate_hard_min = i_min_bitrate;
645 ai.bitrate_hard_max = i_max_bitrate;
646 ai.management_active = 1;
648 vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_SET, &ai );
653 /* Turn off management entirely */
654 vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_SET, NULL );
659 if( vorbis_encode_setup_managed( &p_sys->vi,
660 p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate,
661 i_min_bitrate > 0 ? i_min_bitrate * 1000: -1,
662 p_enc->fmt_out.i_bitrate,
663 i_max_bitrate > 0 ? i_max_bitrate * 1000: -1 ) )
665 vorbis_info_clear( &p_sys->vi );
666 msg_Err( p_enc, "CBR mode initialisation failed" );
667 free( p_enc->p_sys );
672 vorbis_encode_setup_init( &p_sys->vi );
675 vorbis_comment_init( &p_sys->vc);
676 vorbis_comment_add_tag( &p_sys->vc, "ENCODER", "VLC media player");
678 /* set up the analysis state and auxiliary encoding storage */
679 vorbis_analysis_init( &p_sys->vd, &p_sys->vi );
680 vorbis_block_init( &p_sys->vd, &p_sys->vb );
682 p_sys->i_channels = p_enc->fmt_in.audio.i_channels;
683 p_sys->i_last_block_size = 0;
684 p_sys->i_samples_delay = 0;
685 p_sys->i_headers = 0;
691 /****************************************************************************
692 * Encode: the whole thing
693 ****************************************************************************
694 * This function spits out ogg packets.
695 ****************************************************************************/
696 static block_t *Headers( encoder_t *p_enc )
698 encoder_sys_t *p_sys = p_enc->p_sys;
699 block_t *p_block, *p_chain = NULL;
701 /* Create theora headers */
702 if( !p_sys->i_headers )
704 ogg_packet header[3];
707 vorbis_analysis_headerout( &p_sys->vd, &p_sys->vc,
708 &header[0], &header[1], &header[2]);
709 for( i = 0; i < 3; i++ )
711 p_block = block_New( p_enc, header[i].bytes );
712 memcpy( p_block->p_buffer, header[i].packet, header[i].bytes );
714 p_block->i_dts = p_block->i_pts = p_block->i_length = 0;
716 block_ChainAppend( &p_chain, p_block );
718 p_sys->i_headers = 3;
724 /****************************************************************************
725 * Encode: the whole thing
726 ****************************************************************************
727 * This function spits out ogg packets.
728 ****************************************************************************/
729 static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
731 encoder_sys_t *p_sys = p_enc->p_sys;
732 ogg_packet oggpacket;
733 block_t *p_block, *p_chain = NULL;
738 p_sys->i_pts = p_aout_buf->start_date -
739 (mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
740 (mtime_t)p_enc->fmt_in.audio.i_rate;
742 p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
744 buffer = vorbis_analysis_buffer( &p_sys->vd, p_aout_buf->i_nb_samples );
746 /* convert samples to float and uninterleave */
747 for( i = 0; i < p_sys->i_channels; i++ )
749 for( j = 0 ; j < p_aout_buf->i_nb_samples ; j++ )
751 buffer[i][j]= ((float)( ((int16_t *)p_aout_buf->p_buffer )
752 [j * p_sys->i_channels + i ] )) / 32768.f;
756 vorbis_analysis_wrote( &p_sys->vd, p_aout_buf->i_nb_samples );
758 while( vorbis_analysis_blockout( &p_sys->vd, &p_sys->vb ) == 1 )
762 vorbis_analysis( &p_sys->vb, NULL );
763 vorbis_bitrate_addblock( &p_sys->vb );
765 while( vorbis_bitrate_flushpacket( &p_sys->vd, &oggpacket ) )
768 p_block = block_New( p_enc, oggpacket.bytes );
769 memcpy( p_block->p_buffer, oggpacket.packet, oggpacket.bytes );
771 i_block_size = vorbis_packet_blocksize( &p_sys->vi, &oggpacket );
773 if( i_block_size < 0 ) i_block_size = 0;
774 i_samples = ( p_sys->i_last_block_size + i_block_size ) >> 2;
775 p_sys->i_last_block_size = i_block_size;
777 p_block->i_length = (mtime_t)1000000 *
778 (mtime_t)i_samples / (mtime_t)p_enc->fmt_in.audio.i_rate;
780 p_block->i_dts = p_block->i_pts = p_sys->i_pts;
782 p_sys->i_samples_delay -= i_samples;
785 p_sys->i_pts += p_block->i_length;
786 block_ChainAppend( &p_chain, p_block );
793 /*****************************************************************************
794 * CloseEncoder: theora encoder destruction
795 *****************************************************************************/
796 static void CloseEncoder( vlc_object_t *p_this )
798 encoder_t *p_enc = (encoder_t *)p_this;
799 encoder_sys_t *p_sys = p_enc->p_sys;
801 vorbis_block_clear( &p_sys->vb );
802 vorbis_dsp_clear( &p_sys->vd );
803 vorbis_comment_clear( &p_sys->vc );
804 vorbis_info_clear( &p_sys->vi ); /* must be called last */
809 #endif /* HAVE_VORBIS_VORBISENC_H && !MODULE_NAME_IS_tremor */