From 3dbb18d91a0d4b17f0187e3b5faa3b6f3cd1b31e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 20 Oct 2011 08:13:14 +0200 Subject: windows support: remove _UWIN define The _UWIN define causes the mingw headers not to declare deprecated (on Windows) function names such as open and mkdir. But the code uses these. I have no idea why this used to work (if it even did), but the original reason why it was defined seems to have vanished. --- mplayer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 3fef3b1f12..cdcd1d645e 100644 --- a/mplayer.c +++ b/mplayer.c @@ -28,7 +28,6 @@ #include "talloc.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 #endif #include -- cgit v1.2.3 From a1244111a790bbc4bf91b078ebcad3f415da79da Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 3 Feb 2012 08:05:11 +0100 Subject: windows support: unicode filenames Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this. --- mplayer.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index cdcd1d645e..f8b24a1285 100644 --- a/mplayer.c +++ b/mplayer.c @@ -27,6 +27,8 @@ #include "config.h" #include "talloc.h" +#include "osdep/io.h" + #if defined(__MINGW32__) || defined(__CYGWIN__) #include #endif @@ -875,11 +877,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 +966,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 +976,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 +988,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); @@ -3974,6 +3971,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: -- cgit v1.2.3 From 7576885677764a71fe03cec5f697f8a28f9365c8 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 19 Jan 2012 06:49:47 +0200 Subject: core: remove old EDL mode (--edl option) Remove the old EDL implementation that was activated with the --edl option. It is mostly redundant and inferior compared to the newer demux_edl support, though currently there's no support for using the same EDL files with the new implementation and the mute functionality of the old implementation is not supported. The main reason to remove the old implementation at this point is that the mute functionality would conflict with following audio volume handling changes, and working on the old code would be a wasted effort in the long run as at some point it would be removed anyway. The --edlout functionality is kept for now, even though after this commit there is no code that could directly read its output. --- mplayer.c | 78 ++++----------------------------------------------------------- 1 file changed, 5 insertions(+), 73 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index f8b24a1285..19d93bf2d8 100644 --- a/mplayer.c +++ b/mplayer.c @@ -90,8 +90,6 @@ #include "codec-cfg.h" -#include "edl.h" - #include "sub/spudec.h" #include "sub/vobsub.h" @@ -336,9 +334,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; @@ -683,8 +681,6 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask) if (mask & INITIALIZED_AO) { mpctx->initialized_flags &= ~INITIALIZED_AO; current_module = "uninit_ao"; - if (mpctx->edl_muted) - mixer_mute(&mpctx->mixer); if (mpctx->ao) ao_uninit(mpctx->ao, mpctx->stop_play != AT_END_OF_FILE); mpctx->ao = NULL; @@ -695,7 +691,7 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask) void exit_player_with_rc(struct MPContext *mpctx, enum exit_reason how, int rc) { - if (mpctx->user_muted && !mpctx->edl_muted) + if (mpctx->user_muted) mixer_mute(&mpctx->mixer); uninit_player(mpctx, INITIALIZED_ALL); #if defined(__MINGW32__) || defined(__CYGWIN__) @@ -734,8 +730,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"); @@ -3107,59 +3101,6 @@ static void pause_loop(struct MPContext *mpctx) } } - -// Find the right mute status and record position for new file position -static void edl_seek_reset(MPContext *mpctx) -{ - mpctx->edl_muted = 0; - next_edl_record = edl_records; - - while (next_edl_record) { - if (next_edl_record->start_sec >= get_current_time(mpctx)) - break; - - if (next_edl_record->action == EDL_MUTE) - mpctx->edl_muted = !mpctx->edl_muted; - next_edl_record = next_edl_record->next; - } - if ((mpctx->user_muted | mpctx->edl_muted) != mpctx->mixer.muted) - mixer_mute(&mpctx->mixer); -} - - -// 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) { - mpctx->edl_muted = !mpctx->edl_muted; - if ((mpctx->user_muted | mpctx->edl_muted) != mpctx->mixer.muted) - mixer_mute(&mpctx->mixer); - mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_MUTE: [%f]\n", - next_edl_record->start_sec); - } - next_edl_record = next_edl_record->next; - } -} - static void reinit_decoders(struct MPContext *mpctx) { reinit_video_chain(mpctx); @@ -3181,8 +3122,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, @@ -3207,8 +3148,6 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao) vobsub_seek(vo_vobsub, mpctx->sh_video->pts); } - edl_seek_reset(mpctx); - mpctx->hrseek_active = false; mpctx->hrseek_framedrop = false; mpctx->total_avsync_change = 0; @@ -3851,8 +3790,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)) { @@ -4401,11 +4338,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); -- cgit v1.2.3