From 11b55ec7a89c8605401e40b6a4c56ca8971350da Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 14 Feb 2010 10:53:20 +0000 Subject: [PATCH 1/2] Fix exit_player() usage throughout the codebase. exit_player() was declared with differing parameter types in mplayer.c and mplayer.h. Make the declaration in the .h file match the one in the .c file and adjust all usages of exit_player() throughout the codebase. Also move the exit_player() declaration into mp_core.h next to exit_player_with_rc(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30558 b3059339-0415-0410-9bf9-f77b7e298cf2 --- gui/interface.c | 3 ++- gui/mplayer/mw.c | 5 +++-- gui/mplayer/sw.c | 3 ++- libao2/audio_out.c | 4 ++-- libvo/vo_jpeg.c | 12 ++++++------ libvo/vo_md5sum.c | 6 +++--- libvo/vo_png.c | 11 +++++------ libvo/vo_pnm.c | 16 ++++++++-------- libvo/x11_common.c | 1 - mp_core.h | 1 + mplayer.h | 1 - 11 files changed, 32 insertions(+), 31 deletions(-) diff --git a/gui/interface.c b/gui/interface.c index 3351656d87..c78c2eafe2 100644 --- a/gui/interface.c +++ b/gui/interface.c @@ -37,6 +37,7 @@ #include "cfg.h" #include "help_mp.h" #include "get_path.h" +#include "mp_core.h" #include "libvo/x11_common.h" #include "libvo/video_out.h" #include "libvo/font_load.h" @@ -781,7 +782,7 @@ int guiGetEvent( int type,char * arg ) } } - if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } + if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player(EXIT_ERROR); } { int i = 0; diff --git a/gui/mplayer/mw.c b/gui/mplayer/mw.c index 4e64af3a51..1445afe379 100644 --- a/gui/mplayer/mw.c +++ b/gui/mplayer/mw.c @@ -47,6 +47,7 @@ #include "codec-cfg.h" #include "m_option.h" #include "m_property.h" +#include "mp_core.h" #define GUI_REDRAW_WAIT 375 @@ -72,7 +73,7 @@ int i,pot = 0; void mplMainDraw( void ) { - if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); + if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( EXIT_QUIT ); if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || !mainVisible ) return; @@ -102,7 +103,7 @@ void mplEventHandling( int msg,float param ) { // --- user events case evExit: - exit_player( "Exit" ); + exit_player( EXIT_QUIT ); break; case evPlayNetwork: diff --git a/gui/mplayer/sw.c b/gui/mplayer/sw.c index 349847b5b8..652fbaf761 100644 --- a/gui/mplayer/sw.c +++ b/gui/mplayer/sw.c @@ -24,6 +24,7 @@ #include "config.h" #include "libvo/x11_common.h" #include "help_mp.h" +#include "mp_core.h" #include "gmplayer.h" #include "gui/app.h" @@ -39,7 +40,7 @@ extern int i,pot; void mplSubDraw( void ) { - if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); + if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( EXIT_QUIT ); if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++; if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--; diff --git a/libao2/audio_out.c b/libao2/audio_out.c index 09f498fa4e..fc47c82ea7 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -25,7 +25,7 @@ #include "mp_msg.h" #include "help_mp.h" -#include "mplayer.h" /* for exit_player() */ +#include "mp_core.h" /* for exit_player() */ // there are some globals: ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0}; @@ -147,7 +147,7 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate int ao_len; if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) { mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed); - exit_player(NULL); + exit_player(EXIT_NONE); } if (ao_subdevice) { free(ao_subdevice); diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index 1be11014b0..d05190d960 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -44,7 +44,7 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player() */ +#include "mp_core.h" #include "help_mp.h" /* ------------------------------------------------------------------------- */ @@ -121,17 +121,17 @@ static void jpeg_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, MSGTR_VO_UnableToAccess,buf); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !S_ISDIR(stat_p.st_mode) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, buf, MSGTR_VO_ExistsButNoDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !(stat_p.st_mode & S_IWUSR) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_DirExistsButNotWritable); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -143,7 +143,7 @@ static void jpeg_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_CantCreateDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* end switch */ } else if ( verbose ) { mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -192,7 +192,7 @@ static uint32_t jpeg_write(uint8_t * name, uint8_t * buffer) mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, MSGTR_VO_GenericError, strerror(errno) ); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } cinfo.err = jpeg_std_error(&jerr); diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c index 754630f2da..9585f6b1ad 100644 --- a/libvo/vo_md5sum.c +++ b/libvo/vo_md5sum.c @@ -40,7 +40,7 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player() */ +#include "mp_core.h" /* for exit_player() */ #include "help_mp.h" #include "libavutil/md5.h" @@ -86,7 +86,7 @@ int framenum = 0; static void md5sum_write_error(void) { mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* ------------------------------------------------------------------------- */ @@ -152,7 +152,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, MSGTR_VO_CantCreateFile); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, MSGTR_VO_GenericError, strerror(errno) ); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } return 0; diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 0f449cd9e3..5b558b3d1e 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -32,13 +32,12 @@ #include "config.h" #include "fmt-conversion.h" -#include "mp_msg.h" +#include "mp_core.h" #include "mp_msg.h" #include "help_mp.h" #include "video_out.h" #include "video_out_internal.h" #include "subopt-helper.h" -#include "mplayer.h" #include "libavcodec/avcodec.h" #define BUFLENGTH 512 @@ -77,17 +76,17 @@ static void png_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, MSGTR_VO_UnableToAccess,buf); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !S_ISDIR(stat_p.st_mode) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, buf, MSGTR_VO_ExistsButNoDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !(stat_p.st_mode & S_IWUSR) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_DirExistsButNotWritable); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -99,7 +98,7 @@ static void png_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_CantCreateDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* end switch */ } else if ( verbose ) { mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index 20290272bc..0ee005dac3 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -39,7 +39,7 @@ #include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" -#include "mplayer.h" /* for exit_player() */ +#include "mp_core.h" /* for exit_player() */ #include "help_mp.h" /* ------------------------------------------------------------------------- */ @@ -98,7 +98,7 @@ char *pnm_file_extension = NULL; static void pnm_write_error(void) { mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* ------------------------------------------------------------------------- */ @@ -214,17 +214,17 @@ static void pnm_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, MSGTR_VO_UnableToAccess,buf); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !S_ISDIR(stat_p.st_mode) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, buf, MSGTR_VO_ExistsButNoDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if ( !(stat_p.st_mode & S_IWUSR) ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_DirExistsButNotWritable); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } if (strcmp(buf, ".") != 0) { @@ -238,7 +238,7 @@ static void pnm_mkdir(char *buf, int verbose) { MSGTR_VO_GenericError, strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name, buf, MSGTR_VO_CantCreateDirectory); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* end switch */ } else if ( verbose ) { mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name, @@ -442,7 +442,7 @@ static void pnm_write_image(mp_image_t *mpi) if (!mpi) { mp_msg(MSGT_VO, MSGL_ERR, "%s: No image data suplied to video output driver\n", info.short_name ); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } /* Start writing to new subdirectory after a certain amount of frames */ @@ -474,7 +474,7 @@ static void pnm_write_image(mp_image_t *mpi) mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, MSGTR_VO_GenericError, strerror(errno) ); - exit_player(MSGTR_Exit_error); + exit_player(EXIT_ERROR); } pnm_write_pnm(outfile, mpi); diff --git a/libvo/x11_common.c b/libvo/x11_common.c index bb334f13f5..78e71c74b2 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -227,7 +227,6 @@ static int x11_errorhandler(Display * display, XErrorEvent * event) event->error_code, event->request_code, event->minor_code); // abort(); - //exit_player("X11 error"); return 0; #undef MSGLEN } diff --git a/mp_core.h b/mp_core.h index 83eca9ebe1..c26dff3de4 100644 --- a/mp_core.h +++ b/mp_core.h @@ -154,6 +154,7 @@ void reinit_audio_chain(void); void init_vo_spudec(void); double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, const ao_functions_t *audio_out); +void exit_player(exit_reason_t how); void exit_player_with_rc(exit_reason_t how, int rc); void add_subtitles(char *filename, float fps, int noerr); int reinit_video_chain(void); diff --git a/mplayer.h b/mplayer.h index 2f67959be5..49b2a3f22c 100644 --- a/mplayer.h +++ b/mplayer.h @@ -64,7 +64,6 @@ extern int video_id; extern int dvdsub_id; extern int vobsub_id; -void exit_player(const char* how); void update_set_of_subtitles(void); #endif /* MPLAYER_MPLAYER_H */ From 8c21a0fd736a25e6ee2477a76d4fdf4474f6bd1e Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 10:58:01 +0000 Subject: [PATCH 2/2] Make vd_info_t const for pointer in vd_functions, avoids some warnings about initialization discarding the const. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30559 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h index b033513664..65c24f9714 100644 --- a/libmpcodecs/vd.h +++ b/libmpcodecs/vd.h @@ -28,7 +28,7 @@ typedef mp_codec_info_t vd_info_t; /* interface of video decoder drivers */ typedef struct vd_functions_s { - vd_info_t *info; + const vd_info_t *info; int (*init)(sh_video_t *sh); void (*uninit)(sh_video_t *sh); int (*control)(sh_video_t *sh,int cmd,void* arg, ...);