Commit Graph

44567 Commits

Author SHA1 Message Date
wm4 55d6408526 TOOLS/matroska.py: fix some minor things for dumping
TOOLS/matroska.py can be used stand-alone for dumping Matroska file
contents. Fix some related issues.

Elements were treated as unknown if the element hex ID contained
uppercase characters.

Unknown elements stopped parsing. This was intentional, but I don't
really see any reason for it.

Dumping with Python 2 is broken. I don't care, but everytime I hit this,
I find myself trying to find out why. So make it error out explicitly.
2017-01-31 14:47:11 +01:00
wm4 c178920505 demux_mkv: any reference makes a frame not a keyframe
Fixes seeking with:

https://bugs.chromium.org/p/chromium/issues/detail?id=497889

Haali also ignores the element's contents, and interprets its presence
as the block not being a keyframe. FFmpeg is going to have an equivalent
change.

I don't know yet whether the affected sample is valid - a reference
timestamp of 0 doesn't make too much sense to me.
2017-01-31 12:44:49 +01:00
wm4 07494aab16 command: nicer OSd-formatting for loop-file 2017-01-31 11:47:28 +01:00
wm4 9a464f53ef input.conf: change "L" to change loop-file by default 2017-01-31 11:46:43 +01:00
Ricardo Constantino e017c24174
ytdl_hook: refactor edl track joining
Only used once for now.

Also, support switched format strings, like bestaudio+bestvideo.
2017-01-30 16:21:44 +00:00
Ricardo Constantino 6dafc85187
ytdl_hook: respect --no-audio, don't force-select track 2017-01-30 15:01:07 +00:00
wm4 dccb752b5f build: fix --disable-gl if cuda is enabled
video/out/opengl/hwdec_cuda.c is enabled with cuda-hwaccel. But it makes
only sense to build if GL is enabled, and in fact it fails to link
without GL as it calls a specific GL helper function.

In theory it would be perfectly possible to use cuda-copy with GL
disabled. But I'm not bothering with the complexity.
2017-01-30 09:34:10 +01:00
Akemi 954625c165 cocoa: fix unwanted behavior with window level other than the default
setting a window level other than NSNormalWindowLevel always sets
NSWindowCollectionBehaviorTransient, which prevents certain things to
work properly. examples are automatic switching to the active Space when
mpv is made active and (de-)miniaturizing. latter always lead to a
vanishing window.

Fixes #1757 #1884
2017-01-29 19:46:53 +01:00
James Ross-Gowan bed94df521 vo_opengl: dxinterop: use the new SAFE_RELEASE macro 2017-01-30 00:22:30 +11:00
James Ross-Gowan 9692814502 win32: add COM-specific SAFE_RELEASE to windows_utils.h
See: https://msdn.microsoft.com/en-us/library/windows/desktop/dd743946.aspx

Microsoft example code often uses a SAFE_RELEASE macro like the one in
the above link. This makes it easier to avoid errors when releasing COM
interfaces. It also reduces noise in COM-heavy code.

ao_wasapi.h also had a macro called SAFE_RELEASE, though unlike the
version above, its SAFE_RELEASE macro accepted a second parameter which
allowed it to destroy arbitrary objects other than just COM interfaces.
This renames ao_wasapi's SAFE_RELEASE to SAFE_DESTROY, which should more
accurately reflect what it does and prevent confusion with the Microsoft
version.
2017-01-30 00:22:30 +11:00
wm4 a6d29494ca player: print hw format on "VO: " line too
Useful for distinguishing bit depth when hardware decoding. (To the
degree it's useful to show it at all. This just brings the hardware
decoding case on the same level of showing information as the software
decode call.)
2017-01-29 12:53:58 +01:00
Ricardo Constantino 2a7d2d1bc9
ytdl_hook: fix opening hitbox.tv rtmp stream
Worked with librtmp, but ffrtmp needs to set rtmp_swfurl in addition
to rtmp_swfverify, even if they're the same value.
2017-01-29 01:45:13 +00:00
wm4 0aac7533dc vaapi: improve a comment
Try to actually explain what's up with this code.
2017-01-28 18:36:00 +01:00
wm4 443d3a91d3 vaapi: remove central lock around vaapi API calls
The lock was disabled recently. This commit gets rid of the dummied out
calls. The main reason for removing it is that there is no apparent need
for it anymore, and the new FFmpeg vaapi code does not use or provide
such a lock (there are some places which we cannot control and which do
vaapi API calls, like frame destructors).
2017-01-28 18:27:30 +01:00
kwkam d9ef1333c6 waftools/checks/generic: hacks for linking against static/shared libs
When mpv is being linked against static libraries which have shared
libraries as dependencies, linker will throw error because pkg-config
with --static flag will return shared libraries which will be placed
under the -Wl,-Bstatic section, while pkg-config without --static flag
will omit the private libraries required to link the static library.

With this function users can modify the wscript to insert the dependencies
when necessary. For example, linking FFmpeg with shared OpenSSL and zlib:
'func': check_pkg_config_mixed(['crypto','ssl','z'], 'libavcodec')
2017-01-28 14:02:36 +01:00
kwkam d41f25009d wscript: add LIBRARY_PATH for library detection
MinGW GCC seems to ignore LIBRARY_PATH which causes problem
when some libraries not using pkg-config were installed to
local directory
2017-01-28 14:02:34 +01:00
Ilya Tumaykin ea40fa36ee build: rpi: rely on pkgconfig for compiler flags
Upstream provides pkgconfig files for quite some time now [1,2].
Use them to determine the required flags instead of hard coding.

This makes cross-compilation easy, which I dare to say is important for
many raspberry-pi users. This also prevents picking libEGL and libGLESv2
from mesa when they are present, which can happen with the current code.

Good distros should put these pkgconfig files into default pkg-config
search path or populate PKG_CONFIG_PATH for users. However, be nice to
everybody and manually look into '/opt/vc/lib/pkgconfig' just in case.
Hence the PKG_CONFIG_PATH mangling.

[1]: https://github.com/raspberrypi/userland/issues/245
[2]: 05d60a01d5
2017-01-28 14:02:22 +01:00
pavelxdd 9c90c902c1 win32: snap to screen edges
Disabled by default. The snap sensitivity value depends on
the screen DPI. The default value is 16px on a 96 DPI screen.

Fixes #2248
2017-01-27 12:00:32 +01:00
wm4 cfda696580 build: explicitly check for FFmpeg vs. Libav, and their exact versions
In a first pass, we check whether libavcodec is present.

Then we try to compile a snippet and check for FFmpeg vs. Libav. (This
could probably also be done by somehow checking the pkgconfig version.
But pkg-config can't deal with that idiotic FFmpeg idea that a micro
version number >= 100 identifies FFmpeg vs. Libav.)

After that we check the project-specific version numbers. This means it
can no longer happen that we accidentally allow older, unsupported
versions of FFmpeg, just because the Libav version numbers are somehow
this way.

Also drop the resampler checks. We hardcode which resampler to each with
each project. A user can no longer force use of libavresample with
FFmpeg.
2017-01-27 09:57:01 +01:00
wm4 a9e0f4b279 wscript: merge libavfilter check into the main ffmpeg check
It used to be optional. That's why it was separate. No need for that
anymore.
2017-01-27 09:22:52 +01:00
wm4 c3205d294e atomic: drop __sync builtins
The correctness of the stdatomic.h emulation via the __sync builtins is
questionable, and we've been relying on exact stdatomic semantics for a
while, so just get rid of it. Compilers which support __sync but not
stdatomic.h will use to the slow mutex fallback.

Not sure about the __atomic builtins. It doesn't seem to harm either, so
leave it for now.
2017-01-27 09:15:32 +01:00
wm4 70411f2709 stream: minor cleanup to previous commit
This is almost cosmetic, but removes the duplicated EOF-setting.

Somewhat oddly, this will enter the reconnect path and exit it
immediately again - should be fine.
2017-01-27 09:03:14 +01:00
wm4 4e53f9e5b2 stream: set EOF if stream is canceled
Commit 7be495b3 added the cancellation test, but forgot to set the eof
flag. This could lead to demux_mkv.c not terminating if the stream was
cancelled in some code paths.

This function is what is supposed to set the EOF flag in the first
place, so just add the missing code.
2017-01-26 18:27:30 +01:00
wm4 abc6d130ac command: shorten long playlists on OSD
A hacky, convoluted, half-working mess that attempts to cut off overlong
playlists.

It does so by relying on the ASS formatting rule that the font size is
specified in the virtual PlayResY resolution. This means we can
(normally) easily tell how many lines fit on the screen. On the other
hand, this does not work if the text is wrapped.

This as a kludge until a Better™ solution is available.
2017-01-26 18:24:53 +01:00
wm4 60452f640f osd: move some internal declarations to internal headers 2017-01-26 16:34:31 +01:00
wm4 753dbea83f vd_lavc: allocate 8 ref frames for VP9
Apparently this is the maximum that can be preserved. There is also
something about the decoder being able only to use 3 frames at a time,
and I'm assuming these are part of the 8 frames.
2017-01-26 11:37:47 +01:00
wm4 9980b11058 vo_opengl: egl_helpers: fix variable name
It was basically inverted. Not sure how this even happened. Hopefully
it's more an "I don't know what I was doing" instead of an "I don't know
what I am doing" case.
2017-01-26 11:33:58 +01:00
wm4 bdbb3142ec client API: adjust opengl_cb hardware decoding comments
Replace the reprecated --hwdec-preload option.

Add a comment about cuvid/cuda decoding.
2017-01-26 11:32:09 +01:00
Ricardo Constantino d303ebd9b6
stream_lavf: add support for data URIs
Only FFmpeg supports them and they need to be in the format data://
like other protocols or prefixed with ffmpeg:// or lavf://.

Closes #4058
2017-01-25 15:40:56 +00:00
wm4 39adaf3dcc vf_lavfi: don't crash with VOs without hardware decoding support
When playing with VOs which do not provide mp_hwdec_ctx, vf->hwdec_devs
will remain NULL. This would make it crash on hwdec_devices_get_first(),
even if no hardware decoding or filters using hardware decoding were
involved.

Fixes #4064.
2017-01-25 08:32:35 +01:00
wm4 04376fa024 ad_lavc, vd_lavc: preserve codec_id/codec_type when setting params
avcodec_parameters_to_context() overwrites codec_type and codec_id. But
we already set these by passing the selected AVCodec to
avcodec_alloc_context3(). It's entirely possible that at least codec_id
is different when forcing codecs with --ad/--vd. It's probably better
not to cause confusion by overwriting them. It might even trigger
undefined behavior in libavcodec (how it behaves or whether codec_id is
supposed to be strictly set is unknown, though).
2017-01-25 08:30:14 +01:00
wm4 801fa486b0 ad_lavc, vd_lavc: move mpv->lavc decoder parameter setup to common code
This can be useful in other contexts.

Note that we end up setting AVCodecContext.width/height instead of
coded_width/coded_height now. AVCodecParameters can't set coded_width,
but this is probably more correct anyway.
2017-01-25 08:24:19 +01:00
octos ce803da90d manpage: add "A/V sync" to make it findable with Ctrl+f 2017-01-25 07:59:47 +01:00
Roland Hieber 194b26536b osc: fix crashes related to field eventresponder being nil
I'm still getting some crashes after issue #3210 was fixed in commit
5beb230690. It's hard to reproduce those
crashes, they happen maybe once a month, so I guess it could be a race
condition. But in any case, I don't see anything wrong in applying some
defensive programming here.

For reference, here is what was happening on 0.23.0-1 from Debian
testing:

  Playing: ytdl://usL5CeP_row
   (+) Video --vid=1 (*) (h264)
    (+) Audio --aid=1 --alang=und (*) (aac)
    [osc]
    [osc] stack traceback:
    [osc]	  @osc.lua:2074: in function 'process_event'
    [osc]	  @osc.lua:2246: in function 'cb'
    [osc]	  mp.defaults:107: in function 'fn'
    [osc]	  mp.defaults:60: in function 'handler'
    [osc]	  mp.defaults:339: in function 'handler'
    [osc]	  mp.defaults:448: in function 'call_event_handlers'
    [osc]	  mp.defaults:485: in function 'dispatch_events'
    [osc]	  mp.defaults:441: in function <mp.defaults:440>
    [osc]	  [C]: in ?
    [osc]	  [C]: in ?
    [osc] Lua error: @osc.lua:2074: attempt to index field 'eventresponder' (a nil value)

Note that the location is different from where issue #3210 happens.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
2017-01-25 07:58:45 +01:00
wm4 3b0e886193 command: fix potential crash for script-binding with multi-commands
"show-text test; script-binding display_stats" can potentially crash. It
sends a message event. None of the string arguments can be NULL, which
fails if cmd->key_name is NULL. This in turn can be due to commands
combined with ";" (basically the key association doesn't consider nested
commands).
2017-01-24 12:39:39 +01:00
wm4 63b34143a5 cue: accept lower-case cue commands
Some files appear to use them. In the sample I've seen, one field was
"Performer" instead of "PERFORMER".

This change is slightly risky, because it increases the chance of
misdetecting other formats as cue files.

Fixes #4057.
2017-01-24 08:57:51 +01:00
wm4 7be495b369 stream: check for playback aborts on reading too
Benefits demux_mkv.c, or demux_lavf.c during probing. In particular
demux_lavf.c can sometimes get "stuck" when reading from a slow/blocking
source, and if probing needs more than a few iterations.

Since this is a read of an atomic variable with relaxed semantics, this
should have no impact on reading speed at all, not even theoretically.
2017-01-24 08:46:17 +01:00
wm4 f762fc4230 av_common: remove old/unused timestamp passthrough code
This attempted to pass through double float timestamps in a bit exact
way by reinterpret casting them to int64_t. This usually worked, because
libavcodec (in decoding mode) is mostly not allowed to interpret
timestamps. libavcodec doesn't even know the unit of the timestamps,
unless the API user sets a timebase.

We've stopped doing this, and always set a timebase. Only ad_spdif.c
still used this (indirectly through mp_set_av_packet()), but doesn't
actually need timestamps on the packet. In fact, it's already explicitly
setting the packet timestamp fields to 0 before passing it to FFmpeg
API.

This code is unused, and the passthrough method wasn't terribly elegant
to begin with. Drop this code. Arbitrarily use AV_TIME_BASE_Q as
fallback in situations the passthrough was used.
2017-01-24 08:36:40 +01:00
wm4 d16ba1f7f6 build: new vaapi hwaccel API does not use av_image_copy_uc_from()
Not even Libav does. Whoops. The developer who wrote the FFmpeg code for
this said he could not find any improvements when using the "GPU memcpy"
; instead, it made it actually slower on some hardware.

It's not clear to what extent the "GPU memcpy" was needed for vaapi, but
hopefully not very much (see #2317).

This commit enables use of the new vaapi API by default with FFmpeg.
2017-01-24 08:22:10 +01:00
wm4 c06fd19d8f av_common: drop unused function
Unused since the AVCodecParameters change.
2017-01-24 08:15:38 +01:00
wm4 b14fac9afa build: replace some FFmpeg API checks with version checks
The FFmpeg versions we support all have the APIs we were checking for.
Only Libav missed them. Simplify this by explicitly checking for FFmpeg
in the code, instead of trying to detect the presence of the API.
2017-01-24 08:11:42 +01:00
wm4 6be58df8d1 ad_lavc: respect AV_FRAME_FLAG_DISCARD
Since we set "skip_manual", we can actually get frames with this set.
Currently, only AV_PKT_FLAG_DISCARD will trigger this flag, and only
mov.c sets the latter flags, so this is related to FFmpeg's half-broken
mp4 edit list support.
2017-01-24 08:04:53 +01:00
wm4 00eadcec8d sub: add option to force using video resolution for image subtitles
Basically for debugging and dealing with broken files.
2017-01-23 15:55:09 +01:00
wm4 3e89e061c2 sd_lavc: remove old broken heuristic
This core of this heuristic was once copied from MPlayer's spudec.c. I
think it was meant for the case when the resolution field was missing or
so.

I couldn't find a file for which this actually does something. On the
other hand, there are samples which actually have a smaller resolution
than 720x576, and which are broken by this old hack.

For subtitles that set no resolution (I'm not sure which codec/container
that would be), there's still the fallback on video resolution.

Just get rid of this hack. Also cleanup a bit. SD_CTRL_GET_RESOLUTION
hasn't been used since DVD menu removal. get_resolution() is left with 1
call site, and would be quite awkward to keep, so un-inline it.
2017-01-23 15:28:12 +01:00
wm4 5c942128d8 player: actually initialize/destroy MPContext.lock
Seems like quite on oversight.

For most of the better pthread implementations, pthread_mutex_init() on
an already 0-initialized memory block is probably a no-op, but of course
we should do things correctly. Also could setup analysis tools.
2017-01-22 15:24:13 +01:00
wm4 06c55ac6c3 charset_conv: fallback to interpreting subs as latin1 if iconv fails
For display purposes, it's better to show scrambled text - at least
that's a more actionable failure mode than spamming the terminal with
FFmpeg nonsense error messages.

This avoids the obnoxious and pointless

  "Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option"

FFmpeg error, which will be spammed on every single subtitle event. We
don't even have a -sub-charenc option, fuck FFmpeg.

Did I mention fuck FFmpeg yet? Because fuck FFmpeg.
2017-01-22 13:10:16 +01:00
wm4 310671e91a charset_conv: support minimum compatibility to utf8:... syntax
Because it's the most commonly used one, and trivial to support.
2017-01-22 13:06:36 +01:00
wm4 73858bb0cc player: remove --stream-capture option/property
This was excessively useless, and I want my time back that was needed to
explain users why they don't want to use it.

It captured the byte stream only, and even for types of streams it was
designed for (like transport streams), it was rather questionable.

As part of the removal, un-inline demux_run_on_thread() (which has only
1 call-site now), and sort of reimplement --stream-dump to write the
data directly instead of using the removed capture code.

(--stream-dump is also very useless, and I struggled coming up with an
explanation for it in the manpage.)
2017-01-21 17:19:01 +01:00
wm4 085dfdea32 command: rename framedrop properties
"drop-frame-count" -> "decoder-frame-drop-count"
"vo-drop-frame-count" -> "frame-drop-count"

This gets rid of the backwards "drop-frame" part in the name.

Maybe calling the new property "frame-drops" would be better, but there
are already a bunch of similar properties that end in "-count".
2017-01-20 17:01:29 +01:00
wm4 fd203ff16a options: refacactor how --opengl-dwmflush is declared
Same deal as previous commit, except this time we just readd it as lone
global option, and read it directly.
2017-01-20 14:03:34 +01:00