]> git.sesse.net Git - vlc/blobdiff - modules/access/pvr.c
Use var_Inherit* when applicable.
[vlc] / modules / access / pvr.c
index 0247a88dcea752c50206fb2ecdd3c4a36eb9f4e7..2bd417e0694e1ca8c37ed8e9a0abe8b52a2f6127 100644 (file)
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_access.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
+#include <vlc_url.h>
 
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <linux/types.h>
@@ -560,24 +560,24 @@ static int Open( vlc_object_t * p_this )
     /* defaults values */
     var_Create( p_access, "pvr-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
 
-    p_sys->psz_videodev = var_CreateGetString( p_access, "pvr-device" );
-    p_sys->psz_radiodev = var_CreateGetString( p_access, "pvr-radio-device" );
-    p_sys->i_standard   = var_CreateGetInteger( p_access, "pvr-norm" );
-    p_sys->i_width      = var_CreateGetInteger( p_access, "pvr-width" );
-    p_sys->i_height     = var_CreateGetInteger( p_access, "pvr-height" );
-    p_sys->i_frequency  = var_CreateGetInteger( p_access, "pvr-frequency" );
-    p_sys->i_framerate  = var_CreateGetInteger( p_access, "pvr-framerate" );
-    p_sys->i_keyint     = var_CreateGetInteger( p_access, "pvr-keyint" );
-    p_sys->i_bframes    = var_CreateGetInteger( p_access, "pvr-bframes" );
-    p_sys->i_bitrate    = var_CreateGetInteger( p_access, "pvr-bitrate" );
-    p_sys->i_bitrate_peak  = var_CreateGetInteger( p_access, "pvr-bitrate-peak" );
-    p_sys->i_bitrate_mode  = var_CreateGetInteger( p_access, "pvr-bitrate-mode" );
-    p_sys->i_audio_bitmask = var_CreateGetInteger( p_access, "pvr-audio-bitmask" );
-    p_sys->i_volume     = var_CreateGetInteger( p_access, "pvr-audio-volume" );
-    p_sys->i_input      = var_CreateGetInteger( p_access, "pvr-channel" );
+    p_sys->psz_videodev = var_InheritString( p_access, "pvr-device" );
+    p_sys->psz_radiodev = var_InheritString( p_access, "pvr-radio-device" );
+    p_sys->i_standard   = var_InheritInteger( p_access, "pvr-norm" );
+    p_sys->i_width      = var_InheritInteger( p_access, "pvr-width" );
+    p_sys->i_height     = var_InheritInteger( p_access, "pvr-height" );
+    p_sys->i_frequency  = var_InheritInteger( p_access, "pvr-frequency" );
+    p_sys->i_framerate  = var_InheritInteger( p_access, "pvr-framerate" );
+    p_sys->i_keyint     = var_InheritInteger( p_access, "pvr-keyint" );
+    p_sys->i_bframes    = var_InheritInteger( p_access, "pvr-bframes" );
+    p_sys->i_bitrate    = var_InheritInteger( p_access, "pvr-bitrate" );
+    p_sys->i_bitrate_peak  = var_InheritInteger( p_access, "pvr-bitrate-peak" );
+    p_sys->i_bitrate_mode  = var_InheritInteger( p_access, "pvr-bitrate-mode" );
+    p_sys->i_audio_bitmask = var_InheritInteger( p_access, "pvr-audio-bitmask" );
+    p_sys->i_volume     = var_InheritInteger( p_access, "pvr-audio-volume" );
+    p_sys->i_input      = var_InheritInteger( p_access, "pvr-channel" );
 
     /* parse command line options */
-    psz_tofree = strdup( p_access->psz_path );
+    psz_tofree = strdup( p_access->psz_location );
     if( !psz_tofree )
     {
         free( p_sys->psz_radiodev );
@@ -593,7 +593,7 @@ static int Open( vlc_object_t * p_this )
         if( *psz_parser == '/' )
         {
             free( p_sys->psz_videodev );
-            p_sys->psz_videodev = strdup( psz_parser );
+            p_sys->psz_videodev = decode_URI_duplicate( psz_parser );
             break;
         }
 
@@ -664,7 +664,7 @@ static int Open( vlc_object_t * p_this )
     free( psz_tofree );
 
     /* open the device */
-    p_sys->i_fd = utf8_open( p_sys->psz_videodev, O_RDWR );
+    p_sys->i_fd = vlc_open( p_sys->psz_videodev, O_RDWR );
     if( p_sys->i_fd < 0 )
     {
         msg_Err( p_access, "Cannot open device %s (%m).",
@@ -774,7 +774,7 @@ static int Open( vlc_object_t * p_this )
         if ( (p_sys->i_frequency >= pi_radio_range[0])
               && (p_sys->i_frequency <= pi_radio_range[1]) )
         {
-            p_sys->i_radio_fd = utf8_open( p_sys->psz_radiodev, O_RDWR );
+            p_sys->i_radio_fd = vlc_open( p_sys->psz_radiodev, O_RDWR );
             if( p_sys->i_radio_fd < 0 )
             {
                 msg_Err( p_access, "Cannot open radio device (%m)." );
@@ -970,7 +970,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         /* */
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
-            *pi_64 = (int64_t)var_GetInteger( p_access, "pvr-caching" ) * 1000;
+            *pi_64 = var_GetInteger( p_access, "pvr-caching" ) * 1000;
             break;
 
         /* */