Index: Makefile =================================================================== RCS file: /cvsroot/mplayer/main/Makefile,v retrieving revision 1.325 diff -u -r1.325 Makefile --- Makefile 27 Jun 2005 20:08:38 -0000 1.325 +++ Makefile 29 Jun 2005 22:27:40 -0000 @@ -19,47 +19,45 @@ DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done endif -SRCS_COMMON = asxparser.c \ - codec-cfg.c \ - cpudetect.c \ - edl.c \ - find_sub.c \ - m_config.c \ - m_option.c \ - m_struct.c \ - parser-cfg.c \ - playtree.c \ - playtreeparser.c \ - spudec.c \ - sub_cc.c \ - subreader.c \ - vobsub.c \ - -SRCS_MENCODER = mencoder.c \ - mp_msg-mencoder.c \ - $(SRCS_COMMON) \ - divx4_vbr.c \ - libvo/aclib.c \ - libvo/font_load.c \ - libvo/font_load_ft.c \ - libvo/osd.c \ - libvo/sub.c \ - parser-mecmd.c \ - xvid_vbr.c \ - -SRCS_MPLAYER = mplayer.c \ - mp_msg.c \ - $(SRCS_COMMON) \ - mixer.c \ - parser-mpcmd.c \ - subopt-helper.c \ +SRCS = mplayer.c \ + mp_msg.c \ + asxparser.c \ + codec-cfg.c \ + cpudetect.c \ + edl.c \ + find_sub.c \ + m_config.c \ + m_option.c \ + m_struct.c \ + parser-cfg.c \ + playtree.c \ + playtreeparser.c \ + spudec.c \ + sub_cc.c \ + subreader.c \ + vobsub.c \ + mixer.c \ + parser-mpcmd.c \ + subopt-helper.c \ + +ifeq ($(MENCODER),yes) +SRCS += mencoder.c \ + divx4_vbr.c \ + libvo/aclib.c \ + libvo/font_load.c \ + libvo/font_load_ft.c \ + libvo/osd.c \ + libvo/sub.c \ + parser-mecmd.c \ + xvid_vbr.c \ + +endif ifeq ($(UNRARLIB),yes) -SRCS_COMMON += unrarlib.c +SRCS += unrarlib.c endif -OBJS_MENCODER = $(SRCS_MENCODER:.c=.o) -OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) +OBJS = $(SRCS:.c=.o) VO_LIBS = $(AA_LIB) \ $(X_LIB) \ @@ -342,17 +340,19 @@ libavcodec/libpostproc/libpostproc.so: $(MAKE) -C libavcodec/libpostproc -MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS) +DEP = $(OBJS) $(COMMON_DEPS) ifeq ($(LIBMENU),yes) -MPLAYER_DEP += libmenu/libmenu.a +DEP += libmenu/libmenu.a MENU_LIBS = libmenu/libmenu.a PARTS += libmenu else MENU_LIBS = endif -MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS) libmpcodecs/libmpencoders.a +ifeq ($(MENCODER),yes) +DEP += libmpcodecs/libmpencoders.a +endif ifeq ($(VIDIX),yes) VIDIX_LIBS = vidix/libvidix.a @@ -361,57 +361,53 @@ endif ifeq ($(TARGET_WIN32),yes) -OBJS_MPLAYER += osdep/mplayer-rc.o +OBJS += osdep/mplayer-rc.o endif -LIBS_MPLAYER = libvo/libvo.a \ - libao2/libao2.a \ - $(MENU_LIBS) \ - $(VIDIX_LIBS) \ - $(GUI_LIBS) \ - $(COMMON_LIBS) \ - $(GTK_LIBS) \ - $(VO_LIBS) \ - $(AO_LIBS) \ - $(EXTRA_LIB)\ - $(LIRC_LIB) \ - $(LIRCC_LIB) \ - $(STATIC_LIB) \ - $(ARCH_LIB) \ - $(I18NLIBS) \ - $(MATH_LIB) \ +ifeq ($(MENCODER),yes) +LIBS += libmpcodecs/libmpencoders.a \ + $(ENCORE_LIB) \ + $(MLIB_LIB) \ + +endif -$(PRG): $(MPLAYER_DEP) +LIBS += libvo/libvo.a \ + libao2/libao2.a \ + $(MENU_LIBS) \ + $(VIDIX_LIBS) \ + $(GUI_LIBS) \ + $(COMMON_LIBS) \ + $(GTK_LIBS) \ + $(VO_LIBS) \ + $(AO_LIBS) \ + $(EXTRA_LIB)\ + $(LIRC_LIB) \ + $(LIRCC_LIB) \ + $(STATIC_LIB) \ + $(ARCH_LIB) \ + $(I18NLIBS) \ + $(MATH_LIB) \ + +$(PRG): $(DEP) ifeq ($(TARGET_WIN32),yes) windres -o osdep/mplayer-rc.o osdep/mplayer.rc endif - $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(LIBS_MPLAYER) + $(CC) $(CFLAGS) -o $(PRG) $(OBJS) $(LIBS) mplayer.exe.spec.c: libmpcodecs/libmpcodecs.a winebuild -fPIC -o mplayer.exe.spec.c -exe mplayer.exe -mcui \ libmpcodecs/ad_qtaudio.o libmpcodecs/vd_qtvideo.o \ -L/usr/local/lib/wine -lkernel32 -mplayer.exe.so: $(MPLAYER_DEP) mplayer.exe.spec.c - $(CC) $(CFLAGS) -Wall -shared -Wl,-rpath,/usr/local/lib -Wl,-Bsymbolic -o mplayer.exe.so $(OBJS_MPLAYER) mplayer.exe.spec.c libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lwine $(MATH_LIB) +mplayer.exe.so: $(MPLAYER) mplayer.exe.spec.c + $(CC) $(CFLAGS) -Wall -shared -Wl,-rpath,/usr/local/lib -Wl,-Bsymbolic -o mplayer.exe.so $(OBJS) mplayer.exe.spec.c libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lwine $(MATH_LIB) -mplayer_wine.so: $(MPLAYER_DEP) - $(CC) $(CFLAGS) -shared -Wl,-Bsymbolic -o mplayer_wine.so mplayer_wine.spec.c $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) -lwine $(ARCH_LIB) $(MATH_LIB) +mplayer_wine.so: $(MPLAYER) + $(CC) $(CFLAGS) -shared -Wl,-Bsymbolic -o mplayer_wine.so mplayer_wine.spec.c $(OBJS) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) -lwine $(ARCH_LIB) $(MATH_LIB) ifeq ($(MENCODER),yes) -LIBS_MENCODER = libmpcodecs/libmpencoders.a \ - $(ENCORE_LIB) \ - $(COMMON_LIBS) \ - $(EXTRA_LIB) \ - $(MLIB_LIB) \ - $(LIRC_LIB) \ - $(LIRCC_LIB) \ - $(ARCH_LIB) \ - $(I18NLIBS) \ - $(MATH_LIB) \ - -$(PRG_MENCODER): $(MENCODER_DEP) - $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) $(LIBS_MENCODER) +$(PRG_MENCODER): $(PRG) + -ln -sf $(PRG) $(PRG_MENCODER) endif codecs.conf.h: $(PRG_CFG) etc/codecs.conf @@ -425,8 +421,7 @@ # in a recursive "make distclean" and we must wait for this "make distclean" to # finish before we can start building new object files. # help_mp.h is also required by a lot of files, so force generating it early. -$(MPLAYER_DEP): version.h help_mp.h -$(MENCODER_DEP): version.h help_mp.h +$(DEP): version.h help_mp.h $(PRG_CFG): version.h codec-cfg.c codec-cfg.h $(HOST_CC) $(HOST_CFLAGS) -I. -g codec-cfg.c mp_msg.c -o $(PRG_CFG) -DCODECS2HTML $(EXTRA_LIB) $(EXTRA_INC) $(I18NLIBS) @@ -453,7 +448,7 @@ fi ; \ done ifeq ($(MENCODER),yes) - $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER) + -ln -sf $(PRG) $(BINDIR)/$(PRG_MENCODER) for i in $(MAN_LANG); do \ if test "$$i" = en ; then \ ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1 ; \ @@ -523,7 +518,7 @@ depend: help_mp.h ./version.sh `$(CC) -dumpversion` - $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend + $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS) 1>.depend @for a in $(PARTS); do $(MAKE) -C $$a dep; done # ./configure must be run if it changed in CVS Index: cfg-common.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-common.h,v retrieving revision 1.145 diff -u -r1.145 cfg-common.h --- cfg-common.h 13 May 2005 14:45:28 -0000 1.145 +++ cfg-common.h 29 Jun 2005 22:27:40 -0000 @@ -346,6 +346,9 @@ #endif #ifdef USE_TV +#ifdef FOR_MENCODER +extern m_option_t tvopts_conf[]; +#else m_option_t tvopts_conf[]={ {"on", "-tv on is deprecated, use tv:// instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, {"immediatemode", &tv_param_immediate, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL}, @@ -391,6 +394,7 @@ {NULL, NULL, 0, 0, 0, 0, NULL} }; #endif +#endif #ifdef HAS_DVBIN_SUPPORT #include "libmpdemux/dvbin.h" @@ -412,6 +416,9 @@ extern float sws_chr_sharpen; extern float sws_lum_sharpen; +#ifdef FOR_MENCODER +extern m_option_t scaler_filter_conf[]; +#else m_option_t scaler_filter_conf[]={ {"lgb", &sws_lum_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, {"cgb", &sws_chr_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, @@ -421,6 +428,7 @@ {"cs", &sws_chr_sharpen, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; +#endif /* VIVO demuxer options: */ extern int vivo_param_version; @@ -433,6 +441,9 @@ extern int vivo_param_vformat; extern char *dvd_device, *cdrom_device; +#ifdef FOR_MENCODER +extern m_option_t vivoopts_conf[]; +#else m_option_t vivoopts_conf[]={ {"version", &vivo_param_version, CONF_TYPE_INT, 0, 0, 0, NULL}, /* audio options */ @@ -446,6 +457,7 @@ {"vformat", &vivo_param_vformat, CONF_TYPE_INT, 0, 0, 0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; +#endif extern int mf_w; extern int mf_h; @@ -454,6 +466,9 @@ extern m_obj_settings_t* vf_settings; extern m_obj_list_t vf_obj_list; +#ifdef FOR_MENCODER +extern m_option_t mfopts_conf[]; +#else m_option_t mfopts_conf[]={ {"on", "-mf on is deprecated, use mf:// instead.\n", CONF_TYPE_PRINT, 0, 0, 1, NULL}, {"w", &mf_w, CONF_TYPE_INT, 0, 0, 0, NULL}, @@ -462,16 +477,22 @@ {"type", &mf_type, CONF_TYPE_STRING, 0, 0, 0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; +#endif extern m_obj_settings_t* vo_plugin_args; #include "libaf/af.h" extern af_cfg_t af_cfg; // Audio filter configuration, defined in libmpcodecs/dec_audio.c + +#ifdef FOR_MENCODER +extern m_option_t audio_filter_conf[]; +#else m_option_t audio_filter_conf[]={ {"list", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; +#endif #ifdef WIN32 Index: cfg-mencoder.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v retrieving revision 1.100 diff -u -r1.100 cfg-mencoder.h --- cfg-mencoder.h 19 Jun 2005 09:12:42 -0000 1.100 +++ cfg-mencoder.h 29 Jun 2005 22:27:40 -0000 @@ -3,7 +3,9 @@ * config for cfgparser */ +#define FOR_MENCODER 1 #include "cfg-common.h" +#undef FOR_MENCODER #ifdef USE_FAKE_MONO extern int fakemono; // defined in dec_audio.c Index: mencoder.c =================================================================== RCS file: /cvsroot/mplayer/main/mencoder.c,v retrieving revision 1.290 diff -u -r1.290 mencoder.c --- mencoder.c 27 Jun 2005 19:10:11 -0000 1.290 +++ mencoder.c 29 Jun 2005 22:27:40 -0000 @@ -72,7 +72,7 @@ #include "osdep/timer.h" -#include "get_path.c" +extern char *get_path(char *filename); #ifdef USE_LIBAVCODEC #ifdef USE_LIBAVCODEC_SO @@ -83,30 +83,27 @@ #endif #include "libmpcodecs/ae.h" -int vo_doublebuffering=0; -int vo_directrendering=0; -int vo_config_count=0; -int forced_subs_only=0; +extern int forced_subs_only; //-------------------------- // cache2: -int stream_cache_size=-1; +extern int stream_cache_size; #ifdef USE_STREAM_CACHE extern int cache_fill_status; -float stream_cache_min_percent=20.0; -float stream_cache_prefill_percent=5.0; +extern float stream_cache_min_percent; +extern float stream_cache_prefill_percent; #else #define cache_fill_status 0 #endif -int audio_id=-1; -int video_id=-1; -int dvdsub_id=-1; -int vobsub_id=-1; -char* audio_lang=NULL; -char* dvdsub_lang=NULL; +extern int audio_id; +extern int video_id; +extern int dvdsub_id; +extern int vobsub_id; +extern char* audio_lang; +extern char* dvdsub_lang; static char* spudec_ifo=NULL; static char** audio_codec_list=NULL; // override audio codec @@ -124,16 +121,16 @@ //void skip_audio_frame(sh_audio_t *sh_audio){} //void resync_audio_stream(sh_audio_t *sh_audio){} -int verbose=0; // must be global! -int identify=0; -int quiet=0; -double video_time_usage=0; -double vout_time_usage=0; +extern int verbose; // must be global! +extern int identify; +extern int quiet; +extern double video_time_usage; +extern double vout_time_usage; double max_video_time_usage=0; double max_vout_time_usage=0; double cur_video_time_usage=0; double cur_vout_time_usage=0; -int benchmark=0; +extern int benchmark; #ifdef WIN32 char * proc_priority=NULL; @@ -149,10 +146,10 @@ static float audio_delay=0.0; static int audio_density=2; -float force_fps=0; +extern float force_fps; static float force_ofps=0; // set to 24 for inverse telecine static int skip_limit=-1; -float playback_speed=1.0; +extern float playback_speed; static int force_srate=0; static int audio_output_format=0; @@ -174,21 +171,21 @@ #include "libvo/sub.h" // sub: -char *font_name=NULL; +extern char *font_name; #ifdef HAVE_FONTCONFIG extern int font_fontconfig; #endif -float font_factor=0.75; -char **sub_name=NULL; -float sub_delay=0; -float sub_fps=0; -int sub_auto = 0; -int subcc_enabled=0; -int suboverlap_enabled = 1; +extern float font_factor; +extern char **sub_name; +extern float sub_delay; +extern float sub_fps; +extern int sub_auto; +extern int subcc_enabled; +extern int suboverlap_enabled; #ifdef USE_SUB static sub_data* subdata=NULL; -float sub_last_pts = -303; +extern float sub_last_pts; #endif int auto_expand=1; @@ -266,7 +263,7 @@ exit(level); } -void parse_cfgfiles( m_config_t* conf ) +void me_parse_cfgfiles( m_config_t* conf ) { char *conffile; if ((conffile = get_path("mencoder")) == NULL) { @@ -327,7 +324,7 @@ extern void print_wave_header(WAVEFORMATEX *h); -int main(int argc,char* argv[]){ +int me_main(int argc,char* argv[]){ stream_t* stream=NULL; demuxer_t* demuxer=NULL; @@ -372,6 +369,7 @@ audio_encoding_params_t aparams; audio_encoder_t *aencoder = NULL; + sub_auto = 0; mp_msg_init(); mp_msg_set_level(MSGL_STATUS); @@ -435,7 +433,7 @@ mconfig = m_config_new(); m_config_register_options(mconfig,mencoder_opts); - parse_cfgfiles(mconfig); + me_parse_cfgfiles(mconfig); filelist = m_config_parse_me_command_line(mconfig, argc, argv); if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine); Index: mplayer.c =================================================================== RCS file: /cvsroot/mplayer/main/mplayer.c,v retrieving revision 1.850 diff -u -r1.850 mplayer.c --- mplayer.c 24 Jun 2005 10:50:52 -0000 1.850 +++ mplayer.c 29 Jun 2005 22:27:42 -0000 @@ -1001,7 +1001,7 @@ } #endif -int main(int argc,char* argv[]){ +int mp_main(int argc,char* argv[]){ char * mem_ptr; @@ -4299,3 +4299,14 @@ return 1; } + +int +main (int argc, char **argv) +{ +#ifdef HAVE_MENCODER + if (strstr (argv[0], "mencoder")) + return me_main (argc, argv); + else +#endif + return mp_main (argc, argv); +}