Mercurial > mplayer.hg
changeset 5775:e4c2a5541a6a
Added uninit
author | albeu |
---|---|
date | Sun, 21 Apr 2002 18:06:00 +0000 |
parents | a300966abeb6 |
children | 1f320716fe92 |
files | libmpcodecs/ad_vorbis.c |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_vorbis.c Sun Apr 21 17:22:37 2002 +0000 +++ b/libmpcodecs/ad_vorbis.c Sun Apr 21 18:06:00 2002 +0000 @@ -43,7 +43,12 @@ 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 @@ /// 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 @@ (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 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 @@ 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) {