# HG changeset patch # User reimar # Date 1280423123 0 # Node ID a60157df1f1fa8a83bd6919b00fa80104c4b8cbb # Parent e5ce8f0c0633d7001f13f3c1f70c7c63cf881086 Update global_sub_pos if we auto-selected a subtitle. This avoid strange behaviour with subtitle selection in that case, because the subtitle selection code thinks no subtitle was displayed while we actually did display one. diff -r e5ce8f0c0633 -r a60157df1f1f command.c --- a/command.c Thu Jul 29 17:03:14 2010 +0000 +++ b/command.c Thu Jul 29 17:05:23 2010 +0000 @@ -98,6 +98,8 @@ vo_dheight, vo_fs); } +static int sub_pos_by_source(MPContext *mpctx, int src); + static void update_global_sub_size(MPContext *mpctx) { int i; @@ -110,12 +112,16 @@ if (cnt > mpctx->sub_counts[SUB_SOURCE_DEMUX]) mpctx->sub_counts[SUB_SOURCE_DEMUX] = cnt; - // TODO: possibly adjust global_sub_pos - // update global size mpctx->global_sub_size = 0; for (i = 0; i < SUB_SOURCES; i++) mpctx->global_sub_size += mpctx->sub_counts[i]; + + // update global_sub_pos if we auto-detected a demuxer sub + if (mpctx->global_sub_pos == -1 && + mpctx->demuxer->sub && mpctx->demuxer->sub->id >= 0) + mpctx->global_sub_pos = sub_pos_by_source(mpctx, SUB_SOURCE_DEMUX) + + mpctx->demuxer->sub->id; } static int sub_pos_by_source(MPContext *mpctx, int src)