]> git.sesse.net Git - vlc/blobdiff - modules/stream_filter/record.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / stream_filter / record.c
index 51fd62370e75ad058cd7784eb0317e0ec49e09be..9ce1c60bd90456b95db8cae56fce1a8d1d1ad3e2 100644 (file)
@@ -34,7 +34,7 @@
 #include <assert.h>
 #include <vlc_stream.h>
 #include <vlc_input.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
 
 
 /*****************************************************************************
@@ -175,12 +175,9 @@ static int Start( stream_t *s, const char *psz_extension )
         psz_extension = "dat";
 
     /* Retreive path */
-    char *psz_path = var_CreateGetString( s, "input-record-path" );
-    if( !psz_path || *psz_path == '\0' )
-    {
-        free( psz_path );
-        psz_path = strdup( config_GetHomeDir() );
-    }
+    char *psz_path = var_CreateGetNonEmptyString( s, "input-record-path" );
+    if( !psz_path )
+        psz_path = config_GetUserDir( VLC_DOWNLOAD_DIR );
 
     if( !psz_path )
         return VLC_ENOMEM;
@@ -194,12 +191,16 @@ static int Start( stream_t *s, const char *psz_extension )
     if( !psz_file )
         return VLC_ENOMEM;
 
-    f = utf8_fopen( psz_file, "wb" );
+    f = vlc_fopen( psz_file, "wb" );
     if( !f )
     {
         free( psz_file );
         return VLC_EGENERIC;
     }
+
+    /* signal new record file */
+    var_SetString( s->p_libvlc, "record-file", psz_file );
+
     msg_Dbg( s, "Recording into %s", psz_file );
     free( psz_file );