]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_synchro.c
Remove leading line feeds (or while spaces). Fixes "http://www.yle.fi/java/areena...
[vlc] / src / video_output / vout_synchro.c
index 6293b5e5d42536983d1383fbffbdf983a0b720f7..047f7495283d6bead06b43ff34a01b17f1b67bf3 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vout_synchro.c : frame dropping routines
  *****************************************************************************
- * Copyright (C) 1999-2005 VideoLAN
+ * Copyright (C) 1999-2005 the VideoLAN team
  * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
@@ -20,7 +20,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*
@@ -48,7 +48,7 @@
  * T            : Picture period, T = 1/frame_rate.
  * tau[I,P,B]   : Mean time to decode an [I,P,B] picture.
  * tauYUV       : Mean time to render a picture (given by the video_output).
- * tau´[I,P,B] = 2 * tau[I,P,B] + tauYUV
+ * tau´[I,P,B] = 2 * tau[I,P,B] + tauYUV
  *              : Mean time + typical difference (estimated to tau/2, that
  *                needs to be confirmed) + render time.
  * DELTA        : A given error margin.
  * Otherwise :
  * We can decode an I picture if we simply have enough time to decode it
  * before displaying :
- *      t0 - t > tau´I + DELTA
+ *      t0 - t > tau´I + DELTA
  *
  * 5. Decoding of a P picture
  *    =======================
  * On fast machines, we decode all P's.
  * Otherwise :
  * First criterion : have time to decode it.
- *      t2 - t > tau´P + DELTA
+ *      t2 - t > tau´P + DELTA
  *
  * Second criterion : it shouldn't prevent us from displaying the forthcoming
  * I picture, which is more important.
- *      t12 - t > tau´P + tau´I + DELTA
+ *      t12 - t > tau´P + tau´I + DELTA
  *
  * 6. Decoding of a B picture
  *    =======================
  * On fast machines, we decode all B's. Otherwise :
- *      t1 - t > tau´B + DELTA
+ *      t1 - t > tau´B + DELTA
  * Since the next displayed I or P is already decoded, we don't have to
  * worry about it.
  *
 #include <string.h>                                    /* memcpy(), memset() */
 
 #include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/input.h>
-
-#include "vout_synchro.h"
+#include <vlc_vout.h>
+#include <vlc_input.h>
+#include <vlc_vout_synchro.h>
 
 /*
  * Local prototypes
@@ -172,7 +171,7 @@ void vout_SynchroReset( vout_synchro_t * p_synchro )
  * vout_SynchroChoose : Decide whether we will decode a picture or not
  *****************************************************************************/
 vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
-                               int i_render_time )
+                               int i_render_time, vlc_bool_t b_low_delay )
 {
 #define TAU_PRIME( coding_type )    (p_synchro->p_tau[(coding_type)] \
                                     + (p_synchro->p_tau[(coding_type)] >> 1) \
@@ -194,7 +193,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
     switch( i_coding_type )
     {
     case I_CODING_TYPE:
-        if( S.backward_pts )
+        if( b_low_delay )
+        {
+            pts = S.current_pts;
+        }
+        else if( S.backward_pts )
         {
             pts = S.backward_pts;
         }
@@ -225,7 +228,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
         break;
 
     case P_CODING_TYPE:
-        if( S.backward_pts )
+        if( b_low_delay )
+        {
+            pts = S.current_pts;
+        }
+        else if( S.backward_pts )
         {
             pts = S.backward_pts;
         }
@@ -352,7 +359,8 @@ mtime_t vout_SynchroDate( vout_synchro_t * p_synchro )
  *****************************************************************************/
 void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
                              int i_repeat_field, mtime_t next_pts,
-                             mtime_t next_dts, int i_current_rate )
+                             mtime_t next_dts, int i_current_rate,
+                             vlc_bool_t b_low_delay )
 {
     mtime_t         period = 1000000 * 1001 / p_synchro->i_frame_rate
                               * i_current_rate / INPUT_RATE_DEFAULT;
@@ -441,7 +449,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
                                         * (period >> 1);
 
 #define PTS_THRESHOLD   (period >> 2)
-    if( i_coding_type == B_CODING_TYPE )
+    if( i_coding_type == B_CODING_TYPE || b_low_delay )
     {
         /* A video frame can be displayed 1, 2 or 3 times, according to
          * repeat_first_field, top_field_first, progressive_sequence and