]> git.sesse.net Git - vlc/blobdiff - src/input/decoder_synchro.c
Don't clutter REGISTRY on windows...
[vlc] / src / input / decoder_synchro.c
index 89ef646a2c3d2de8fd56e056623a9b6dc9a6b72c..f28aea476921305b37cf9069d09472996ddd9aa5 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 #include <vlc_input.h>
+#include <vlc_codec.h>
 #include <vlc_codec_synchro.h>
 
 /*
 
 struct decoder_synchro_t
 {
-    VLC_COMMON_MEMBERS
+    /* */
+    decoder_t       *p_dec;
 
+    /* */
     int             i_frame_rate;
     int             i_current_rate;
-    vlc_bool_t      b_no_skip;
-    vlc_bool_t      b_quiet;
+    bool      b_no_skip;
+    bool      b_quiet;
 
     /* date of the beginning of the decoding of the current picture */
     mtime_t         decoding_start;
@@ -153,18 +160,14 @@ struct decoder_synchro_t
 /*****************************************************************************
  * decoder_SynchroInit : You know what ?
  *****************************************************************************/
-decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec,
-                                     int i_frame_rate )
+decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec, int i_frame_rate )
 {
-    decoder_synchro_t * p_synchro = vlc_object_create( p_dec,
-                                                  sizeof(decoder_synchro_t) );
+    decoder_synchro_t * p_synchro = malloc( sizeof(*p_synchro) );
     if ( p_synchro == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return NULL;
-    }
-    vlc_object_attach( p_synchro, p_dec );
+    memset( p_synchro, 0, sizeof(*p_synchro) );
 
+    p_synchro->p_dec = p_dec;
     p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" );
     p_synchro->b_quiet = config_GetInt( p_dec, "quiet-synchro" );
 
@@ -191,8 +194,7 @@ decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec,
  *****************************************************************************/
 void decoder_SynchroRelease( decoder_synchro_t * p_synchro )
 {
-    vlc_object_detach( p_synchro );
-    vlc_object_destroy( p_synchro );
+    free( p_synchro );
 }
 
 /*****************************************************************************
@@ -207,8 +209,8 @@ void decoder_SynchroReset( decoder_synchro_t * p_synchro )
 /*****************************************************************************
  * decoder_SynchroChoose : Decide whether we will decode a picture or not
  *****************************************************************************/
-vlc_bool_t decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
-                               int i_render_time, vlc_bool_t b_low_delay )
+bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
+                               int i_render_time, bool b_low_delay )
 {
 #define TAU_PRIME( coding_type )    (p_synchro->p_tau[(coding_type)] \
                                     + (p_synchro->p_tau[(coding_type)] >> 1) \
@@ -216,7 +218,7 @@ vlc_bool_t decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_ty
 #define S (*p_synchro)
     mtime_t         now, period;
     mtime_t         pts = 0;
-    vlc_bool_t      b_decode = 0;
+    bool      b_decode = 0;
 
     if ( p_synchro->b_no_skip )
         return 1;
@@ -259,8 +261,8 @@ vlc_bool_t decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_ty
         }
         if( !b_decode && !p_synchro->b_quiet )
         {
-            msg_Warn( p_synchro,
-                      "synchro trashing I ("I64Fd")", pts - now );
+            msg_Warn( p_synchro->p_dec,
+                      "synchro trashing I (%"PRId64")", pts - now );
         }
         break;
 
@@ -355,7 +357,7 @@ void decoder_SynchroDecode( decoder_synchro_t * p_synchro )
  * decoder_SynchroEnd : Called when the image is totally decoded
  *****************************************************************************/
 void decoder_SynchroEnd( decoder_synchro_t * p_synchro, int i_coding_type,
-                      vlc_bool_t b_garbage )
+                      bool b_garbage )
 {
     mtime_t     tau;
 
@@ -397,7 +399,7 @@ mtime_t decoder_SynchroDate( decoder_synchro_t * p_synchro )
 void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type,
                              int i_repeat_field, mtime_t next_pts,
                              mtime_t next_dts, int i_current_rate,
-                             vlc_bool_t b_low_delay )
+                             bool b_low_delay )
 {
     mtime_t         period = 1000000 * 1001 / p_synchro->i_frame_rate
                               * i_current_rate / INPUT_RATE_DEFAULT;
@@ -414,7 +416,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
         {
 #if 0
             if( !p_synchro->b_quiet )
-                msg_Dbg( p_synchro,
+                msg_Dbg( p_synchro->p_dec,
                          "stream periodicity changed from P[%d] to P[%d]",
                          p_synchro->i_n_p, p_synchro->i_eta_p );
 #endif
@@ -429,8 +431,8 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
 
 #if 0
         if( !p_synchro->b_quiet )
-            msg_Dbg( p_synchro, "I("I64Fd") P("I64Fd")[%d] B("I64Fd")"
-                  "[%d] YUV("I64Fd") : trashed %d:%d/%d",
+            msg_Dbg( p_synchro->p_dec, "I(%"PRId64") P(%"PRId64")[%d] B(%"PRId64")"
+                  "[%d] YUV(%"PRId64") : trashed %d:%d/%d",
                   p_synchro->p_tau[I_CODING_TYPE],
                   p_synchro->p_tau[P_CODING_TYPE],
                   p_synchro->i_n_p,
@@ -447,7 +449,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
         if( p_synchro->i_pic >= 100 )
         {
             if( !p_synchro->b_quiet && p_synchro->i_trashed_pic != 0 )
-                msg_Dbg( p_synchro, "decoded %d/%d pictures",
+                msg_Dbg( p_synchro->p_dec, "decoded %d/%d pictures",
                          p_synchro->i_pic
                            - p_synchro->i_trashed_pic,
                          p_synchro->i_pic );
@@ -464,7 +466,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
         {
 #if 0
             if( !p_synchro->b_quiet )
-                msg_Dbg( p_synchro,
+                msg_Dbg( p_synchro->p_dec,
                          "stream periodicity changed from B[%d] to B[%d]",
                          p_synchro->i_n_b, p_synchro->i_eta_b );
 #endif
@@ -500,8 +502,8 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
                   || p_synchro->current_pts - next_pts
                     > PTS_THRESHOLD) && !p_synchro->b_quiet )
             {
-                msg_Warn( p_synchro, "decoder synchro warning: pts != "
-                          "current_date ("I64Fd")",
+                msg_Warn( p_synchro->p_dec, "decoder synchro warning: pts != "
+                          "current_date (%"PRId64")",
                           p_synchro->current_pts
                               - next_pts );
             }
@@ -521,7 +523,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
                   || p_synchro->backward_pts - next_dts
                     > PTS_THRESHOLD) && !p_synchro->b_quiet )
             {
-                msg_Warn( p_synchro, "backward_pts != dts ("I64Fd")",
+                msg_Warn( p_synchro->p_dec, "backward_pts != dts (%"PRId64")",
                            next_dts
                                - p_synchro->backward_pts );
             }
@@ -530,8 +532,8 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
                   || p_synchro->current_pts - p_synchro->backward_pts
                     > PTS_THRESHOLD) && !p_synchro->b_quiet )
             {
-                msg_Warn( p_synchro,
-                          "backward_pts != current_pts ("I64Fd")",
+                msg_Warn( p_synchro->p_dec,
+                          "backward_pts != current_pts (%"PRId64")",
                           p_synchro->current_pts
                               - p_synchro->backward_pts );
             }
@@ -545,7 +547,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
                   || p_synchro->current_pts - next_dts
                     > PTS_THRESHOLD) && !p_synchro->b_quiet )
             {
-                msg_Warn( p_synchro, "dts != current_pts ("I64Fd")",
+                msg_Warn( p_synchro->p_dec, "dts != current_pts (%"PRId64")",
                           p_synchro->current_pts
                               - next_dts );
             }
@@ -570,7 +572,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
         /* We cannot be _that_ late, something must have happened, reinit
          * the dates. */
         if( !p_synchro->b_quiet )
-            msg_Warn( p_synchro, "PTS << now ("I64Fd"), resetting",
+            msg_Warn( p_synchro->p_dec, "PTS << now (%"PRId64"), resetting",
                       now - p_synchro->current_pts - DEFAULT_PTS_DELAY );
         p_synchro->current_pts = now + DEFAULT_PTS_DELAY;
     }