From 389c32b5c72897a8b1b3c929c8f278e8980f2290 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 31 Oct 2010 00:04:18 +0300 Subject: Remove MEncoder Disable MEncoder compilation and remove files used by MEncoder only. There's no attempt to remove all references to MEncoder from the build system, documentation etc at this point. Removed files: (muxers, audio/video encoders, misc) mencoder.c cfg-mencoder.h parser-mecmd.[ch] xvid_vbr.[ch] libmpdemux/muxer* libmpcodecs/ae* libmpcodecs/ve* libmpcodecs/native/rtjpegn.[ch] libmpcodecs/native/mmx.h // was used by rtjpegn only Rationale: MEncoder is still useful for some people, but there's not much potential for further development; in the long run almost all use cases can be handled better by solutions based on something else (for example using FFmpeg or encoding MPlayer output). FFmpeg is already getting video filtering support which should work for some common MEncoder uses. Keeping MEncoder working takes extra work that is away from player development. While that amount of work is not huge (mostly MEncoder can be just ignored), it's not completely insignificant either. MEncoder is still maintained to some degree in the svn tree, so if necessary it's possible to use it from there for now. This tree has never had major improvements for the MEncoder side, so using svn MEncoder instead should be no major loss. --- Makefile | 57 +- cfg-mencoder.h | 278 ----- configure | 9 +- libmpcodecs/ae.c | 116 -- libmpcodecs/ae.h | 65 - libmpcodecs/ae_faac.c | 215 ---- libmpcodecs/ae_faac.h | 27 - libmpcodecs/ae_lame.c | 493 -------- libmpcodecs/ae_lame.h | 26 - libmpcodecs/ae_lavc.c | 244 ---- libmpcodecs/ae_lavc.h | 26 - libmpcodecs/ae_pcm.c | 101 -- libmpcodecs/ae_pcm.h | 26 - libmpcodecs/ae_toolame.c | 236 ---- libmpcodecs/ae_toolame.h | 34 - libmpcodecs/ae_twolame.c | 235 ---- libmpcodecs/ae_twolame.h | 32 - libmpcodecs/native/mmx.h | 98 -- libmpcodecs/native/rtjpegn.c | 1758 --------------------------- libmpcodecs/native/rtjpegn.h | 44 - libmpcodecs/ve.c | 75 -- libmpcodecs/ve_lavc.c | 1050 ---------------- libmpcodecs/ve_libdv.c | 135 --- libmpcodecs/ve_nuv.c | 255 ---- libmpcodecs/ve_qtvideo.c | 359 ------ libmpcodecs/ve_raw.c | 177 --- libmpcodecs/ve_vfw.c | 377 ------ libmpcodecs/ve_x264.c | 308 ----- libmpcodecs/ve_x264.h | 26 - libmpcodecs/ve_xvid4.c | 1527 ----------------------- libmpdemux/muxer.c | 167 --- libmpdemux/muxer.h | 143 --- libmpdemux/muxer_avi.c | 694 ----------- libmpdemux/muxer_lavf.c | 408 ------- libmpdemux/muxer_mpeg.c | 2735 ------------------------------------------ libmpdemux/muxer_rawaudio.c | 89 -- libmpdemux/muxer_rawvideo.c | 92 -- mencoder.c | 1779 --------------------------- parser-mecmd.c | 169 --- parser-mecmd.h | 55 - xvid_vbr.c | 1648 ------------------------- xvid_vbr.h | 231 ---- 42 files changed, 6 insertions(+), 16613 deletions(-) delete mode 100644 cfg-mencoder.h delete mode 100644 libmpcodecs/ae.c delete mode 100644 libmpcodecs/ae.h delete mode 100644 libmpcodecs/ae_faac.c delete mode 100644 libmpcodecs/ae_faac.h delete mode 100644 libmpcodecs/ae_lame.c delete mode 100644 libmpcodecs/ae_lame.h delete mode 100644 libmpcodecs/ae_lavc.c delete mode 100644 libmpcodecs/ae_lavc.h delete mode 100644 libmpcodecs/ae_pcm.c delete mode 100644 libmpcodecs/ae_pcm.h delete mode 100644 libmpcodecs/ae_toolame.c delete mode 100644 libmpcodecs/ae_toolame.h delete mode 100644 libmpcodecs/ae_twolame.c delete mode 100644 libmpcodecs/ae_twolame.h delete mode 100644 libmpcodecs/native/mmx.h delete mode 100644 libmpcodecs/native/rtjpegn.c delete mode 100644 libmpcodecs/native/rtjpegn.h delete mode 100644 libmpcodecs/ve.c delete mode 100644 libmpcodecs/ve_lavc.c delete mode 100644 libmpcodecs/ve_libdv.c delete mode 100644 libmpcodecs/ve_nuv.c delete mode 100644 libmpcodecs/ve_qtvideo.c delete mode 100644 libmpcodecs/ve_raw.c delete mode 100644 libmpcodecs/ve_vfw.c delete mode 100644 libmpcodecs/ve_x264.c delete mode 100644 libmpcodecs/ve_x264.h delete mode 100644 libmpcodecs/ve_xvid4.c delete mode 100644 libmpdemux/muxer.c delete mode 100644 libmpdemux/muxer.h delete mode 100644 libmpdemux/muxer_avi.c delete mode 100644 libmpdemux/muxer_lavf.c delete mode 100644 libmpdemux/muxer_mpeg.c delete mode 100644 libmpdemux/muxer_rawaudio.c delete mode 100644 libmpdemux/muxer_rawvideo.c delete mode 100644 mencoder.c delete mode 100644 parser-mecmd.c delete mode 100644 parser-mecmd.h delete mode 100644 xvid_vbr.c delete mode 100644 xvid_vbr.h diff --git a/Makefile b/Makefile index 4e40e77332..224dbf33cc 100644 --- a/Makefile +++ b/Makefile @@ -642,51 +642,18 @@ SRCS_MPLAYER = command.c \ libvo/vo_null.c \ $(SRCS_MPLAYER-yes) - -SRCS_MENCODER-$(FAAC) += libmpcodecs/ae_faac.c -SRCS_MENCODER-$(LIBAVCODEC) += libmpcodecs/ae_lavc.c libmpcodecs/ve_lavc.c -SRCS_MENCODER-$(LIBAVFORMAT) += libmpdemux/muxer_lavf.c -SRCS_MENCODER-$(LIBDV) += libmpcodecs/ve_libdv.c -SRCS_MENCODER-$(LIBLZO) += libmpcodecs/ve_nuv.c \ - libmpcodecs/native/rtjpegn.c -SRCS_MENCODER-$(MP3LAME) += libmpcodecs/ae_lame.c -SRCS_MENCODER-$(QTX_CODECS_WIN32) += libmpcodecs/ve_qtvideo.c -SRCS_MENCODER-$(TOOLAME) += libmpcodecs/ae_toolame.c -SRCS_MENCODER-$(TWOLAME) += libmpcodecs/ae_twolame.c -SRCS_MENCODER-$(WIN32DLL) += libmpcodecs/ve_vfw.c -SRCS_MENCODER-$(X264) += libmpcodecs/ve_x264.c -SRCS_MENCODER-$(XVID4) += libmpcodecs/ve_xvid4.c - -SRCS_MENCODER = mencoder.c \ - parser-mecmd.c \ - xvid_vbr.c \ - libmpcodecs/ae.c \ - libmpcodecs/ae_pcm.c \ - libmpcodecs/ve.c \ - libmpcodecs/ve_raw.c \ - libmpdemux/muxer.c \ - libmpdemux/muxer_avi.c \ - libmpdemux/muxer_mpeg.c \ - libmpdemux/muxer_rawaudio.c \ - libmpdemux/muxer_rawvideo.c \ - $(SRCS_MENCODER-yes) - COMMON_LIBS += $(COMMON_LIBS-yes) OBJS_COMMON += $(addsuffix .o, $(basename $(SRCS_COMMON))) -OBJS_MENCODER += $(addsuffix .o, $(basename $(SRCS_MENCODER))) OBJS_MPLAYER += $(addsuffix .o, $(basename $(SRCS_MPLAYER))) OBJS_MPLAYER-$(PE_EXECUTABLE) += osdep/mplayer-rc.o OBJS_MPLAYER += $(OBJS_MPLAYER-yes) -MENCODER_DEPS = $(OBJS_MENCODER) $(OBJS_COMMON) $(COMMON_LIBS) MPLAYER_DEPS = $(OBJS_MPLAYER) $(OBJS_COMMON) $(COMMON_LIBS) -DEPS = $(filter-out %.S,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SRCS_COMMON) $(SRCS_MPLAYER:.m=.d) $(SRCS_MENCODER)))) +DEPS = $(filter-out %.S,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SRCS_COMMON) $(SRCS_MPLAYER:.m=.d)))) ALL_PRG-$(MPLAYER) += mplayer$(EXESUF) -ALL_PRG-$(MENCODER) += mencoder$(EXESUF) -INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mencoder-man INSTALL_TARGETS-$(MPLAYER) += install-mplayer \ install-mplayer-man \ install-mplayer-msg @@ -754,11 +721,9 @@ all: $(ALL_PRG-yes) locales %-rc.o: %.rc $(WINDRES) -I. $< $@ -mencoder$(EXESUF): $(MENCODER_DEPS) -mencoder$(EXESUF): EXTRALIBS += $(EXTRALIBS_MENCODER) mplayer$(EXESUF): $(MPLAYER_DEPS) mplayer$(EXESUF): EXTRALIBS += $(EXTRALIBS_MPLAYER) -mencoder$(EXESUF) mplayer$(EXESUF): +mplayer$(EXESUF): $(CC) -o $@ $^ $(EXTRALIBS) codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h @@ -848,29 +813,19 @@ install-dirs: install-%: %$(EXESUF) install-dirs $(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR) -install-mencoder-man: $(foreach lang,$(MAN_LANGS),install-mencoder-man-$(lang)) install-mplayer-man: $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang)) install-mplayer-msg: $(foreach lang,$(MSG_LANGS),install-mplayer-msg-$(lang)) -install-mencoder-man-en: install-mplayer-man-en - cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 - install-mplayer-man-en: if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi $(INSTALL) -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/ -define MENCODER_MAN_RULE -install-mencoder-man-$(lang): install-mplayer-man-$(lang) - cd $(MANDIR)/$(lang)/man1 && ln -sf mplayer.1 mencoder.1 -endef - define MPLAYER_MAN_RULE install-mplayer-man-$(lang): if test ! -d $(MANDIR)/$(lang)/man1 ; then $(INSTALL) -d $(MANDIR)/$(lang)/man1 ; fi $(INSTALL) -m 644 DOCS/man/$(lang)/mplayer.1 $(MANDIR)/$(lang)/man1/ endef -$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MENCODER_MAN_RULE))) $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE))) define MPLAYER_MSG_RULE @@ -883,17 +838,15 @@ $(foreach lang,$(MSG_LANG_ALL),$(eval $(MPLAYER_MSG_RULE))) uninstall: rm -f $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF) - rm -f $(BINDIR)/mencoder$(EXESUF) - rm -f $(MANDIR)/man1/mencoder.1 $(MANDIR)/man1/mplayer.1 rm -f $(prefix)/share/pixmaps/mplayer.xpm rm -f $(prefix)/share/applications/mplayer.desktop - rm -f $(MANDIR)/man1/mplayer.1 $(MANDIR)/man1/mencoder.1 - rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man))) + rm -f $(MANDIR)/man1/mplayer.1 + rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1,$(MANDIR)/$(lang)/man1/$(man))) rm -f $(foreach lang,$(MSG_LANGS),$(LOCALEDIR)/$(lang)/LC_MESSAGES/mplayer.1) clean: -rm -f $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~) - -rm -f $(call ADD_ALL_EXESUFS,mplayer mencoder) + -rm -f $(call ADD_ALL_EXESUFS,mplayer) distclean: clean testsclean toolsclean driversclean dhahelperclean dhahelperwinclean -rm -rf DOCS/tech/doxygen diff --git a/cfg-mencoder.h b/cfg-mencoder.h deleted file mode 100644 index 02473ef00b..0000000000 --- a/cfg-mencoder.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_CFG_MENCODER_H -#define MPLAYER_CFG_MENCODER_H - -/* - * config for cfgparser - */ - -#include "libmpcodecs/ve_x264.h" -#include "cfg-common.h" - -extern const m_option_t faacopts_conf[]; -extern const m_option_t lameopts_conf[]; -extern const m_option_t lavcopts_conf[]; -extern const m_option_t lavfopts_conf[]; -extern const m_option_t mpegopts_conf[]; -extern const m_option_t nuvopts_conf[]; -extern const m_option_t toolameopts_conf[]; -extern const m_option_t twolameopts_conf[]; -extern const m_option_t vfwopts_conf[]; -extern const m_option_t xvidencopts_conf[]; - -const m_option_t ovc_conf[]={ - {"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_COPY, NULL}, - {"frameno", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_FRAMENO, NULL}, - {"lavc", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBAVCODEC, NULL}, -// {"null", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NULL, NULL}, - {"raw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAW, NULL}, - {"vfw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_VFW, NULL}, - {"libdv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBDV, NULL}, - {"xvid", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_XVID, NULL}, - {"qtvideo", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_QTVIDEO, NULL}, - {"nuv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NUV, NULL}, - {"x264", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_X264, NULL}, - {"help", "\nAvailable codecs:\n" - " copy - frame copy, without re-encoding. Doesn't work with filters.\n" - " frameno - special audio-only file for 3-pass encoding, see DOCS.\n" - " raw - uncompressed video. Use fourcc option to set format explicitly.\n" -#ifdef CONFIG_LIBLZO - " nuv - nuppel video\n" -#endif -#ifdef CONFIG_LIBAVCODEC - " lavc - libavcodec codecs - best quality!\n" -#endif -#ifdef CONFIG_WIN32DLL - " vfw - VfW DLLs, read DOCS/HTML/en/encoding-guide.html.\n" - " qtvideo - QuickTime DLLs, currently only SVQ1/3 are supported.\n" -#endif -#ifdef CONFIG_LIBDV095 - " libdv - DV encoding with libdv v0.9.5\n" -#endif -#ifdef CONFIG_XVID4 - " xvid - XviD encoding\n" -#endif -#ifdef CONFIG_X264 - " x264 - H.264 encoding\n" -#endif - "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -const m_option_t oac_conf[]={ - {"copy", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_COPY, NULL}, - {"pcm", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_PCM, NULL}, -#ifdef CONFIG_MP3LAME - {"mp3lame", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_VBRMP3, NULL}, -#else - {"mp3lame", "MPlayer was compiled without libmp3lame support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_MP3LAME */ -#ifdef CONFIG_LIBAVCODEC - {"lavc", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_LAVC, NULL}, -#else - {"lavc", "MPlayer was compiled without libavcodec. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_LIBAVCODEC */ -#ifdef CONFIG_TOOLAME - {"toolame", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_TOOLAME, NULL}, -#else - {"toolame", "MPlayer was compiled without libtoolame. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_TOOLAME */ -#ifdef CONFIG_TWOLAME - {"twolame", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_TWOLAME, NULL}, -#else - {"twolame", "MPlayer was compiled without libtwolame. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_TWOLAME */ -#ifdef CONFIG_FAAC - {"faac", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_FAAC, NULL}, -#else - {"faac", "MPlayer was compiled without libfaac. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_FAAC */ - {"help", "\nAvailable codecs:\n" - " copy - frame copy, without re-encoding (useful for AC3)\n" - " pcm - uncompressed PCM audio\n" -#ifdef CONFIG_MP3LAME - " mp3lame - cbr/abr/vbr MP3 using libmp3lame\n" -#endif -#ifdef CONFIG_LIBAVCODEC - " lavc - FFmpeg audio encoder (MP2, AC3, ...)\n" -#endif -#ifdef CONFIG_TOOLAME - " toolame - Toolame MP2 audio encoder\n" -#endif -#ifdef CONFIG_TWOLAME - " twolame - Twolame MP2 audio encoder\n" -#endif -#ifdef CONFIG_FAAC - " faac - FAAC AAC audio encoder\n" -#endif - "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -const m_option_t info_conf[]={ - {"name", &info_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"artist", &info_artist, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"genre", &info_genre, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"subject", &info_subject, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"copyright", &info_copyright, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"srcform", &info_sourceform, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"comment", &info_comment, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"help", "\nAvailable INFO fields:\n" - " name - title of the work\n" - " artist - artist or author of the work\n" - " genre - original work category\n" - " subject - contents of the work\n" - " copyright - copyright information\n" - " srcform - original format of the digitzed material\n" - " comment - general comments about the work\n" - "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -const m_option_t of_conf[]={ - {"avi", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_AVI, NULL}, - {"mpeg", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_MPEG, NULL}, -#ifdef CONFIG_LIBAVFORMAT - {"lavf", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_LAVF, NULL}, -#endif - {"rawvideo", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_RAWVIDEO, NULL}, - {"rawaudio", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_RAWAUDIO, NULL}, - {"help", "\nAvailable output formats:\n" - " avi - Microsoft Audio/Video Interleaved\n" - " mpeg - MPEG-1/2 system stream format\n" -#ifdef CONFIG_LIBAVFORMAT - " lavf - FFmpeg libavformat muxers\n" -#endif - " rawvideo - (video only, one stream only) raw stream, no muxing\n" - " rawaudio - (audio only, one stream only) raw stream, no muxing\n" - "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -extern float avi_aspect_override; /* defined in libmpdemux/muxer_avi.c */ -extern int write_odml; /* defined in libmpdemux/muxer_avi.c */ - -const m_option_t mencoder_opts[]={ - /* name, pointer, type, flags, min, max */ - - {"frameno-file", &frameno_filename, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, - - {"hr-edl-seek", &edl_seek_type, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"nohr-edl-seek", &edl_seek_type, CONF_TYPE_FLAG, 0, 1, 0, NULL}, - - // set output framerate - recommended for variable-FPS (ASF etc) files - // and for 29.97FPS progressive MPEG2 streams - {"ofps", &force_ofps, CONF_TYPE_DOUBLE, CONF_MIN|CONF_GLOBAL, 0, 0, NULL}, - {"o", &out_filename, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, - - // limit number of skippable frames after a non-skipped one - {"skiplimit", &skip_limit, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"noskiplimit", &skip_limit, CONF_TYPE_FLAG, 0, 0, -1, NULL}, - {"noskip", &skip_limit, CONF_TYPE_FLAG, 0, 0, 0, NULL}, - - {"audio-density", &audio_density, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 1, 50, NULL}, - {"audio-preload", &audio_preload, CONF_TYPE_FLOAT, CONF_RANGE|CONF_GLOBAL, 0, 2, NULL}, - {"audio-delay", &audio_delay_fix, CONF_TYPE_FLOAT, CONF_GLOBAL, 0, 0, NULL}, - - {"x", "-x has been removed, use -vf scale=w:h for scaling.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {"xsize", "-xsize has been removed, use -vf crop=w:h:x:y for cropping.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - - // output audio/video codec selection - {"oac", (void *) oac_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, - {"ovc", (void *) ovc_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, - - // output file format - {"of", (void *) of_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, - - // override audio format tag in output file - {"fafmttag", &force_audiofmttag, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL}, - // override FOURCC in output file - {"ffourcc", &force_fourcc, CONF_TYPE_STRING, CONF_GLOBAL, 4, 4, NULL}, - - // override avi aspect autodetection - {"force-avi-aspect", &avi_aspect_override, CONF_TYPE_FLOAT, CONF_RANGE|CONF_GLOBAL, 0.2, 3.0, NULL}, - - {"pass", "-pass has been removed, use -lavcopts vpass=n, -xvidencopts pass=n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {"passlogfile", &passtmpfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, - - {"vobsubout", &vobsub_out, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, - {"vobsuboutindex", &vobsub_out_index, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 31, NULL}, - {"vobsuboutid", &vobsub_out_id, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, - - {"autoexpand", &auto_expand, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"noautoexpand", &auto_expand, CONF_TYPE_FLAG, 0, 1, 0, NULL}, - - {"encodedups", &encode_duplicates, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"noencodedups", &encode_duplicates, CONF_TYPE_FLAG, 0, 1, 0, NULL}, - - {"odml", &write_odml, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, - {"noodml", &write_odml, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL}, - - // info header strings - {"info", (void *) info_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, - -#ifdef CONFIG_MP3LAME - {"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif -#ifdef CONFIG_LIBAVCODEC - {"lavcopts", lavcopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#else - {"lavcopts", "MPlayer was compiled without libavcodec. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_LIBAVCODEC */ -#ifdef CONFIG_TOOLAME - {"toolameopts", toolameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#else - {"toolameopts", "MPlayer was compiled without libtoolame. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_TOOLAME */ -#ifdef CONFIG_TWOLAME - {"twolameopts", twolameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#else - {"twolameopts", "MPlayer was compiled without libtwolame. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_TWOLAME */ -#ifdef CONFIG_FAAC - {"faacopts", faacopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#else - {"faacopts", "MPlayer was compiled without libfaac. See README or DOCS.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif /* CONFIG_FAAC */ -#ifdef CONFIG_WIN32DLL - {"xvfwopts", vfwopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif -#ifdef CONFIG_XVID4 - {"xvidencopts", xvidencopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif -#if defined(CONFIG_X264) - {"x264encopts", &x264enc_set_param, CONF_TYPE_FUNC_PARAM, CONF_GLOBAL, 0, 0, NULL}, -#endif - -#ifdef CONFIG_LIBLZO - {"nuvopts", nuvopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif - {"mpegopts", mpegopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#ifdef CONFIG_LIBAVFORMAT - {"lavfopts", lavfopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif - -// {"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -// {"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -// {"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -#endif /* MPLAYER_CFG_MENCODER_H */ diff --git a/configure b/configure index 176c4d3fc9..0210fa642c 100755 --- a/configure +++ b/configure @@ -264,7 +264,6 @@ Installation directories: --codecsdir=DIR directory for binary codecs [LIBDIR/codecs] Optional features: - --disable-mencoder disable MEncoder (A/V encoder) compilation [enable] --disable-mplayer disable MPlayer compilation [enable] --disable-largefiles disable support for files > 2GB [enable] --enable-termcap use termcap database for key codes [autodetect] @@ -501,7 +500,6 @@ Use these options if autodetection fails: --extra-ldflags=FLAGS extra LDFLAGS --extra-libs=FLAGS extra linker flags --extra-libs-mplayer=FLAGS extra linker flags for MPlayer - --extra-libs-mencoder=FLAGS extra linker flags for MEncoder --with-xvmclib=NAME adapter-specific library name (e.g. XvMCNVIDIA) --with-freetype-config=PATH path to freetype-config @@ -559,7 +557,7 @@ _libpostproc=auto _libswscale=auto _libavcodec_internals=no _libswscale_internals=no -_mencoder=yes +_mencoder=no _mplayer=yes _x11=auto _xshape=auto @@ -810,9 +808,6 @@ for ac_option do --extra-libs-mplayer=*) libs_mplayer=$(echo $ac_option | cut -d '=' -f 2) ;; - --extra-libs-mencoder=*) - libs_mencoder=$(echo $ac_option | cut -d '=' -f 2) - ;; --target=*) _target=$(echo $ac_option | cut -d '=' -f 2) @@ -884,8 +879,6 @@ for ac_option do --disable-runtime-cpudetection) _runtime_cpudetection=no ;; --enable-cross-compile) _cross_compile=yes ;; --disable-cross-compile) _cross_compile=no ;; - --enable-mencoder) _mencoder=yes ;; - --disable-mencoder) _mencoder=no ;; --enable-mplayer) _mplayer=yes ;; --disable-mplayer) _mplayer=no ;; --enable-dynamic-plugins) _dynamic_plugins=yes ;; diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c deleted file mode 100644 index 1669359981..0000000000 --- a/libmpcodecs/ae.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "config.h" -#include "libmpdemux/aviheader.h" -#include "libmpdemux/ms_hdr.h" -#include "stream/stream.h" -#include "libmpdemux/muxer.h" -#include "ae.h" - -#include "ae_pcm.h" - -#ifdef CONFIG_TOOLAME -#include "ae_toolame.h" -#endif - -#ifdef CONFIG_MP3LAME -#include "ae_lame.h" -#endif - -#ifdef CONFIG_LIBAVCODEC -#include "ae_lavc.h" -#endif - -#ifdef CONFIG_FAAC -#include "ae_faac.h" -#endif - -#ifdef CONFIG_TWOLAME -#include "ae_twolame.h" -#endif - -audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) -{ - int ris; - audio_encoder_t *encoder; - if(! params) - return NULL; - - encoder = calloc(1, sizeof(audio_encoder_t)); - memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); - encoder->stream = stream; - - switch(stream->codec) - { - case ACODEC_PCM: - ris = mpae_init_pcm(encoder); - break; -#ifdef CONFIG_TOOLAME - case ACODEC_TOOLAME: - ris = mpae_init_toolame(encoder); - break; -#endif -#ifdef CONFIG_LIBAVCODEC - case ACODEC_LAVC: - ris = mpae_init_lavc(encoder); - break; -#endif -#ifdef CONFIG_MP3LAME - case ACODEC_VBRMP3: - ris = mpae_init_lame(encoder); - break; -#endif -#ifdef CONFIG_FAAC - case ACODEC_FAAC: - ris = mpae_init_faac(encoder); - break; -#endif -#ifdef CONFIG_TWOLAME - case ACODEC_TWOLAME: - ris = mpae_init_twolame(encoder); - break; -#endif - default: - ris = 0; - break; - } - - if(! ris) - { - free(encoder); - return NULL; - } - encoder->bind(encoder, stream); - encoder->decode_buffer = malloc(encoder->decode_buffer_size); - if(! encoder->decode_buffer) - { - free(encoder); - return NULL; - } - - encoder->codec = stream->codec; - return encoder; -} diff --git a/libmpcodecs/ae.h b/libmpcodecs/ae.h deleted file mode 100644 index 440e4ddf4f..0000000000 --- a/libmpcodecs/ae.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_AE_H -#define MPLAYER_AE_H - -#include "libmpdemux/muxer.h" - -#define ACODEC_COPY 0 -#define ACODEC_PCM 1 -#define ACODEC_VBRMP3 2 -#define ACODEC_NULL 3 -#define ACODEC_LAVC 4 -#define ACODEC_TOOLAME 5 -#define ACODEC_FAAC 6 -#define ACODEC_TWOLAME 7 - -#define AE_NEEDS_COMPRESSED_INPUT 1 - -typedef struct { - int channels; - int sample_rate; - int bitrate; - int samples_per_frame; - int audio_preload; -} audio_encoding_params_t; - -typedef struct audio_encoder_s { - int codec; - int flags; - muxer_stream_t *stream; - audio_encoding_params_t params; - int audio_preload; //in ms - int input_format; - int min_buffer_size, max_buffer_size; //for init_audio_filters - unsigned char *decode_buffer; - int decode_buffer_size; - int decode_buffer_len; - void *priv; - int (*bind)(struct audio_encoder_s*, muxer_stream_t*); - int (*get_frame_size)(struct audio_encoder_s*); - int (*set_decoded_len)(struct audio_encoder_s *encoder, int len); - int (*encode)(struct audio_encoder_s *encoder, uint8_t *dest, void *src, int nsamples, int max_size); - void (*fixup)(struct audio_encoder_s *encoder); - int (*close)(struct audio_encoder_s *encoder); -} audio_encoder_t; - -audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params); - -#endif /* MPLAYER_AE_H */ diff --git a/libmpcodecs/ae_faac.c b/libmpcodecs/ae_faac.c deleted file mode 100644 index 63c716378d..0000000000 --- a/libmpcodecs/ae_faac.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include -#include -#include -#include -#include "m_option.h" -#include "mp_msg.h" -#include "libmpdemux/aviheader.h" -#include "libaf/af_format.h" -#include "libaf/reorder_ch.h" -#include "libmpdemux/ms_hdr.h" -#include "stream/stream.h" -#include "libmpdemux/muxer.h" -#include -#include "ae.h" - - -static faacEncHandle faac; -static faacEncConfigurationPtr config = NULL; -static int - param_bitrate = 128, - param_quality = 0, - param_object_type = 1, - param_mpeg = 2, - param_tns = 0, - param_raw = 0, - param_cutoff = 0, - param_format = 16, - param_debug = 0; - -static int enc_frame_size = 0, divisor; -static unsigned long samples_input, max_bytes_output; -static unsigned char *decoder_specific_buffer = NULL; -static unsigned long decoder_specific_len = 0; - -const m_option_t faacopts_conf[] = { - {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"quality", ¶m_quality, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL}, - {"object", ¶m_object_type, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL}, - {"mpeg", ¶m_mpeg, CONF_TYPE_INT, CONF_RANGE, 2, 4, NULL}, - {"tns", ¶m_tns, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"cutoff", ¶m_cutoff, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"format", ¶m_format, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"raw", ¶m_raw, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"debug", ¶m_debug, CONF_TYPE_INT, CONF_RANGE, 0, 100000000, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - - -static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a) -{ - mux_a->wf = calloc(1, sizeof(WAVEFORMATEX) + decoder_specific_len + 256); - mux_a->wf->wFormatTag = 0x706D; - mux_a->wf->nChannels = encoder->params.channels; - mux_a->h.dwSampleSize=0; // VBR - mux_a->h.dwRate=encoder->params.sample_rate; - mux_a->h.dwScale=encoder->params.samples_per_frame; - mux_a->wf->nSamplesPerSec=mux_a->h.dwRate; - mux_a->wf->nAvgBytesPerSec = encoder->params.bitrate / 8; - - mux_a->wf->nBlockAlign = mux_a->h.dwScale; - mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; - mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - - mux_a->wf->cbSize = decoder_specific_len; - mux_a->wf->wBitsPerSample = 0; /* does not apply */ - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->fdwFlags = 2; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; - - // Fix allocation - mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - - if(config->inputFormat == FAAC_INPUT_FLOAT) - encoder->input_format = AF_FORMAT_FLOAT_NE; - else if(config->inputFormat == FAAC_INPUT_32BIT) - encoder->input_format = AF_FORMAT_S32_NE; - else - encoder->input_format = AF_FORMAT_S16_NE; - - encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; - encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; - - if(decoder_specific_buffer && decoder_specific_len) - memcpy(mux_a->wf + 1, decoder_specific_buffer, decoder_specific_len); - - return 1; -} - -static int get_frame_size(audio_encoder_t *encoder) -{ - int sz = enc_frame_size; - enc_frame_size = 0; - return sz; -} - -static int encode_faac(audio_encoder_t *encoder, uint8_t *dest, void *src, int len, int max_size) -{ - if (encoder->params.channels >= 5) - reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - AF_CHANNEL_LAYOUT_AAC_DEFAULT, - encoder->params.channels, - len / divisor, divisor); - - // len is divided by the number of bytes per sample - enc_frame_size = faacEncEncode(faac, (int32_t*) src, len / divisor, dest, max_size); - - return enc_frame_size; -} - -int close_faac(audio_encoder_t *encoder) -{ - return 1; -} - -int mpae_init_faac(audio_encoder_t *encoder) -{ - if(encoder->params.channels < 1 || encoder->params.channels > 6 || (param_mpeg != 2 && param_mpeg != 4)) - { - mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, unsupported number of channels: %d, or mpeg version: %d, exit\n", encoder->params.channels, param_mpeg); - return 0; - } - - faac = faacEncOpen(encoder->params.sample_rate, encoder->params.channels, &samples_input, &max_bytes_output); - if(!faac) - { - mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, couldn't init, exit\n"); - return 0; - } - mp_msg(MSGT_MENCODER, MSGL_V, "AE_FAAC, sample_input: %lu, max_bytes_output: %lu\n", samples_input, max_bytes_output); - config = faacEncGetCurrentConfiguration(faac); - if(!config) - { - mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, couldn't get init configuration, exit\n"); - return 0; - } - - param_bitrate *= 1000; - if(param_quality) - config->quantqual = param_quality; - else - config->bitRate = param_bitrate / encoder->params.channels; - - if(param_format==33) - { - config->inputFormat = FAAC_INPUT_FLOAT; - divisor = 4; - } - else if(param_format==32) - { - config->inputFormat = FAAC_INPUT_32BIT; - divisor = 4; - } - else - { - config->inputFormat = FAAC_INPUT_16BIT; - divisor = 2; - } - config->outputFormat = param_raw ? 0 : 1; // 1 is ADTS - config->aacObjectType = param_object_type; - if(MAIN==0) config->aacObjectType--; - config->mpegVersion = (param_mpeg == 4 ? MPEG4 : MPEG2); - config->useTns = param_tns; - config->allowMidside = 1; - config->shortctl = SHORTCTL_NORMAL; - param_cutoff = param_cutoff ? param_cutoff : encoder->params.sample_rate / 2; - if(param_cutoff > encoder->params.sample_rate / 2) - param_cutoff = encoder->params.sample_rate / 2; - config->bandWidth = param_cutoff; - if(encoder->params.channels == 6) - config->useLfe = 1; - - if(!faacEncSetConfiguration(faac, config)) - { - mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, counldn't set specified parameters, exiting\n"); - return 0; - } - - if(param_raw) - faacEncGetDecoderSpecificInfo(faac, &decoder_specific_buffer, &decoder_specific_len); - else - decoder_specific_len = 0; - - encoder->params.bitrate = param_bitrate; - encoder->params.samples_per_frame = 1024; - encoder->decode_buffer_size = divisor * samples_input; //samples * 16 bits_per_sample - - encoder->bind = bind_faac; - encoder->get_frame_size = get_frame_size; - encoder->encode = encode_faac; - encoder->close = close_faac; - - return 1; -} diff --git a/libmpcodecs/ae_faac.h b/libmpcodecs/ae_faac.h deleted file mode 100644 index dddc0bf5ad..0000000000 --- a/libmpcodecs/ae_faac.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_AE_FAAC_H -#define MPLAYER_AE_FAAC_H - -#include "ae.h" -#include "libmpdemux/muxer.h" - -int mpae_init_faac(audio_encoder_t *encoder); - -#endif /* MPLAYER_AE_FAAC_H */ diff --git a/libmpcodecs/ae_lame.c b/libmpcodecs/ae_lame.c deleted file mode 100644 index 90ed31dfe7..0000000000 --- a/libmpcodecs/ae_lame.c +++ /dev/null @@ -1,493 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include -#include -#include -#include -#include "m_option.h" -#include "mp_msg.h" -#include "libmpdemux/aviheader.h" -#include "libmpdemux/ms_hdr.h" -#include "stream/stream.h" -#include "libmpdemux/muxer.h" -#include "ae_pcm.h" -#include "libaf/af_format.h" -#include "libmpdemux/mp3_hdr.h" - -#undef CDECL -#include - -lame_global_flags *lame; -static int lame_param_quality=0; // best -static int lame_param_algqual=5; // same as old default -static int lame_param_vbr=vbr_default; -static int lame_param_mode=-1; // unset -static int lame_param_padding=-1; // unset -static int lame_param_br=-1; // unset -static int lame_param_ratio=-1; // unset -static float lame_param_scale=-1; // unset -static int lame_param_lowpassfreq = 0; //auto -static int lame_param_highpassfreq = 0; //auto -static int lame_param_free_format = 0; //disabled -static int lame_param_br_min = 0; //not specified -static int lame_param_br_max = 0; //not specified - -#ifdef CONFIG_MP3LAME_PRESET -int lame_param_fast=0; // unset -static char* lame_param_preset=NULL; // unset -static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_name ); -#endif - -#define MEncoderMP3LameHelp _("\n\n"\ -" vbr=<0-4> variable bitrate method\n"\ -" 0: cbr (constant bitrate)\n"\ -" 1: mt (Mark Taylor VBR algorithm)\n"\ -" 2: rh (Robert Hegemann VBR algorithm - default)\n"\ -" 3: abr (average bitrate)\n"\ -" 4: mtrh (Mark Taylor Robert Hegemann VBR algorithm)\n"\ -"\n"\ -" abr average bitrate\n"\ -"\n"\ -" cbr constant bitrate\n"\ -" Also forces CBR mode encoding on subsequent ABR presets modes.\n"\ -"\n"\ -" br=<0-1024> specify bitrate in kBit (CBR and ABR only)\n"\ -"\n"\ -" q=<0-9> quality (0-highest, 9-lowest) (only for VBR)\n"\ -"\n"\ -" aq=<0-9> algorithmic quality (0-best/slowest, 9-worst/fastest)\n"\ -"\n"\ -" ratio=<1-100> compression ratio\n"\ -"\n"\ -" vol=<0-10> set audio input gain\n"\ -"\n"\ -" mode=<0-3> (default: auto)\n"\ -" 0: stereo\n"\ -" 1: joint-stereo\n"\ -" 2: dualchannel\n"\ -" 3: mono\n"\ -"\n"\ -" padding=<0-2>\n"\ -" 0: no\n"\ -" 1: all\n"\ -" 2: adjust\n"\ -"\n"\ -" fast Switch on faster encoding on subsequent VBR presets modes,\n"\ -" slightly lower quality and higher bitrates.\n"\ -"\n"\ -" preset= Provide the highest possible quality settings.\n"\ -" medium: VBR encoding, good quality\n"\ -" (150-180 kbps bitrate range)\n"\ -" standard: VBR encoding, high quality\n"\ -" (170-210 kbps bitrate range)\n"\ -" extreme: VBR encoding, very high quality\n"\ -" (200-240 kbps bitrate range)\n"\ -" insane: CBR encoding, highest preset quality\n"\ -" (320 kbps bitrate)\n"\ -" <8-320>: ABR encoding at average given kbps bitrate.\n\n") - - - -const m_option_t lameopts_conf[] = { - {"q", &lame_param_quality, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, - {"aq", &lame_param_algqual, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, - {"vbr", &lame_param_vbr, CONF_TYPE_INT, CONF_RANGE, 0, vbr_max_indicator, NULL}, - {"cbr", &lame_param_vbr, CONF_TYPE_FLAG, 0, 0, 0, NULL}, - {"abr", &lame_param_vbr, CONF_TYPE_FLAG, 0, 0, vbr_abr, NULL}, - {"mode", &lame_param_mode, CONF_TYPE_INT, CONF_RANGE, 0, MAX_INDICATOR, NULL}, - {"padding", &lame_param_padding, CONF_TYPE_INT, CONF_RANGE, 0, PAD_MAX_INDICATOR, NULL}, - {"br", &lame_param_br, CONF_TYPE_INT, CONF_RANGE, 0, 1024, NULL}, - {"ratio", &lame_param_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, - {"vol", &lame_param_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10, NULL}, - {"lowpassfreq",&lame_param_lowpassfreq, CONF_TYPE_INT, CONF_RANGE, -1, 48000,0}, - {"highpassfreq",&lame_param_highpassfreq, CONF_TYPE_INT, CONF_RANGE, -1, 48000,0}, - {"nofree", &lame_param_free_format, CONF_TYPE_FLAG, 0, 0, 0, NULL}, - {"free", &lame_param_free_format, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"br_min", &lame_param_br_min, CONF_TYPE_INT, CONF_RANGE, 0, 1024, NULL}, - {"br_max", &lame_param_br_max, CONF_TYPE_INT, CONF_RANGE, 0, 1024, NULL}, -#ifdef CONFIG_MP3LAME_PRESET - {"fast", &lame_param_fast, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"preset", &lame_param_preset, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#else - {"fast", "MPlayer was built without -lameopts fast support (requires libmp3lame >=3.92).\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {"preset", "MPlayer was built without -lameopts preset support (requires libmp3lame >=3.92).\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif - {"help", MEncoderMP3LameHelp, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - - -static int bind_lame(audio_encoder_t *encoder, muxer_stream_t *mux_a) -{ - mp_tmsg(MSGT_MENCODER, MSGL_INFO, "MP3 audio selected.\n"); - mux_a->h.dwSampleSize=0; // VBR - mux_a->h.dwRate=encoder->params.sample_rate; - mux_a->h.dwScale=encoder->params.samples_per_frame; // samples/frame - if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_tmsg(MSGT_MENCODER,MSGL_WARN,"sizeof(MPEGLAYER3WAVEFORMAT)==%d!=30, maybe broken C compiler?\n",sizeof(MPEGLAYER3WAVEFORMAT)); - mux_a->wf=malloc(sizeof(MPEGLAYER3WAVEFORMAT)); // should be 30 - mux_a->wf->wFormatTag=0x55; // MP3 - mux_a->wf->nChannels= (lame_param_mode<0) ? encoder->params.channels : ((lame_param_mode==3) ? 1 : 2); - mux_a->wf->nSamplesPerSec=mux_a->h.dwRate; - if(! lame_param_vbr) - mux_a->wf->nAvgBytesPerSec=lame_param_br * 125; - else - mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME! - mux_a->wf->nBlockAlign=encoder->params.samples_per_frame; // required for l3codeca.acm + WMP 6.4 - mux_a->wf->wBitsPerSample=0; //16; - // from NaNdub: (requires for l3codeca.acm) - mux_a->wf->cbSize=12; - ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->wID=1; - ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->fdwFlags=2; - ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nBlockSize=encoder->params.samples_per_frame; // ??? - ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nFramesPerBlock=1; - ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nCodecDelay=0; - - encoder->input_format = AF_FORMAT_S16_NE; - encoder->min_buffer_size = 4608; - encoder->max_buffer_size = mux_a->h.dwRate * mux_a->wf->nChannels * 2; - - return 1; -} - -#define min(a, b) ((a) <= (b) ? (a) : (b)) - -static int get_frame_size(audio_encoder_t *encoder) -{ - int sz; - if(encoder->stream->buffer_len < 4) - return 0; - sz = mp_decode_mp3_header(encoder->stream->buffer); - if(sz <= 0) - return 0; - return sz; -} - -static int encode_lame(audio_encoder_t *encoder, uint8_t *dest, void *src, int len, int max_size) -{ - int n = 0; - if(encoder->params.channels == 1) - n = lame_encode_buffer(lame, (short *)src, (short *)src, len/2, dest, max_size); - else - n = lame_encode_buffer_interleaved(lame,(short *)src, len/4, dest, max_size); - - return n < 0 ? 0 : n; -} - - -static int close_lame(audio_encoder_t *encoder) -{ - return 1; -} - -static void fixup(audio_encoder_t *encoder) -{ - // fixup CBR mp3 audio header: - if(!lame_param_vbr) { - encoder->stream->h.dwSampleSize=1; - if (encoder->stream->h.dwLength) - ((MPEGLAYER3WAVEFORMAT*)(encoder->stream->wf))->nBlockSize= - (encoder->stream->size+(encoder->stream->h.dwLength>>1))/encoder->stream->h.dwLength; - encoder->stream->h.dwLength=encoder->stream->size; - encoder->stream->h.dwRate=encoder->stream->wf->nAvgBytesPerSec; - encoder->stream->h.dwScale=1; - encoder->stream->wf->nBlockAlign=1; - mp_tmsg(MSGT_MENCODER, MSGL_V, "\n\nCBR audio: %d bytes/sec, %d bytes/block\n", - encoder->stream->h.dwRate,((MPEGLAYER3WAVEFORMAT*)(encoder->stream->wf))->nBlockSize); - } -} - -int mpae_init_lame(audio_encoder_t *encoder) -{ - encoder->params.bitrate = lame_param_br * 125; - encoder->params.samples_per_frame = encoder->params.sample_rate < 32000 ? 576 : 1152; - encoder->decode_buffer_size = 2304; - - lame=lame_init(); - lame_set_bWriteVbrTag(lame,0); - lame_set_in_samplerate(lame,encoder->params.sample_rate); - //lame_set_in_samplerate(lame,sh_audio->samplerate); // if resampling done by lame - lame_set_num_channels(lame,encoder->params.channels); - lame_set_out_samplerate(lame,encoder->params.sample_rate); - lame_set_quality(lame,lame_param_algqual); // 0 = best q - if(lame_param_free_format) lame_set_free_format(lame,1); - if(lame_param_vbr){ // VBR: - lame_set_VBR(lame,lame_param_vbr); // vbr mode - lame_set_VBR_q(lame,lame_param_quality); // 0 = best vbr q 5=~128k - if(lame_param_br>0) lame_set_VBR_mean_bitrate_kbps(lame,lame_param_br); - if(lame_param_br_min>0) lame_set_VBR_min_bitrate_kbps(lame,lame_param_br_min); - if(lame_param_br_max>0) lame_set_VBR_max_bitrate_kbps(lame,lame_param_br_max); - } else { // CBR: - if(lame_param_br>0) lame_set_brate(lame,lame_param_br); - } - if(lame_param_mode>=0) lame_set_mode(lame,lame_param_mode); // j-st - if(lame_param_ratio>0) lame_set_compression_ratio(lame,lame_param_ratio); - if(lame_param_scale>0) { - mp_tmsg(MSGT_MENCODER, MSGL_V, "Setting audio input gain to %f.\n", lame_param_scale); - lame_set_scale(lame,lame_param_scale); - } - if(lame_param_lowpassfreq>=-1) lame_set_lowpassfreq(lame,lame_param_lowpassfreq); - if(lame_param_highpassfreq>=-1) lame_set_highpassfreq(lame,lame_param_highpassfreq); -#ifdef CONFIG_MP3LAME_PRESET - if(lame_param_preset != NULL) { - mp_tmsg(MSGT_MENCODER, MSGL_V, "\npreset=%s\n\n",lame_param_preset); - if(lame_presets_set(lame,lame_param_fast, (lame_param_vbr==0), lame_param_preset) < 0) - return 0; - } -#endif - if(lame_init_params(lame) == -1) { - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, - "Cannot set LAME options, check bitrate/samplerate, some very low bitrates\n"\ - "(<32) need lower samplerates (i.e. -srate 8000).\n"\ - "If everything else fails, try a preset."); - return 0; - } - if( mp_msg_test(MSGT_MENCODER,MSGL_V) ) { - lame_print_config(lame); - lame_print_internals(lame); - } - - encoder->bind = bind_lame; - encoder->get_frame_size = get_frame_size; - encoder->encode = encode_lame; - encoder->fixup = fixup; - encoder->close = close_lame; - return 1; -} - -#ifdef CONFIG_MP3LAME_PRESET -/* lame_presets_set - taken out of presets_set in lame-3.93.1/frontend/parse.c and modified */ -static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_name ) -{ - int mono = 0; - - if (strcmp(preset_name, "help") == 0) { - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url()); - -#define LamePresetsLongInfo _("\n"\ -"The preset switches are designed to provide the highest possible quality.\n"\ -"\n"\ -"They have for the most part been subjected to and tuned via rigorous double\n"\ -"blind listening tests to verify and achieve this objective.\n"\ -"\n"\ -"These are continually updated to coincide with the latest developments that\n"\ -"occur and as a result should provide you with nearly the best quality\n"\ -"currently possible from LAME.\n"\ -"\n"\ -"To activate these presets:\n"\ -"\n"\ -" For VBR modes (generally highest quality):\n"\ -"\n"\ -" \"preset=standard\" This preset should generally be transparent\n"\ -" to most people on most music and is already\n"\ -" quite high in quality.\n"\ -"\n"\ -" \"preset=extreme\" If you have extremely good hearing and similar\n"\ -" equipment, this preset will generally provide\n"\ -" slightly higher quality than the \"standard\"\n"\ -" mode.\n"\ -"\n"\ -" For CBR 320kbps (highest quality possible from the preset switches):\n"\ -"\n"\ -" \"preset=insane\" This preset will usually be overkill for most\n"\ -" people and most situations, but if you must\n"\ -" have the absolute highest quality with no\n"\ -" regard to filesize, this is the way to go.\n"\ -"\n"\ -" For ABR modes (high quality per given bitrate but not as high as VBR):\n"\ -"\n"\ -" \"preset=\" Using this preset will usually give you good\n"\ -" quality at a specified bitrate. Depending on the\n"\ -" bitrate entered, this preset will determine the\n"\ -" optimal settings for that particular situation.\n"\ -" While this approach works, it is not nearly as\n"\ -" flexible as VBR, and usually will not attain the\n"\ -" same level of quality as VBR at higher bitrates.\n"\ -"\n"\ -"The following options are also available for the corresponding profiles:\n"\ -"\n"\ -" standard\n"\ -" extreme\n"\ -" insane\n"\ -" (ABR Mode) - The ABR Mode is implied. To use it,\n"\ -" simply specify a bitrate. For example:\n"\ -" \"preset=185\" activates this\n"\ -" preset and uses 185 as an average kbps.\n"\ -"\n"\ -" \"fast\" - Enables the new fast VBR for a particular profile. The\n"\ -" disadvantage to the speed switch is that often times the\n"\ -" bitrate will be slightly higher than with the normal mode\n"\ -" and quality may be slightly lower also.\n"\ -" Warning: with the current version fast presets might result in too\n"\ -" high bitrate compared to regular presets.\n"\ -"\n"\ -" \"cbr\" - If you use the ABR mode (read above) with a significant\n"\ -" bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,\n"\ -" you can use the \"cbr\" option to force CBR mode encoding\n"\ -" instead of the standard abr mode. ABR does provide higher\n"\ -" quality but CBR may be useful in situations such as when\n"\ -" streaming an MP3 over the internet may be important.\n"\ -"\n"\ -" For example:\n"\ -"\n"\ -" \"-lameopts fast:preset=standard \"\n"\ -" or \"-lameopts cbr:preset=192 \"\n"\ -" or \"-lameopts preset=172 \"\n"\ -" or \"-lameopts preset=extreme \"\n"\ -"\n"\ -"\n"\ -"A few aliases are available for ABR mode:\n"\ -"phone => 16kbps/mono phon+/lw/mw-eu/sw => 24kbps/mono\n"\ -"mw-us => 40kbps/mono voice => 56kbps/mono\n"\ -"fm/radio/tape => 112kbps hifi => 160kbps\n"\ -"cd => 192kbps studio => 256kbps") - - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, LamePresetsLongInfo); - return -1; - } - - //aliases for compatibility with old presets - - if (strcmp(preset_name, "phone") == 0) { - preset_name = "16"; - mono = 1; - } - if ( (strcmp(preset_name, "phon+") == 0) || - (strcmp(preset_name, "lw") == 0) || - (strcmp(preset_name, "mw-eu") == 0) || - (strcmp(preset_name, "sw") == 0)) { - preset_name = "24"; - mono = 1; - } - if (strcmp(preset_name, "mw-us") == 0) { - preset_name = "40"; - mono = 1; - } - if (strcmp(preset_name, "voice") == 0) { - preset_name = "56"; - mono = 1; - } - if (strcmp(preset_name, "fm") == 0) { - preset_name = "112"; - } - if ( (strcmp(preset_name, "radio") == 0) || - (strcmp(preset_name, "tape") == 0)) { - preset_name = "112"; - } - if (strcmp(preset_name, "hifi") == 0) { - preset_name = "160"; - } - if (strcmp(preset_name, "cd") == 0) { - preset_name = "192"; - } - if (strcmp(preset_name, "studio") == 0) { - preset_name = "256"; - } - -#ifdef CONFIG_MP3LAME_PRESET_MEDIUM - if (strcmp(preset_name, "medium") == 0) { - if (fast > 0) - lame_set_preset(gfp, MEDIUM_FAST); - else - lame_set_preset(gfp, MEDIUM); - - return 0; - } -#endif - - if (strcmp(preset_name, "standard") == 0) { - if (fast > 0) - lame_set_preset(gfp, STANDARD_FAST); - else - lame_set_preset(gfp, STANDARD); - - return 0; - } - - else if (strcmp(preset_name, "extreme") == 0){ - if (fast > 0) - lame_set_preset(gfp, EXTREME_FAST); - else - lame_set_preset(gfp, EXTREME); - - return 0; - } - - else if (((strcmp(preset_name, "insane") == 0) || - (strcmp(preset_name, "320" ) == 0)) && (fast < 1)) { - - lame_set_preset(gfp, INSANE); - - return 0; - } - - // Generic ABR Preset - if (((atoi(preset_name)) > 0) && (fast < 1)) { - if ((atoi(preset_name)) >= 8 && (atoi(preset_name)) <= 320){ - lame_set_preset(gfp, atoi(preset_name)); - - if (cbr == 1 ) - lame_set_VBR(gfp, vbr_off); - - if (mono == 1 ) { - lame_set_mode(gfp, MONO); - } - - return 0; - - } - else { - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url()); - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, - "Error: The bitrate specified is out of the valid range for this preset.\n"\ - "\n"\ - "When using this mode you must enter a value between \"8\" and \"320\".\n"\ - "\n"\ - "For further information try: \"-lameopts preset=help\"\n"); - return -1; - } - } - - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url()); -#define InvalidLamePresetOptions _("Error: You did not enter a valid profile and/or options with preset.\n"\ -"\n"\ -"Available profiles are:\n"\ -"\n"\ -" standard\n"\ -" extreme\n"\ -" insane\n"\ -" (ABR Mode) - The ABR Mode is implied. To use it,\n"\ -" simply specify a bitrate. For example:\n"\ -" \"preset=185\" activates this\n"\ -" preset and uses 185 as an average kbps.\n"\ -"\n"\ -" Some examples:\n"\ -"\n"\ -" \"-lameopts fast:preset=standard \"\n"\ -" or \"-lameopts cbr:preset=192 \"\n"\ -" or \"-lameopts preset=172 \"\n"\ -" or \"-lameopts preset=extreme \"\n"\ -"\n"\ -"For further information try: \"-lameopts preset=help\"\n") - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, InvalidLamePresetOptions); - return -1; -} -#endif diff --git a/libmpcodecs/ae_lame.h b/libmpcodecs/ae_lame.h deleted file mode 100644 index 861c0d3dc1..0000000000 --- a/libmpcodecs/ae_lame.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_AE_LAME_H -#define MPLAYER_AE_LAME_H - -#include "ae.h" - -int mpae_init_lame(audio_encoder_t *encoder); - -#endif /* MPLAYER_AE_LAME_H */ diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c deleted file mode 100644 index 7c584daac3..0000000000 --- a/libmpcodecs/ae_lavc.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include -#include -#include -#include -#include "config.h" -#include "m_option.h" -#include "mp_msg.h" -#include "libmpdemux/aviheader.h" -#include "libmpdemux/ms_hdr.h" -#include "stream/stream.h" -#include "libmpdemux/muxer.h" -#include "ae_lavc.h" -#include "libaf/af_format.h" -#include "libaf/reorder_ch.h" -#include "libavcodec/avcodec.h" -#include "ffmpeg_files/intreadwrite.h" - -static AVCodec *lavc_acodec; -static AVCodecContext *lavc_actx; -extern char *lavc_param_acodec; -extern int lavc_param_abitrate; -extern int lavc_param_atag; -extern int lavc_param_audio_global_header; -extern int avcodec_initialized; -static int compressed_frame_size = 0; -#include "libmpdemux/mp_taglists.h" - -static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) -{ - mux_a->wf = malloc(sizeof(WAVEFORMATEX)+lavc_actx->extradata_size+256); - mux_a->wf->wFormatTag = lavc_param_atag; - mux_a->wf->nChannels = lavc_actx->channels; - mux_a->wf->nSamplesPerSec = lavc_actx->sample_rate; - mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8); - mux_a->avg_rate= lavc_actx->bit_rate; - mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec; - if(lavc_actx->block_align) - mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align; - else - { - mux_a->h.dwScale = (mux_a->wf->nAvgBytesPerSec * lavc_actx->frame_size)/ mux_a->wf->nSamplesPerSec; /* for cbr */ - - if ((mux_a->wf->nAvgBytesPerSec * - lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) - { - mux_a->h.dwScale = lavc_actx->frame_size; - mux_a->h.dwRate = lavc_actx->sample_rate; - mux_a->h.dwSampleSize = 0; // Blocksize not constant - } - else - mux_a->h.dwSampleSize = 0; - } - if(mux_a->h.dwSampleSize) - mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize; - else - mux_a->wf->nBlockAlign = 1; - mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; - mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; - - switch(lavc_param_atag) - { - case 0x11: /* imaadpcm */ - mux_a->wf->wBitsPerSample = 4; - mux_a->wf->cbSize = 2; - AV_WL16(mux_a->wf+1, lavc_actx->frame_size); - break; - case 0x55: /* mp3 */ - mux_a->wf->cbSize = 12; - mux_a->wf->wBitsPerSample = 0; /* does not apply */ - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->fdwFlags = 2; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; - ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; - break; - default: - mux_a->wf->wBitsPerSample = 0; /* Unknown */ - if (lavc_actx->extradata && (lavc_actx->extradata_size > 0)) - { - memcpy(mux_a->wf+1, lavc_actx->extradata, lavc_actx->extradata_size); - mux_a->wf->cbSize = lavc_actx->extradata_size; - } - else - mux_a->wf->cbSize = 0; - break; - } - - // Fix allocation - mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - - encoder->input_format = AF_FORMAT_S16_NE; - encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; - encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; - - return 1; -} - -static int encode_lavc(audio_encoder_t *encoder, uint8_t *dest, void *src, int size, int max_size) -{ - int n; - if ((encoder->params.channels == 6 || encoder->params.channels == 5) && - (!strcmp(lavc_acodec->name,"ac3") || - !strcmp(lavc_acodec->name,"libfaac"))) { - int isac3 = !strcmp(lavc_acodec->name,"ac3"); - reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - isac3 ? AF_CHANNEL_LAYOUT_LAVC_DEFAULT - : AF_CHANNEL_LAYOUT_AAC_DEFAULT, - encoder->params.channels, - size / 2, 2); - } - n = avcodec_encode_audio(lavc_actx, dest, size, src); - compressed_frame_size = n; - return n; -} - - -static int close_lavc(audio_encoder_t *encoder) -{ - compressed_frame_size = 0; - return 1; -} - -static int get_frame_size(audio_encoder_t *encoder) -{ - int sz = compressed_frame_size; - compressed_frame_size = 0; - return sz; -} - -int mpae_init_lavc(audio_encoder_t *encoder) -{ - encoder->params.samples_per_frame = encoder->params.sample_rate; - encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; - - if(!lavc_param_acodec) - { - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, Missing codec name!\n"); - return 0; - } - - if(!avcodec_initialized){ - avcodec_init(); - avcodec_register_all(); - avcodec_initialized=1; - } - - lavc_acodec = avcodec_find_encoder_by_name(lavc_param_acodec); - if (!lavc_acodec) - { - mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't find encoder for codec %s.\n", lavc_param_acodec);