From b4dd2194d5c2540583becf6c021d8eb0f52cddc0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 8 Aug 2012 21:45:37 +0200 Subject: command: fix subtitle selection display Commit 9c02ae7e9510897 set the sh variable (see diff) to the struct of type sh_sub instead the one of sh_stream. Unfortunately this didn't crash, and merely made the OSD show "unknown" for the language. Commit 804bf91570a24b9 accidentally removed the display of the track title. Add it back. --- command.c | 10 +++++++--- libmpdemux/demuxer.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/command.c b/command.c index d9cd83a862..66ff8d131a 100644 --- a/command.c +++ b/command.c @@ -1576,12 +1576,16 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg, return M_PROPERTY_OK; } if (opts->sub_id >= 0 && mpctx->d_sub && mpctx->d_sub->sh) { - struct sh_stream *sh = mpctx->d_sub->sh; + struct sh_stream *sh = ((struct sh_sub *)mpctx->d_sub->sh)->gsh; char *lang = demuxer_stream_lang(mpctx->demuxer, sh); if (!lang) lang = talloc_strdup(NULL, mp_gtext("unknown")); - *(char **) arg = talloc_asprintf(NULL, "(%d) %s", opts->sub_id, - lang); + if (sh->title) + *(char **)arg = talloc_asprintf(NULL, "(%d) %s (\"%s\")", + opts->sub_id, lang, sh->title); + else + *(char **) arg = talloc_asprintf(NULL, "(%d) %s", opts->sub_id, + lang); talloc_free(lang); return M_PROPERTY_OK; } diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 9b63eb63ac..5f31057cb3 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -136,7 +136,7 @@ typedef struct demux_stream { // ---- mov ----- unsigned int ss_mul, ss_div; // ---- stream header ---- - void *sh; + void *sh; // points to sh_audio or sh_video } demux_stream_t; typedef struct demuxer_info { -- cgit v1.2.3