# HG changeset patch # User reynaldo # Date 1283539803 0 # Node ID a6c25d94e60eb09af3f82f18edf1a654f3ce884a # Parent 5c2b199e78d550afb0067f87e8da62224785a5af Add new slave mode command for loading EDL file on demand. Patch by Vlad Seryakov, vseryakov at gmail. diff -r 5c2b199e78d5 -r a6c25d94e60e DOCS/tech/slave.txt --- a/DOCS/tech/slave.txt Thu Sep 02 19:48:07 2010 +0000 +++ b/DOCS/tech/slave.txt Fri Sep 03 18:50:03 2010 +0000 @@ -105,6 +105,9 @@ prev mouse +edl_loadfile + Load new EDL file + edl_mark Write the current position into the EDL file. diff -r 5c2b199e78d5 -r a6c25d94e60e help/help_mp-en.h --- a/help/help_mp-en.h Thu Sep 02 19:48:07 2010 +0000 +++ b/help/help_mp-en.h Fri Sep 03 18:50:03 2010 +0000 @@ -183,6 +183,7 @@ // --- edit decision lists #define MSGTR_EdlOutOfMem "Can't allocate enough memory to hold EDL data.\n" +#define MSGTR_EdlOutOfMemFile "Can't allocate enough memory to hold EDL file name [%s].\n" #define MSGTR_EdlRecordsNo "Read %d EDL actions.\n" #define MSGTR_EdlQueueEmpty "There are no EDL actions to take care of.\n" #define MSGTR_EdlCantOpenForWrite "Can't open EDL file [%s] for writing.\n" diff -r 5c2b199e78d5 -r a6c25d94e60e input/input.c --- a/input/input.c Thu Sep 02 19:48:07 2010 +0000 +++ b/input/input.c Fri Sep 03 18:50:03 2010 +0000 @@ -76,6 +76,7 @@ { MP_CMD_RADIO_STEP_FREQ, "radio_step_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, #endif { MP_CMD_SEEK, "seek", 1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_EDL_LOADFILE, "edl_loadfile", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, { MP_CMD_EDL_MARK, "edl_mark", 0, { {-1,{0}} } }, { MP_CMD_AUDIO_DELAY, "audio_delay", 1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_SPEED_INCR, "speed_incr", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, diff -r 5c2b199e78d5 -r a6c25d94e60e input/input.h --- a/input/input.h Thu Sep 02 19:48:07 2010 +0000 +++ b/input/input.h Fri Sep 03 18:50:03 2010 +0000 @@ -61,6 +61,7 @@ MP_CMD_GET_PERCENT_POS, MP_CMD_SUB_STEP, MP_CMD_TV_SET_CHANNEL, + MP_CMD_EDL_LOADFILE, MP_CMD_EDL_MARK, MP_CMD_SUB_ALIGNMENT, MP_CMD_TV_LAST_CHANNEL, diff -r 5c2b199e78d5 -r a6c25d94e60e mplayer.c --- 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; diff -r 5c2b199e78d5 -r a6c25d94e60e mplayer.h --- a/mplayer.h Thu Sep 02 19:48:07 2010 +0000 +++ b/mplayer.h Fri Sep 03 18:50:03 2010 +0000 @@ -44,7 +44,7 @@ extern int stream_cache_size; extern int autosync; - +extern double start_pts; extern int frame_dropping; extern int auto_quality;