mirror of https://github.com/mpv-player/mpv
dec_video uninit
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1655 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
3ac8704a9f
commit
e0840baae9
30
dec_video.c
30
dec_video.c
|
@ -140,6 +140,26 @@ int set_video_colors(sh_video_t *sh_video,char *item,int value){
|
||||||
return 0;
|
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){
|
int init_video(sh_video_t *sh_video){
|
||||||
unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
|
unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
|
||||||
|
|
||||||
|
@ -280,9 +300,13 @@ switch(sh_video->codec->driver){
|
||||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n");
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n");
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
static int avcodec_inited=0;
|
||||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n");
|
mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n");
|
||||||
avcodec_init();
|
if(!avcodec_inited){
|
||||||
avcodec_register_all();
|
avcodec_init();
|
||||||
|
avcodec_register_all();
|
||||||
|
avcodec_inited=1;
|
||||||
|
}
|
||||||
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll);
|
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll);
|
||||||
if(!lavc_codec){
|
if(!lavc_codec){
|
||||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll);
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll);
|
||||||
|
@ -322,7 +346,7 @@ switch(sh_video->codec->driver){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sh_video->inited=1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
mplayer.c
10
mplayer.c
|
@ -594,7 +594,12 @@ play_next_file:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
demuxer=NULL; stream=NULL;
|
stream=NULL;
|
||||||
|
demuxer=NULL;
|
||||||
|
d_audio=NULL;
|
||||||
|
d_video=NULL;
|
||||||
|
sh_audio=NULL;
|
||||||
|
sh_video=NULL;
|
||||||
|
|
||||||
#ifdef USE_LIBVO2
|
#ifdef USE_LIBVO2
|
||||||
current_module="vo2_new";
|
current_module="vo2_new";
|
||||||
|
@ -1809,6 +1814,9 @@ goto_next_file: // don't jump here after ao/vo/getch initialization!
|
||||||
++curr_filename;
|
++curr_filename;
|
||||||
if(curr_filename<num_filenames){
|
if(curr_filename<num_filenames){
|
||||||
|
|
||||||
|
current_module="uninit_vcodec";
|
||||||
|
if(sh_video) uninit_video(sh_video);
|
||||||
|
|
||||||
current_module="free_demuxer";
|
current_module="free_demuxer";
|
||||||
if(demuxer) free_demuxer(demuxer);
|
if(demuxer) free_demuxer(demuxer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue