mpv/Makefile

473 lines
15 KiB
Makefile
Raw Normal View History

# MPlayer Makefile
#
# copyright (c) 2008 Diego Biurrun
# Rewritten entirely from a set of Makefiles written by Arpi and many others.
#
# 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 config.mak
###### variable declarations #######
SOURCES_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c
SOURCES_AUDIO_INPUT-$(OSS) += stream/ai_oss.c
SOURCES-$(AUDIO_INPUT) += $(SOURCES_AUDIO_INPUT-yes)
SOURCES-$(CDDA) += stream/stream_cdda.c \
stream/cdinfo.c
SOURCES-$(DVBIN) += stream/dvb_tune.c \
stream/stream_dvb.c
SOURCES-$(DVDREAD) += stream/stream_dvd.c \
stream/stream_dvd_common.c
SOURCES-$(HAVE_SYS_MMAN_H) += audio/filter/af_export.c
SOURCES-$(LADSPA) += audio/filter/af_ladspa.c
SOURCES-$(LIBASS) += sub/ass_mp.c sub/sd_ass.c \
demux/demux_libass.c
SOURCES-$(LIBBLURAY) += stream/stream_bluray.c
SOURCES-$(LIBBS2B) += audio/filter/af_bs2b.c
SOURCES-$(LIBPOSTPROC) += video/filter/vf_pp.c
SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c
SOURCES-$(COCOA) += video/out/cocoa_common.m \
osdep/macosx_bundle.m \
osdep/macosx_application.m \
osdep/macosx_events.m \
osdep/ar/HIDRemote.m
SOURCES-$(MNG) += demux/demux_mng.c
SOURCES-$(MPG123) += audio/decode/ad_mpg123.c
SOURCES-$(NEED_GETTIMEOFDAY) += osdep/gettimeofday.c
SOURCES-$(NEED_GLOB) += osdep/glob-win.c
SOURCES-$(PRIORITY) += osdep/priority.c
SOURCES-$(PVR) += stream/stream_pvr.c
SOURCES-$(RADIO) += stream/stream_radio.c
SOURCES-$(RADIO_CAPTURE) += stream/audio_in.c
SOURCES-$(STREAM_CACHE) += stream/cache.c
SOURCES-$(TV) += stream/stream_tv.c stream/tv.c \
stream/frequencies.c stream/tvi_dummy.c
SOURCES-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
SOURCES-$(VCD) += stream/stream_vcd.c
SOURCES-$(DUMMY_OSD) += sub/osd_dummy.c
SOURCES-$(LIBASS_OSD) += sub/osd_libass.c
SOURCES-$(ALSA) += audio/out/ao_alsa.c
SOURCES-$(CACA) += video/out/vo_caca.c
SOURCES-$(SDL) += audio/out/ao_sdl.c
SOURCES-$(SDL2) += video/out/vo_sdl.c
SOURCES-$(COREAUDIO) += audio/out/ao_coreaudio.c \
audio/out/ao_coreaudio_utils.c \
audio/out/ao_coreaudio_properties.c
SOURCES-$(COREVIDEO) += video/out/vo_corevideo.c
SOURCES-$(DIRECT3D) += video/out/vo_direct3d.c \
video/out/w32_common.c
SOURCES-$(DSOUND) += audio/out/ao_dsound.c
SOURCES-$(WASAPI) += audio/out/ao_wasapi.c
SOURCES-$(GL) += video/out/gl_common.c video/out/gl_osd.c \
video/out/vo_opengl.c video/out/gl_lcms.c \
video/out/gl_video.c video/out/dither.c \
video/out/vo_opengl_old.c \
video/out/pnm_loader.c
SOURCES-$(ENCODING) += video/out/vo_lavc.c audio/out/ao_lavc.c \
mpvcore/encode_lavc.c
SOURCES-$(GL_WIN32) += video/out/w32_common.c video/out/gl_w32.c
SOURCES-$(GL_X11) += video/out/x11_common.c video/out/gl_x11.c
SOURCES-$(GL_COCOA) += video/out/gl_cocoa.c
SOURCES-$(GL_WAYLAND) += video/out/wayland_common.c \
video/out/gl_wayland.c
SOURCES-$(JACK) += audio/out/ao_jack.c
SOURCES-$(JOYSTICK) += mpvcore/input/joystick.c
SOURCES-$(LIBQUVI) += mpvcore/resolve_quvi.c
SOURCES-$(LIBQUVI9) += mpvcore/resolve_quvi9.c
SOURCES-$(LIRC) += mpvcore/input/lirc.c
SOURCES-$(OPENAL) += audio/out/ao_openal.c
SOURCES-$(OSS) += audio/out/ao_oss.c
SOURCES-$(PULSE) += audio/out/ao_pulse.c
SOURCES-$(PORTAUDIO) += audio/out/ao_portaudio.c
SOURCES-$(RSOUND) += audio/out/ao_rsound.c
vdpau: split off decoder parts, use "new" libavcodec vdpau hwaccel API Move the decoder parts from vo_vdpau.c to a new file vdpau_old.c. This file is named so because because it's written against the "old" libavcodec vdpau pseudo-decoder (e.g. "h264_vdpau"). Add support for the "new" libavcodec vdpau support. This was recently added and replaces the "old" vdpau parts. (In fact, Libav is about to deprecate and remove the "old" API without deprecation grace period, so we have to support it now. Moreover, there will probably be no Libav release which supports both, so the transition is even less smooth than we could hope, and we have to support both the old and new API.) Whether the old or new API is used is checked by a configure test: if the new API is found, it is used, otherwise the old API is assumed. Some details might be handled differently. Especially display preemption is a bit problematic with the "new" libavcodec vdpau support: it wants to keep a pointer to a specific vdpau API function (which can be driver specific, because preemption might switch drivers). Also, surface IDs are now directly stored in AVFrames (and mp_images), so they can't be forced to VDP_INVALID_HANDLE on preemption. (This changes even with older libavcodec versions, because mp_image always uses the newer representation to make vo_vdpau.c simpler.) Decoder initialization in the new code tries to deal with codec profiles, while the old code always uses the highest profile per codec. Surface allocation changes. Since the decoder won't call config() in vo_vdpau.c on video size change anymore, we allow allocating surfaces of arbitrary size instead of locking it to what the VO was configured. The non-hwdec code also has slightly different allocation behavior now. Enabling the old vdpau special decoders via e.g. --vd=lavc:h264_vdpau doesn't work anymore (a warning suggesting the --hwdec option is printed instead).
2013-07-27 23:49:45 +00:00
SOURCES-$(VDPAU) += video/vdpau.c video/out/vo_vdpau.c
SOURCES-$(VDPAU_DEC) += video/decode/vdpau.c
SOURCES-$(VDPAU_DEC_OLD) += video/decode/vdpau_old.c
SOURCES-$(X11) += video/out/vo_x11.c video/out/x11_common.c
SOURCES-$(XV) += video/out/vo_xv.c
SOURCES-$(VF_LAVFI) += video/filter/vf_lavfi.c
SOURCES-$(AF_LAVFI) += audio/filter/af_lavfi.c
ifeq ($(HAVE_AVUTIL_REFCOUNTING),no)
SOURCES-yes += video/decode/lavc_dr1.c
endif
SOURCES-$(DLOPEN) += video/filter/vf_dlopen.c
SOURCES = talloc.c \
audio/audio.c \
audio/chmap.c \
audio/chmap_sel.c \
audio/fmt-conversion.c \
audio/format.c \
audio/mixer.c \
audio/reorder_ch.c \
audio/decode/ad_lavc.c \
audio/decode/ad_spdif.c \
audio/decode/dec_audio.c \
audio/filter/af.c \
audio/filter/af_center.c \
audio/filter/af_channels.c \
audio/filter/af_delay.c \
audio/filter/af_dummy.c \
audio/filter/af_equalizer.c \
audio/filter/af_extrastereo.c \
audio/filter/af_force.c \
audio/filter/af_format.c \
audio/filter/af_hrtf.c \
audio/filter/af_karaoke.c \
audio/filter/af_lavcac3enc.c \
audio/filter/af_lavrresample.c \
audio/filter/af_pan.c \
audio/filter/af_scaletempo.c \
audio/filter/af_sinesuppress.c \
audio/filter/af_sub.c \
audio/filter/af_surround.c \
audio/filter/af_sweep.c \
audio/filter/af_tools.c \
audio/filter/af_drc.c \
audio/filter/af_volume.c \
audio/filter/filter.c \
audio/filter/window.c \
audio/out/ao.c \
audio/out/ao_null.c \
audio/out/ao_pcm.c \
core: redo how codecs are mapped, remove codecs.conf Use codec names instead of FourCCs to identify codecs. Rewrite how codecs are selected and initialized. Now each decoder exports a list of decoders (and the codec it supports) via add_decoders(). The order matters, and the first decoder for a given decoder is preferred over the other decoders. E.g. all ad_mpg123 decoders are preferred over ad_lavc, because it comes first in the mpcodecs_ad_drivers array. Likewise, decoders within ad_lavc that are enumerated first by libavcodec (using av_codec_next()) are preferred. (This is actually critical to select h264 software decoding by default instead of vdpau. libavcodec and ffmpeg/avconv use the same method to select decoders by default, so we hope this is sane.) The codec names follow libavcodec's codec names as defined by AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders have names different from the canonical codec name. The AVCodecDescriptor API is relatively new, so we need a compatibility layer for older libavcodec versions for codec names that are referenced internally, and which are different from the decoder name. (Add a configure check for that, because checking versions is getting way too messy.) demux/codec_tags.c is generated from the former codecs.conf (minus "special" decoders like vdpau, and excluding the mappings that are the same as the mappings libavformat's exported RIFF tables). It contains all the mappings from FourCCs to codec name. This is needed for demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the codec as determined by libavformat, while the other demuxers have to do this on their own, using the mp_set_audio/video_codec_from_tag() functions. Note that the sh_audio/video->format members don't uniquely identify the codec anymore, and sh->codec takes over this role. Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which provide cover the functionality of the removed switched. Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure container/video combinations (e.g. the sample Film_200_zygo_pro.mov) are played flipped. ffplay/avplay doesn't handle this properly either, so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
demux/codec_tags.c \
demux/demux.c \
demux/demux_edl.c \
demux/demux_cue.c \
demux/demux_lavf.c \
demux/demux_mf.c \
demux/demux_mkv.c \
2013-06-20 22:26:05 +00:00
demux/demux_subreader.c \
demux/demux_raw.c \
demux/ebml.c \
demux/mf.c \
mpvcore/asxparser.c \
mpvcore/av_common.c \
mpvcore/av_log.c \
mpvcore/av_opts.c \
mpvcore/bstr.c \
mpvcore/charset_conv.c \
mpvcore/codecs.c \
mpvcore/command.c \
mpvcore/cpudetect.c \
mpvcore/m_config.c \
mpvcore/m_option.c \
mpvcore/m_property.c \
mpvcore/mp_common.c \
mpvcore/mp_msg.c \
mpvcore/mp_ring.c \
mpvcore/mplayer.c \
mpvcore/options.c \
mpvcore/parser-cfg.c \
mpvcore/parser-mpcmd.c \
mpvcore/path.c \
mpvcore/playlist.c \
mpvcore/playlist_parser.c \
mpvcore/screenshot.c \
mpvcore/version.c \
mpvcore/input/input.c \
mpvcore/timeline/tl_edl.c \
mpvcore/timeline/tl_matroska.c \
mpvcore/timeline/tl_cue.c \
osdep/io.c \
osdep/numcores.c \
osdep/timer.c \
stream/cookies.c \
stream/stream.c \
demux_lavf: add support for libavdevice libavdevice supports various "special" video and audio inputs, such as screen-capture or libavfilter filter graphs. libavdevice inputs are implemented as demuxers. They don't use the custom stream callbacks (in AVFormatContext.pb). Instead, input parameters are passed as filename. This means the mpv stream layer has to be disabled. Do this by adding the pseudo stream handler avdevice://, whose only purpose is passing the filename to demux_lavf, without actually doing anything. Change the logic how the filename is passed to libavformat. Remove handling of the filename from demux_open_lavf() and move it to lavf_check_file(). (This also fixes a possible bug when skipping the "lavf://" prefix.) libavdevice now can be invoked by specifying demuxer and args as in: mpv avdevice://demuxer:args The args are passed as filename to libavformat. When using libavdevice demuxers, their actual meaning is highly implementation specific. They don't refer to actual filenames. Note: libavdevice is disabled by default. There is one problem: libavdevice pulls in libavfilter, which in turn causes symbol clashes with mpv internals. The problem is that libavfilter includes a mplayer filter bridge, which is used to interface with a set of nearly unmodified mplayer filters copied into libavfilter. This filter bridge uses the same symbol names as mplayer/mpv's filter chain, which results in symbol clashes at link-time. This can be prevented by building ffmpeg with --disable-filter=mp, but unfortunately this is not the default. This means linking to libavdevice (which in turn forces linking with libavfilter by default) must be disabled. We try doing this by compiling a test file that defines one of the clashing symbols (vf_mpi_clear). To enable libavdevice input, ffmpeg should be built with the options: --disable-filter=mp and mpv with: --enable-libavdevice Originally, I tried to auto-detect it. But the resulting complications in configure did't seem worth the trouble.
2012-11-30 17:41:04 +00:00
stream/stream_avdevice.c \
stream/stream_file.c \
stream/stream_lavf.c \
stream/stream_memory.c \
stream/stream_mf.c \
stream/stream_null.c \
sub/dec_sub.c \
sub/draw_bmp.c \
sub/find_subfiles.c \
sub/img_convert.c \
sub/sd_lavc.c \
sub/sd_lavc_conv.c \
sub/sd_lavf_srt.c \
sub/sd_microdvd.c \
sub/sd_movtext.c \
sub/sd_spu.c \
sub/sd_srt.c \
sub/spudec.c \
sub/sub.c \
video/csputils.c \
video/fmt-conversion.c \
video/image_writer.c \
video/img_format.c \
video/mp_image.c \
video/mp_image_pool.c \
video/sws_utils.c \
video/decode/dec_video.c \
video/decode/vd.c \
video/decode/vd_lavc.c \
video/filter/vf.c \
video/filter/pullup.c \
video/filter/vf_crop.c \
video/filter/vf_delogo.c \
video/filter/vf_divtc.c \
video/filter/vf_down3dright.c \
video/filter/vf_dsize.c \
video/filter/vf_eq.c \
video/filter/vf_expand.c \
video/filter/vf_flip.c \
video/filter/vf_format.c \
video/filter/vf_gradfun.c \
video/filter/vf_hqdn3d.c \
video/filter/vf_ilpack.c \
video/filter/vf_mirror.c \
video/filter/vf_noformat.c \
video/filter/vf_noise.c \
video/filter/vf_phase.c \
video/filter/vf_pullup.c \
video/filter/vf_rotate.c \
video/filter/vf_scale.c \
video/filter/vf_screenshot.c \
video/filter/vf_softpulldown.c \
video/filter/vf_stereo3d.c \
video/filter/vf_sub.c \
video/filter/vf_swapuv.c \
video/filter/vf_unsharp.c \
video/filter/vf_vo.c \
video/filter/vf_yadif.c \
video/out/bitmap_packer.c \
video/out/aspect.c \
video/out/filter_kernels.c \
video/out/vo.c \
video/out/vo_null.c \
video/out/vo_image.c \
osdep/$(GETCH) \
osdep/$(TIMER) \
$(SOURCES-yes)
OBJECTS += $(addsuffix .o, $(basename $(SOURCES)))
OBJECTS-$(PE_EXECUTABLE) += osdep/mpv-rc.o
OBJECTS += $(OBJECTS-yes)
DEP_FILES = $(patsubst %.S,%.d,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SOURCES:.m=.d) $(SOURCES:.m=.d))))
ALL_TARGETS += mpv$(EXESUF)
INSTALL_BIN += install-mpv
INSTALL_BIN_STRIP += install-mpv-strip
INSTALL_MAN =
ifeq ($(BUILD_MAN),yes)
INSTALL_MAN += install-mpv-man
ALL_TARGETS += DOCS/man/en/mpv.1
endif
DIRS = . \
audio \
audio/decode \
audio/filter \
audio/out \
mpvcore \
mpvcore/input \
mpvcore/timeline \
demux \
osdep \
osdep/ar \
stream \
sub \
video \
video/decode \
video/filter \
video/out
ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2)))
ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS))
ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1))
###### brief build output #######
ifndef V
$(eval override CC = @printf "CC\t$$@\n"; $(CC))
$(eval override RM = @$(RM))
endif
###### generic rules #######
all: $(ALL_TARGETS)
%.1: %.rst
2012-11-02 13:37:02 +00:00
$(RST2MAN) $< $@
%.o: %.S
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
%.o: %.c
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
%.o: %.cpp
$(CC) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
%.o: %.m
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
%-rc.o: %.rc
$(WINDRES) -I. $< $@
mpv$(EXESUF): $(OBJECTS)
mpv$(EXESUF):
$(CC) -o $@ $^ $(EXTRALIBS)
mpvcore/input/input.c: mpvcore/input/input_conf.h
mpvcore/input/input_conf.h: TOOLS/file2string.pl etc/input.conf
./$^ >$@
MKVLIB_DEPS = TOOLS/lib/Parse/Matroska.pm \
TOOLS/lib/Parse/Matroska/Definitions.pm \
TOOLS/lib/Parse/Matroska/Element.pm \
TOOLS/lib/Parse/Matroska/Reader.pm \
TOOLS/lib/Parse/Matroska/Utils.pm \
demux/ebml.c demux/demux_mkv.c: demux/ebml_types.h
demux/ebml_types.h: TOOLS/matroska.pl $(MKVLIB_DEPS)
./$< --generate-header > $@
demux/ebml.c: demux/ebml_defs.c
demux/ebml_defs.c: TOOLS/matroska.pl $(MKVLIB_DEPS)
./$< --generate-definitions > $@
video/out/gl_video.c: video/out/gl_video_shaders.h
video/out/gl_video_shaders.h: TOOLS/file2string.pl video/out/gl_video_shaders.glsl
./$^ >$@
sub/osd_libass.c: sub/osd_font.h
sub/osd_font.h: TOOLS/file2string.pl sub/osd_font.otf
./$^ >$@
# ./configure must be rerun if it changed
config.mak: configure
@echo "############################################################"
@echo "####### Please run ./configure again - it's changed! #######"
@echo "############################################################"
version.h .version: version.sh
./$<
# Force version.sh to run to potentially regenerate version.h
-include .version
%$(EXESUF): %.c
$(CC) $(CFLAGS) -o $@ $^
###### dependency declarations / specific CFLAGS ######
mpvcore/version.c osdep/mpv-rc.o: version.h
osdep/mpv-rc.o: osdep/mpv.exe.manifest etc/mpv-icon.ico
DOCS/man/en/mpv.1: DOCS/man/en/af.rst \
DOCS/man/en/ao.rst \
DOCS/man/en/changes.rst \
DOCS/man/en/encode.rst \
DOCS/man/en/input.rst \
DOCS/man/en/options.rst \
DOCS/man/en/vf.rst \
DOCS/man/en/vo.rst
###### installation / clean / generic rules #######
install: $(INSTALL_BIN) $(INSTALL_MAN)
install-no-man: $(INSTALL_BIN)
install-strip: $(INSTALL_BIN_STRIP) $(INSTALL_MAN)
install-strip-no-man: $(INSTALL_BIN_STRIP)
install-dirs:
if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
install-%: %$(EXESUF) install-dirs
$(INSTALL) -m 755 $< $(BINDIR)
install-%-strip: %$(EXESUF) install-dirs
$(INSTALL) -m 755 -s $< $(BINDIR)
install-mpv-man: install-mpv-man-en
install-mpv-man-en: DOCS/man/en/mpv.1
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/
uninstall:
$(RM) $(BINDIR)/mpv$(EXESUF)
$(RM) $(MANDIR)/man1/mpv.1
$(RM) $(MANDIR)/en/man1/mpv.1
clean:
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_EXESUFS,mpv)
-$(RM) DOCS/man/en/mpv.1
-$(RM) version.h
-$(RM) mpvcore/input/input_conf.h
-$(RM) video/out/vdpau_template.c
-$(RM) demux/ebml_types.h demux/ebml_defs.c
-$(RM) video/out/gl_video_shaders.h
-$(RM) sub/osd_font.h
2012-07-28 16:32:26 +00:00
distclean: clean
-$(RM) config.log config.mak config.h TAGS tags
TAGS:
2011-06-30 20:12:48 +00:00
$(RM) $@; find . -name '*.[chS]' -o -name '*.asm' | xargs etags -a
tags:
2011-06-30 20:12:48 +00:00
$(RM) $@; find . -name '*.[chS]' -o -name '*.asm' | xargs ctags -a
osxbundle:
@TOOLS/osxbundle.py mpv
osxbundle-skip-deps:
@TOOLS/osxbundle.py --skip-deps mpv
-include $(DEP_FILES)
.PHONY: all *install* *clean .version
# Disable suffix rules. Most of the builtin rules are suffix rules,
# so this saves some time on slow systems.
.SUFFIXES:
# If a command returns failure but changed its target file, delete the
# (presumably malformed) file. Otherwise the file would be considered to
# be up to date if make is restarted.
.DELETE_ON_ERROR: