From c048b5db02333ad198ac1bd9ca793b31efdaff1f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Jun 2014 01:40:20 +0200 Subject: options: allow adding multiple files with --audio-file At least 1 person expected that this works this way. --- DOCS/man/en/options.rst | 5 +++-- options/options.c | 2 +- options/options.h | 2 +- player/loadfile.c | 6 ++++-- 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=`` - 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=`` 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) -- cgit v1.2.3