# HG changeset patch # User arpi # Date 998569499 0 # Node ID 9d85b84e367e2ca051db593b75266d41c141dd65 # Parent a90e0d8eba7c37bb8335e2b1247b271a98606a61 dec_video uninit diff -r a90e0d8eba7c -r 9d85b84e367e dec_video.c --- a/dec_video.c Thu Aug 23 11:54:55 2001 +0000 +++ b/dec_video.c Thu Aug 23 12:24:59 2001 +0000 @@ -140,6 +140,26 @@ return 0; } +int uninit_video(sh_video_t *sh_video){ + if(!sh_video->inited) return; + printf("uninit video: %d \n",sh_video->codec->driver); + switch(sh_video->codec->driver){ + case VFM_FFMPEG: + if (avcodec_close(&lavc_context) < 0) + mp_msg(MSGT_DECVIDEO,MSGL_ERR, "could not close codec\n"); + break; + + case VFM_MPEG: + mpeg2_free_image_buffers (picture); + break; + } + if(sh_video->our_out_buffer){ + free(sh_video->our_out_buffer); + sh_video->our_out_buffer=NULL; + } + sh_video->inited=0; +} + int init_video(sh_video_t *sh_video){ unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; @@ -280,9 +300,13 @@ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n"); return 0; #else + static int avcodec_inited=0; mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n"); - avcodec_init(); - avcodec_register_all(); + if(!avcodec_inited){ + avcodec_init(); + avcodec_register_all(); + avcodec_inited=1; + } lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll); if(!lavc_codec){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll); @@ -322,7 +346,7 @@ break; } } - + sh_video->inited=1; return 1; } diff -r a90e0d8eba7c -r 9d85b84e367e mplayer.c --- a/mplayer.c Thu Aug 23 11:54:55 2001 +0000 +++ b/mplayer.c Thu Aug 23 12:24:59 2001 +0000 @@ -594,7 +594,12 @@ } #endif - demuxer=NULL; stream=NULL; + stream=NULL; + demuxer=NULL; + d_audio=NULL; + d_video=NULL; + sh_audio=NULL; + sh_video=NULL; #ifdef USE_LIBVO2 current_module="vo2_new"; @@ -1809,6 +1814,9 @@ ++curr_filename; if(curr_filename