Web lists-archives.com

[MPlayer-dev-eng] gui: subtitle menu is not populated when playing from mpg file




please consider the following fix for mplayer -gui...

mpctx_get_global_sub_size(guiInfo.mpcontext);
is not returning the number of subtitles, because
void update_global_sub_size(MPContext *mpctx)
was not called to update it.

ps: the indentation is not optimal to keep the patch size minimal

Index: gui/dialog/menu.c
===================================================================
--- gui/dialog/menu.c   (revision 37244)
+++ gui/dialog/menu.c   (working copy)
@@ -733,9 +733,17 @@
    }

   /* cheap subtitle switching for non-DVD streams */
-  if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD )
+  if ( guiInfo.StreamType != STREAMTYPE_DVD )
    {
-    int pos, i, j, subs0 =
guiInfo.mpcontext->sub_counts[SUB_SOURCE_SUBS], subs1 =
guiInfo.mpcontext->sub_counts[SUB_SOURCE_VOBSUB];
+    int pos, i, j, subs0, subs1, subs2;
+    subs0 = guiInfo.mpcontext->sub_counts[SUB_SOURCE_SUBS];
+    subs1 = guiInfo.mpcontext->sub_counts[SUB_SOURCE_VOBSUB];
+    subs2 = 0; //guiInfo.mpcontext->sub_counts[SUB_SOURCE_DEMUX]; //
may be out-of-date!
+    for (i = 0; i < MAX_S_STREAMS; i++)
+      if (guiInfo.mpcontext->demuxer->s_streams[i])
+        subs2++;
+    global_sub_size = subs0 + subs1 + subs2;
+    if ( global_sub_size) {
     pos = mpctx_get_global_sub_pos(guiInfo.mpcontext);
     SubMenu=AddSubMenu( window1, (const char*)subtitle_xpm, Menu,
MSGTR_GUI_Subtitles );
     AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu,
MSGTR_GUI__none_, pos == -1, (-1 << 16) + ivSetSubtitle );
@@ -784,6 +792,7 @@
       else snprintf( tmp, sizeof(tmp), MSGTR_GUI_TrackN, i );
       AddMenuCheckItem( window1,(const
char*)empty1px_xpm,SubMenu,tmp,pos == i,( i << 16 ) + ivSetSubtitle );
      }
+    }
    }

   AddSeparator( Menu );
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng