Index: input/input.c =================================================================== --- input/input.c (revision 32035) +++ input/input.c (working copy) @@ -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}} } }, Index: input/input.h =================================================================== --- input/input.h (revision 32035) +++ input/input.h (working copy) @@ -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, Index: mplayer.c =================================================================== --- mplayer.c (revision 32035) +++ mplayer.c (working copy) @@ -142,7 +142,7 @@ int quiet=0; int enable_mouse_movements=0; float start_volume = -1; - +double start_pts = MP_NOPTS_VALUE; char *heartbeat_cmd; #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) @@ -339,6 +339,7 @@ // (next seek, pause,...), otherwise after the seek it will // enter the same scene again and skip forward immediately float edl_backward_delay = 2; +int edl_adjust_pts = 0; // Automatically add/sub start_pts int use_filedir_conf; int use_filename_title; @@ -555,7 +556,7 @@ static void print_file_properties(const MPContext *mpctx, const char *filename) { - double start_pts = MP_NOPTS_VALUE; + double video_start_pts = MP_NOPTS_VALUE; mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_FILENAME=%s\n", filename_recode(filename)); @@ -2611,6 +2612,15 @@ } } +static void edl_loadfile(void) +{ + if (edl_filename) { + if (edl_records) { + free_edl(edl_records); + } + next_edl_record = edl_records = edl_parse_file(); + } +} // style & SEEK_ABSOLUTE == 0 means seek relative to current position, == 1 means absolute // style & SEEK_FACTOR == 0 means amount in seconds, == 2 means fraction of file length @@ -3210,11 +3220,8 @@ if(use_filename_title && vo_wintitle == NULL) vo_wintitle = strdup ( mp_basename2 (filename)); } + edl_loadfile(); -if (edl_filename) { - if (edl_records) free_edl(edl_records); - next_edl_record = edl_records = edl_parse_file(); -} if (edl_output_filename) { if (edl_fd) fclose(edl_fd); if ((edl_fd = fopen(edl_output_filename, "w")) == NULL) @@ -3631,6 +3638,16 @@ } print_file_properties(mpctx, filename); + + // Adjust EDL positions with start_pts + if (edl_adjust_pts && start_pts) { + edl_record_ptr edl = edl_records; + while (edl) { + edl->start_sec += start_pts; + edl->stop_sec += start_pts; + edl = edl->next; + } + } if(!mpctx->sh_video) goto main; // audio-only @@ -3975,6 +3992,13 @@ int brk_cmd = 0; while( !brk_cmd && (cmd = mp_input_get_cmd(0,0,0)) != NULL) { brk_cmd = run_command(mpctx, cmd); + switch (cmd->id) { + case MP_CMD_EDL_LOADFILE: + if (edl_filename) free(edl_filename); + edl_filename = cmd->args[0].v.s; + edl_loadfile(); + break; + } mp_cmd_free(cmd); if (brk_cmd == 2) goto goto_enable_cache; Index: cfg-mplayer.h =================================================================== --- cfg-mplayer.h (revision 32035) +++ cfg-mplayer.h (working copy) @@ -103,6 +103,8 @@ CONF_TYPE_PRINT, 0, 0, 0, NULL}, {"edlout", &edl_output_filename, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"edl-backward-delay", &edl_backward_delay, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + {"edl-adjust-pts", &edl_adjust_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"noedl-adjust-pts", &edl_adjust_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL}, #ifdef CONFIG_X11 {"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL}, Index: command.c =================================================================== --- command.c (revision 32035) +++ command.c (working copy) @@ -70,6 +70,8 @@ #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) extern int use_menu; +extern int edl_adjust_pts; +extern double start_pts; static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy) { @@ -2601,6 +2603,9 @@ } break; + case MP_CMD_EDL_LOADFILE: + break; + case MP_CMD_EDL_MARK: if (edl_fd) { float v = sh_video ? sh_video->pts : @@ -2614,7 +2619,8 @@ if (mpctx->begin_skip > v) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdloutBadStop); else { - fprintf(edl_fd, "%f %f %d\n", mpctx->begin_skip, v, 0); + float pts = edl_adjust_pts ? start_pts : 0; + fprintf(edl_fd, "%f %f %d\n", mpctx->begin_skip - pts, v - pts, 0); mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutEndSkip); } mpctx->begin_skip = MP_NOPTS_VALUE;