changeset 34114:113156bc1137

Ensure that filename related config will always be loaded. Currently, filename related config will only be loaded if MPlayer knows the filename when it gets called, which isn't the case if either MPlayer is called in slave mode or the GUI is called without file argument. In either case, the file to be played is known only later. If filename related config hasn't yet been read, do it after leaving the idle mode loop.
author ib
date Sat, 15 Oct 2011 11:07:29 +0000
parents b3e209516ae0
children 3d7ee643b110
files mplayer.c
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Sat Oct 15 10:37:36 2011 +0000
+++ b/mplayer.c	Sat Oct 15 11:07:29 2011 +0000
@@ -990,6 +990,17 @@
     }
 }
 
+static int load_profile_config(m_config_t *conf, const char *const file)
+{
+    if (file) {
+        load_per_protocol_config(conf, file);
+        load_per_extension_config(conf, file);
+        load_per_file_config(conf, file);
+    }
+
+    return file != NULL;
+}
+
 /* When libmpdemux performs a blocking operation (network connection or
  * cache filling) if the operation fails we use this function to check
  * if it was interrupted by the user.
@@ -2719,6 +2730,7 @@
 int main(int argc, char *argv[])
 {
     int opt_exit = 0; // Flag indicating whether MPlayer should exit without playing anything.
+    int profile_config_loaded;
     int i;
 
     common_preinit();
@@ -3016,11 +3028,7 @@
     mpctx->global_sub_size = 0;
     memset(mpctx->sub_counts, 0, sizeof(mpctx->sub_counts));
 
-    if (filename) {
-        load_per_protocol_config(mconfig, filename);
-        load_per_extension_config(mconfig, filename);
-        load_per_file_config(mconfig, filename);
-    }
+    profile_config_loaded = load_profile_config(mconfig, filename);
 
     if (video_driver_list)
         load_per_output_config(mconfig, PROFILE_CFG_VO, video_driver_list[0]);
@@ -3115,6 +3123,8 @@
             filename = play_tree_iter_get_file(mpctx->playtree_iter, 1);
         }
     }
+
+    if (!profile_config_loaded) load_profile_config(mconfig, filename);
 //---------------------------------------------------------------------------
 
     if (mpctx->video_out && vo_config_count)