]> git.sesse.net Git - vlc/blobdiff - src/input/es_out_timeshift.c
Added timeshift options (input-timeshift-granularity/input-timeshift-path).
[vlc] / src / input / es_out_timeshift.c
index 9d0bf8388875ef26b20433acfb1ffe328a6f43e6..818c02164ac7076617c0e095765498563fbaca60 100644 (file)
@@ -59,8 +59,6 @@ enum
     C_SEND,
     C_DEL,
     C_CONTROL,
-
-    C_MAX
 };
 
 typedef struct
@@ -308,12 +306,18 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out
 
     TAB_INIT( p_sys->i_es, p_sys->pp_es );
 
-    /* TODO config
-     * timeshift-granularity
-     * timeshift-path
-     */
-    p_sys->i_tmp_size_max = 50 * 1024*1024;
-    p_sys->psz_tmp_path = GetTmpPath( NULL );
+    /* */
+    const int i_tmp_size_max = var_CreateGetInteger( p_input, "input-timeshift-granularity" );
+    if( i_tmp_size_max < 0 )
+        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 bytes",
+             (int)p_sys->i_tmp_size_max );
+
+    char *psz_tmp_path = var_CreateGetNonEmptyString( p_input, "input-timeshift-path" );
+    p_sys->psz_tmp_path = GetTmpPath( psz_tmp_path );
+    msg_Dbg( p_input, "using timeshift  path '%s'", p_sys->psz_tmp_path );
 
     return p_out;
 }
@@ -764,6 +768,8 @@ static void TsPushCmd( ts_thread_t *p_ts, ts_cmd_t *p_cmd )
         if( !p_storage )
         {
             CmdClean( p_cmd );
+            vlc_mutex_unlock( &p_ts->lock );
+            /* TODO warn the user (but only once) */
             return;
         }
 
@@ -779,6 +785,7 @@ static void TsPushCmd( ts_thread_t *p_ts, ts_cmd_t *p_cmd )
         }
     }
 
+    /* TODO return error and warn the user (but only once) */
     TsStoragePushCmd( p_ts->p_storage_w, p_cmd, p_ts->p_storage_r == p_ts->p_storage_w );
 
     vlc_cond_signal( &p_ts->wait );
@@ -1143,7 +1150,7 @@ static void TsStoragePopCmd( ts_storage_t *p_storage, ts_cmd_t *p_cmd )
         }
         else
         {
-            fprintf( stderr, "----------------- 2: %m\n" );
+            //fprintf( stderr, "TsStoragePopCmd: %m\n" );
             p_cmd->send.p_block = block_Alloc( 1 );
         }
     }