options: allow adding multiple files with --audio-file

At least 1 person expected that this works this way.
This commit is contained in:
wm4 2014-06-18 01:40:20 +02:00
parent c48dd85821
commit c048b5db02
4 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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),

View File

@ -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;

View File

@ -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)