changeset 30516:f4e017b6921a

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().
author diego
date Sun, 14 Feb 2010 10:53:20 +0000
parents 9c07a0af62d8
children 290e478b07cd
files gui/interface.c gui/mplayer/mw.c gui/mplayer/sw.c libao2/audio_out.c libvo/vo_jpeg.c libvo/vo_md5sum.c libvo/vo_png.c libvo/vo_pnm.c libvo/x11_common.c mp_core.h mplayer.h
diffstat 11 files changed, 32 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/gui/interface.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
 	     }
 	 }
 
-	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;
--- a/gui/mplayer/mw.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/gui/mplayer/mw.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
 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 @@
   {
 // --- user events
    case evExit:
-        exit_player( "Exit" );
+        exit_player( EXIT_QUIT );
         break;
 
    case evPlayNetwork:
--- a/gui/mplayer/sw.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/gui/mplayer/sw.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
 
 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--;
--- a/libao2/audio_out.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libao2/audio_out.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
         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);
--- a/libvo/vo_jpeg.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libvo/vo_jpeg.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
                             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 @@
                         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 @@
         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);
--- a/libvo/vo_md5sum.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libvo/vo_md5sum.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
 
 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 @@
                 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;
--- a/libvo/vo_png.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libvo/vo_png.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
                             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 @@
                         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,
--- a/libvo/vo_pnm.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libvo/vo_pnm.c	Sun Feb 14 10:53:20 2010 +0000
@@ -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 @@
 
 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 @@
                             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 @@
                         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 @@
 
     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 @@
         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);
--- a/libvo/x11_common.c	Sun Feb 14 09:19:30 2010 +0000
+++ b/libvo/x11_common.c	Sun Feb 14 10:53:20 2010 +0000
@@ -227,7 +227,6 @@
            event->error_code, event->request_code, event->minor_code);
 
 //    abort();
-    //exit_player("X11 error");
     return 0;
 #undef MSGLEN
 }
--- a/mp_core.h	Sun Feb 14 09:19:30 2010 +0000
+++ b/mp_core.h	Sun Feb 14 10:53:20 2010 +0000
@@ -154,6 +154,7 @@
 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);
--- a/mplayer.h	Sun Feb 14 09:19:30 2010 +0000
+++ b/mplayer.h	Sun Feb 14 10:53:20 2010 +0000
@@ -64,7 +64,6 @@
 extern int dvdsub_id;
 extern int vobsub_id;
 
-void exit_player(const char* how);
 void update_set_of_subtitles(void);
 
 #endif /* MPLAYER_MPLAYER_H */