Normally, we always want to enable encoding, as it uses stock ffmpeg
APIs and has no other dependencies or disadvantages.
However, supporting older releases of ffmpeg and Libav (which equal to
outdated git snapshots fix security and crash fixes applied) force us
to disable some advanced ffmpeg API usage, which includes encoding.
Libav 0.8.4 is ridiculously old (in relative terms), so I don't know
how many things are broken silently.
Encoding is disabled, because the required API hasn't been added yet.
(On the other hand, the old API can't be used in newer versions.)
This should improve compatibility with ffmpeg 0.11.2 as well, which
didn't define AV_CODEC_ID_SUBRIP yet.
Add building the manpage to the all target (which is also the default
target). This fixes the behavior that "make install" tried to build the
manpage if it wasn't built yet.
Add rst2man detection to configure, and disable rst2man usage in the all
and install targets if it hasn't been found. You can still build or
install the man page manually (by using the install-mpv-man target),
but the all and install targets won't attempt to use rst2man.
Additionally, building/installing the manpage by default can be
explicitly inhibited using the --disable-manpage configure option.
It's possible to avoid rst2man by using "make mpv install-no-man" as
well.
This removes the rather complicated configure and Makefile parts
related to auto-detecting available languages for manpages and locales.
We don't have non-English manpages or any locales, so this is
pointless. It didn't even work: configure --language=all created an
invalid config.mak that would cause "make install" to fail.
Remove installation of locales. There are no translations at all which
could be installed. Should there ever be someone who is interested in
adding translations, this can be added back in a simpler way.
Rename the --enable-translation configure option to --enable-gettext.
This is what this option really does: enable gettext() use. This may
be interesting for people who want to experiment with localizing mpv,
but is entirely useless for normal use.
Remove detection of the binary codecs directory in configure.
The function fixup_network_stream_cache() accesses stream->opts, which
is NULL in some cases when loading playlists. stream->opts is a pointer
to the global MPOpts struct. For simplicity, this parameter is left
NULL in some cases. Usually, this doesn't matter, because barely
anything in stream/ uses MPOpts anyway.
Hack-fix this for now by not accessing MPOpts and disabling the stream
cache in this case. Calling open_stream() with options==NULL now
basically means: do not use cache settings.
Lowering volume while muted did not work correctly with audio outputs
that support native mute setting separate from volume (ao_alsa and
ao_pulse), because the AO-level volume was not set while muted but was
still being read back. Fix by setting the AO volume in this case.
Put MP_EXPAND_ARGS() in compiler.h, even though it's not compiler
dependent. Both mp_talloc.h and mp_common.h need it, while mp_common.h
includes mp_talloc.h. This is the least annoying solution.
Finish renaming directories and moving files. Adjust all include
statements to make the previous commit compile.
The two commits are separate, because git is bad at tracking renames
and content changes at the same time.
Also take this as an opportunity to remove the separation between
"common" and "mplayer" sources in the Makefile. ("common" used to be
shared between mplayer and mencoder.)
Tis drops the silly lib prefixes, and attempts to organize the tree in
a more logical way. Make the top-level directory less cluttered as
well.
Renames the following directories:
libaf -> audio/filter
libao2 -> audio/out
libvo -> video/out
libmpdemux -> demux
Split libmpcodecs:
vf* -> video/filter
vd*, dec_video.* -> video/decode
mp_image*, img_format*, ... -> video/
ad*, dec_audio.* -> audio/decode
libaf/format.* is moved to audio/ - this is similar to how mp_image.*
is located in video/.
Move most top-level .c/.h files to core. (talloc.c/.h is left on top-
level, because it's external.) Park some of the more annoying files
in compat/. Some of these are relicts from the time mplayer used
ffmpeg internals.
sub/ is not split, because it's too much of a mess (subtitle code is
mixed with OSD display and rendering).
Maybe the organization of core is not ideal: it mixes playback core
(like mplayer.c) and utility helpers (like bstr.c/h). Should the need
arise, the playback core will be moved somewhere else, while core
contains all helper and common code.
The srgb_compand() function passes bvec to mix(), which is apparently
not available on GL 2.1 / GLSL 1.20:
0:0(0): error: no matching function for call to `mix(vec3, vec3, bvec3)'
0:0(0): error: candidates are: float mix(float, float, float)
0:0(0): error: vec2 mix(vec2, vec2, vec2)
0:0(0): error: vec3 mix(vec3, vec3, vec3)
0:0(0): error: vec4 mix(vec4, vec4, vec4)
0:0(0): error: vec2 mix(vec2, vec2, float)
0:0(0): error: vec3 mix(vec3, vec3, float)
0:0(0): error: vec4 mix(vec4, vec4, float)
Also add back disabling color management on older GL, as the
srgb_compand() function is needed for that.
Based on a patch by nand. This is needed, because sRGB mode changes the
video over-all gamma. This has to be done for subtitles as well.
The final srgb_compand() call in the OSD shader compensates for the fact
that in ed8fad729d framebuffer use was replaced with doing sRGB
conversion manually by srgb_compand().
This only affects subtitles rendered with libass. Nothing is changed for
RGB subs.
Also change the USE_ flags for OSD shaders to USE_OSD_ to make the
difference between video and OSD rendering more apparent.
This was done to query the colorspace for sub/OSD rendering. A
single vo_xv_get_eq() call probably requires a dozens of round-trips
(depending what xlib actually does). This likely wasn't a real problem,
but it might be better to be paranoid about this.
To simplify implementation, the same filter kernel was used for both
directions, even when the scaling factors were different. It turns
out that people actually did this, and that the resulting rendering
errors were rather visible. Disable this feature by default, as
fixing it would require structural changes, and it's a useless anyway.
fast_memcpy, defined in fastmemcpy.h, used to be mplayer's "optimized"
memcpy. It has been removed from this fork, and fast_memcpy has been
reduced to an alias for memcpy. Replace all remaining uses of the
fast_memcpy macro alias.
Patch by nand. Modified not to use macros in the GLSL, and also remove
the checks for framebuffer presence. (Disabling ICC if no sRGB
framebuffer is available was probably a bug.)
The CoreAudio AO's AOCONTROL_GET_VOLUME/AOCONTROL_SET_VOLUME operate on the
AUHAL's volume, and every application has it's AUHAL with a separate volume.
Additionally CoreAudios's mixer seems to be better. As much as I tried to, I
couldn't get it to clip sounds.
Code from libavformat's demuxer.
Merged by wm4. It looks like the byte stream writer API is private in
newer ffmpeg, so use the macros from <libavutil/intreadwrite.h>
instead.
It's not really known how to correctly set the field that is used by
the decoder to calculate the length of the last frame. The original
patch used:
put_le32(&b, (demuxer->movi_end - demuxer->movi_start) * sh_a->samplerate);
This doesn't seem to be correct. Write 0 instead. This is also
incorrect, but better than writing an essentially random value.
file2string.pl and vdpau_functions.pl are direct ports.
matroska.py was reimplemented as the Parse::Matroska module in CPAN,
and matroska.pl was made a client of Parse::Matroska.
A copy of Parse::Matroska is included in TOOLS/lib, and matroska.pl
looks there first when trying to load the module.
osxbundle.py was not ported since I have no means to verify it.
Python is always available on OSX though, so there is no harm in
removing the check for it on configure.
This caused failures when doing single threaded decoding in some cases.
It's unknown what exactly the reasons are for these failures, but
direct rendering is probably worthless anyway.
Disable slices by default as well, just to be sure not to invoke broken
code paths. Multithreading disables these too.
The old behavior can be restored by passing the -dr1 -slices command
line options. (-dr1 is left undocumented intentionally.)
Multithreaded decoding worked fine, because vd_ffmpeg.c automatically
disables direct rendering in this case.
It looks like that only `install_name_tool -change` must be applied
recursively. This allows to bundle up all our stuff without thinkering with
the Mach-O headerpad size (which could even be impossible for libraries we
don't compile and link ourselves).
In mplayer2, it was valid to try to start encoding before all streams
were initialized. mpv avoids this situation and thus allows us to
properly bail out on some kinds of failures.
Also, this commit fixes a missing check in ao uninit which could cause
heap corruption when ao initialization did not complete.
The call snd_pcm_hw_params_alloca(&alsa_hwparams) expands to a macro,
which actually uses alloca(), and stores its result to alsa_hwparams.
At the same time, alsa_hwparams was a global variable for no good
reason. Make it less confusing and move the variables into the init()
function, where they are needed.