changeset 21140:b42f1c1ef651

Make compilation depending on USE_SUB unconditional. USE_SUB was hardcoded to true in configure, manually turning it off would break compilation, and there's no apparent reason why having all subtitle code under #ifdefs (even working ones) would be worth the clutter.
author uau
date Tue, 21 Nov 2006 20:48:17 +0000
parents 65d41a1f8fc4
children 33cce0f7e66c
files Gui/interface.c Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/opts.c Gui/win32/dialogs.c Gui/win32/gui.c Gui/win32/gui.h Gui/win32/interface.c cfg-common.h configure mencoder.c mplayer.c
diffstat 11 files changed, 3 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/interface.c	Tue Nov 21 20:48:17 2006 +0000
@@ -380,9 +380,7 @@
  if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
  if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
  if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename );
-#if defined( USE_OSD ) || defined( USE_SUB )
  guiLoadFont();
-#endif
 }
 
 void guiDone( void )
@@ -427,7 +425,6 @@
 extern int  		vcd_track;
 extern m_obj_settings_t*vo_plugin_args;
 
-#if defined( USE_OSD ) || defined( USE_SUB )
 void guiLoadFont( void )
 {
 #ifdef HAVE_FREETYPE
@@ -469,9 +466,7 @@
    }
 #endif
 }
-#endif
 
-#ifdef USE_SUB
 extern mp_osd_obj_t* vo_osd_list;
 
 extern char **sub_name;
@@ -518,7 +513,6 @@
  update_set_of_subtitles();
 
 }
-#endif
 
 static void add_vop( char * str )
 {
@@ -905,16 +899,12 @@
 	 }
 #endif
 // -- subtitle
-#ifdef USE_SUB
 	//subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
 	stream_dump_type=0;
 	if ( gtkSubDumpMPSub ) stream_dump_type=4;
 	if ( gtkSubDumpSrt ) stream_dump_type=6;
 	gtkSubDumpMPSub=gtkSubDumpSrt=0;
-#endif
-#if defined( USE_OSD ) || defined( USE_SUB )
         guiLoadFont();
-#endif
 
 // --- misc		    
 	if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
--- a/Gui/mplayer/gtk/fs.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/mplayer/gtk/fs.c	Tue Nov 21 20:48:17 2006 +0000
@@ -496,12 +496,10 @@
 	  gfree( (void **)&guiIntfStruct.Subtitlename );
           fs_PersistantHistory( fsSelectedDirectory );      //totem, write into history
           break;
-#ifdef USE_SUB
    case fsSubtitleSelector:
           guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile );
 	  guiLoadSubtitle( guiIntfStruct.Subtitlename );
           break;
-#endif
    case fsOtherSelector:
           guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile );
           break;
@@ -510,9 +508,7 @@
           break;
    case fsFontSelector:
           guiSetDF( font_name,fsSelectedDirectory,fsSelectedFile );
-#if defined( USE_OSD ) || defined( USE_SUB )
 	  guiLoadFont();
-#endif
 	  if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
 	  break;
   }
--- a/Gui/mplayer/gtk/opts.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/mplayer/gtk/opts.c	Tue Nov 21 20:48:17 2006 +0000
@@ -400,18 +400,6 @@
   else gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),DEFAULT_CDROM_DEVICE );
 
 // -- disables
-#ifndef USE_SUB
- gtk_widget_set_sensitive( AConfig,FALSE );
- gtk_widget_set_sensitive( CBNoAutoSub,FALSE );
- gtk_widget_set_sensitive( CBSubOverlap,FALSE );
- gtk_widget_set_sensitive( CBSubUnicode,FALSE );
- gtk_widget_set_sensitive( CBDumpMPSub,FALSE );
- gtk_widget_set_sensitive( CBDumpSrt,FALSE );
- gtk_widget_set_sensitive( HSSubDelay,FALSE );
- gtk_widget_set_sensitive( HSSubPosition,FALSE );
- gtk_widget_set_sensitive( HSSubFPS,FALSE );
-#endif
-
 #ifndef USE_ASS
  gtk_widget_set_sensitive( CBUseASS,FALSE );
  gtk_widget_set_sensitive( CBASSUseMargins,FALSE );
@@ -426,12 +414,6 @@
  gtk_widget_set_sensitive( RBOSDTPTT,FALSE );
 #endif
 
-#if !defined( USE_OSD ) && !defined( USE_SUB )
- gtk_widget_set_sensitive( HSFontFactor,FALSE );
- gtk_widget_set_sensitive( prEFontName,FALSE );
- gtk_widget_set_sensitive( BLoadFont,FALSE );
-#endif
-
 // -- signals
  gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)0 );
  gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 );
--- a/Gui/win32/dialogs.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/win32/dialogs.c	Tue Nov 21 20:48:17 2006 +0000
@@ -43,7 +43,6 @@
 guiInterface_t guiIntfStruct;
 int addurl = 0;
 
-#ifdef USE_SUB
 extern mp_osd_obj_t* vo_osd_list;
 extern char **sub_name;
 
@@ -89,7 +88,6 @@
     }
     update_set_of_subtitles();
 }
-#endif
 
 int display_openfilewindow(gui_t *gui, int add)
 {
@@ -156,7 +154,6 @@
     return result;
 }
 
-#ifdef USE_SUB
 void display_opensubtitlewindow(gui_t *gui)
 {
     OPENFILENAME subtitleopen;
@@ -183,7 +180,6 @@
     if(GetOpenFileName(&subtitleopen))
         guiLoadSubtitle(subtitlefile);
 }
-#endif
 
 void display_loadplaylistwindow(gui_t *gui)
 {
--- a/Gui/win32/gui.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/win32/gui.c	Tue Nov 21 20:48:17 2006 +0000
@@ -216,11 +216,9 @@
             if(display_openfilewindow(gui, 0) && (msg == evLoadPlay))
                 handlemsg(hWnd, evDropFile);
             return;
-#ifdef USE_SUB
         case evLoadSubtitle:
             display_opensubtitlewindow(gui);
             break;
-#endif
         case evPreferences:
             display_prefswindow(gui);
             return;
@@ -979,11 +977,9 @@
                 case ID_MUTE:
                     mp_input_queue_cmd(mp_input_parse_cmd("mute"));
                     break;
-#ifdef USE_SUB
                 case IDSUBTITLE_OPEN:
                     display_opensubtitlewindow(gui);
                     break;
-#endif
                 case ID_PTRACK:
                     handlemsg(hWnd, evPrev);
                     break;
@@ -1186,9 +1182,7 @@
     AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
     AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT) gui->diskmenu, "Play &CD/DVD/VCD/SVCD");
     AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
-#ifdef USE_SUB
     AppendMenu(gui->menu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
-#endif
     AppendMenu(gui->menu, MF_STRING, ID_SKINBROWSER, "Skin Browser");
     AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
     AppendMenu(gui->menu, MF_STRING, ID_PREFS, "Preferences");
@@ -1214,9 +1208,7 @@
     AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
     AppendMenu(gui->traymenu, MF_STRING, ID_MUTE, "Toggle Mute");
     AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
-#ifdef USE_SUB
     AppendMenu(gui->traymenu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
-#endif
     AppendMenu(gui->traymenu, MF_STRING, ID_PLAYLIST, "Playlist");
     AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
     AppendMenu(gui->traymenu, MF_STRING, ID_SHOWHIDE, "Show/Hide");
--- a/Gui/win32/gui.h	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/win32/gui.h	Tue Nov 21 20:48:17 2006 +0000
@@ -111,8 +111,6 @@
 extern void display_chapterselwindow(gui_t *gui);
 extern void display_eqwindow(gui_t *gui);
 extern void display_prefswindow(gui_t *gui);
-#ifdef USE_SUB
 extern void display_opensubtitlewindow(gui_t *gui);
-#endif
 
 #endif
--- a/Gui/win32/interface.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/Gui/win32/interface.c	Tue Nov 21 20:48:17 2006 +0000
@@ -750,12 +750,10 @@
                     if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
                     break;
-#ifdef USE_SUB
                 case MP_CMD_GUI_LOADSUBTITLE:
                     if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
                     break;
-#endif
                 default:
                     break;
             }
--- a/cfg-common.h	Tue Nov 21 20:31:35 2006 +0000
+++ b/cfg-common.h	Tue Nov 21 20:48:17 2006 +0000
@@ -251,7 +251,6 @@
 	{"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
 // ------------------------- subtitles options --------------------
 
-#ifdef USE_SUB
 	{"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 #ifdef USE_FRIBIDI
 	{"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
@@ -289,7 +288,6 @@
 	{"sub-bg-alpha", &sub_bg_alpha, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
 	{"sub-no-text-pp", &sub_no_text_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"sub-fuzziness", &sub_match_fuzziness, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-#endif
 #ifdef USE_OSD
 	{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
--- a/configure	Tue Nov 21 20:31:35 2006 +0000
+++ b/configure	Tue Nov 21 20:48:17 2006 +0000
@@ -7534,7 +7534,6 @@
 #define PREFIX "$_prefix"
 
 #define USE_OSD 1
-#define USE_SUB 1
 
 /* enable/disable SIGHANDLER */
 $_def_sighandler
--- a/mencoder.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/mencoder.c	Tue Nov 21 20:48:17 2006 +0000
@@ -199,10 +199,8 @@
 int   subcc_enabled=0;
 int   suboverlap_enabled = 1;
 
-#ifdef USE_SUB
 static sub_data* subdata=NULL;
 float sub_last_pts = -303;
-#endif
 
 int auto_expand=1;
 int encode_duplicates=1;
@@ -649,7 +647,6 @@
     }
   }
 
-#ifdef USE_SUB
 // after reading video params we should load subtitles because
 // we know fps so now we can adjust subtitles time to ~6 seconds AST
 // check .sub
@@ -669,7 +666,6 @@
       free(tmp[i++]);
     free(tmp);
   }
-#endif	
 
 // set up video encoder:
 
@@ -1477,7 +1473,6 @@
     }
         fflush(stdout);
 
-#ifdef USE_SUB
   // find sub
   if(subdata && sh_video->pts>0){
       float pts=sh_video->pts;
@@ -1489,7 +1484,6 @@
          sub_last_pts = pts;
       }
   }
-#endif
 
 #ifdef USE_DVDREAD
 // DVD sub:
--- a/mplayer.c	Tue Nov 21 20:31:35 2006 +0000
+++ b/mplayer.c	Tue Nov 21 20:48:17 2006 +0000
@@ -50,9 +50,7 @@
 
 #include "cfg-mplayer-def.h"
 
-#ifdef USE_SUB
 #include "subreader.h"
-#endif
 
 #include "libvo/video_out.h"
 
@@ -340,12 +338,12 @@
 /*DSP!!char *dsp=NULL;*/
 int   subcc_enabled=0;
 int suboverlap_enabled = 1;
-#ifdef USE_SUB
+
 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
 int set_of_sub_size = 0;
 int set_of_sub_pos = -1;
 double sub_last_pts = -303;
-#endif
+
 int global_sub_size = 0; // this encompasses all subtitle sources
 int global_sub_pos = -1; // this encompasses all subtitle sources
 #define SUB_SOURCE_SUBS 0
@@ -963,8 +961,6 @@
     return source;
 }
 
-#ifdef USE_SUB
-
 sub_data* subdata = NULL;
 static subtitle* vo_sub_last = NULL;
 
@@ -1029,7 +1025,6 @@
         ++set_of_sub_size;
     }
 }
-#endif /* USE_SUB */
 
 void init_vo_spudec(void) {
   if (vo_spudec)
@@ -1259,7 +1254,6 @@
   return result;
 }
 
-#ifdef USE_SUB
 /**
  * \brief Log the currently displayed subtitle to a file
  * 
@@ -1294,7 +1288,6 @@
     }
     fclose(f);
 }
-#endif /* USE_SUB */
 
 /// \defgroup OSDMsgStack OSD message stack
 ///
@@ -2203,7 +2196,6 @@
 
 /// Text subtitle position (RW)
 static int mp_property_sub_pos(m_option_t* prop,int action,void* arg) {
-#ifdef USE_SUB
     if(!sh_video) return M_PROPERTY_UNAVAILABLE;
 
     switch(action) {
@@ -2215,9 +2207,6 @@
     default:
         return m_property_int_range(prop,action,arg,&sub_pos);
     }
-#else
-    return M_PROPERTY_UNAVAILABLE;
-#endif
 }
 
 /// Selected subtitles (RW)
@@ -2237,15 +2226,12 @@
         *(char**)arg = malloc(64);
         (*(char**)arg)[63] = 0;
         sub_name = 0;
-#ifdef USE_SUB
         if(subdata)
             sub_name = subdata->filename;
-#endif
 #ifdef USE_ASS
         if (ass_track && ass_track->name)
             sub_name = ass_track->name;
 #endif
-#if defined(USE_SUB) || defined(USE_ASS)
         if(sub_name) {
             char *tmp,*tmp2;
             tmp = sub_name;
@@ -2258,7 +2244,6 @@
                      strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19);
             return M_PROPERTY_OK;
         }
-#endif
         if (demuxer->type == DEMUXER_TYPE_MATROSKA && dvdsub_id >= 0) {
             char lang[40] = MSGTR_Unknown;
             demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 9);
@@ -2328,11 +2313,10 @@
            global_sub_indices[SUB_SOURCE_DEMUX],
            global_sub_pos, source);
 
-#ifdef USE_SUB
     set_of_sub_pos = -1;
     subdata = NULL;
     vo_sub_last = vo_sub = NULL;
-#endif
+
     vobsub_id = -1;
     dvdsub_id = -1;
     if (d_dvdsub) {
@@ -2345,7 +2329,6 @@
 
     if (source == SUB_SOURCE_VOBSUB) {
         vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB];
-#ifdef USE_SUB
     } else if (source == SUB_SOURCE_SUBS) {
         set_of_sub_pos = global_sub_pos - global_sub_indices[SUB_SOURCE_SUBS];
 #ifdef USE_ASS
@@ -2357,7 +2340,6 @@
             subdata = set_of_subtitles[set_of_sub_pos];
             vo_osd_changed(OSDTYPE_SUBTITLE);
         }
-#endif
     } else if (source == SUB_SOURCE_DEMUX) {
         dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX];
         if (d_dvdsub) {
@@ -2391,9 +2373,7 @@
             }
         }
     } else { // off
-#ifdef USE_SUB
         vo_osd_changed(OSDTYPE_SUBTITLE);
-#endif
         if(vo_spudec) vo_osd_changed(OSDTYPE_SPU);
     }
 #ifdef USE_DVDREAD
@@ -2415,7 +2395,6 @@
 
 /// Alignment of text subtitles (RW) 
 static int mp_property_sub_alignment(m_option_t* prop,int action,void* arg) {
-#ifdef USE_SUB
     char* name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom };
 
     if(!sh_video || global_sub_pos < 0 || sub_source() != SUB_SOURCE_SUBS)
@@ -2435,14 +2414,10 @@
     default:
         return m_property_choice(prop,action,arg,&sub_alignment);
     }
-#else
-    return M_PROPERTY_UNAVAILABLE;
-#endif
 }
 
 /// Subtitle visibility (RW)
 static int mp_property_sub_visibility(m_option_t* prop,int action,void* arg) {
-#ifdef USE_SUB
     if(!sh_video) return M_PROPERTY_UNAVAILABLE;
     
     switch(action) {
@@ -2455,9 +2430,6 @@
     default:
         return m_property_flag(prop,action,arg,&sub_visibility);
     }
-#else
-    return M_PROPERTY_UNAVAILABLE;
-#endif
 }
 
 /// Show only forced subtitles (RW)
@@ -2899,7 +2871,6 @@
 
 static void update_subtitles(void)
 {
-#ifdef USE_SUB
     // find sub
     if (subdata) {
 	double pts = sh_video->pts;
@@ -2913,7 +2884,6 @@
 	    sub_last_pts = pts;
 	}
     }
-#endif
 
     // DVD sub:
     if (vo_config_count && vo_spudec) {
@@ -4419,7 +4389,6 @@
 if (vo_spudec!=NULL)
   spudec_set_forced_subs_only(vo_spudec,forced_subs_only);
 
-#ifdef USE_SUB
 if(sh_video) {
 // after reading video params we should load subtitles because
 // we know fps so now we can adjust subtitle time to ~6 seconds AST
@@ -4446,7 +4415,6 @@
       global_sub_size += set_of_sub_size;
   }
 }
-#endif /* USE_SUB */
 
 if (global_sub_size) {
   // find the best sub to use
@@ -4988,7 +4956,6 @@
       brk_cmd = 1;
     } break;
     case MP_CMD_SUB_STEP : {
-#ifdef USE_SUB
     if (sh_video) {
       int movement = cmd->args[0].v.i;
       step_sub(subdata, sh_video->pts, movement);
@@ -4999,12 +4966,9 @@
       set_osd_msg(OSD_MSG_SUB_DELAY,1,osd_duration,
                   MSGTR_OSDSubDelay, ROUND(sub_delay*1000));
     }
-#endif
     } break;
     case MP_CMD_SUB_LOG : {
-#ifdef USE_SUB
 	log_sub();
-#endif
     } break;
     case MP_CMD_OSD :  {
 	int v = cmd->args[0].v.i;
@@ -5203,7 +5167,6 @@
 #endif /* USE_TV */
     case MP_CMD_SUB_LOAD:
     {
-#ifdef USE_SUB
       if (sh_video) {
         int n = set_of_sub_size;
         add_subtitles(cmd->args[0].v.s, sh_video->fps, 0);
@@ -5213,11 +5176,9 @@
           ++global_sub_size;
         }
       }
-#endif
     } break;
     case MP_CMD_SUB_REMOVE:
     {
-#ifdef USE_SUB
       if (sh_video) {
         int v = cmd->args[0].v.i;
         sub_data *subd;
@@ -5263,15 +5224,12 @@
           set_of_subtitles[set_of_sub_size] = NULL;
         }
       }
-#endif /* USE_SUB */
     } break;
     case MP_CMD_GET_SUB_VISIBILITY:
 	{
-#ifdef USE_SUB
 	if (sh_video) {
 		mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_SUB_VISIBILITY=%d\n", sub_visibility);
 	}
-#endif
 	} break;
     case MP_CMD_SCREENSHOT :
       if(vo_config_count){
@@ -5677,7 +5635,6 @@
 // time to uninit all, except global stuff:
 uninit_player(INITED_ALL-(INITED_GUI+INITED_INPUT+(fixed_vo?INITED_VO:0)));
 
-#ifdef USE_SUB  
   if ( set_of_sub_size > 0 ) 
    {
     current_module="sub_free";
@@ -5695,7 +5652,6 @@
 #ifdef USE_ASS
     ass_track = NULL;
 #endif
-#endif
 
 if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) {
   eof = eof == PT_NEXT_ENTRY ? 1 : -1;