summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-18 01:40:20 +0200
committerwm4 <wm4@nowhere>2014-06-18 01:58:05 +0200
commitc048b5db02333ad198ac1bd9ca793b31efdaff1f (patch)
treeacd4a4244b4d1c4d38005b9276d14068b831574e
parentc48dd85821445d701caa02d2b619294e4982d62b (diff)
downloadmpv-c048b5db02333ad198ac1bd9ca793b31efdaff1f.tar.bz2
mpv-c048b5db02333ad198ac1bd9ca793b31efdaff1f.tar.xz
options: allow adding multiple files with --audio-file
At least 1 person expected that this works this way.
-rw-r--r--DOCS/man/en/options.rst5
-rw-r--r--options/options.c2
-rw-r--r--options/options.h2
-rw-r--r--player/loadfile.c6
4 files changed, 9 insertions, 6 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 051158191b..956b78f11a 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -274,8 +274,9 @@ OPTIONS
This option has no influence on files with normal video tracks.
``--audio-file=<filename>``
- Play audio from an external file (WAV, MP3 or Ogg Vorbis) while viewing a
- movie.
+ Play audio from an external file while viewing a video. Each use of this
+ option will add a new audio track. The details are similar to how
+ ``--sub-file`` works.
``--audio-format=<format>``
Select the sample format used for output from the audio filter layer to
diff --git a/options/options.c b/options/options.c
index b03e8738ca..e2ce57955e 100644
--- a/options/options.c
+++ b/options/options.c
@@ -206,7 +206,7 @@ const m_option_t mp_opts[] = {
#endif
// demuxer.c - select audio/sub file/demuxer
- OPT_STRING("audio-file", audio_stream, 0),
+ OPT_STRING_APPEND_LIST("audio-file", audio_files, 0),
OPT_STRING("demuxer", demuxer_name, 0),
OPT_STRING("audio-demuxer", audio_demuxer_name, 0),
OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
diff --git a/options/options.h b/options/options.h
index f547675bb6..110a16701c 100644
--- a/options/options.h
+++ b/options/options.h
@@ -178,7 +178,7 @@ typedef struct MPOpts {
int sub_fix_timing;
char *sub_cp;
- char *audio_stream;
+ char **audio_files;
char *demuxer_name;
char *audio_demuxer_name;
char *sub_demuxer_name;
diff --git a/player/loadfile.c b/player/loadfile.c
index 43cb127e5a..bae8f74fe9 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -794,8 +794,10 @@ err_out:
static void open_audiofiles_from_options(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
- open_external_file(mpctx, opts->audio_stream, opts->audio_demuxer_name,
- STREAM_AUDIO);
+ for (int n = 0; opts->audio_files && opts->audio_files[n]; n++) {
+ open_external_file(mpctx, opts->audio_files[n], opts->audio_demuxer_name,
+ STREAM_AUDIO);
+ }
}
struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename)