From: Miguel F. <mig...@us...> - 2002-01-28 17:28:42
|
Update of /cvsroot/xine/xine-lib/src/libffmpeg In directory usw-pr-cvs1:/tmp/cvs-serv7336/src/libffmpeg Modified Files: xine_decoder.c Log Message: patches from Ewald Snel (finish metronom sync loop on xine exit, initialize ffmpeg static data only once) Index: xine_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/xine_decoder.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- xine_decoder.c 2002/01/18 01:24:59 1.24 +++ xine_decoder.c 2002/01/28 17:28:39 1.25 @@ -31,6 +31,7 @@ #include <stdio.h> #include <inttypes.h> #include <string.h> +#include <pthread.h> #include "xine_internal.h" #include "video_out.h" @@ -370,9 +371,15 @@ } +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 @@ this->video_decoder.priority = 5; this->size = 0; - avcodec_init(); - avcodec_register_all(); + pthread_once( &once_control, init_routine ); return (video_decoder_t *) this; } |