diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-21 18:06:00 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-04-21 18:06:00 +0000 |
commit | 203cf520dafe1d9e45df856683ccfe35538dda23 (patch) | |
tree | 0c9fe0c6b16b28baa6f0388c6040f420c47fc0cd | |
parent | 260f6aec1d537de8e85e58b8a03c31183c939e0d (diff) | |
download | mpv-203cf520dafe1d9e45df856683ccfe35538dda23.tar.bz2 mpv-203cf520dafe1d9e45df856683ccfe35538dda23.tar.xz |
Added uninit
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5776 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/ad_vorbis.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libmpcodecs/ad_vorbis.c b/libmpcodecs/ad_vorbis.c index b792f9d149..749366d54c 100644 --- a/libmpcodecs/ad_vorbis.c +++ b/libmpcodecs/ad_vorbis.c @@ -43,7 +43,12 @@ static int init(sh_audio_t *sh) ogg_packet op; vorbis_comment vc; struct ov_struct_st *ov; - + int error(void) { + vorbis_comment_clear(&vc); + vorbis_info_clear(&ov->vi); + free(ov); + return 0; + } /// Init the decoder with the 3 header packets ov = (struct ov_struct_st*)malloc(sizeof(struct ov_struct_st)); vorbis_info_init(&ov->vi); @@ -53,23 +58,20 @@ static int init(sh_audio_t *sh) /// Header if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) { mp_msg(MSGT_DECAUDIO,MSGL_ERR,"OggVorbis: initial (identification) header broken!\n"); - free(ov); - return 0; + return error(); } op.bytes = ds_get_packet(sh->ds,&op.packet); op.b_o_s = 0; /// Comments if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) { mp_msg(MSGT_DECAUDIO,MSGL_ERR,"OggVorbis: comment header broken!\n"); - free(ov); - return 0; + return error(); } op.bytes = ds_get_packet(sh->ds,&op.packet); //// Codebook if(vorbis_synthesis_headerin(&ov->vi,&vc,&op)<0) { mp_msg(MSGT_DECAUDIO,MSGL_WARN,"OggVorbis: codebook header broken!\n"); - free(ov); - return 0; + return error();; } else { /// Print the infos char **ptr=vc.user_comments; while(*ptr){ @@ -80,6 +82,7 @@ static int init(sh_audio_t *sh) (ov->vi.bitrate_lower!=ov->vi.bitrate_nominal)||(ov->vi.bitrate_upper!=ov->vi.bitrate_nominal)?'V':'C'); mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Encoded by: %s\n",vc.vendor); } + vorbis_comment_clear(&vc); // printf("lower=%d upper=%d \n",(int)ov->vi.bitrate_lower,(int)ov->vi.bitrate_upper); @@ -100,6 +103,10 @@ static int init(sh_audio_t *sh) static void uninit(sh_audio_t *sh) { + struct ov_struct_st *ov = sh->context; + vorbis_block_clear(&ov->vb); + vorbis_info_clear(&ov->vi); + free(ov); } static int control(sh_audio_t *sh,int cmd,void* arg, ...) @@ -122,7 +129,6 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) int samples; float **pcm; ogg_packet op; - char* np; struct ov_struct_st *ov = sh->context; op.b_o_s = op.e_o_s = 0; while(len < minlen) { |