diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-28 14:29:41 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-28 14:29:41 +0000 |
commit | 52422f3769f4ba68cead01a28af30ca839c5ad97 (patch) | |
tree | 3376ae88e6359a2515e382a19c149a05beab57ad /mplayer.c | |
parent | 90e4cb1c23fc7009c02614cac0b52d9ae88ee663 (diff) | |
download | mpv-52422f3769f4ba68cead01a28af30ca839c5ad97.tar.bz2 mpv-52422f3769f4ba68cead01a28af30ca839c5ad97.tar.xz |
The patch adds support for a per-file config, which is loaded before
playing the file. The config file is looked for in the same directory
as the input file, and in the ~/.mplayer dir.
Magne Oestlyngen <ml@skybert.org>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8615 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -521,6 +521,39 @@ if ((conffile = get_path("")) == NULL) { } } +void load_per_file_config (m_config_t* conf, const char *const file) +{ + char *confpath; + char cfg[PATH_MAX]; + struct stat st; + char *name; + + sprintf (cfg, "%s.conf", file); + + if (!stat (cfg, &st)) + { + mp_msg(MSGT_CPLAYER,MSGL_INFO,"Loading config '%s'\n", cfg); + m_config_parse_config_file (conf, cfg); + return; + } + + if ((name = strrchr (cfg, '/')) == NULL) + name = cfg; + else + name++; + + if ((confpath = get_path (name)) != NULL) + { + if (!stat (confpath, &st)) + { + mp_msg(MSGT_CPLAYER,MSGL_INFO,"Loading config '%s'\n", confpath); + m_config_parse_config_file (conf, confpath); + } + + free (confpath); + } +} + // When libmpdemux perform a blocking operation (network connection or cache filling) // if the operation fail we use this function to check if it was interrupted by the user. // The function return a new value for eof. @@ -971,6 +1004,8 @@ current_module = NULL; play_next_file: + if (filename) load_per_file_config (mconfig, filename); + // We must enable getch2 here to be able to interrupt network connection // or cache filling if(!use_stdin && !slave_mode){ |