diff mplayer.c @ 31956:a6c25d94e60e

Add new slave mode command for loading EDL file on demand. Patch by Vlad Seryakov, vseryakov at gmail.
author reynaldo
date Fri, 03 Sep 2010 18:50:03 +0000
parents 0e720002f853
children 49848f9a8f30
line wrap: on
line diff
--- a/mplayer.c	Thu Sep 02 19:48:07 2010 +0000
+++ b/mplayer.c	Fri Sep 03 18:50:03 2010 +0000
@@ -2533,6 +2533,17 @@
 #endif
 }
 
+static void edl_loadfile(void)
+{
+    if (edl_filename) {
+        if (edl_records) {
+            free_edl(edl_records);
+            edl_needs_reset = 1;
+        }
+        next_edl_record = edl_records = edl_parse_file();
+    }
+}
+
 // Execute EDL command for the current position if one exists
 static void edl_update(MPContext *mpctx)
 {
@@ -3211,10 +3222,7 @@
             vo_wintitle = strdup ( mp_basename2 (filename));
     }
 
-if (edl_filename) {
-    if (edl_records) free_edl(edl_records);
-    next_edl_record = edl_records = edl_parse_file();
-}
+    edl_loadfile();
 if (edl_output_filename) {
     if (edl_fd) fclose(edl_fd);
     if ((edl_fd = fopen(edl_output_filename, "w")) == NULL)
@@ -3975,6 +3983,15 @@
   int brk_cmd = 0;
   while( !brk_cmd && (cmd = mp_input_get_cmd(0,0,0)) != NULL) {
       brk_cmd = run_command(mpctx, cmd);
+      if (cmd->id == MP_CMD_EDL_LOADFILE) {
+          if (edl_filename) free(edl_filename);
+          edl_filename = strdup(cmd->args[0].v.s);
+          if (edl_filename)
+              edl_loadfile();
+          else
+              mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlOutOfMemFile,
+                    cmd->args[0].v.s);
+      }
       mp_cmd_free(cmd);
       if (brk_cmd == 2)
 	  goto goto_enable_cache;