]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/mediadirs.c
Shortname corrections
[vlc] / modules / services_discovery / mediadirs.c
index 425beb59b59c75cf3a766c5d0c602c70ff68a6cf..d948f78891e6cd5184793aa8b7d5fff2095cd5e3 100644 (file)
@@ -61,30 +61,33 @@ OPEN_MODULE( Picture )
 
 #undef OPEN_MODULE
 
+static int vlc_sd_probe_Open( vlc_object_t * );
+
 vlc_module_begin ()
     set_category( CAT_PLAYLIST )
     set_subcategory( SUBCAT_PLAYLIST_SD )
 
-        set_shortname( "Video" )
+        set_shortname( N_("Video") )
         set_description( N_("My Videos") )
         set_capability( "services_discovery", 10 )
         set_callbacks( OpenVideo, Close )
         add_shortcut( "video_dir" )
 
     add_submodule ()
-        set_shortname( "Audio" )
+        set_shortname( N_("Audio") )
         set_description( N_("My Music") )
         set_capability( "services_discovery", 10 )
         set_callbacks( OpenAudio, Close )
         add_shortcut( "audio_dir" )
 
     add_submodule ()
-        set_shortname( "Picture")
+        set_shortname( N_("Picture") )
         set_description( N_("My Pictures") )
         set_capability( "services_discovery", 10 )
         set_callbacks( OpenPicture, Close )
         add_shortcut( "picture_dir" )
 
+    VLC_SD_PROBE_SUBMODULE
 vlc_module_end ()
 
 
@@ -107,7 +110,7 @@ struct services_discovery_sys_t
     enum type_e i_type;
 
     char* psz_dir[2];
-    char* psz_var;
+    const char* psz_var;
 };
 
 /*****************************************************************************
@@ -129,21 +132,21 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
         p_sys->psz_dir[0] = config_GetUserDir( VLC_VIDEOS_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
 
-        p_sys->psz_var = strdup( "record-file" );
+        p_sys->psz_var = "record-file";
     }
     else if( p_sys->i_type == Audio )
     {
         p_sys->psz_dir[0] = config_GetUserDir( VLC_MUSIC_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "input-record-path" );
 
-        p_sys->psz_var = strdup( "record-file" );
+        p_sys->psz_var = "record-file";
     }
     else if( p_sys->i_type == Picture )
     {
         p_sys->psz_dir[0] = config_GetUserDir( VLC_PICTURES_DIR );
         p_sys->psz_dir[1] = var_CreateGetString( p_sd, "snapshot-path" );
 
-        p_sys->psz_var = strdup( "snapshot-file" );
+        p_sys->psz_var = "snapshot-file";
     }
     else
     {
@@ -156,7 +159,6 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
     if( vlc_clone( &p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW ) )
     {
         var_DelCallback( p_sd->p_libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
-        free( p_sys->psz_var );
         free( p_sys->psz_dir[1] );
         free( p_sys->psz_dir[0] );
         free( p_sys );
@@ -233,7 +235,6 @@ static void Close( vlc_object_t *p_this )
 
     var_DelCallback( p_sd->p_libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
 
-    free( p_sys->psz_var );
     free( p_sys->psz_dir[1] );
     free( p_sys->psz_dir[0] );
     free( p_sys );
@@ -349,3 +350,12 @@ enum type_e fileType( services_discovery_t *p_sd, const char* psz_file )
     free( psz_dir );
     return i_ret;
 }
+
+static int vlc_sd_probe_Open( vlc_object_t *obj )
+{
+    vlc_probe_t *probe = (vlc_probe_t *)obj;
+
+    vlc_sd_probe_Add( probe, "video_dir", N_("My Videos") );
+    vlc_sd_probe_Add( probe, "audio_dir", N_("My Music") );
+    return vlc_sd_probe_Add( probe, "picture_dir", N_("My Pictures") );
+}