1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00
Commit Graph

42784 Commits

Author SHA1 Message Date
kwkam
3314483a02 common/common.c: handle utf16 in mp_parse_escape
Signed-off-by: wm4 <wm4@nowhere>
2016-02-06 22:54:49 +01:00
wm4
563b4785da lavfi: fix EOF case
This was dumb. Could make it burn 100% CPU and not exit at the end.
(Because it would retry as instructed, instead of terminating playback.)

It also needs to consider EOF as waiting for input. lavfi_process() will
decide if it's really EOF, or if further input might come in the future.
Without this, it'd would think that it does not need to wait for input,
i.e. that new input will be available immediately.

(Not so fond of the duplication of subtle logic.)
2016-02-06 19:13:32 +01:00
wm4
a0d3ce4819 audio: fix EOF handling if nothing could be decoded at all
The code for decoding the initial frame has to handle this explicitly.
2016-02-06 18:33:31 +01:00
Kevin Mitchell
fb5f732798 vd_lavc: fix use after free in some hwdecs
fd339e3f53 introduced a regression that caused
segfault while uniniting dxva2 decoder (and possibly vdpau too). The problem was
that it freed the avctx earlier, before calling the backend-specific uninit
which referenced it.

Revert some of the changes of that commit, and avoid calling flush by
checking whether the codec is open instead.

(Based on a PR by Kevin Mitchell.)

Signed-off-by: wm4 <wm4@nowhere>
2016-02-06 14:24:25 +01:00
wm4
bb6ae0e50b audio: minor simplification
These fields are already deallocated by uninit_decoder(). Also remove
the wrong/useless log message.
2016-02-05 23:43:25 +01:00
wm4
ffb1d7807e player: remove some further current_track dependencies
Now it's used for initialization only for audio and video.
2016-02-05 23:41:44 +01:00
wm4
1661ba09eb lavfi: fix build on Libav
It doesn't provide this function. The code is not really designed to
work without it, so it will probably mess up big time, but at least
make it compile again.
2016-02-05 23:37:59 +01:00
wm4
c0de087ba1 player: add complex filter graph support
See --lavfi-complex option.

This is still quite rough. There's no support for dynamic configuration
of any kind. There are probably corner cases where playback might freeze
or burn 100% CPU (due to dataflow problems when interaction with
libavfilter).

Future possible plans might include:
- freely switch tracks by providing some sort of default track graph
  label
- automatically enabling audio visualization
- automatically mix audio or stack video when multiple tracks are
  selected at once (similar to how multiple sub tracks can be selected)
2016-02-05 23:19:56 +01:00
wm4
45345d9c41 build: make libavfilter mandatory
The complex filter support that will be added makes much more complex
use of libavfilter, and I'm not going to bother with adding hacks to
keep libavfilter optional.
2016-02-05 23:17:33 +01:00
wm4
8af70561a4 player: move audio and video decoder init to separate functions
Preparation.
2016-02-05 23:17:27 +01:00
wm4
242dbc6c2c player: simplify error_on_track()
track can't be NLUL at this point, so the if is redundant. Remove it and
unindent the block. Also, make the function check whether the track is
selected at all, which makes it safer and idempotent.
2016-02-05 23:17:27 +01:00
wm4
1aa2ae5404 options: set fs=yes by default on RPI, and change RPI defaults handling
The main reason for changing the fullscreen default is that not doing it
would change the vo_rpi default behavior with the previous commit.
2016-02-05 18:05:38 +01:00
Uros Vampl
2b58738545 vo_rpi: add geometry handling
This makes it possible to set video size and position using the
--geometry and/or --autofit options. It's also possible to switch
between fullscreen/non-fullscreen playback during runtime.
2016-02-05 17:49:43 +01:00
wm4
fd339e3f53 vd_lavc: avoid calling flush on an unopened AVCodecContext
It can be "dangerous". In particular, the decoder might have failed to
initialize, and is now in a broken state. avcodec_flush_buffers() is not
expected to be called in this state, and could trigger undefined
behavior.
2016-02-05 17:46:46 +01:00
wm4
b4f63cbbec input: ignore --input-cursor for events injected by input commands
Apparently useful for window embedding.

Fixes #2750.
2016-02-04 23:01:15 +01:00
wm4
155f7fac9d sub: implement "sub-seek 0"
For bitmap subs, implement it properly. For libass, you need newest git
master.

Fixes #2791.
2016-02-04 22:48:13 +01:00
wm4
6cbd7d6390 video: remove AVI timestamps for dropped frames
Might possible improve A/V sync, although this is at best approximate.
(AVI is just fucked.)
2016-02-04 21:31:15 +01:00
wm4
363a225364 ao_coreaudio: fix 7.1(rear) channel mapping
I can't explain this, but it seems to be a similar case to the ALSA HDMI
one. I find it hard to tell because of the slightly different names and
conventions in use in libavcodec, WAVEEXT channel masks, decoders, codec
specifications, HDMI, and platform audio APIs.

The fix is the same as the one for ao_alsa (see commit be49da72). This
should fix at least playing 7.1 sources on OSX with 7.1(rear) selected
in Audio MIDI Setup. The ao_alsa commit mentions XBMC, but I couldn't
find out where it does that or if it also does that for CoreAudio. It's
woth noting that PHT (essentially an old XBMC fork) also exhibited the
incorrect behavior (i.e. side and back speakers were swapped).
2016-02-04 12:29:32 +01:00
wm4
54d0f5bc9a af_lavrresample: change fudged channels
Remove flc-frc <-> sl<->sr. This was just plain wrong, and a mistaken
change to make 7.1 work properly on CoreAudio with 7.1(rear) layout.
Also see the following commit.

Add br-br <-> sl<->sr, because we decided that it makes sense.

Note that this "fudging" is applied only if the channel pairs are
replaced, i.e. they would get dropped and be replaced with silence. This
is done to compensate for libswresample's default rematrixing (which
takes care of some more common cases).
2016-02-04 12:28:54 +01:00
wm4
a38f313bcc vd_lavc: remove redundant best_csp field
And some other simplifications.
2016-02-03 21:31:53 +01:00
wm4
1b6a191ea3 vd_lavc: force microsecond timestamps on RPI
Avoids "problems". In particular, it makes MMAL output a NOPTS timestamp
if the input timestamp was NOPTS.

Don't do it for other decoders. Ideally, we will at some point in the
future switch to integer fractions for timestamps at least up until the
filter layer. But this would be a larger change, and for now I'd prefer
keeping the not-rounded demuxer timestamps (if we have them).
2016-02-03 21:29:56 +01:00
wm4
35bdb63952 command: fix track cycling logic
Also remove the unused function argument.

Fixes #2784.
2016-02-03 09:05:05 +01:00
wm4
5d94977477 command: show original aspect in video-aspect property too
Basically, just make it append " (original)" if the original aspect
ratio is selected.
2016-02-02 22:12:24 +01:00
wm4
04783e11c9 w32_common: switch to UniformResourceLocatorW
This is the "unicode" version of it. It appears Firefox uses it now?
I'm not sure if we still need to support the old variant, but hopefully
not.

Fixes #2782.
2016-02-02 21:51:50 +01:00
Alexis Nootens
8996f79edb TOOLS/lua/autoload.lua: remove the extension prior to sort
When the directory contains files named such as xx-14.ext and
xx-14.5.ext, remove the extension to sort the table to load the
14 before the 14.5.
2016-02-02 19:58:51 +01:00
Stefano Pigozzi
b7e613f261 build: add special openbsd case for iconv check
Fixes #2710
2016-02-01 23:04:23 +01:00
wm4
a080432992 player: refactor: reduce some dependencies on current_track
Don't mind me.
2016-02-01 22:28:47 +01:00
wm4
5c8378b71a player: use different variable to indicate coverart
Slightly better.
2016-02-01 22:14:32 +01:00
wm4
ab318aeea8 audio/video: merge decoder return values
Will be helpful for the coming filter support. I planned on merging
audio/video decoding, but this will have to wait a bit longer, so only
remove the duplicate status codes.
2016-02-01 22:03:04 +01:00
wm4
07d8a0e142 CONTRIBUTING.md: encourage users to ping forgotten issues
Now I'm not sure if this is really necessary to explicitly mention. But
then there have been issues and pull requests without being properly
looked at for a week or longer.
2016-02-01 20:13:39 +01:00
wm4
d53942dd79 audio: remove default preference for libdcadec
Not needed anymore, because the decoder was merged with FFmpeg.
2016-02-01 20:09:02 +01:00
wm4
05ffde6599 vo_opengl: hwdec: use IDs for API, and log which backend is used
Since there can be multiple backends for a single API (vaapi can use GLX
or EGL), not logging the exact backend name is annoying. So add it. At
the same time, there is no need to duplicate the name as used by the
--hwdec options, so replace it with using the numeric hwdec API ID.
2016-02-01 20:02:52 +01:00
wm4
a9dfd8d557 audio: use brutal resync only on larger PTS discontinuities
Let's fix broken samples with questionable heuristic without real
reasoning. Until this gets fixed properly, this is a good compromise,
though. A proper fix would properly resync audio and video without
brutally resetting the decoders, but on the other hand not doing the
brutal reset would cause issues in other obscure corner cases such
resyncing might cause.
2016-01-31 22:10:11 +01:00
wm4
c440ee99a4 audio: fix a case of going to sleep before playback start
This code is tricky because it has to wakeup the mainloop to make
progressing during syncing audio, but also has to avoid waking it up
when it's not needed. Failure to do so either burns CPU by not ever
going to sleep, or causes apparent "freezes" by going to sleep (and it
will continue if the mainloop is woken up e.g. due to user input).

In this case, simply starting A/V playback with --start=5 and removing
an unrelated wakeup in osd.c can trigger such a "freeze". The unrelated
wakeup did hide this bug, nonetheless it's a bug.

(Can't wait to rewrite this shitty audio resync code. And it's all my
fault.)
2016-01-31 22:02:02 +01:00
archenemies
006c9694c0 DOCS: explain about DVD situation in man page.
Explains libdvdnav vs libdvdread situation (as much as I know),
workarounds for bugs, and limitations of image-based subtitles.
(try #4)
2016-01-31 00:12:45 +01:00
Tracerneo
ca9124cd07 x11: stop waiting for MapNotify when WM_STATE changes
Signed-off-by: wm4 <wm4@nowhere>
2016-01-31 00:10:20 +01:00
wm4
e42a08340b vd_lavc: release surfaces before destroying decoder
Commit b53cb8de added a delay queue for decoded frames. This is supposed
to be used with copy-back decoders like dxva2-copy and vaapi-copy.
Surfaces returned by them can't be referenced after uninitializing the
decoders, so they have to be released before destroying the decoder.
Move the flush_all() call above decoder uninit accordingly. Also move
the destruction of the AVFrame used for decoding (just for being
defensive - normally it doesn't hold any reference).
2016-01-30 20:59:25 +01:00
wm4
effc466222 Fix build on Libav
I hope.
2016-01-30 14:14:59 +01:00
wm4
a8dd0abb6d vd_lavc: allow switching between hw/sw decoding any time
We just need to provide an entrypoint for it, and move the main init
code to a separate function. This gets rid of the messy video chain full
reinit in command.c, which completely destroyed and recreated the video
state for the purpose of mid-stream hw/sw switching.
2016-01-29 22:47:27 +01:00
wm4
942a6729fa vd_lavc: simplify an aspect of hwdec fallback
Don't give the "software_fallback_decoder" field special meaning. Alwass
set it, and rename it to "decoder". Whether hw decoding is used is
determined by the "hwdec" field already.
2016-01-29 22:46:46 +01:00
wm4
526d578bee player: refactor: some more minor decoder/output decoupling
These changes don't make too much sense without context, but are
preparation for later. Then the audio_src/video_src fields will be
actually be NULL under circumstances.
2016-01-29 22:46:28 +01:00
wm4
c00dc5c5c6 audio: refactor: separate audio init and filter/output init
Before this commit, reinit_audio_chain() did 2 things: create all the
management data structures and initialize the decoder, and handling lazy
filter/output init (as well as dealing with format changes). For the
second purpose, it could be called multiple times (even though it wasn't
really idempotent). This was pretty weird, so make them separate
functions. The new function is actually idempotent too.

It also turns out the reinit functions don't have to call themselves
recursively for the spdif PCM fallback.
2016-01-29 22:44:35 +01:00
wm4
c5a48c6332 audio: move pts reset check
Reduces the dependency of the filter/output code on the decoder.
2016-01-29 22:44:20 +01:00
wm4
340deb4e6e player: fix initial audio sync in certain cases
Regression caused by commit 3b95dd47. Also see commit 4c25b000. We can
either use video_next_pts and add "delay", or we just use video_pts. Any
other combination breaks. The reason why the assumption that delay==0 at
this point was wrong exactly because after displaying the first video
frame (usually done before audio resync) a new frame might be "added"
immediately, resulting in a new video_next_pts and "delay", which will
still amount to video_pts.

Fixes #2770. (The reason why display-sync was blamed in this issue is
because enabling display-sync in the options forces a prefetch by 2
instead of 1 frames for seeks/playback restart, which triggers the
issue, even if display-sync is not actually enabled. In this case,
display-sync is never enabled because the frames have a unusually high
frame duration. This is also what exposed the initial desync issue.)
2016-01-29 22:43:59 +01:00
wm4
d980fd0856 video: fix broken-PTS fallback determination
This codes tries to deal with broken PTS timestamps, but since commit
271cabe6 it didn't always overwrite the previous timestamp as it should
have. This mattered only if there were broken timestamps in the video
stream.

Also remove the pointless prev_codec_pts variables, since the decoder
doesn't overwrite these fields anymore.
2016-01-29 22:43:18 +01:00
wm4
354c1fc06d audio: move mp_audio->AVFrame conversion to a function
This also makes it refcounted, i.e. the new AVFrame will reference the
mp_audio buffers, instead of potentially forcing the consumer of the
AVFrame to copy the data.

All the extra code is for handling the >8 channels case, which requires
very messy dealing with the extended_ fields (not our fault).
2016-01-29 22:43:00 +01:00
Kevin Mitchell
946ee29a7d TOOLS/lua/ao-null-reload.lua: send ao-reload on audio-device-list change
Only triggers if ao=null. This is required for ao=wasapi to recover from periods
with no available devices.

fixes #2738
2016-01-28 06:49:36 -08:00
wm4
939ad0889b rpi: add VC-1 support
Oops, this was forgotten earlier. Enables automatic use of the VC-1
hardware decoder on RPI.
2016-01-28 11:23:23 +01:00
wm4
d2942f1bcd mp_image: copy dts as part of mp_image attributes too
Fixes DTS handling with certain container formats broken in commit
b53cb8de (when using vaapi-copy or dxva2-copy).
2016-01-28 11:23:16 +01:00
Kevin Mitchell
4d5d25fdbb ao_wasapi: add "wasapi" prefix to non-static find_deviceID function 2016-01-28 00:56:03 -08:00