changeset 36458:4634a3085efc

Add mpctx_get_global_sub_pos(). This avoids direct context access.
author ib
date Tue, 17 Dec 2013 22:31:30 +0000
parents 31120561a9da
children e6953c9c223a
files access_mpcontext.h gui/dialog/menu.c mplayer.c
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/access_mpcontext.h	Tue Dec 17 22:30:06 2013 +0000
+++ b/access_mpcontext.h	Tue Dec 17 22:31:30 2013 +0000
@@ -26,6 +26,7 @@
 void *mpctx_get_playtree_iter(struct MPContext *mpctx);
 void *mpctx_get_mixer(struct MPContext *mpctx);
 int mpctx_get_global_sub_size(struct MPContext *mpctx);
+int mpctx_get_global_sub_pos(struct MPContext *mpctx);
 int mpctx_get_osd_function(struct MPContext *mpctx);
 
 #endif /* MPLAYER_ACCESS_MPCONTEXT_H */
--- a/gui/dialog/menu.c	Tue Dec 17 22:30:06 2013 +0000
+++ b/gui/dialog/menu.c	Tue Dec 17 22:31:30 2013 +0000
@@ -654,14 +654,15 @@
   /* cheap subtitle switching for non-DVD streams */
   if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD )
    {
-    int i;
+    int pos, i;
+    pos = mpctx_get_global_sub_pos(guiInfo.mpcontext);
     SubMenu=AddSubMenu( window1, (const char*)subtitle_xpm, Menu, MSGTR_MENU_Subtitles );
-    AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu, MSGTR_MENU_None, guiInfo.mpcontext->global_sub_pos == -1, (-1 << 16) + ivSetSubtitle );
+    AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu, MSGTR_MENU_None, pos == -1, (-1 << 16) + ivSetSubtitle );
     for ( i=0;i < global_sub_size;i++ )
      {
       char tmp[32];
       snprintf( tmp, 32, MSGTR_MENU_Track, i );
-      AddMenuCheckItem( window1,(const char*)empty1px_xpm,SubMenu,tmp,guiInfo.mpcontext->global_sub_pos == i,( i << 16 ) + ivSetSubtitle );
+      AddMenuCheckItem( window1,(const char*)empty1px_xpm,SubMenu,tmp,pos == i,( i << 16 ) + ivSetSubtitle );
      }
    }
 
--- a/mplayer.c	Tue Dec 17 22:30:06 2013 +0000
+++ b/mplayer.c	Tue Dec 17 22:31:30 2013 +0000
@@ -365,6 +365,11 @@
     return mpctx->global_sub_size;
 }
 
+int mpctx_get_global_sub_pos(MPContext *mpctx)
+{
+    return mpctx->global_sub_pos;
+}
+
 int mpctx_get_osd_function(MPContext *mpctx)
 {
     return mpctx->osd_function;