From e14df5c4f4e57a860222156b2f6124824b90c216 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 3 Jun 2015 21:50:37 +0200 Subject: [PATCH] player: print a message along with track list Slightly less strange. --- player/command.c | 8 ++++---- player/core.h | 2 +- player/loadfile.c | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/player/command.c b/player/command.c index 7715cfb0d3..5148510b1f 100644 --- a/player/command.c +++ b/player/command.c @@ -4568,7 +4568,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (lang && lang[0]) t->lang = talloc_strdup(t, lang); if (mpctx->playback_initialized) - print_track_list(mpctx); + print_track_list(mpctx, "Track added:"); break; } @@ -4580,7 +4580,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re return -1; mp_remove_track(mpctx, t); if (mpctx->playback_initialized) - print_track_list(mpctx); + print_track_list(mpctx, "Track removed:"); break; } @@ -4597,7 +4597,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re } if (nt) { mp_switch_track(mpctx, nt->type, nt, 0); - print_track_list(mpctx); + print_track_list(mpctx, "Reloaded:"); return 0; } return -1; @@ -4617,7 +4617,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re mp_switch_track(mpctx, STREAM_SUB, s, 0); if (mpctx->playback_initialized) - print_track_list(mpctx); + print_track_list(mpctx, "Track list:\n"); } break; } diff --git a/player/core.h b/player/core.h index 7c9c13c257..542105ba6e 100644 --- a/player/core.h +++ b/player/core.h @@ -397,7 +397,7 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction, void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e); void mp_play_files(struct MPContext *mpctx); void update_demuxer_properties(struct MPContext *mpctx); -void print_track_list(struct MPContext *mpctx); +void print_track_list(struct MPContext *mpctx, const char *msg); void reselect_demux_streams(struct MPContext *mpctx); void prepare_playlist(struct MPContext *mpctx, struct playlist *pl); void autoload_external_files(struct MPContext *mpctx); diff --git a/player/loadfile.c b/player/loadfile.c index b3fc08094e..46aa999d76 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -143,8 +143,10 @@ static void print_stream(struct MPContext *mpctx, struct track *t) MP_INFO(mpctx, "%s\n", b); } -void print_track_list(struct MPContext *mpctx) +void print_track_list(struct MPContext *mpctx, const char *msg) { + if (msg) + MP_INFO(mpctx, "%s\n", msg); for (int t = 0; t < STREAM_TYPE_COUNT; t++) { for (int n = 0; n < mpctx->num_tracks; n++) if (mpctx->tracks[n]->type == t) @@ -176,7 +178,7 @@ void update_demuxer_properties(struct MPContext *mpctx) struct demuxer *tracks = mpctx->track_layout; if (tracks->events & DEMUX_EVENT_STREAMS) { add_demuxer_tracks(mpctx, tracks); - print_track_list(mpctx); + print_track_list(mpctx, NULL); tracks->events &= ~DEMUX_EVENT_STREAMS; } if (events & DEMUX_EVENT_METADATA) {