* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: threads_funcs.h,v 1.3 2002/05/18 17:47:46 sam Exp $
+ * $Id: threads_funcs.h,v 1.4 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( p_thread, NULL, func, p_data );
+#ifdef SYS_DARWIN
+ {
+ struct sched_param param;
+ param.sched_priority = 10;
+ if (pthread_setschedparam(*p_thread, SCHED_RR, ¶m))
+ {
+ intf_ErrMsg("pthread_setschedparam failed");
+ }
+ }
+#endif
+
#elif defined( HAVE_CTHREADS_H )
*p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
i_ret = 0;
* aout_macosx.c : CoreAudio output plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: aout_macosx.m,v 1.2 2002/05/19 00:34:54 massiot Exp $
+ * $Id: aout_macosx.m,v 1.3 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
OSStatus err;
UInt32 ui_param_size;
- struct thread_time_constraint_policy ttcpolicy;
- int mib[2];
- unsigned int miblen;
- int i_busspeed;
- size_t len;
-
/* allocate instance */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
return( -1 );
}
- /* Go to time-constrained thread policy */
-
- /* Get bus speed */
- mib[0] = CTL_HW;
- mib[1] = HW_BUS_FREQ;
- miblen = 2;
- len = 4;
- if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
- {
- intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
- }
- else
- {
- /* This is in AbsoluteTime units, which are equal to
- * 1/4 the bus speed on most machines. */
- /* FIXME : these are random numbers ! */
- /* hard-coded numbers are approximations for 100 MHz bus speed.
- * assume that app deals in frame-sized chunks, e.g. 30 per second.
- * ttcpolicy.period = 833333; */
- ttcpolicy.period = i_busspeed / 120;
- /* ttcpolicy.computation = 60000; */
- ttcpolicy.computation = i_busspeed / 1440;
- /* ttcpolicy.constraint = 120000; */
- ttcpolicy.constraint = i_busspeed / 720;
- ttcpolicy.preemptible = 1;
-
- if (thread_policy_set(mach_thread_self(),
- THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
- THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
- {
- intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
- }
- }
-
return( 0 );
}
* intf_controller.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.m,v 1.2 2002/05/18 13:33:44 massiot Exp $
+ * $Id: intf_controller.m,v 1.3 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
switch( [[NSApp currentEvent] type] )
{
case NSLeftMouseDown:
- [o_slider_lock lock];
+ [o_slider_lock tryLock];
break;
case NSLeftMouseUp:
* intf_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.m,v 1.5 2002/05/19 19:16:40 jlj Exp $
+ * $Id: intf_vlc_wrapper.m,v 1.6 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
{
float f_time = 0.0;
- vlc_mutex_lock( &p_input_bank->lock );
-
if( p_input_bank->pp_input[0] != NULL )
{
f_time = (float)p_area->i_tell / (float)p_area->i_size;
}
- vlc_mutex_unlock( &p_input_bank->lock );
-
return( f_time );
}
- (void)setTimeAsFloat:(float)f_position
{
- vlc_mutex_lock( &p_input_bank->lock );
-
if( p_input_bank->pp_input[0] != NULL )
{
input_Seek( p_input_bank->pp_input[0], p_area->i_size * f_position );
}
-
- vlc_mutex_unlock( &p_input_bank->lock );
}
#undef p_area
int i_index;
picture_t *p_pic;
- struct thread_time_constraint_policy ttcpolicy;
- int mib[2];
- unsigned int miblen;
- int i_busspeed;
- size_t len;
-
I_OUTPUTPICTURES = 0;
/* Initialize the output structure; we already found a codec,
I_OUTPUTPICTURES++;
}
- /* Go to time-constrained thread policy */
-
- /* Get bus speed */
- mib[0] = CTL_HW;
- mib[1] = HW_BUS_FREQ;
- miblen = 2;
- len = 4;
- if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
- {
- intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
- }
- else
- {
- /* This is in AbsoluteTime units, which are equal to
- * 1/4 the bus speed on most machines. */
-
- /* hard-coded numbers are approximations for 100 MHz bus speed.
- * assume that app deals in frame-sized chunks, e.g. 30 per second.
- * ttcpolicy.period = 833333; */
- ttcpolicy.period = i_busspeed / 120;
- /* ttcpolicy.computation = 60000; */
- ttcpolicy.computation = i_busspeed / 1440;
- /* ttcpolicy.constraint = 120000; */
- ttcpolicy.constraint = i_busspeed / 720;
- ttcpolicy.preemptible = 1;
-
- if (thread_policy_set(mach_thread_self(),
- THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
- THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
- {
- intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
- }
- }
-
return( 0 );
}
* darwin_specific.c: Darwin specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: darwin_specific.c,v 1.8 2002/04/26 00:20:00 jlj Exp $
+ * $Id: darwin_specific.c,v 1.9 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
p_char++;
}
-
- return;
+
+ /* Run the interface with a real-time priority too */
+ {
+ struct sched_param param;
+ param.sched_priority = 10;
+ if (pthread_setschedparam(pthread_self(), SCHED_RR, ¶m))
+ {
+ intf_ErrMsg("pthread_setschedparam failed");
+ }
+ }
}
/*****************************************************************************
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.176 2002/05/17 14:17:05 lool Exp $
+ * $Id: video_output.c,v 1.177 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
continue;
}
+#if 0
+ /* Removed because it causes problems for some people --Meuuh */
else if( display_date > current_date + VOUT_BOGUS_DELAY )
{
/* Picture is waaay too early: it will be destroyed */
continue;
}
+#endif
else if( display_date > current_date + VOUT_DISPLAY_DELAY )
{
/* A picture is ready to be rendered, but its rendering date