Commit Graph

36041 Commits

Author SHA1 Message Date
wm4 c890b8942d m_option: make defval const
There's really no reason why it shouldn't.
2013-08-17 19:50:45 +02:00
wm4 8b245c4d4b sd_lavc_conv: don't check AV_CODEC_PROP_TEXT_SUB flag
Not actually useful. This would break whenever a new text subtitle
format would be added, which requires a binary->text transformation.
(mov_text is one such format; disable it.) In general, we would have
to know which packet formats are binary, which we don't, so the only
reasonable way to handle this is a white list.
2013-08-15 23:40:04 +02:00
wm4 3e6ed76935 sub: don't print detected charset if it's UTF-8
Too noisy. This also fixes that iconv() was called if "utf8" was used
as codepage.
2013-08-15 23:40:04 +02:00
wm4 4246b5fbf0 vdpau_old: add forgotten probe callback
Could make it crash if the VO didn't support vdpau decoding.
2013-08-15 23:40:04 +02:00
wm4 a82be4348e manpage: fix incorrect ao_alsa example, extend changes.rst
One example in ao.rst used the old syntax with mangled device names.
Fix it. Mention some shell related caveats. Explicitly mention the
change of device name syntax in changes.rst, because it seems to be
a common issue.
2013-08-15 23:40:03 +02:00
wm4 f9271c2ca2 sub: make --subcp=enca the default. 2013-08-15 23:40:03 +02:00
wm4 fe3c445112 sub: allow specifying a fallback codepage if input is not UTF-8
Normally, --subcp always forces conversion. This really always forces
conversion, even if the UTF-8 check on the input succeeds.

Extend the --subcp to allow codepages as fallback if UTF-8 doesn't
work. So, for example --subcp=utf8:cp1250 will use UTF-8 if the input
looks like UTF-8, and will fall back to use cp1250 if the UTF-8 check
fails.

I think this should actually be the default, but on the other hand,
this changes the semantics of the option, and a user would actually
expect --subcp to force conversion, rather than silently using UTF-8
if that happens to work.
2013-08-15 23:40:03 +02:00
wm4 00f735d5cb bstr: make UTF-8 check stricter
Don't accept overlong sequences. Don't accept codepoints past the
maximum unicode codepoint. Don't accept the UTF-16 surrogate codepoints.

I'm not sure if there are more codepoints that are defined to be
invalid, but we just want to make libavcodec happy, so this is enough.

(libavcodec's subtitle converter checks for valid UTF-8 and throws up
and dies if it's not - now we want to use bstr_sanitize_utf8_latin1() to
force valid UTF-8, so the strictness of our UTF-8 parser has to match at
least that of the libavcodec's check.)

I'm not sure whether the min test is actually 100% correct.

Note that libavcodec also treats BOM codepoints as invalid. This is
definitely a bug: the BOM is really just "zero-width non-breaking space"
redefined by Microsoft, but it is perfectly valid to appear in the
middle of a string. Official Unicode has merely deprecated the old
usage of the BOM codepoint, and didn't make it illegal. Besides, the
string could be from the start of a file, so even this check doesn't
make sense even with libavcodec's insane logic. We don't copy this bug.
2013-08-15 23:40:03 +02:00
wm4 acb51c9243 sub: if charset detection fails, treat it as broken UTF-8
Broken UTF-8 in this context means we treat it as UTF-8, but we also
interpret broken UTF-8 sequences as Latin1.

Also, run our own UTF-8 check function before the charset detectors.
This prevents from ENCA's UTF-8 check possibly messing up (like
detecting 7-bit clean UTF-8 as ASCII, or other things). It also takes
care of UTF-8 detection if no charset detector (ENCA, libguess) is
compiled in, and it lets us deal better with cut-off UTF-8 sequences.
2013-08-15 23:40:02 +02:00
wm4 380fa71fc7 bstr: add UTF-8 validation and sanitation functions 2013-08-15 23:40:02 +02:00
wm4 04bc16f6ea vdpau: fix compilation on Libav
Libav's <libavcodec/vdpau.h> header uses some libavocdec symbols without
forward-declaring them and without including the headers declaring them.
FFmpeg's header for this is fine.
2013-08-15 23:40:02 +02:00
wm4 006c2f66e1 video/decode: change fix_image callback
This might make it slightly easier when trying to implement surface
read-back for hardware decoding.
2013-08-15 23:40:02 +02:00
wm4 be2f2ff033 vd_lavc: fix comment, document hwdec video frame size trickiness
About this issue, it would be better if the surfaces could be allocated
with the real size, and the vdpau video mixer could be created with that
size as well. That would be a bit hard, because the real surface size
had to be communicated to vdpau. So I'm going with this solution. vaapi
seems to be fine with either surface size, so there's hopefully no
problem.
2013-08-15 23:40:02 +02:00
wm4 0da9638576 video/decode: pass parameters directly to hwdec allocate_image callback
Instead of passing AVFrame. This also moves the mysterious logic about
the size of the allocated image to common code, instead of duplicating
it everywhere.
2013-08-15 23:40:02 +02:00
Stefano Pigozzi 30f2db5930 vo_corevideo: add uyvy422 pixel format support
Looks like the vda_h264_dec in ffmpeg likes to output this format and it
inserted swscale to do pixfmt conversion to yuyv422.
2013-08-15 11:22:40 +02:00
Giuliano Schneider e437ecf729 input: fix build if HAVE_PTHREADS is undefined 2013-08-15 11:22:30 +02:00
wm4 cd85379423 sub: fix accidental subtitle overlaps
The fix_overlaps_and_gaps() function in dec_sub.c fixes small gaps or
overlaps between subtitle events. However, sometimes it could happen
that the corrected subtitle events could overlap by 1ms due to bad
rounding, making libass shift subtitles to reduce collisions. (The
second subtitle will be shown above the previous one, even if both
subtitles are visible only for 1ms.)

sd_ass.c rounds the timestamps when converting to integers for unknown
reasons. I think it would work fine without that rounding, but since
I have no clue why it rounds, and since it could be needed to ensure
correct timestamps with ASS subtitles demuxed from Matroska, I'd rather
not touch it. So the solution is to use already rounded timestamps to
calculate the new subtitle duration in fix_overlaps_and_gaps().

See github issue #182.
2013-08-14 15:23:13 +02:00
wm4 3ffabe26af x11: fix --ontop
Apply it after mapping.
2013-08-14 00:36:33 +02:00
wm4 6704e39fcb vaapi: fix typo 2013-08-14 00:36:33 +02:00
Stefano Pigozzi 68b189351c changes.rst: document some OSX and windows changes 2013-08-13 23:20:27 +02:00
Stefano Pigozzi cd973fd30f input.conf: bind AXIS_(LEFT|RIGHT) to seek 5
Binding them to volume was a bad default, so change it.
2013-08-13 23:07:49 +02:00
Stefano Pigozzi 04cdc205bc cocoa_common: add precise scrolling support
This adds precise scrolling support. I ran some tests and it seems a little
bit smoother and well.. precise. The defaults are rebindable using: AXIS_UP,
AXIS_DOWN, AXIS_LEFT and AXIS_RIGHT.
2013-08-13 23:05:46 +02:00
Stefano Pigozzi 11dad6d44b macosx: remove platform specific input queue
Since last commit the input queue in the core is thread safe, so there is no
need for all this platform specific stuff anymore.
2013-08-13 23:02:43 +02:00
Stefano Pigozzi 36586dd7b7 input: make input queue thread safe
If pthreads are enabled the input queue accesses are regulated by acquiring
a mutex. This is useful for platforms like OS X, where the events are created
in the cocoa thread and added to the queue to then be dequeued in the playloop
thread.
2013-08-13 23:02:16 +02:00
Martin Herkt 87ce0c3b8d mpvcore/options: Update default user agent string
Uh… about time, I guess?
2013-08-13 03:43:22 +02:00
wm4 d5f1b1638c demux: move demux_mf before demux_subreader
demux_subreader is quite aggressive, and sometimes detects random
strings in EXIF as subtitle text.
2013-08-12 20:40:39 +02:00
wm4 b644fe3da6 demux_subreader: report what subtitle format has been found 2013-08-12 20:39:43 +02:00
Noble Huang 1ef239a499 stream_bluray: fix bd:// url segfault introduced by commit bc1d61 2013-08-12 19:00:39 +02:00
wm4 92720fcc0e Revert "sub: support straight alpha additionally to premultiplied alpha"
This reverts commit 689a25003f, with some
adjustments to code that was added after that commit.

I just messed up big time. We don't need this, and in fact the commit
confused straight and premultiplied alpha at one point (just a simple
inverted condition due to an oversight), which is why it looked like
it was working.

In commit 2827295 I wrote:

   Also, libva can't decide whether it accepts straight or premultiplied
   alpha for OSD sub-pictures [...]

That was just me messing up and being severely confused by my own bugs.
VA API  uses premultiplied alpha, which by the way is nice and
thoughtful of the VA API devs.

Well, this was stupid. But in the end, I'm glad that I could actually
reduce codesize by a good amount again.
2013-08-12 02:49:22 +02:00
wm4 19a7534573 manpage: actually document --hwdec=auto 2013-08-12 02:16:20 +02:00
wm4 12a6f73a2f configure: fix typo 2013-08-12 02:14:00 +02:00
wm4 7df6539a87 vo: fix build with #ifdef -> #if
Whoever had the idea of introducing mixed conventions for these
preprocessor symbols should be shot.
2013-08-12 01:38:38 +02:00
wm4 2827295703 video: add vaapi decode and output support
This is based on the MPlayer VA API patches. To be exact it's based on
a very stripped down version of commit f1ad459a263f8537f6c from
git://gitorious.org/vaapi/mplayer.git.

This doesn't contain useless things like benchmarking hacks and the
demo code for GLX interop. Also, unlike in the original patch, decoding
and video output are split into separate source files (the separation
between decoding and display also makes pixel format hacks unnecessary).

On the other hand, some features not present in the original patch were
added, like screenshot support.

VA API is rather bad for actual video output. Dealing with older libva
versions or the completely broken vdpau backend doesn't help. OSD is
low quality and should be rather slow. In some cases, only either OSD
or subtitles can be shown at the same time (because OSD is drawn first,
OSD is prefered).

Also, libva can't decide whether it accepts straight or premultiplied
alpha for OSD sub-pictures: the vdpau backend seems to assume
premultiplied, while a native vaapi driver uses straight. So I picked
straight alpha. It doesn't matter much, because the blending code for
straight alpha I added to img_convert.c is probably buggy, and ASS
subtitles might be blended incorrectly.

Really good video output with VA API would probably use OpenGL and the
GL interop features, but at this point you might just use vo_opengl.
(Patches for making HW decoding with vo_opengl have a chance of being
accepted.)

Despite these issues, decoding seems to work ok. I still got tearing
on the Intel system I tested (Intel(R) Core(TM) i3-2350M). It was also
tested with the vdpau vaapi wrapper on a nvidia system; however this
was rather broken. (Fortunately, there is no reason to use mpv's VAAPI
support over native VDPAU.)
2013-08-12 01:12:02 +02:00
wm4 c7da4ba744 img_convert: add function to scale RGBA OSD images 2013-08-12 00:51:31 +02:00
wm4 689a25003f sub: support straight alpha additionally to premultiplied alpha
This is for VAAPI support. VAAPI does not support premultiplied alpha
for OSD. (Normally, we prefer premultiplied, because it has better
behavior on scaling.)

I'm not sure whether blending in the ASS->RGBA part is correct and I
didn't test it extensively.
2013-08-12 00:50:28 +02:00
wm4 8fe4790ec8 video: redo hw decoding initialization, add --hwdec=auto
Change how the HW decoding stuff is organized, the way it's initialized
in particular. Instead of duplicating the list of supported codecs for
hwaccel decoders, add a probe function which allows each decoder to
report whether it supports a given codec.

Add an "auto" choice to the --hwdec option, which automatically enables
hardware decoding if libavcodec and/or the VO supports it.

What mpv prints on the terminal changes a bit. Now it will just print
a single line whether hw decoding is used or not (and nothing at all if
no hw decoding at all was requested). The pretty violent fallback from
hw decoding to software decoding is still quite verbose and evil-looking
though.
2013-08-11 23:59:18 +02:00
wm4 cdf4b7d2ee x11_common: get hack for Motif Window Manager out of the way
Disable the hack by default, because it's interfering with some more
modern WMs. MWM (Motif Window Manager) is probably pretty dead, but
we still allow enabling the old hack with "--fstype=mwm_hack".

See github issue #179.
2013-08-11 23:59:18 +02:00
wm4 e978511d63 vo: unref waiting image before destroying VO driver
This is in theory more correct with respect to hardware decoding. With
hardware decoding, the VOs play the role of the video surface allocator,
and nothing is allowed to reference surfaces past the VO lifetime. But
in theory waiting_mpi could be a reference to a HW video surface, so it
should be relased before the VO is uninitialized.
2013-08-11 20:09:06 +02:00
wm4 abe47a4840 core: make sure hw decoding works when playing multiple files
The hw decoding context was set only for the first file (when the VO was
initialized), instead of every file.
2013-08-11 20:08:00 +02:00
wm4 c6db8f6a8b version.sh: add --print option, which prints version to stdout
Might be helpful when creating a tarball.
2013-08-09 10:07:23 +02:00
wm4 b27f65a758 version.sh: integrate the release tag in output
This is basically reconstructed from 46b218c. Since we now have proper
release tags, we want this again.

Add --tags to the git describe call, because the github release system
creates light-weight tags only, and we're too lazy to create annitated
tags (or is that bad practice?).

Add --long, so that the git commit hash is part of the output even if
the tag matches.
2013-08-09 09:44:24 +02:00
wm4 d8922361d1 demux_lavf: blacklist "tty" libavformat demuxer
This is completely useless, and in this particular case, it broke the
fallback for MLP2 subtitles (stored as .txt files) to demux_subreader.
(Yes, libavformat should be fixed to handle this, but for now this will
_always_ break playback of subtitle files stored in .txt.)

You can still force this demuxer, but by default we will just pretend
that the "tty" demuxer does not exist.
2013-08-07 23:15:43 +02:00
Alexander Preisinger 182b470567 changes.rst: add precise scrolling support 2013-08-07 22:26:56 +02:00
Alexander Preisinger f921d5c07f input.conf: better documentation and sane defaults
Uses the same defaults as BTN3/4/5/6 which are hardcoded by most backends for
the mouse wheel.
2013-08-07 22:20:10 +02:00
Alexander Preisinger f364a1e3df wayland: add support for precise scrolling
The default value for a standard mouse is 10.0. Because we don't want to
multiply the value in the input config file we scale it down to 1.0.

Hopefully this should work for more precise mousewheels or touchpad, but
I don't have access to such hardware.
2013-08-07 22:15:39 +02:00
Alexander Preisinger 023e5ccd02 input: add support for precise scroll axes
Support horizontal and vertical axes of input devices.

If the input device support precise scrolling with an input value then it
should first be scaled to a standard multiplier, where 1.0 is the default.

The multiplier will then applied to the following commands if possible:
 * MP_CMD_SEEK
 * MP_CMD_SPEED_MULT
 * MP_CMD_ADD

All other commands will triggered on every axis event, without change the
values specified in the config file.
2013-08-07 22:15:39 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
Stefano Pigozzi bc27f946c2 core: move contents to mpvcore (1/2)
core is used in many unix systems for core dumps. For that reason some tools
work under the assumption that the file is indeed a core dump (for example
autoconf does this).

This commit just renames the files. The following one will change all the
includes to fix compilation. This is done this way because git has a easier
time tracing file changes if there is a pure rename commit.
2013-08-06 22:48:47 +02:00
wm4 d40a91e804 gl_video: handle non-mod-2 4:2:0 YUV video correctly
Allocate textures big enough to include the bottom/right borders (so the
chroma texture sizes are rounded up instead of down). Make the texture
large enough to include the additional luma border. Conceptually, we
pretend that the video frame is fully aligned, and then crop away the
unwanted borders. Filtering (even just bilinear) will access the
borders anyway, so it's possible that we might need to switch to
"harder" cropping instead, but at least pixels not close to the
border should be displayed correctly now.

Add a comment to mp_image.c about this luma border. These semantics are
kind of subtle, and the image allocation code handle this in a subtle
way too, so it's better to document this explicitly. The libavutil
image allocation code does similar things.
2013-08-06 21:46:47 +02:00
Diogo Franco 57ec67a6cc Merge pull request #154 from rossy2401/wasapi-pause
WASAPI stops working after pause
2013-08-05 18:22:46 -07:00