diff options
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 69 |
1 files changed, 14 insertions, 55 deletions
@@ -27,8 +27,9 @@ #include "config.h" #include "talloc.h" +#include "osdep/io.h" + #if defined(__MINGW32__) || defined(__CYGWIN__) -#define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ #include <windows.h> #endif #include <string.h> @@ -88,8 +89,6 @@ #include "codec-cfg.h" -#include "edl.h" - #include "sub/spudec.h" #include "sub/vobsub.h" @@ -334,9 +333,9 @@ char *current_module; // for debugging // --- -edl_record_ptr edl_records = NULL; ///< EDL entries memory area -edl_record_ptr next_edl_record = NULL; ///< only for traversing edl_records FILE *edl_fd; // file to write to when in -edlout mode. +char *edl_output_filename; // file to put EDL entries in (-edlout) + int use_filedir_conf; int use_filename_title; @@ -732,8 +731,6 @@ void exit_player_with_rc(struct MPContext *mpctx, enum exit_reason how, int rc) talloc_free(mpctx->key_fifo); - free(edl_records); // free mem allocated for EDL - edl_records = NULL; switch (how) { case EXIT_QUIT: mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "\nExiting... (%s)\n", "Quit"); @@ -875,11 +872,7 @@ static void parse_cfgfiles(struct MPContext *mpctx, m_config_t *conf) if ((conffile = get_path("")) == NULL) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Cannot find HOME directory.\n"); else { -#ifdef __MINGW32__ - mkdir(conffile); -#else mkdir(conffile, 0777); -#endif free(conffile); if ((conffile = get_path("config")) == NULL) mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "get_path(\"config\") problem\n"); @@ -968,8 +961,7 @@ static void load_per_output_config(m_config_t *conf, char *cfg, char *out) */ static int try_load_config(m_config_t *conf, const char *file) { - struct stat st; - if (stat(file, &st)) + if (!mp_path_exists(file)) return 0; mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Loading config '%s'\n", file); m_config_parse_config_file(conf, file); @@ -979,10 +971,10 @@ static int try_load_config(m_config_t *conf, const char *file) static void load_per_file_config(m_config_t *conf, const char * const file) { char *confpath; - char cfg[PATH_MAX]; + char cfg[MP_PATH_MAX]; const char *name; - if (strlen(file) > PATH_MAX - 14) { + if (strlen(file) > MP_PATH_MAX - 14) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "Filename is too long, " "can not load file or directory specific config files\n"); return; @@ -991,7 +983,7 @@ static void load_per_file_config(m_config_t *conf, const char * const file) name = mp_basename(cfg); if (use_filedir_conf) { - char dircfg[PATH_MAX]; + char dircfg[MP_PATH_MAX]; strcpy(dircfg, cfg); strcpy(dircfg + (name - cfg), "mplayer.conf"); try_load_config(conf, dircfg); @@ -3119,36 +3111,6 @@ static void pause_loop(struct MPContext *mpctx) } } -// Execute EDL command for the current position if one exists -static void edl_update(MPContext *mpctx) -{ - if (!next_edl_record) - return; - - if (!mpctx->sh_video) { - mp_tmsg(MSGT_CPLAYER, MSGL_ERR, - "Cannot use EDL without video, disabling.\n"); - free_edl(edl_records); - next_edl_record = NULL; - edl_records = NULL; - return; - } - - if (get_current_time(mpctx) >= next_edl_record->start_sec) { - if (next_edl_record->action == EDL_SKIP) { - mpctx->osd_function = OSD_FFW; - queue_seek(mpctx, MPSEEK_RELATIVE, next_edl_record->length_sec, 0); - mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_SKIP: start [%f], stop " - "[%f], length [%f]\n", next_edl_record->start_sec, - next_edl_record->stop_sec, next_edl_record->length_sec); - } else if (next_edl_record->action == EDL_MUTE) { - mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_MUTE: [%f] ignored\n", - next_edl_record->start_sec); - } - next_edl_record = next_edl_record->next; - } -} - static void reinit_decoders(struct MPContext *mpctx) { reinit_video_chain(mpctx); @@ -3170,8 +3132,8 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao) mpctx->time_frame = 0; mpctx->restart_playback = true; // Not all demuxers set d_video->pts during seek, so this value - // (which is used by at least vobsub and edl code below) may - // be completely wrong (probably 0). + // (which is used by at least vobsub code below) may be completely + // wrong (probably 0). mpctx->sh_video->pts = mpctx->d_video->pts + mpctx->video_offset; mpctx->video_pts = mpctx->sh_video->pts; update_subtitles(mpctx, mpctx->sh_video->pts, mpctx->video_offset, @@ -3838,8 +3800,6 @@ static void run_playloop(struct MPContext *mpctx) queue_seek(mpctx, MPSEEK_RELATIVE, step_sec, 0); } - edl_update(mpctx); - /* Looping. */ if (opts->loop_times >= 0 && (mpctx->stop_play == AT_END_OF_FILE || mpctx->stop_play == PT_NEXT_ENTRY)) { @@ -3959,6 +3919,10 @@ int main(int argc, char *argv[]) || !strcmp(argv[1], "--leak-report"))) talloc_enable_leak_report(); +#ifdef __MINGW32__ + mp_get_converted_argv(&argc, &argv); +#endif + char *mem_ptr; // movie info: @@ -4387,11 +4351,6 @@ play_next_file: mp_basename(mpctx->filename)); } - 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); |