Web lists-archives.com

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

Lode Leroy wrote on Fri, 1 Aug 2014 16:30:25 +0200:

> 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.

Well, this is because of the mpg demuxer (lavf works fine by the way).

Apparently the mpg demuxer can detect subtitles only while playing, but
MPlayer has already finished updating subtitle information then.

In order to really fix the cause, update_global_sub_size() should be called
prior to returning MPContext global_sub_size information. Unfortunately,
update_global_sub_size() cannot be static any longer then.

I consider this a better solution that adding some update_global_sub_size()
code to the GUI.


Index: command.h
--- command.h	(revision 37251)
+++ command.h	(working copy)
@@ -22,6 +22,7 @@
 struct MPContext;
 struct mp_cmd;
+void update_global_sub_size(struct MPContext *mpctx);
 int run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
 char *property_expand_string(struct MPContext *mpctx, char *str);
 void property_print_help(void);
Index: command.c
--- command.c	(revision 37251)
+++ command.c	(working copy)
@@ -148,7 +148,7 @@
     return sub_source_by_pos(mpctx, mpctx->global_sub_pos);
-static void update_global_sub_size(MPContext *mpctx)
+void update_global_sub_size(MPContext *mpctx)
     int i;
     int cnt = 0;
Index: mplayer.c
--- mplayer.c	(revision 37251)
+++ mplayer.c	(working copy)
@@ -362,6 +362,7 @@
 int mpctx_get_global_sub_size(MPContext *mpctx)
+    update_global_sub_size(mpctx);
     return mpctx->global_sub_size;
MPlayer-dev-eng mailing list