Advertisement
Guest User

preroll

a guest
Jan 14th, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.31 KB | None | 0 0
  1.  
  2. diff --git a/src/input/es_out.c b/src/input/es_out.c
  3. index 89bff72..34a246d 100644
  4. --- a/src/input/es_out.c
  5. +++ b/src/input/es_out.c
  6. @@ -159,6 +159,7 @@ struct es_out_sys_t
  7.  
  8.      /* Current preroll */
  9.      mtime_t     i_preroll_end;
  10. +    bool        b_prerolling;
  11.  
  12.      /* Used for buffering */
  13.      bool        b_buffering;
  14. @@ -322,6 +323,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
  15.      p_sys->i_buffering_extra_stream = 0;
  16.      p_sys->i_buffering_extra_system = 0;
  17.      p_sys->i_preroll_end = -1;
  18. +    p_sys->b_prerolling = false;
  19.  
  20.      p_sys->p_sout_record = NULL;
  21.  
  22. @@ -622,6 +624,7 @@ static void EsOutChangePosition( es_out_t *out )
  23.      p_sys->i_buffering_extra_stream = 0;
  24.      p_sys->i_buffering_extra_system = 0;
  25.      p_sys->i_preroll_end = -1;
  26. +    p_sys->b_prerolling = false;
  27.  }
  28.  
  29.  
  30. @@ -664,6 +667,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
  31.                (int)(i_stream_duration/1000), (int)(i_system_duration/1000) );
  32.      p_sys->b_buffering = false;
  33.      p_sys->i_preroll_end = -1;
  34. +    p_sys->b_prerolling = false;
  35.  
  36.      if( p_sys->i_buffering_extra_initial > 0 )
  37.      {
  38. @@ -851,6 +855,7 @@ static void EsOutFrameNext( es_out_t *out )
  39.                                                  INPUT_RATE_DEFAULT / i_rate;
  40.  
  41.      p_sys->i_preroll_end = -1;
  42. +    p_sys->b_prerolling = false;
  43.  }
  44.  static mtime_t EsOutGetBuffering( es_out_t *out )
  45.  {
  46. @@ -1946,7 +1951,7 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
  47.      vlc_mutex_lock( &p_sys->lock );
  48.  
  49.      /* Mark preroll blocks */
  50. -    if( p_sys->i_preroll_end >= 0 )
  51. +    if( p_sys->b_prerolling )
  52.      {
  53.          int64_t i_date = p_block->i_pts;
  54.          if( p_block->i_pts <= VLC_TS_INVALID )
  55. @@ -1954,6 +1959,9 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
  56.  
  57.          if( i_date < p_sys->i_preroll_end )
  58.              p_block->i_flags |= BLOCK_FLAG_PREROLL;
  59. +        else
  60. +            p_sys->b_prerolling = false;
  61. +
  62.      }
  63.  
  64.      if( !es->p_dec )
  65. @@ -2440,6 +2448,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
  66.                  return VLC_EGENERIC;
  67.  
  68.              p_sys->i_preroll_end = i_date;
  69. +            p_sys->b_prerolling = (i_date >= 0);
  70.  
  71.              return VLC_SUCCESS;
  72.          }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement