From ad776ce19470ab178577b13fb62adba321de0ddb Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 28 Jan 2002 17:28:39 +0000 Subject: patches from Ewald Snel (finish metronom sync loop on xine exit, initialize ffmpeg static data only once) CVS patchset: 1457 CVS date: 2002/01/28 17:28:39 --- src/libffmpeg/xine_decoder.c | 12 +++++++++--- src/xine-engine/metronom.c | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 573719a97..c239648d6 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.24 2002/01/18 01:24:59 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.25 2002/01/28 17:28:39 miguelfreitas Exp $ * * xine decoder plugin using ffmpeg * @@ -31,6 +31,7 @@ #include #include #include +#include #include "xine_internal.h" #include "video_out.h" @@ -370,9 +371,15 @@ static char *ff_get_id(void) { } +static void init_routine(void) { + avcodec_init(); + avcodec_register_all(); +} + video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { ff_decoder_t *this ; + static pthread_once_t once_control = PTHREAD_ONCE_INIT; if (iface_version != 5) { printf( "ffmpeg: plugin doesn't support plugin API version %d.\n" @@ -395,8 +402,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.priority = 5; this->size = 0; - avcodec_init(); - avcodec_register_all(); + pthread_once( &once_control, init_routine ); return (video_decoder_t *) this; } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 42aaa1aa0..f2d4e2875 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.51 2002/01/15 16:37:14 miguelfreitas Exp $ + * $Id: metronom.c,v 1.52 2002/01/28 17:28:39 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -899,7 +899,7 @@ static int metronom_sync_loop (metronom_t *this) { scr_plugin_t** scr; uint32_t pts; - while (1) { + while (((xine_t*)this->xine)->status != XINE_QUIT) { pts = this->scr_master->get_current(this->scr_master); for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) @@ -907,6 +907,7 @@ static int metronom_sync_loop (metronom_t *this) { sleep(5); /* synchronise every 5 seconds */ } + return 0; } -- cgit v1.2.3