Commit Graph

40313 Commits

Author SHA1 Message Date
wm4 1883b7cc0c player: add --autofit-smaller option
Fixes #1472.

(Maybe these options should have been named --autofit-max and
--autofit-min, but since --autofit-larger already exists, use
--autofit-smaller for symmetry.)
2015-01-16 22:30:41 +01:00
wm4 c8052da7de demux: return EOF when reading from unselected stream
Normally the player doesn't read from unselected streams, so this should
be a no-op. But unfortunately, some broken files can severely confuse
the player, and assign the same demuxer stream to multiple front-end
tracks. Then selecting one of the tracks would deselect the other track,
with the end result that the demuxer stream for the selected track is
deselected. This could happen with mkv files that use the same track
number (which is of course broken). timeline_set_part() sets the tracks
using demuxer_stream_by_demuxer_id(), using the broken non-unique IDs.

The observable effect was that the player never quit, because
demux_read_packet_async() told the caller to wait some longer for new
packets. Fix by returning EOF instead.

Fixes #1481.
2015-01-16 20:22:43 +01:00
wm4 280f123f35 player: don't enable demuxer readahead before selecting tracks
This is for the ordered chapters case only. In theory this could have
resulted in initial audio, video or subs missing, although it didn't
happen in practice (because no streams were selected, thus the demuxer
thread didn't actually try to read anything). It's still better to make
this explicit.

Also, timeline_set_part() can be private to loadfile.c.
2015-01-16 20:22:43 +01:00
Stefano Pigozzi 730db25b1b cocoa: don't set application icon in libmpv 2015-01-16 19:24:25 +01:00
wm4 918b06c42c player: respect --untimed on last frame
The last video frame is another case that has a separate code path,
although it's pretty similar to the one in commit 73e5aa87. Fix this
in a different way, which also takes care of the last frame case,
although without context the code becomes slightly more tricky.

As further cleanup, move the decision about framedropping itself to
the same place, so the check in vo.c becomes much simpler. The check
for the vo->driver->encode flag, which is remvoed completely, was
redundant too.

Fixes #1480.
2015-01-16 13:57:33 +01:00
James Ross-Gowan 42fa954849 subprocess-win: Always quote argv[0]
If the program name isn't quoted and the .exe it refers to isn't found,
CreateProcess will add the program arguments to the program name and
continue searching, so for "program arg1 arg2", CreateProcess would try
"program.exe", "program arg1.exe", then "program arg1 arg2.exe". This
behaviour is weird and not really desirable, so prevent it by always
quoting the program name.

When quoting argv[0], escape sequences shouldn't be used. msvcrt, .NET
and CommandLineToArgvW all treat argv[0] literally and end it on the
trailing quote, without processing escape sequences.
2015-01-16 22:39:55 +11:00
wm4 0092ae8676 manpage: fix osd-ass-cc examples
The "\\" escape was rendered as "\" on the website. I'm hoping quoting
this in ``...`` will render it correctly.

Also add an example for show_text, which awkwardly does not require
escaping the "\".
2015-01-16 12:17:55 +01:00
wm4 73e5aa87d1 player: respect --untimed on video format changes
If the video format changes (e.g. different frame size), a special code
path is entered to wait until the currently displayed frame is done.
Otherwise, the frame before the change would be destroyed by the
vo_reconfig() call.

This code path didn't respect --untimed; correct this.

Fixes #1475.
2015-01-16 12:03:04 +01:00
James Ross-Gowan e93c62520e win32: make sure __STRICT_ANSI__ is not defined
__STRICT_ANSI__ disables functions and definitions that aren't in ANSI
C. Unfortunately this includes j1(), which is used by the new
ewa_lanczos code. Cygwin's CFLAGS already unset __STRICT_ANSI__, but it
should be unset for both Cygwin and MinGW.
2015-01-16 21:34:46 +11:00
ChrisK2 1558938f87 ytdl_hook: Check for empty playlists
Sometimes we get empty playlists back, print a warning message
instead of crash
2015-01-16 06:59:16 +01:00
ChrisK2 70f43db95b OSC: Reset all styles for idle message 2015-01-16 06:40:32 +01:00
Niklas Haas 61f5a80f10
vo_opengl: get rid of approx-gamma and make it the default as per BT.1886
After finding out more about how video mastering is done in the real
world it dawned upon me why the "hack" we figured out in #534 looks so
much better.

Since mastering studios have historically been using only CRTs, the
practice adopted for backwards compatibility was to simulate CRT
responses even on modern digital monitors, a practice so ubiquitous that
the ITU-R formalized it in R-Rec BT.1886 to be precisely gamma 2.40.

As such, we finally have enough proof to get rid of the option
altogether and just always do that.

The value 1.961 is a rounded version of my experimentally obtained
approximation of the BT.709 curve, which resulted in a value of around
1.9610336. This is the closest average match to the source brightness
while preserving the nonlinear response of the BT.1886 ideal monitor.

For playback in dark environments, it's expected that the gamma shift
should be reproduced by a user controlled setting, up to a maximum of
1.224 (2.4/1.961) for a pitch black environment.

More information:
https://developer.apple.com/library/mac/technotes/tn2257/_index.html
2015-01-16 02:17:19 +01:00
wm4 4e419b2b7b player: don't fall asleep on audio decoding errors
This makes it retry later.

Fixes #1474.
2015-01-15 21:57:09 +01:00
Niklas Haas 7aaf71861e
manpage: changes.rst: document vo_opengl's placebo features 2015-01-15 21:32:19 +01:00
Niklas Haas 26baf5b9da
vo_opengl: add ewa_lanczos upscaler (aka jinc)
This is the polar (elliptic weighted average) version of lanczos.
This introduces a general new form of polar filters.
2015-01-15 21:20:27 +01:00
wm4 93e0d6f3b3 player: fix --stop-playback-on-init-failure on audio init failure
This was forgotten when the option was implemented, and makes this
option work as advertised.

Fixes #1473 (though the default behavior is probably still stupid).
2015-01-15 20:13:15 +01:00
wm4 ae641d200a af: remove old filter compatibility hack 2015-01-15 20:13:15 +01:00
wm4 388cf6dc96 audio/filter: switch remaining filters to refcounting
All of these filters are very similar in frame management, and copy data
to a new frame during filtering.
2015-01-15 20:13:14 +01:00
wm4 87fe7d8788 audio/filter: switch remaining in-place filters to refcounting
Adds about 7 lines of boilerplate per filter. This could be avoided by
providing a different entrypoint (something like af->filter_inplace),
which would basically mirror the old interface exactly for this kind of
filter. But I feel like it would just be a hack to support all those
old, useless filters better. (The ideal solution would be using a
language that can do closures to provide a compat. wrapper, but
whatever.)

af_bs2b has terribly repetitious code for setting up filter functions
for each format (most of them useless, in addition to bs2b being
useless), so I did something terrible with macros.

af_sinesuppress had commented code for float filtering (maybe it was
broken; it has been commented every since it was added in 2006). Remove
this code.
2015-01-15 20:13:12 +01:00
wm4 ba0e8b754c af: verify filter input formats
Just to make sure all filters get the correct format. Together wih the
check in af_add_output_frame(), this asserts that

    af->prev->fmt_out == af->fmt_in

This also requires setting the "in" pseudo-filter (s->first) formats
correctly. Before this commit, the fmt_in/fmt_out fields weren't used
for this filter.
2015-01-15 20:10:46 +01:00
wm4 66c8a87485 vo_opengl_cb: initial screenshot support
Support for taking screenshots when doing hardware decoding needs to be
added later.

This takes the last image queued to the VO, which is logically the image
the player thinks is on screen (so e.g. subtitles will match).

forget_frames() does not clear this, because seeking does not remove the
current image from the screen (until the next one is drawn).
2015-01-15 20:10:11 +01:00
wm4 c118d8f6cc image_writer: check for conversion errors
This can happen when e.g. a VO returns a screenshot in an unsupported
format.
2015-01-15 20:10:08 +01:00
wm4 a6997be61b osc: fix disabling OSC
Upon the "DEL" key binding or the "disable-osc" message, the OSC should
stay permanently invisible. This was recently broken (not sure by what),
because other code accidentally reenables it anyway, which resulted in
the OSC appearing again when moving the mouse.
2015-01-15 20:09:32 +01:00
wm4 c88b535c46 DOCS/client_api_examples: fix locale nonsense in qml examples
The Qt example already does this. I hoped this was restricted to
QApplication only, but apparently Qt repeated this mistake with
QGuiApplication (QGuiApplication was specifically added for QtQuick at a
much later point, even though QApplication inherits from it).
2015-01-15 20:08:57 +01:00
wm4 c757a06845 ao_alsa: fix a small memory leak 2015-01-14 22:16:36 +01:00
wm4 e865d255d0 af_lavcac3enc: use refcounted frames 2015-01-14 22:16:30 +01:00
wm4 5d972491bb af_lavfi: use refcounted frames 2015-01-14 22:15:56 +01:00
wm4 9c974b2a1b audio/filter: actually set fmt_in/fmt_out fields 2015-01-14 22:15:51 +01:00
wm4 f6a0a1554c af_scaletempo: use refcounted frames 2015-01-14 22:15:39 +01:00
wm4 218c749a16 af_lavrresample: use refcounted frames 2015-01-14 22:15:31 +01:00
wm4 7b8862760d audio: add missing declaration 2015-01-14 22:15:00 +01:00
wm4 c8ecb66269 ao_pcm: add append mode
Pretty useful for debugging, although a bit useless or possibly
misleading too (see comments in the manpage).
2015-01-14 22:14:56 +01:00
wm4 4cabd08e8a audio: fix initial audio PTS
Commit 5e25a3d2 broke handling of the initial frame (the one decoded
with initial_audio_decode()). It didn't update the pts_offset field,
leading to a shift in timestamps by one audio frame.

Fix by calling the actual decode function in a single place. This
requires slightly more changes than what would be necessary to fix the
bug, but it also somewhat simplifies the data flow.
2015-01-14 22:14:46 +01:00
wm4 1a522f2976 player: fallback to seek time for percent-pos property
The percent-pos property normally goes by time, except for file formats
like .ts or .ogg, where you can't trust the timestamps and duration info
to compute the position in the overall files. These use the byte
position and size instead.

When the file position was unavailable (e.g. due to an ongoing seek),
the percent-pos was unknown. Change it to use the time position instead.
In most cases, it's actually accurate enough, and the temporary
unavailability of the property can be annoying, e.g. on the terminal
status line.
2015-01-14 22:14:20 +01:00
wm4 3cb2add636 audio: fix assertion failure on audio decoding
There are several cases in which a decoder may need several packets to
produce some output audio. Commit 5e25a3d2 broke this.

Fixes #1471.
2015-01-14 07:58:01 +01:00
wm4 ecca64e182 af_convert24: use refcounted frames
This requires allocating a fully new frame. 32->24 could be in-place,
but this is not possible for 24->32.
2015-01-13 20:17:08 +01:00
wm4 983f5efa3c audio/filters: use refcounted frames for some in-place filters
These are also quite simple, but require requesting write access to the
frames. The error handling (for OOM) is a bit annoying.
2015-01-13 20:17:03 +01:00
wm4 1fde40732e audio/filters: use refcounted frames for some simple filters
These are read-only, and very trivial to convert.
2015-01-13 20:16:59 +01:00
wm4 772c42a95c af_volume: use refcounted frames 2015-01-13 20:15:53 +01:00
wm4 5e25a3d216 audio: use refcounted frames in the filter chain
The goal is switching the whole audio chain to using refcounted frames.
This brings the architecture closer to FFmpeg, enables better
integration with libavfilter, will reduce useless copying somewhat, and
will probably allow better timestamp tracking.

For now, every filter goes through a semi-awful wrapper in
af_do_filter(), though. This will be fixed step by step, and the wrapper
should eventually be removed. Another thing that will have to be done is
improving the timestamp handling and avoiding extra copies for the AO.

Some of the new code is rather similar to the video filter code (the
core filter code basically just has types replaced). Such code
duplication is normally very unwanted, but in this case there's probably
no other choice. On the other hand, this code is pretty simple (even if
somewhat tricky). Maybe there will be unified filter code in the future,
but this is still far away.
2015-01-13 20:15:43 +01:00
wm4 97becbc31b audio: add some utility functions for refcounted frames
Used in the following commits.
2015-01-13 20:14:25 +01:00
wm4 0bbd65b09c audio/filter: remove unused af_calc_filter_multiplier()
The purpose of this function was to filter only as much audio input as
needed to produce a certain amount of audio output. This could (in
theory) avoid excessive buffering when e.g. changing playback speed with
resampling.

Use of this was already removed in commit 5fd8a1e0. No problems were
experienced, so let's assume this feature is practically worthless.
(Though it's possible that it was quite useful over a decade ago, or in
some cornercases with evil files.)
2015-01-13 20:14:02 +01:00
wm4 9418f88475 client API: fix log buffer overflow case
It just crashed. The prefix and text fields point to static strings in
this case. Oops.

Fixes the issue mentioned in #838.
2015-01-13 19:33:16 +01:00
wm4 53a5923ba1 manpage: fix references to vf_pp
It was removed, but is still available through FFmpeg.

Fixes #1468.
2015-01-13 16:54:59 +01:00
wm4 206cfd964c vf: make message less confusing
Well, probably still not very good, but now at least accounts for the
case the decoder or a filter outputs nonsense values.
2015-01-13 14:40:37 +01:00
wm4 77b488b4a2 mp_image: reject invalid display aspect ratio
Having any of these set to 0 makes no sense.

I think some code might still be using 0/0 aspect ratio to signal unset
aspect ratio, but I didn't find it. If there is still code like this, it
should be fixed instead.

Fixes #1467.
2015-01-13 14:26:25 +01:00
wm4 b2cc0fb1ae player: fix crash wtih --secondary-sid
Fises #1463.
2015-01-13 02:45:51 +01:00
Oliver Freyermuth 794804725d cache: cache-position needs to be int64_t
Both max_filepos and offset are int64_t,
so pos can overflow, e.g. causing endless loops
in stream implementation.
2015-01-13 02:39:16 +01:00
Oliver Freyermuth 3d1b9ba4bd stream_dvb: Add MP_ERR if polling worked, but read fails.
Read can still fail, e.g. if the buffer is invalid.
2015-01-13 02:37:12 +01:00
wm4 460ef9c7a4 wayland: implement key modifiers
Includes shift, ctrl, alt, meta.
2015-01-12 16:41:00 +01:00