mirror of https://github.com/mpv-player/mpv
mplayer: fix output of audio/sub language in terminal output
The SH_COMMON lang field seems to be blatantly unreliable and is not always set by demux_lavf (at least not with dvdnav:// ). Also fix the same for the show_tracks_osd slave command.
This commit is contained in:
parent
e13c053665
commit
e26b7314cf
12
command.c
12
command.c
|
@ -2665,13 +2665,13 @@ static void show_tracks_on_osd(MPContext *mpctx)
|
|||
if (cnt > 1)
|
||||
res = talloc_asprintf_append(res, "(Warning: more than one video stream.)\n");
|
||||
|
||||
#define STD_TRACK_HDR(st, id) \
|
||||
#define STD_TRACK_HDR(st, id, lang) \
|
||||
res = talloc_asprintf_append(res, "%s(%d) ", IND, st->id); \
|
||||
if (st->title) { \
|
||||
res = talloc_asprintf_append(res, "'%s' ", st->title); \
|
||||
} \
|
||||
if (st->lang) { \
|
||||
res = talloc_asprintf_append(res, "(%s) ", st->lang); \
|
||||
if (lang) { \
|
||||
res = talloc_asprintf_append(res, "(%s) ", lang); \
|
||||
}
|
||||
|
||||
for (n = 0; n < MAX_A_STREAMS; n++) {
|
||||
|
@ -2680,7 +2680,8 @@ static void show_tracks_on_osd(MPContext *mpctx)
|
|||
cnt++;
|
||||
if (a == cur_a)
|
||||
res = talloc_asprintf_append(res, "> ");
|
||||
STD_TRACK_HDR(a, aid)
|
||||
char *lang = demuxer_audio_lang(mpctx->demuxer, a->index);
|
||||
STD_TRACK_HDR(a, aid, lang)
|
||||
if (a == cur_a)
|
||||
res = talloc_asprintf_append(res, "<");
|
||||
res = talloc_asprintf_append(res, "\n");
|
||||
|
@ -2695,7 +2696,8 @@ static void show_tracks_on_osd(MPContext *mpctx)
|
|||
cnt++;
|
||||
if (s == cur_s)
|
||||
res = talloc_asprintf_append(res, "> ");
|
||||
STD_TRACK_HDR(s, sid)
|
||||
char *lang = demuxer_sub_lang(mpctx->demuxer, s->index);
|
||||
STD_TRACK_HDR(s, sid, lang)
|
||||
char *type = "?";
|
||||
switch (s->type) {
|
||||
case 't': type = "SRT"; break;
|
||||
|
|
|
@ -401,8 +401,13 @@ static void print_stream(struct MPContext *mpctx, sh_common_t *s)
|
|||
}
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, "[stream] ID %d: %s", s->demuxer_id, tname);
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%d", selopt, s->id);
|
||||
if (s->lang)
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%s", langopt, s->lang);
|
||||
char *lang = NULL;
|
||||
if (s->stream_type == STREAM_AUDIO)
|
||||
lang = demuxer_audio_lang(mpctx->demuxer, s->index);
|
||||
if (s->stream_type == STREAM_SUBTITLE)
|
||||
lang = demuxer_sub_lang(mpctx->demuxer, s->index);
|
||||
if (lang)
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%s", langopt, lang);
|
||||
if (s->default_track)
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, " (*)");
|
||||
if (s->title)
|
||||
|
|
Loading…
Reference in New Issue