0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

37272 Commits

Author SHA1 Message Date
wm4
444f79d86f lua: change error behavior
Return the error Lua-style, instead of raising it as Lua error. This is
better, because raising errors is reserved for more "fatal" conditions.
Pretending they're exceptions and trying to do exception-style error
handling will just lead to pain in this language.
2014-02-11 00:10:25 +01:00
wm4
7a53dd5f2f lua: rename some API functions
send_command     -> command
send_commandv    -> commandv
get_timer        -> get_time
property_get     -> get_property
property_get_string -> get_property_osd
getopt           -> get_opt
2014-02-11 00:01:57 +01:00
wm4
2868fbea3f av_log: add tons of warnings against mismatched ffmpeg/libav libraries
Print a warning if a library has mismatched compile time and link time
versions.

Refuse to work if the compile time and link time versions are a mix of
ffmpeg and libav. We print an error message and call exit(). Since we'd
randomly crash anyway, I think this is ok.

This doesn't catch the case if you e.g. use a ffmpeg libavcodec and a
libav libavformat, which would of course just crash as quickly, but I
think this checks enough already.
2014-02-10 23:28:10 +01:00
wm4
476a4a378a av_log: restructure version printing code
Makes the following commit simpler.
2014-02-10 23:11:30 +01:00
nand
7d9fff9c6b vo_opengl: fix typo in gamma function's parameter
The correct value is 0.081, not 0.18. The scale factor also needed
slight adjustment due to the order of operations.
2014-02-10 22:11:13 +01:00
Jonas Zetterberg
1fcdf2d849 vo_vdpau: Discard zero timestamps
Some drivers do not supply timestamps, use old timestamp in these conditions.
2014-02-10 22:10:56 +01:00
Jonas Zetterberg
c60c784a6a vo_vdpau: Ensure presentation time is within bounds
When a time sync happens the last sync time is the minimum time that can be
used for presentation.
2014-02-10 22:10:54 +01:00
wm4
bbdc47ee80 Merge branch 'client_api' 2014-02-10 22:10:31 +01:00
wm4
a6da2a6608 Add a client API example 2014-02-10 21:30:55 +01:00
wm4
3dd12104d9 build: add option to build a library
This library will export the client API functions.

Note that this doesn't allow compiling the command line player to link
against this library yet. The reason is that there's lots of weird stuff
required to setup the execution environment (mostly Windows and OSX
specifics), as well as things which are out of scope of the client API
and every application has to do on its own. However, since the mpv
command line player basically reuses functions from the mpv core to
implement these things, it's not very easy to separate the command
line player form the mpv core.
2014-02-10 21:25:22 +01:00
wm4
238c9b1d8d build: include a copy of syms.py from upstream waf
The alternatives to copying this small bit of code are even worse.

This is unmodified, except for the added line 3.
2014-02-10 21:08:37 +01:00
wm4
92a004bf87 lua: add a timer API 2014-02-10 21:07:23 +01:00
wm4
206616b697 lua: port to client API
This is partial only, and it still accesses some MPContext internals.
Specifically, chapter and track lists are still read directly, and OSD
access is special-cased too.

The OSC seems to work fine, except using the fast-forward/backward
buttons. These buttons behave differently, because the OSC code had
certain assumptions how often its update code is called.

The Lua interface changes slightly.

Note that this has the odd property that Lua script and video start
at the same time, asynchronously. If this becomes an issue, explicit
synchronization could be added.
2014-02-10 21:03:59 +01:00
wm4
88ae914b1e Add a client API
Add a client API, which is intended to be a stable API to get some rough
control over the player. Basically, it reflects what can be done with
input.conf commands or the old slavemode. It will replace the old
slavemode (and enable the implementation of a new slave protocol).
2014-02-10 21:01:35 +01:00
wm4
c6166ff448 timer: init only once
This avoids trouble if another mpv instance is initialized in the same
process.

Since timeBeginPeriod/timeEndPeriod are hereby not easily matched
anymore, use an atexit() handler to call timeEndPeriod, so that we
can be sure these calls are matched, even if we allow multiple
initializations later when introducing the client API.
2014-02-10 01:12:34 +01:00
wm4
8437356b6c options: add --no-terminal switch
Mostly useful for internal reasons. This code will be enabled by
default if mpv is started via the client API.
2014-02-10 00:14:52 +01:00
wm4
20fbe2fb8c threads: add a dispatch queue thing
Makes working with the (still) single-threaded playback thread easier.

Might be reusable for other stuff.
2014-02-10 00:04:39 +01:00
wm4
dd264ebe9d threads: avoid timeout calculation overflow
It's quite possible to overflow the calculation by setting the timeout
to high values. Limit it to INT_MAX, which should be safe. The issue is
mainly the secs variable.

timespec.tv_sec will normally be 64 bit on sane systems, and we assume
it can't overflow by adding INT_MAX to it.
2014-02-10 00:04:39 +01:00
wm4
7aa3726c9a demux_mkv: remove weird seeking semantics for audio
This skipped all audio packets before the first video key frame was
found. I'm not really sure why this would be needed; most likely it
isn't. So get rid of it. Even if audio packets are returned to the
player too soon, the player will sync the audio start to the video
start by decoding and discarding audio data.

Note that although the removed code was just added in the previous
commit, it merely kept the old keeping semantics which demux_mkv
always followed. This commit removes these special semantics.
2014-02-09 21:13:03 +01:00
wm4
4dbd5df174 demux_mkv: improve audio-only seeking
v_skip_to_keyframe is set to true while non-keyframe video packets are
skipped. Until now, audio packets were also skipped when doing this. I
can't see any good reason why this would be done, but for now I want to
keep the old logic when audio+video seeks are done.

However, for audio-only mode, do proper seeking, which also fixes
behavior when trying to seek past the end of the file: playback is
terminated properly, instead of starting playback on the start of the
last cluster.

Note that a_no_timecode_check is used only for audio+video seek. I'm
not sure what this is needed for, but it might influence A/V sync after
seeking.
2014-02-09 20:50:24 +01:00
wm4
ad782a53ef demux: fix some newlines in output messages 2014-02-09 18:59:57 +01:00
wm4
c0771b8144 player: fix an assert when reinitializing audio in some cases
This sometimes happened when changing playback speed (= reinitializing
audio) after seeking of playback start. The assertion in audio.c:441 was
triggered, because buffer_playable_samples wasn't reset correctly when
the audio buffer was cleared or shortened. The assertion is correct and
should hold up any time.
2014-02-09 18:59:44 +01:00
nand
257d9f1610 vo_opengl: use exactly the values defined by BT.709 for CMS
I could not see any difference whatsoever, but for usage with a 3DLUT
there's zero performance difference so we might as well follow the spec to
the letter.
2014-02-09 14:42:39 +01:00
wm4
7f744c9a16 msg: clear lines by printing spaces on MS Windows
On Windows, no ANSI control sequences are available, so we can't easily
clear lines, move the cursor, etc. It's yet to be decided how this
should be handled (emulate ANSI escapes in osdep/terminal-win.c, or
provide abstracted terminal API functions to unify the Linux and Windows
code).

For now, this fixes the regression that was introduced earlier by the
status line rewrite. It doesn't fix all aspects of status line and
terminal OSD handling, as can be clearly seen by the unconditional use
of terminal_erase_to_end_of_line further down the changed code.

Fixes github issue #499 (sort of).
2014-02-09 00:45:26 +01:00
wm4
8eaf6c42ac demux_lavf: work around idiotic libavutil API printing a warning
Trying to set a non-existent flag (like +keepside on Libav) causes
libavutil print an incomprehensible warning (something about eval;
probably the overengineered libavutil option parser tripping over the
'+' normally used for flags, and trying to interpret it as formula).

There's apparently no easy way to check for the existence of a flag,
so add some more ifdeffery to shut it up.
2014-02-08 01:04:37 +01:00
wm4
17ec073a15 player: handle seek delays differently
The code removed from handle_input_and_seek_coalesce() did two things:

1. If there's a queued seek, stop accepting non-seek commands, and delay
   them to the next playloop iteration.
2. If a seek is executing (i.e. the seek was unqueued, and now it's
   trying to decode and display the first video frame), stop accepting
   seek commands (and in fact all commands that were queued after the
   first seek command). This logic is disabled if seeking started longer
   than 300ms ago. (To avoid starvation.)

I'm not sure why 1. would be needed. It's still possible that a command
immediately executed after a seek command sees a "seeking in progress"
state, because it affects queued seeks only, and not seeks in progress.
Drop this code, since it can easily lead to input starvation, and I'm
not aware of any disadvantages.

The logic in 2. is good to make seeking behave much better, as it
guarantees that the video display is updated frequently. Keep the core
idea, but implement it differently. Now this logic is applied to seeks
only. Commands after the seek can execute freely, and like with 1., I
don't see a reason why they couldn't. However, in some cases, seeks are
supposed to be executed instantly, so queue_seek() needs an additional
parameter to signal the need for immediate update.

One nice thing is that commands like sub_seek automatically profit from
the seek delay logic. On the other hand, hitting chapter seek multiple
times still does not update the video on chapter boundaries (as it
should be).

Note that the main goal of this commit is actually simplification of the
input processing logic and to allow all commands to be executed
immediately.
2014-02-07 22:29:50 +01:00
wm4
67769db1a4 gl_x11: don't require a X visual for modern GL context creation
Legacy GL context creation (glXCreateContext) explicitly requires a X
visual, while the modern one (glXCreateContextAttribsARB) does not for
some reason. So fail only on the legacy code path if we don't find a
visual. Note that vo_x11_config_vo_window() will select a default visual
if a NULL visual is passed to it.
2014-02-06 14:33:30 +01:00
wm4
7134574f53 gl_x11: always request true color visual
This fixes issue #504. For some reason, glXChooseFBConfig() will return
a fbconfig with no associated visual. (I'm not sure if this allowed.
They don't always have a visual, but since GLX_X_RENDERABLE is set
and GLX_DRAWABLE_TYPE is (implicitly) set to GLX_WINDOW_BIT, why would
there be no visual?)

Even worse, a test program seems to show that a 16 bit fbconfig is
selected (instead of 24/32 bit), which doesn't sound nice at all. Since
there _are_ better fbconfigs available, glXChooseFBConfig() should
normally sort them by quality, and return the better ones first. It's
worth noting that this function should also prefer GLX_TRUE_COLOR
over anything else, although this comes last in the sort order.

Whatever is going on, requesting GLX_X_VISUAL_TYPE with GLX_TRUE_COLOR
seems to fix it.
2014-02-06 14:12:04 +01:00
wm4
41a5837e2b demux_lavf: do metadata-from-packet update before possibly discarding it
There is some logic to discard packets from streams that are not
selected. Run the metadata update code before this, just to make 100%
sure that no metadata updates can be lost when streams are deselected.

(I'm not sure why this logic would be needed, since both libavformat and
the generic demuxer code do this already. But a quick test shows that
av_read_frame() can return a packet from a stream even if the stream has
AVStream.discard set to AVDISCARD_ALL. This happened after stream
switching. Maybe libavformat doesn't discard already queued packets.)
2014-02-06 14:11:12 +01:00
wm4
47bc87208b demux_lavf: don't check for error when setting "keepside" flag
This flag doesn't exist on Libav (because they never do this insane
packet merging stuff), so this would print unnecessary warnings there.
2014-02-06 14:05:04 +01:00
Timothy Gu
30ffbc65bd DOCS/waf-buildsystem: add link to the Waf book 2014-02-06 13:45:35 +01:00
Timothy Gu
01d9e40200 DOCS/crosscompile-mingw: use Markdown 2014-02-06 13:45:23 +01:00
Timothy Gu
515a30d9a5 DOCS/crosscompile-mingw: update
MXE's ffmpeg is not old anymore.
2014-02-06 13:45:11 +01:00
wm4
7fbf9e0efd demux: reword "Clip info:" line to "File tags:" 2014-02-06 13:43:30 +01:00
wm4
bc35d4fcb4 demux: fill metadata directly, instead of using wrapper functions
Get rid of demux_info_add[_bstr] and demuxer_add_chapter_info.

Make demuxer_add_chapter_info return the chapter index for convenience.
2014-02-06 13:43:01 +01:00
wm4
39b932042b demux_lavf: clear metadata on update, instead of merging it
Assume a metadata update is a full update. Clear the previous metadata,
so that tags which existed only in the previous metadata are removed.
2014-02-06 13:42:30 +01:00
wm4
eb1ec14b67 demux: handle tag updates differently
Instead of printing lines like:

    Demuxer info GENRE changed to Alternative Rock

Just output all tags once they change. The assumption is that individual
tags rarely change, while all tags change in the common case.

This changes tag updates to use polling. This could be fixed later,
although the ICY stuff makes it a bit painful, so maybe it will remain
this way.

Also remove DEMUXER_CTRL_UPDATE_INFO. This was intended to check for tag
updates, but now we use a different approach.
2014-02-06 13:41:20 +01:00
wm4
5693b5ae16 stream_lavf: prefix icy metadata with "icy-"
ICY metadata is not always of good quality, and especially if there are
proper tags. We don't want the ICY metadata override the tags.
2014-02-06 13:40:09 +01:00
Ben Boeckel
ef68cfcc8a demux_lavf: get updated metadata from a packet if available
The side_data type is brand new in ffmpeg.
2014-02-06 13:39:55 +01:00
wm4
e6861ca51f umpv: silence mpv terminal output
Now it does basically the same as mkv.desktop. Explanation is included
in the description comment.
2014-02-05 19:04:35 +01:00
wm4
a6f04a41fe umpv: improve description 2014-02-05 19:01:06 +01:00
wm4
f77efbcce9 umpv: use --force-window
This makes it show a window even when playing audio-only files.
2014-02-05 18:55:06 +01:00
wm4
fdd5d00be3 audio: fix signedness of AF_FORMAT_S32P
This was marked as unsigned, but it's signed. Found by xylosper.
2014-02-05 18:53:00 +01:00
wm4
8edf2cda4b io: make MP_PATH_MAX private to win32 code
The win32 code is the only thing which actually needs this (and it's
used to make emulation of UTF-8 filename APIs easier).
2014-02-03 22:12:30 +01:00
wm4
d91b9e9f3b mf: don't limit filename length with PATH_MAX
Use an arbitrary constant instead, which is as good as PATH_MAX.

This helps us to avoid having to think about pull request #523.

Also fix a case where a potentially signed char was passed to isspace().
2014-02-03 22:11:03 +01:00
wm4
208c54a710 player: refresh OSD on track switching
Apparently, at least sub_reload was missing a refresh at all.
2014-02-03 22:01:09 +01:00
wm4
b270f5e177 command: output more information in colorspace properties and simplify
Instead of trying to be clever to avoid outputting redundant
information, simply output everything that we have.
2014-02-03 22:01:09 +01:00
wm4
d03111c5be csputils: correct constness of csp name constants 2014-02-03 22:01:09 +01:00
Alexander Preisinger
44bfe3b14a wayland: change minimum version
Change minimum version to 1.3 and remove the version checking in the source
code.
2014-02-02 08:46:13 +01:00
wm4
c8b754e38f x11: fix initial VO size
This was done incorrectly in the previous commit: the fallback size used
the window size as requested with the first config call, which is the
size of the hidden window in the vo_opengl case. (That damn hidden
window again...)
2014-02-02 03:19:36 +01:00