From 4fac32efce398a53b4f9d2c89d643695783b84f3 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Mon, 11 Feb 2002 01:55:20 +0000 Subject: serialize all libmpeg2 calls (I guess this needs to be done for other video decoders as well) CVS patchset: 1492 CVS date: 2002/02/11 01:55:20 --- src/libmpeg2/xine_decoder.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index da5415253..b5c40788c 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/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.21 2002/02/09 07:13:23 guenter Exp $ + * $Id: xine_decoder.c,v 1.22 2002/02/11 01:55:20 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -54,11 +54,17 @@ static void mpeg2dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; - printf ("libmpeg2: init \n"); + printf ("libmpeg2: init... \n"); + + pthread_mutex_lock (&this->lock); + mpeg2_init (&this->mpeg2, video_out); video_out->open(video_out); this->video_out = video_out; - pthread_mutex_init (&this->lock, NULL); + + pthread_mutex_unlock (&this->lock); + + printf ("libmpeg2: init...done\n"); } static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { @@ -98,12 +104,13 @@ static void mpeg2dec_close (video_decoder_t *this_gen) { printf ("libmpeg2: close\n"); + pthread_mutex_lock (&this->lock); + mpeg2_close (&this->mpeg2); this->video_out->close(this->video_out); - pthread_mutex_destroy (&this->lock); - + pthread_mutex_unlock (&this->lock); } static char *mpeg2dec_get_id(void) { @@ -135,6 +142,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.priority = 1; this->mpeg2.xine = xine; + pthread_mutex_init (&this->lock, NULL); return (video_decoder_t *) this; } -- cgit v1.2.3