diff options
author | Mike Scheutzow <scheutzow@alcatel-lucent.com> | 2010-08-17 07:46:09 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2010-08-17 07:46:09 +0000 |
commit | f7b8c814609e33d1c558c279644c237240707dc7 (patch) | |
tree | 70ef13b2257949b070b5cc8aaa4cfe6e7e0504f6 /ffplay.c | |
parent | ead7ef82518a3994b7c65f61285e529dcb340fba (diff) | |
download | ffmpeg-f7b8c814609e33d1c558c279644c237240707dc7.tar.gz |
Move do_exit() up for upcoming patch.
Patch by Mike Scheutzow, mjs973 optonline net
Originally committed as revision 24800 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 108 |
1 files changed, 54 insertions, 54 deletions
@@ -1290,6 +1290,60 @@ retry: } } +static void stream_close(VideoState *is) +{ + VideoPicture *vp; + int i; + /* XXX: use a special url_shutdown call to abort parse cleanly */ + is->abort_request = 1; + SDL_WaitThread(is->parse_tid, NULL); + SDL_WaitThread(is->refresh_tid, NULL); + + /* free all pictures */ + for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) { + vp = &is->pictq[i]; +#if CONFIG_AVFILTER + if (vp->picref) { + avfilter_unref_buffer(vp->picref); + vp->picref = NULL; + } +#endif + if (vp->bmp) { + SDL_FreeYUVOverlay(vp->bmp); + vp->bmp = NULL; + } + } + SDL_DestroyMutex(is->pictq_mutex); + SDL_DestroyCond(is->pictq_cond); + SDL_DestroyMutex(is->subpq_mutex); + SDL_DestroyCond(is->subpq_cond); +#if !CONFIG_AVFILTER + if (is->img_convert_ctx) + sws_freeContext(is->img_convert_ctx); +#endif + av_free(is); +} + +static void do_exit(void) +{ + int i; + if (cur_stream) { + stream_close(cur_stream); + cur_stream = NULL; + } + for (i = 0; i < AVMEDIA_TYPE_NB; i++) + av_free(avcodec_opts[i]); + av_free(avformat_opts); + av_free(sws_opts); +#if CONFIG_AVFILTER + avfilter_uninit(); +#endif + if (show_status) + printf("\n"); + SDL_Quit(); + exit(0); +} + /* allocate a picture (needs to do that in main thread to avoid potential locking problems */ static void alloc_picture(void *opaque) @@ -2659,40 +2713,6 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat) return is; } -static void stream_close(VideoState *is) -{ - VideoPicture *vp; - int i; - /* XXX: use a special url_shutdown call to abort parse cleanly */ - is->abort_request = 1; - SDL_WaitThread(is->parse_tid, NULL); - SDL_WaitThread(is->refresh_tid, NULL); - - /* free all pictures */ - for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) { - vp = &is->pictq[i]; -#if CONFIG_AVFILTER - if (vp->picref) { - avfilter_unref_buffer(vp->picref); - vp->picref = NULL; - } -#endif - if (vp->bmp) { - SDL_FreeYUVOverlay(vp->bmp); - vp->bmp = NULL; - } - } - SDL_DestroyMutex(is->pictq_mutex); - SDL_DestroyCond(is->pictq_cond); - SDL_DestroyMutex(is->subpq_mutex); - SDL_DestroyCond(is->subpq_cond); -#if !CONFIG_AVFILTER - if (is->img_convert_ctx) - sws_freeContext(is->img_convert_ctx); -#endif - av_free(is); -} - static void stream_cycle_channel(VideoState *is, int codec_type) { AVFormatContext *ic = is->ic; @@ -2770,26 +2790,6 @@ static void step_to_next_frame(void) step = 1; } -static void do_exit(void) -{ - int i; - if (cur_stream) { - stream_close(cur_stream); - cur_stream = NULL; - } - for (i = 0; i < AVMEDIA_TYPE_NB; i++) - av_free(avcodec_opts[i]); - av_free(avformat_opts); - av_free(sws_opts); -#if CONFIG_AVFILTER - avfilter_uninit(); -#endif - if (show_status) - printf("\n"); - SDL_Quit(); - exit(0); -} - static void toggle_audio_display(void) { if (cur_stream) { |