player: print a message along with track list

Slightly less strange.
This commit is contained in:
wm4 2015-06-03 21:50:37 +02:00
parent 52bd61d698
commit e14df5c4f4
3 changed files with 9 additions and 7 deletions

View File

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

View File

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

View File

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