]> git.sesse.net Git - vlc/blobdiff - src/input/es_out_timeshift.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / input / es_out_timeshift.c
index d6502349d36aa1b098b08d525bd87f17de741e42..3ac19d5abd660db7efdf1b2728c0c25205670ebe 100644 (file)
 #endif
 
 #include <vlc_common.h>
-#include <vlc_charset.h>
-
+#include <vlc_fs.h>
+#ifdef WIN32
+#  include <vlc_charset.h>
+#endif
 #include <vlc_input.h>
 #include <vlc_es_out.h>
 #include <vlc_block.h>
@@ -130,6 +132,7 @@ typedef struct attribute_packed
         struct
         {
             mtime_t i_pts_delay;
+            mtime_t i_pts_jitter;
             int     i_cr_average;
         } jitter;
     } u;
@@ -329,7 +332,7 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out
         p_sys->i_tmp_size_max = 50*1024*1024;
     else
         p_sys->i_tmp_size_max = __MAX( i_tmp_size_max, 1*1024*1024 );
-    msg_Dbg( p_input, "using timeshift granularity of %d MBytes",
+    msg_Dbg( p_input, "using timeshift granularity of %d MiB",
              (int)p_sys->i_tmp_size_max/(1024*1024) );
 
     char *psz_tmp_path = var_CreateGetNonEmptyString( p_input, "input-timeshift-path" );
@@ -505,7 +508,7 @@ static int ControlLockedSetPauseState( es_out_t *p_out, bool b_source_paused, bo
             /* XXX we may do it BUT it would be better to finish the clock clean up+improvments
              * and so be able to advertize correctly pace control property in access
              * module */
-            msg_Err( p_sys->p_input, "EsOutTimeshift does not work with streams that have space control" );
+            msg_Err( p_sys->p_input, "EsOutTimeshift does not work with streams that have pace control" );
         }
     }
 
@@ -540,7 +543,7 @@ static int ControlLockedSetRate( es_out_t *p_out, int i_src_rate, int i_rate )
             /* XXX we may do it BUT it would be better to finish the clock clean up+improvments
              * and so be able to advertize correctly pace control property in access
              * module */
-            msg_Err( p_sys->p_input, "EsOutTimeshift does not work with streams that have space control" );
+            msg_Err( p_sys->p_input, "EsOutTimeshift does not work with streams that have pace control" );
         }
 
     }
@@ -630,7 +633,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
         }
         return es_out_Control( p_sys->p_out, ES_OUT_GET_ES_STATE, p_es->p_es, pb_enabled );
     }
-
     /* Special internal input control */
     case ES_OUT_GET_EMPTY:
     {
@@ -678,7 +680,8 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
             return VLC_EGENERIC;
 
         mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * );
-        return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system );
+        mtime_t *pi_delay  = (mtime_t*)va_arg( args, mtime_t * );
+        return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system, pi_delay );
     }
     case ES_OUT_MODIFY_PCR_SYSTEM:
     {
@@ -690,6 +693,13 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
 
         return es_out_ControlModifyPcrSystem( p_sys->p_out, b_absolute, i_system );
     }
+    case ES_OUT_GET_GROUP_FORCED:
+    {
+        int *pi_group = va_arg( args, int * );
+        return es_out_Control( p_sys->p_out, ES_OUT_GET_GROUP_FORCED, pi_group );
+    }
+
+
     default:
         msg_Err( p_sys->p_input, "Unknown es_out_Control query !" );
         assert(0);
@@ -1064,14 +1074,14 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
     p_storage->i_file_size = 0;
     p_storage->p_filew = GetTmpFile( &p_storage->psz_file, psz_tmp_path );
     if( p_storage->psz_file )
-        p_storage->p_filer = utf8_fopen( p_storage->psz_file, "rb" );
+        p_storage->p_filer = vlc_fopen( p_storage->psz_file, "rb" );
 
     /* */
     p_storage->i_cmd_w = 0;
     p_storage->i_cmd_r = 0;
     p_storage->i_cmd_max = 30000;
     p_storage->p_cmd = malloc( p_storage->i_cmd_max * sizeof(*p_storage->p_cmd) );
-    //fprintf( stderr, "\nSTORAGE name=%s size=%d kbytes\n", p_storage->psz_file, p_storage->i_cmd_max * sizeof(*p_storage->p_cmd) /1024 );
+    //fprintf( stderr, "\nSTORAGE name=%s size=%d KiB\n", p_storage->psz_file, p_storage->i_cmd_max * sizeof(*p_storage->p_cmd) /1024 );
 
     if( !p_storage->p_cmd || !p_storage->p_filew || !p_storage->p_filer )
     {
@@ -1099,7 +1109,7 @@ static void TsStorageDelete( ts_storage_t *p_storage )
 
     if( p_storage->psz_file )
     {
-        utf8_unlink( p_storage->psz_file );
+        vlc_unlink( p_storage->psz_file );
         free( p_storage->psz_file );
     }
 
@@ -1423,9 +1433,11 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
     case ES_OUT_SET_JITTER:
     {
         mtime_t i_pts_delay = (mtime_t)va_arg( args, mtime_t );
+        mtime_t i_pts_jitter = (mtime_t)va_arg( args, mtime_t );
         int     i_cr_average = (int)va_arg( args, int );
 
         p_cmd->u.control.u.jitter.i_pts_delay = i_pts_delay;
+        p_cmd->u.control.u.jitter.i_pts_jitter = i_pts_jitter;
         p_cmd->u.control.u.jitter.i_cr_average = i_cr_average;
         break;
     }
@@ -1495,6 +1507,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
                                                p_cmd->u.control.u.times.i_length );
     case ES_OUT_SET_JITTER:
         return es_out_Control( p_out, i_query, p_cmd->u.control.u.jitter.i_pts_delay,
+                                               p_cmd->u.control.u.jitter.i_pts_jitter,
                                                p_cmd->u.control.u.jitter.i_cr_average );
 
     default:
@@ -1533,9 +1546,9 @@ static char *GetTmpPath( char *psz_path )
     {
         /* Make sure that the path exists and is a directory */
         struct stat s;
-        const int i_ret = utf8_stat( psz_path, &s );
+        const int i_ret = vlc_stat( psz_path, &s );
 
-        if( i_ret < 0 && !utf8_mkdir( psz_path, 0600 ) )
+        if( i_ret < 0 && !vlc_mkdir( psz_path, 0600 ) )
             return psz_path;
         else if( i_ret == 0 && ( s.st_mode & S_IFDIR ) )
             return psz_path;
@@ -1590,7 +1603,7 @@ static FILE *GetTmpFile( char **ppsz_file, const char *psz_path )
         return NULL;
 
     /* */
-    fd = utf8_mkstemp( psz_name );
+    fd = vlc_mkstemp( psz_name );
     *ppsz_file = psz_name;
 
     if( fd < 0 )