diff options
author | xylosper <darklin20@gmail.com> | 2015-02-03 17:15:14 +0900 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-03 13:53:39 +0100 |
commit | 95fd83a269db6e2a04e40fe0c40cc02a051f316d (patch) | |
tree | 352214e07190724a7ec2d76c39e097245eef6c90 /player/loadfile.c | |
parent | 2c22fcd350a55ffe9c49f3fedbd4be33a16cfba5 (diff) | |
download | mpv-95fd83a269db6e2a04e40fe0c40cc02a051f316d.tar.bz2 mpv-95fd83a269db6e2a04e40fe0c40cc02a051f316d.tar.xz |
command: new commands audio_add/audio_remove/audio_reload
These commands are counterparts of sub_add/sub_remove/sub_reload which
work for external audio file.
Signed-off-by: wm4 <wm4@nowhere>
(minor simplification)
Diffstat (limited to 'player/loadfile.c')
-rw-r--r-- | player/loadfile.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index bf4121ba00..bb15068ead 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -646,8 +646,8 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track) return true; } -static struct track *open_external_file(struct MPContext *mpctx, char *filename, - enum stream_type filter) +struct track *mp_add_external_file(struct MPContext *mpctx, char *filename, + enum stream_type filter) { struct MPOpts *opts = mpctx->opts; if (!filename) @@ -714,19 +714,14 @@ static void open_audiofiles_from_options(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; for (int n = 0; opts->audio_files && opts->audio_files[n]; n++) - open_external_file(mpctx, opts->audio_files[n], STREAM_AUDIO); -} - -struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename) -{ - return open_external_file(mpctx, filename, STREAM_SUB); + mp_add_external_file(mpctx, opts->audio_files[n], STREAM_AUDIO); } static void open_subtitles_from_options(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; for (int i = 0; opts->sub_name && opts->sub_name[i] != NULL; i++) - mp_add_subtitles(mpctx, opts->sub_name[i]); + mp_add_external_file(mpctx, opts->sub_name[i], STREAM_SUB); } static void autoload_external_files(struct MPContext *mpctx) @@ -751,7 +746,7 @@ static void autoload_external_files(struct MPContext *mpctx) if (strcmp(mpctx->sources[n]->stream->url, filename) == 0) goto skip; } - struct track *track = open_external_file(mpctx, filename, list[i].type); + struct track *track = mp_add_external_file(mpctx, filename, list[i].type); if (track) { track->auto_loaded = true; if (!track->lang) |