]> git.sesse.net Git - vlc/commitdiff
Mac OS X-specific :
authorChristophe Massiot <massiot@videolan.org>
Sun, 19 May 2002 23:51:37 +0000 (23:51 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 19 May 2002 23:51:37 +0000 (23:51 +0000)
* We now use real-time threads ;
* Worked around a bug when seeking ;
All :
* Removed my patch to the video output since it causes problems for some
  people.

include/threads_funcs.h
plugins/macosx/aout_macosx.m
plugins/macosx/intf_controller.m
plugins/macosx/intf_vlc_wrapper.m
plugins/macosx/vout_macosx.m
src/misc/darwin_specific.c
src/video_output/video_output.c

index 65809d70937d6bdca84ec041c0de702126177dca..07c03313061e79abf3344471e05ad46306be5b9e 100644 (file)
@@ -3,7 +3,7 @@
  * 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>
@@ -751,6 +751,17 @@ static inline int _vlc_thread_create( char * psz_file, int i_line,
 #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, &param))
+        {
+            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;
index 9e3ef1610c67b22feb488ad7202001ceff82caa8..1ff2e8360bc76aa50c599502ba2c55468b9f3085 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
@@ -106,12 +106,6 @@ static int aout_Open( aout_thread_t *p_aout )
     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 )
@@ -182,40 +176,6 @@ static int aout_Open( aout_thread_t *p_aout )
         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 );
 }
 
index 553dd3231ff1aef73491da6f0bcee67ac27b5c94..8457303c0406e3eac622c14fe61144e8bd8c3249 100644 (file)
@@ -2,7 +2,7 @@
  * 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:
index def5d83a9da504e32f2a75b9a5cdddaf6ddf278e..a565a3e9c15744825063f3e1a45b145dc3be7661 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
@@ -316,28 +316,20 @@ static Intf_VLCWrapper *o_intf = nil;
 {
     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
index 995eb22c043a2d222ea4d8261651b20bba418e56..7594c401422e0dd225a94c61cebfbc6a9bc927b1 100644 (file)
@@ -184,12 +184,6 @@ static int vout_Init( vout_thread_t *p_vout )
     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,
@@ -237,40 +231,6 @@ static int vout_Init( vout_thread_t *p_vout )
         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 );
 }
 
index e018f54b35fc5a47ade77b4e4387f45a73060f70..7892739d6ad5ad8cbcef678e2c047d5ceba1e229 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
  *
@@ -53,8 +53,16 @@ void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 
         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, &param))  
+        {
+            intf_ErrMsg("pthread_setschedparam failed");
+        }
+    }
 }
 
 /*****************************************************************************
index 27e8ee39e36c535b655bd678c97e5cdc2b36874f..d84be28090986c3c4b4d7ed8d20bdebe8b9e3d5e 100644 (file)
@@ -5,7 +5,7 @@
  * 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>
  *
@@ -577,6 +577,8 @@ static void RunThread( vout_thread_t *p_vout)
 
                 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 */
@@ -599,6 +601,7 @@ static void RunThread( vout_thread_t *p_vout)
 
                 continue;
             }
+#endif
             else if( display_date > current_date + VOUT_DISPLAY_DELAY )
             {
                 /* A picture is ready to be rendered, but its rendering date