From 17b69493b70413326c95c3c552009626809b45ec Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 30 Jul 2012 15:46:05 +0200 Subject: libvo: remove exit_player_bad() For some reason, these 3 VOs basically call exit() if something went wrong. --- libvo/vo_jpeg.c | 11 +++++------ libvo/vo_md5sum.c | 4 +--- libvo/vo_pnm.c | 14 ++++++-------- mplayer.h | 7 ------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index efa0381086..674f113886 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -44,7 +44,6 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player_bad() */ #include "osdep/io.h" /* ------------------------------------------------------------------------- */ @@ -117,17 +116,17 @@ static void jpeg_mkdir(const char *buf, int verbose) { _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, _("Unable to access"), buf); - exit_player_bad(_("Fatal error")); + return; } if ( !S_ISDIR(stat_p.st_mode) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, buf, _("already exists, but is not a directory.")); - exit_player_bad(_("Fatal error")); + return; } if ( !(stat_p.st_mode & S_IWUSR) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, _("Output directory already exists, but is not writable.")); - exit_player_bad(_("Fatal error")); + return; } mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -139,7 +138,7 @@ static void jpeg_mkdir(const char *buf, int verbose) { _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, _("Unable to create output directory.")); - exit_player_bad(_("Fatal error")); + return; } /* end switch */ } else if ( verbose ) { mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -188,7 +187,7 @@ static uint32_t jpeg_write(const char * name, uint8_t * buffer) mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, _("This error has occurred"), strerror(errno) ); - exit_player_bad(_("Fatal error")); + return 1; } cinfo.err = jpeg_std_error(&jerr); diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c index dc3487ef3b..9c9a4d2f97 100644 --- a/libvo/vo_md5sum.c +++ b/libvo/vo_md5sum.c @@ -40,7 +40,6 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player_bad() */ #include "libavutil/md5.h" /* ------------------------------------------------------------------------- */ @@ -78,7 +77,6 @@ int framenum = 0; static void md5sum_write_error(void) { mp_tmsg(MSGT_VO, MSGL_ERR, "%s: Error writing file.\n", info.short_name); - exit_player_bad(_("Fatal error")); } /* ------------------------------------------------------------------------- */ @@ -144,7 +142,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, _("Unable to create output file.")); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, _("This error has occurred"), strerror(errno) ); - exit_player_bad(_("Fatal error")); + return -1; } return 0; diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index 5345eaa122..36f432ba30 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -39,7 +39,6 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player_bad() */ #include "osdep/io.h" /* ------------------------------------------------------------------------- */ @@ -98,7 +97,6 @@ char *pnm_file_extension = NULL; static void pnm_write_error(void) { mp_tmsg(MSGT_VO, MSGL_ERR, "%s: Error writing file.\n", info.short_name); - exit_player_bad(_("Fatal error")); } /* ------------------------------------------------------------------------- */ @@ -209,17 +207,17 @@ static void pnm_mkdir(char *buf, int verbose) { _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, _("Unable to access"), buf); - exit_player_bad(_("Fatal error")); + return; } if ( !S_ISDIR(stat_p.st_mode) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, buf, _("already exists, but is not a directory.")); - exit_player_bad(_("Fatal error")); + return; } if ( !(stat_p.st_mode & S_IWUSR) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, _("Output directory already exists, but is not writable.")); - exit_player_bad(_("Fatal error")); + return; } if (strcmp(buf, ".") != 0) { @@ -233,7 +231,7 @@ static void pnm_mkdir(char *buf, int verbose) { _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, _("Unable to create output directory.")); - exit_player_bad(_("Fatal error")); + return; } /* end switch */ } else if ( verbose ) { mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -437,7 +435,7 @@ static void pnm_write_image(mp_image_t *mpi) if (!mpi) { mp_msg(MSGT_VO, MSGL_ERR, "%s: No image data supplied to video output driver\n", info.short_name ); - exit_player_bad(_("Fatal error")); + return; } /* Start writing to new subdirectory after a certain amount of frames */ @@ -469,7 +467,7 @@ static void pnm_write_image(mp_image_t *mpi) mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, "This error has occurred", strerror(errno) ); - exit_player_bad(_("Fatal error")); + return; } pnm_write_pnm(outfile, mpi); diff --git a/mplayer.h b/mplayer.h index 0c8be38efb..2c46d9ac85 100644 --- a/mplayer.h +++ b/mplayer.h @@ -39,13 +39,6 @@ extern int auto_quality; extern int vobsub_id; -static inline void exit_player_bad(const char *how) -{ - if (how) - mp_msg(MSGT_CPLAYER, MSGL_INFO, "Deprecated exit call: %s", how); - exit(1); -} - struct MPContext; struct subtitle; -- cgit v1.2.3