From 2b50b7ddab6524345ace4e75a0b476bedf3a9c8a Mon Sep 17 00:00:00 2001 From: uau Date: Tue, 21 Nov 2006 20:48:17 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21156 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/interface.c | 10 --------- Gui/mplayer/gtk/fs.c | 4 ---- Gui/mplayer/gtk/opts.c | 18 --------------- Gui/win32/dialogs.c | 4 ---- Gui/win32/gui.c | 8 ------- Gui/win32/gui.h | 2 -- Gui/win32/interface.c | 2 -- cfg-common.h | 2 -- configure | 1 - mencoder.c | 6 ----- mplayer.c | 50 +++--------------------------------------- 11 files changed, 3 insertions(+), 104 deletions(-) diff --git a/Gui/interface.c b/Gui/interface.c index a05458f613..d642c33e20 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -380,9 +380,7 @@ void guiInit( void ) 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 stream_dump_type; 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 @@ void guiLoadFont( void ) } #endif } -#endif -#ifdef USE_SUB extern mp_osd_obj_t* vo_osd_list; extern char **sub_name; @@ -518,7 +513,6 @@ void guiLoadSubtitle( char * name ) update_set_of_subtitles(); } -#endif static void add_vop( char * str ) { @@ -905,16 +899,12 @@ int guiGetEvent( int type,char * arg ) } #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; diff --git a/Gui/mplayer/gtk/fs.c b/Gui/mplayer/gtk/fs.c index 714ea7b4b1..17801ed5eb 100644 --- a/Gui/mplayer/gtk/fs.c +++ b/Gui/mplayer/gtk/fs.c @@ -496,12 +496,10 @@ void fs_Ok_released( GtkButton * button,gpointer user_data ) 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 @@ void fs_Ok_released( GtkButton * button,gpointer user_data ) 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; } diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c index 4b3b45b4b8..ac8597f95b 100644 --- a/Gui/mplayer/gtk/opts.c +++ b/Gui/mplayer/gtk/opts.c @@ -400,18 +400,6 @@ void ShowPreferences( void ) 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 @@ void ShowPreferences( void ) 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 ); diff --git a/Gui/win32/dialogs.c b/Gui/win32/dialogs.c index 5be4af04a6..084966604f 100644 --- a/Gui/win32/dialogs.c +++ b/Gui/win32/dialogs.c @@ -43,7 +43,6 @@ extern int get_video_colors(sh_video_t *sh_video, char *item, int *value); 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 @@ void guiLoadSubtitle(char *name) } update_set_of_subtitles(); } -#endif int display_openfilewindow(gui_t *gui, int add) { @@ -156,7 +154,6 @@ int display_openfilewindow(gui_t *gui, int add) return result; } -#ifdef USE_SUB void display_opensubtitlewindow(gui_t *gui) { OPENFILENAME subtitleopen; @@ -183,7 +180,6 @@ void display_opensubtitlewindow(gui_t *gui) if(GetOpenFileName(&subtitleopen)) guiLoadSubtitle(subtitlefile); } -#endif void display_loadplaylistwindow(gui_t *gui) { diff --git a/Gui/win32/gui.c b/Gui/win32/gui.c index fa3c316a82..786769498f 100644 --- a/Gui/win32/gui.c +++ b/Gui/win32/gui.c @@ -216,11 +216,9 @@ static void handlemsg(HWND hWnd, int msg) 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 @@ static LRESULT CALLBACK EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM 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 @@ static void create_menu(gui_t *gui) 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 @@ static void create_traymenu(gui_t *gui) 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"); diff --git a/Gui/win32/gui.h b/Gui/win32/gui.h index e777c12c34..2594d4ae01 100644 --- a/Gui/win32/gui.h +++ b/Gui/win32/gui.h @@ -111,8 +111,6 @@ extern void display_skinbrowser(gui_t *gui); 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 diff --git a/Gui/win32/interface.c b/Gui/win32/interface.c index 6fd964acc3..0da169da87 100644 --- a/Gui/win32/interface.c +++ b/Gui/win32/interface.c @@ -750,12 +750,10 @@ int guiGetEvent(int type, char *arg) 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; } diff --git a/cfg-common.h b/cfg-common.h index 6f8bf086e6..7096ffa9b2 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -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}, diff --git a/configure b/configure index a545e2cb3a..23fc0593db 100755 --- a/configure +++ b/configure @@ -7534,7 +7534,6 @@ $_def_named_asm_args #define PREFIX "$_prefix" #define USE_OSD 1 -#define USE_SUB 1 /* enable/disable SIGHANDLER */ $_def_sighandler diff --git a/mencoder.c b/mencoder.c index 472a1ef3bb..b7c2c25e8c 100644 --- a/mencoder.c +++ b/mencoder.c @@ -199,10 +199,8 @@ int sub_auto = 0; 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 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee } } -#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 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee free(tmp[i++]); free(tmp); } -#endif // set up video encoder: @@ -1477,7 +1473,6 @@ if(sh_audio && !demuxer2){ } fflush(stdout); -#ifdef USE_SUB // find sub if(subdata && sh_video->pts>0){ float pts=sh_video->pts; @@ -1489,7 +1484,6 @@ if(sh_audio && !demuxer2){ sub_last_pts = pts; } } -#endif #ifdef USE_DVDREAD // DVD sub: diff --git a/mplayer.c b/mplayer.c index 883647c2ec..b39dd22010 100644 --- a/mplayer.c +++ b/mplayer.c @@ -50,9 +50,7 @@ extern int mp_input_win32_slave_cmd_func(int fd,char* dest,int size); #include "cfg-mplayer-def.h" -#ifdef USE_SUB #include "subreader.h" -#endif #include "libvo/video_out.h" @@ -340,12 +338,12 @@ char *vobsub_name=NULL; /*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 @@ int sub_source(void) return source; } -#ifdef USE_SUB - sub_data* subdata = NULL; static subtitle* vo_sub_last = NULL; @@ -1029,7 +1025,6 @@ void update_set_of_subtitles(void) ++set_of_sub_size; } } -#endif /* USE_SUB */ void init_vo_spudec(void) { if (vo_spudec) @@ -1259,7 +1254,6 @@ static int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data) return result; } -#ifdef USE_SUB /** * \brief Log the currently displayed subtitle to a file * @@ -1294,7 +1288,6 @@ static void log_sub(void){ } fclose(f); } -#endif /* USE_SUB */ /// \defgroup OSDMsgStack OSD message stack /// @@ -2203,7 +2196,6 @@ static int mp_property_aspect(m_option_t* prop,int action,void* arg) { /// 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 @@ static int mp_property_sub_pos(m_option_t* prop,int action,void* arg) { default: return m_property_int_range(prop,action,arg,&sub_pos); } -#else - return M_PROPERTY_UNAVAILABLE; -#endif } /// Selected subtitles (RW) @@ -2237,15 +2226,12 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { *(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 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { 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 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { 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 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { 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 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { 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 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) { } } } 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 @@ static int mp_property_sub_delay(m_option_t* prop,int action,void* arg) { /// 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 @@ static int mp_property_sub_alignment(m_option_t* prop,int action,void* arg) { 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 @@ static int mp_property_sub_visibility(m_option_t* prop,int action,void* arg) { 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 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, static void update_subtitles(void) { -#ifdef USE_SUB // find sub if (subdata) { double pts = sh_video->pts; @@ -2913,7 +2884,6 @@ static void update_subtitles(void) sub_last_pts = pts; } } -#endif // DVD sub: if (vo_config_count && vo_spudec) { @@ -4419,7 +4389,6 @@ if(vo_spudec==NULL && sh_video && 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 @@ if(sh_video) { global_sub_size += set_of_sub_size; } } -#endif /* USE_SUB */ if (global_sub_size) { // find the best sub to use @@ -4988,7 +4956,6 @@ if(step_sec>0) { 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 @@ if(step_sec>0) { 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 @@ if(step_sec>0) { #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 @@ if(step_sec>0) { ++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 @@ if(step_sec>0) { 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 @@ if(benchmark){ // 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 @@ uninit_player(INITED_ALL-(INITED_GUI+INITED_INPUT+(fixed_vo?INITED_VO:0))); #ifdef USE_ASS ass_track = NULL; #endif -#endif if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) { eof = eof == PT_NEXT_ENTRY ? 1 : -1;