diff -aur vlc-1.1.0/include/vlc/libvlc_media_player.h vlc-1.1.0.new/include/vlc/libvlc_media_player.h
--- vlc-1.1.0/include/vlc/libvlc_media_player.h	2010-06-08 00:57:45.000000000 +0200
+++ vlc-1.1.0.new/include/vlc/libvlc_media_player.h	2010-06-25 00:37:26.953727017 +0200
@@ -378,6 +378,14 @@
 VLC_PUBLIC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
 
 /**
+ * Current time remaining in buffer in ms
+ *
+ * \param p_mi the Media Player
+ * \return libvlc_time_t
+ */
+VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_buffered_time( libvlc_media_player_t *p_mi );
+
+/**
  * Get title chapter count
  *
  * \param p_mi the Media Player
diff -aur vlc-1.1.0/include/vlc_input.h vlc-1.1.0.new/include/vlc_input.h
--- vlc-1.1.0/include/vlc_input.h	2010-06-11 16:46:11.000000000 +0200
+++ vlc-1.1.0.new/include/vlc_input.h	2010-06-25 00:23:39.672456705 +0200
@@ -518,6 +518,9 @@
     /* External clock managments */
     INPUT_GET_PCR_SYSTEM,   /* arg1=mtime_t *, arg2=mtime_t *       res=can fail */
     INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t      res=can fail */
+
+    /* Input Buffer */
+    INPUT_GET_BUFFERED,     /* arg1=mtime_t*     res=can fail */
 };
 
 /** @}*/
diff -aur vlc-1.1.0/src/control/media_player.c vlc-1.1.0.new/src/control/media_player.c
--- vlc-1.1.0/src/control/media_player.c	2010-06-11 16:46:15.000000000 +0200
+++ vlc-1.1.0.new/src/control/media_player.c	2010-06-25 00:38:20.188964161 +0200
@@ -1094,6 +1100,20 @@
     return b_will_play;
 }
 
+libvlc_time_t libvlc_media_player_get_buffered_time( libvlc_media_player_t *p_mi )
+{
+    input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
+    mtime_t        i_time = 0;
+
+    if( p_input_thread )
+    {
+        input_Control( p_input_thread, INPUT_GET_BUFFERED, &i_time );
+        vlc_object_release( p_input_thread );
+    }
+
+    return i_time / 1000;
+}
+
 int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
 {
     if (rate < 0.)
diff -aur vlc-1.1.0/src/input/clock.c vlc-1.1.0.new/src/input/clock.c
--- vlc-1.1.0/src/input/clock.c	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/input/clock.c	2010-06-25 00:15:17.886411840 +0200
@@ -165,6 +165,9 @@
         unsigned i_index;
     } late;
 
+    /* expected system time */
+    mtime_t       i_system_expected;
+
     /* Reference point */
     clock_point_t ref;
     bool          b_has_reference;
@@ -314,8 +317,9 @@
 
     /* It does not take the decoder latency into account but it is not really
      * the goal of the clock here */
-    const mtime_t i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
-    const mtime_t i_late = ( i_ck_system - cl->i_pts_delay ) - i_system_expected;
+    cl->i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
+    const mtime_t i_late = ( i_ck_system - cl->i_pts_delay ) - cl->i_system_expected;
+
     *pb_late = i_late > 0;
     if( i_late > 0 )
     {
@@ -590,6 +594,13 @@
     return i_pts_delay + i_late_median;
 }
 
+mtime_t input_clock_GetBuffered( input_clock_t *cl, mtime_t i_ck_system )
+{
+    const mtime_t i_late = ( i_ck_system - cl->i_pts_delay ) - cl->i_system_expected;
+
+    return i_late <= 0 ? -i_late : 0;
+}
+
 /*****************************************************************************
  * ClockStreamToSystem: converts a movie clock to system date
  *****************************************************************************/
diff -aur vlc-1.1.0/src/input/clock.h vlc-1.1.0.new/src/input/clock.h
--- vlc-1.1.0/src/input/clock.h	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/input/clock.h	2010-06-25 00:16:45.802132508 +0200
@@ -138,5 +139,11 @@
  */
 mtime_t input_clock_GetJitter( input_clock_t * );
 
+/**
+ * This function returns the amount of microseconds buffered in relation to the given
+ * reference time.
+ */
+mtime_t input_clock_GetBuffered( input_clock_t *cl, mtime_t i_ck_system );
+
 #endif
 
diff -aur vlc-1.1.0/src/input/control.c vlc-1.1.0.new/src/input/control.c
--- vlc-1.1.0/src/input/control.c	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/input/control.c	2010-06-25 00:20:05.030027781 +0200
@@ -349,6 +349,13 @@
             vlc_mutex_unlock( &p_input->p->p_item->lock );
             return VLC_SUCCESS;
 
+        case INPUT_GET_BUFFERED:
+        {
+            mtime_t *pi_size = (mtime_t*)va_arg( args, mtime_t * );
+
+            return es_out_Control( p_input->p->p_es_out_display, ES_OUT_GET_BUFFERED, pi_size );
+        }
+
         case INPUT_ADD_SLAVE:
             psz = (char*)va_arg( args, char * );
             if( psz && *psz )
diff -aur vlc-1.1.0/src/input/es_out.c vlc-1.1.0.new/src/input/es_out.c
--- vlc-1.1.0/src/input/es_out.c	2010-06-18 09:16:38.000000000 +0200
+++ vlc-1.1.0.new/src/input/es_out.c	2010-06-25 00:17:48.720290073 +0200
@@ -2534,6 +2534,22 @@
             return VLC_SUCCESS;
         }
 
+        case ES_OUT_GET_BUFFERED:
+        {
+	        mtime_t *pi_time = va_arg( args, mtime_t* );
+
+            if( p_sys->b_buffering )
+                return VLC_EGENERIC;
+
+            es_out_pgrm_t *p_pgrm = p_sys->p_pgrm;
+            if( !p_pgrm )
+                return VLC_EGENERIC;
+
+            *pi_time = input_clock_GetBuffered( p_pgrm->p_clock, mdate() );
+
+            return VLC_SUCCESS;
+        }
+
         case ES_OUT_SET_DELAY:
         {
             const int i_cat = (int)va_arg( args, int );
diff -aur vlc-1.1.0/src/input/es_out.h vlc-1.1.0.new/src/input/es_out.h
--- vlc-1.1.0/src/input/es_out.h	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/input/es_out.h	2010-06-25 00:27:39.073514713 +0200
@@ -80,6 +80,9 @@
 
     /* Set jitter */
     ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
+
+    /* Get Decoder FIFO state */
+    ES_OUT_GET_BUFFERED,                            /* arg1=mtime_t* pi_time res=can fail */
 };
 
 static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
@@ -148,6 +151,10 @@
                                 i_pts_delay, i_pts_jitter, i_cr_average );
     assert( !i_ret );
 }
+static inline int es_out_GetBuffered( es_out_t *p_out, mtime_t *pi_time )
+{
+    return es_out_Control( p_out, ES_OUT_GET_BUFFERED, pi_time );
+}
 static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
                                        vlc_object_t **pp_decoder, vout_thread_t **pp_vout, aout_instance_t **pp_aout )
 {
diff -aur vlc-1.1.0/src/input/es_out_timeshift.c vlc-1.1.0.new/src/input/es_out_timeshift.c
--- vlc-1.1.0/src/input/es_out_timeshift.c	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/input/es_out_timeshift.c	2010-06-25 00:28:02.069881200 +0200
@@ -484,6 +484,22 @@
 
     return VLC_SUCCESS;
 }
+static int ControlLockedGetBuffered( es_out_t *p_out, mtime_t *pi_size )
+{
+    es_out_sys_t *p_sys = p_out->p_sys;
+
+    if( p_sys->b_delayed )
+    {
+        if( pi_size )
+            *pi_size = 0;
+    }
+    else
+    {
+        es_out_GetBuffered( p_sys->p_out, pi_size );
+    }
+
+    return VLC_SUCCESS;
+}
 static int ControlLockedSetPauseState( es_out_t *p_out, bool b_source_paused, bool b_paused, mtime_t i_date )
 {
     es_out_sys_t *p_sys = p_out->p_sys;
@@ -650,6 +666,11 @@
         bool *pb_buffering = (bool *)va_arg( args, bool* );
         return ControlLockedGetBuffering( p_out, pb_buffering );
     }
+    case ES_OUT_GET_BUFFERED:
+    {
+        mtime_t *pi_time = (mtime_t *)va_arg( args, mtime_t* );
+        return ControlLockedGetBuffered( p_out, pi_time );
+    }
     case ES_OUT_SET_PAUSE_STATE:
     {
         const bool b_source_paused = (bool)va_arg( args, int );
diff -aur vlc-1.1.0/src/libvlc.sym vlc-1.1.0.new/src/libvlc.sym
--- vlc-1.1.0/src/libvlc.sym	2010-04-13 02:22:28.000000000 +0200
+++ vlc-1.1.0.new/src/libvlc.sym	2010-06-25 00:41:46.279872145 +0200
@@ -108,6 +108,7 @@
 libvlc_media_player_next_frame
 libvlc_media_player_event_manager
 libvlc_media_player_get_agl
+libvlc_media_player_get_buffered_time
 libvlc_media_player_get_chapter
 libvlc_media_player_get_chapter_count
 libvlc_media_player_get_chapter_count_for_title
