[MPlayer-cvslog] CVS: main mplayer.c,1.847,1.848

Reimar Döffinger CVS syncmail at mplayerhq.hu
Thu Jun 9 22:13:55 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv22505

Modified Files:
	mplayer.c 
Log Message:
Add sub_load and sub_remove slave commands.
Patch by kiriuja [mplayer-patches at en-directo dot net]


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.847
retrieving revision 1.848
diff -u -r1.847 -r1.848
--- mplayer.c	1 Jun 2005 09:01:41 -0000	1.847
+++ mplayer.c	9 Jun 2005 20:13:52 -0000	1.848
@@ -3378,6 +3378,70 @@
       }
 #endif
     } break;
+    case MP_CMD_SUB_LOAD:
+    {
+#ifdef USE_SUB
+      if (sh_video) {
+        int n = set_of_sub_size;
+        add_subtitles(cmd->args[0].v.s, sh_video->fps, 0);
+        if (n != set_of_sub_size) {
+          if (global_sub_indices[SUB_SOURCE_SUBS] < 0)
+            global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size;
+          ++global_sub_size;
+        }
+      }
+#endif
+    } break;
+    case MP_CMD_SUB_REMOVE:
+    {
+#ifdef USE_SUB
+      if (sh_video) {
+        int v = cmd->args[0].v.i;
+        sub_data *subd;
+        if (v < 0) {
+          for (v = 0; v < set_of_sub_size; ++v) {
+            subd = set_of_subtitles[v];
+            mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename);
+            sub_free(subd);
+            set_of_subtitles[v] = NULL;
+          }
+          global_sub_indices[SUB_SOURCE_SUBS] = -1;
+          global_sub_size -= set_of_sub_size;
+          set_of_sub_size = 0;
+          if (set_of_sub_pos >= 0) {
+            global_sub_pos = -2;
+            vo_sub_last = vo_sub = NULL;
+            vo_osd_changed(OSDTYPE_SUBTITLE);
+            vo_update_osd(sh_video->disp_w, sh_video->disp_h);
+            mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
+          }
+        }
+        else if (v < set_of_sub_size) {
+          subd = set_of_subtitles[v];
+          mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename);
+          sub_free(subd);
+          if (set_of_sub_pos == v) {
+            global_sub_pos = -2;
+            vo_sub_last = vo_sub = NULL;
+            vo_osd_changed(OSDTYPE_SUBTITLE);
+            vo_update_osd(sh_video->disp_w, sh_video->disp_h);
+            mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
+          }
+          else if (set_of_sub_pos > v) {
+            --set_of_sub_pos;
+            --global_sub_pos;
+          }
+          while (++v < set_of_sub_size)
+            set_of_subtitles[v - 1] = set_of_subtitles[v];
+          --set_of_sub_size;
+          --global_sub_size;
+          if (set_of_sub_size <= 0)
+            global_sub_indices[SUB_SOURCE_SUBS] = -1;
+          set_of_subtitles[set_of_sub_size] = NULL;
+        }
+      }
+#endif
+    } break;
     case MP_CMD_GET_SUB_VISIBILITY:
 	{
 #ifdef USE_SUB




More information about the MPlayer-cvslog mailing list