Commit d90e04a7 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* include/main.h

  src/libvlc.c: Added a quicktime_lock on SYS_DARWIN
* ALL: QT on OSX is not threadsafe in certain areas. i have found the proces
  of identifying the right Codec to use for decoding to be one of these areas.
  So when we do this, only one thread at a time can use QT.
  Watching QT trailers is doable now, as soon as ffmpeg fix their altivec optimizations again ;)
parent c80aee13
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Declaration and extern access to global program object. * Declaration and extern access to global program object.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: main.h,v 1.53 2003/02/17 05:50:31 sam Exp $ * $Id: main.h,v 1.54 2003/05/21 15:40:03 hartman Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -101,5 +101,8 @@ struct vlc_t ...@@ -101,5 +101,8 @@ struct vlc_t
/* Locks */ /* Locks */
vlc_mutex_t config_lock; /* lock for the config file */ vlc_mutex_t config_lock; /* lock for the config file */
#ifdef SYS_DARWIN
vlc_mutex_t quicktime_lock; /* QT is not thread safe on OSX */
#endif
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* quicktime.c: a quicktime decoder that uses the QT library/dll * quicktime.c: a quicktime decoder that uses the QT library/dll
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: quicktime.c,v 1.1 2003/05/20 21:35:52 hartman Exp $ * $Id: quicktime.c,v 1.2 2003/05/21 15:40:03 hartman Exp $
* *
* Authors: Laurent Aimar <fenrir at via.ecp.fr> * Authors: Laurent Aimar <fenrir at via.ecp.fr>
* Derk-Jan Hartman <thedj at users.sf.net> * Derk-Jan Hartman <thedj at users.sf.net>
...@@ -352,9 +352,18 @@ static int InitThreadAudio ( adec_thread_t *p_dec ) ...@@ -352,9 +352,18 @@ static int InitThreadAudio ( adec_thread_t *p_dec )
p_dec->OutputFormatInfo.sampleRate = p_wf->nSamplesPerSec; p_dec->OutputFormatInfo.sampleRate = p_wf->nSamplesPerSec;
p_dec->OutputFormatInfo.format = FCC( 'N', 'O', 'N', 'E' ); p_dec->OutputFormatInfo.format = FCC( 'N', 'O', 'N', 'E' );
#ifdef SYS_DARWIN
/* on OS X QT is not threadsafe */
vlc_mutex_lock( &p_dec->p_fifo->p_vlc->quicktime_lock );
#endif
i_error = p_dec->SoundConverterOpen( &p_dec->InputFormatInfo, i_error = p_dec->SoundConverterOpen( &p_dec->InputFormatInfo,
&p_dec->OutputFormatInfo, &p_dec->OutputFormatInfo,
&p_dec->myConverter ); &p_dec->myConverter );
#ifdef SYS_DARWIN
vlc_mutex_unlock( &p_dec->p_fifo->p_vlc->quicktime_lock );
#endif
if( i_error ) if( i_error )
{ {
msg_Dbg( p_dec->p_fifo, "error while SoundConverterOpen = %d", i_error ); msg_Dbg( p_dec->p_fifo, "error while SoundConverterOpen = %d", i_error );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.m: MacOS X video output plugin * vout.m: MacOS X video output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.47 2003/05/05 22:04:11 hartman Exp $ * $Id: vout.m,v 1.48 2003/05/21 15:40:03 hartman Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -150,8 +150,13 @@ int E_(OpenVideo) ( vlc_object_t *p_this ) ...@@ -150,8 +150,13 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
if( vout_ChromaCmp( p_vout->render.i_chroma, VLC_FOURCC('I','4','2','0') ) ) if( vout_ChromaCmp( p_vout->render.i_chroma, VLC_FOURCC('I','4','2','0') ) )
{ {
/* Damn QT isn't thread safe. so keep a lock in the p_vlc object */
vlc_mutex_lock( &p_vout->p_vlc->quicktime_lock );
err = FindCodec( kYUV420CodecType, bestSpeedCodec, err = FindCodec( kYUV420CodecType, bestSpeedCodec,
nil, &p_vout->p_sys->img_dc ); nil, &p_vout->p_sys->img_dc );
vlc_mutex_unlock( &p_vout->p_vlc->quicktime_lock );
if( err == noErr && p_vout->p_sys->img_dc != 0 ) if( err == noErr && p_vout->p_sys->img_dc != 0 )
{ {
p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0'); p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.86 2003/05/11 13:14:04 sigmunau Exp $ * $Id: libvlc.c,v 1.87 2003/05/21 15:40:03 hartman Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -187,6 +187,9 @@ int VLC_Create( void ) ...@@ -187,6 +187,9 @@ int VLC_Create( void )
/* Initialize mutexes */ /* Initialize mutexes */
vlc_mutex_init( p_vlc, &p_vlc->config_lock ); vlc_mutex_init( p_vlc, &p_vlc->config_lock );
#ifdef SYS_DARWIN
vlc_mutex_init( p_vlc, &p_vlc->quicktime_lock );
#endif
/* Store our newly allocated structure in the global list */ /* Store our newly allocated structure in the global list */
vlc_object_attach( p_vlc, &libvlc ); vlc_object_attach( p_vlc, &libvlc );
...@@ -650,6 +653,9 @@ int VLC_Destroy( int i_object ) ...@@ -650,6 +653,9 @@ int VLC_Destroy( int i_object )
/* Destroy mutexes */ /* Destroy mutexes */
vlc_mutex_destroy( &p_vlc->config_lock ); vlc_mutex_destroy( &p_vlc->config_lock );
#ifdef SYS_DARWIN
vlc_mutex_destroy( &p_vlc->quicktime_lock );
#endif
vlc_object_detach( p_vlc ); vlc_object_detach( p_vlc );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment