Commit Graph

1107 Commits

Author SHA1 Message Date
wm4 f13266014f client API: add glue for making full use of mpv_command_node()
Until now, the return value was always MPV_FORMAT_NONE. Now a command
can actually set it. This will be used in one of the following commits.
2015-04-20 23:00:12 +02:00
wm4 c6d046414b player: change video-bitrate and audio-bitrate properties
Remove the old implementation for these properties. It was never very
good, often returned very innaccurate values or just 0, and was static
even if the source was variable bitrate. Replace it with the
implementation of "packet-video-bitrate". Mark the "packet-..."
properties as deprecated. (The effective difference is different
formatting, and returning the raw value in bits instead of kilobits.)

Also extend the documentation a little.

It appears at least some decoders (sipr?) need the
AVCodecContext.bit_rate field set, so this one is still passed through.
2015-04-20 20:52:16 +02:00
xylosper c64e4e48d9 command: disc-mouse-on-button property
This property indicates whether mouse cursor is located on button
or not for disc naviation.
2015-04-21 00:54:29 +09:00
wm4 f4292ebf52 vf_screenshot: remove this filter
It's entirely useless, especially now that vo.c handles screenshots in a
generic way, and requires no special VO support. There are some
potential weird use-cases, but actually I've never seen it being used.
2015-04-16 22:16:04 +02:00
wm4 547976633f command: let screenshot_to_file command overwrite files
The old behavior does not make too much sense after all. If you don't
want to file to be overwritten, the user can check this manually.

This is a change in behavior - let's hope nobody actually relied on it.
2015-04-16 22:06:47 +02:00
wm4 533b0c70e1 video: do not show decoder framedrops if they're not requested
libavcodec makes it impossible to distinguish dropped frames (requested
with AVCodecContext.skip_frame), and cases when the decoder simply does
not return a frame by default (such as with VP9, which has invisible
reference frames).

This confuses users when decoding VP9 video. It's basically a cosmetic
issue, so just paint it over by ignoring them if framedropping is
disabled.
2015-04-16 21:55:10 +02:00
wm4 d55c41501f subprocess: move implementation for deatched subprocesses 2015-04-15 22:43:02 +02:00
wm4 d8a0356b3b player: silence spam in verbose mode when playing audio with cover art
When playing cover art, it conceptually reaches EOF as soon as the image
was put on the VO, causing the EOF message to be repeated every time new
audio was decoded. Just silence the message.
2015-04-14 14:36:15 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
James Ross-Gowan 96d0a3f56c main-fn-win: fix handle validity check for XP
Apparently the standard handles can be set to bogus values on XP. Use
GetFileType to check whether they refer to an actual file/pipe/etc. The
logic used by is_valid_handle() is now pretty similar to what the CRT
uses to check for valid stdio handles.
2015-04-11 14:35:50 +10:00
James Ross-Gowan 1e3aad5f87 win32: use pseudo-gui profile when started without stdio
If mpv is started from Explorer or the Start Menu, it will have no
console and no standard IO handles. In this case, it's fairly safe to
enable the pseudo-gui profile.
2015-04-11 14:35:09 +10:00
James Ross-Gowan 527911d2a2 win32: only attach to the console from mpv.com
Previously, mpv.exe used the --terminal option to decide whether to
attach to the parent process's console, which made it impossible to tell
whether mpv would attach to the console before the config files were
parsed. Instead, make mpv always attach to the console when launched
from the console wrapper (mpv.com) and never attach otherwise. This will
be useful for the next commit, which will use the presence of the
console to decide whether to use the pseudo-gui profile.

This change should also be an improvement in behavior. The old code
would attach to the parent process's console, regardless of whether it
was mpv.com or some other program like cmd.exe. This could be confusing,
since mpv.exe is marked as a Windows GUI program and shouldn't write
text to its parent process's console when launched directly. (See #768.)

Visual Studio does something similar with its devenv.com wrapper.
devenv.exe only attaches to the console when launched from devenv.com.
2015-04-11 14:34:33 +10:00
James Ross-Gowan ac7ecbe30c win32: use a platform-specific unicode entry-point
Add a platform-specific entry-point for Windows. This will allow some
platform-specific initialization to be added without the need for ugly
ifdeffery in main.c.

As an immediate advantage, mpv can now use a unicode entry-point and
convert the command line arguments to UTF-8 before passing them to
mpv_main, so osdep_preinit can be simplified a little bit.
2015-04-11 14:27:25 +10:00
wm4 cf55fa6471 player: use config parser for setting up pseudo-gui profile 2015-04-10 20:40:50 +02:00
wm4 1e692cb043 player: change pseudo-gui settings
Remove --keep-open. Switch to --idle=once. This effectively makes the
player quit after end of playback, but still shows the idle screen if it
was started with no files.
2015-04-10 20:31:21 +02:00
wm4 46eb04f3c2 player: do not accidentally init terminal
Starting the command line player with --no-terminal, the terminal was
sitll initialized. This happened because update_logging() used the
option value before the options were parsed. Fix by moving down the
initialization to before the point where it's actually needed.
2015-04-10 13:07:24 +02:00
Sebastian Mayr c4faab4871 ytdl: set additional properties for rtmp streams 2015-04-09 20:36:38 +02:00
robin d453600b4f ytdl_hook.lua: Disable video when vid option is "no"
When setting options like --no-video, ytdl_hook adds the "-x" argument
to youtube-dl, so that bandwith is saved by not downloading the video on
some sites.
2015-04-09 20:34:36 +02:00
wm4 e76f6929e5 vo_opengl_cb: deprecate mpv_opengl_cb_render()
Its vp parameter made no sense anymore. Introduce a new one.
2015-04-09 19:31:01 +02:00
wm4 8dc7156bc0 vo_opengl_cb: add a function to report vsync time
And also let vo.c know of it.

Currently, this does not help much, but will facilitate future
improvements.
2015-04-09 19:30:26 +02:00
wm4 579c4dac34 audio: change a detail about filter insertion
The af_add() function has a problem: if the inserted filter returns
AF_DETACH during init, the function will have a dangling pointer. Until
now this was avoided by making sure none of the used filters actually
return AF_DETACH, but it's getting infeasible.

Solve this by requiring passing an unique label to af_add(), which is
then used instead of the pointer.
2015-04-07 21:24:22 +02:00
wm4 d857b5f5ab audio: avoid one more redundant audio filter reinit
Only reinit filters if it's actually needed. This is also slightly
easier to understand: if you look at the code, it should now be more
obvious why a reinit is needed (hopefully).
2015-04-07 13:48:19 +02:00
wm4 f316f1ec16 screenshot: use GPU readback only for hardware decoded images
Avoids a confusing message printed by the vdpau code when taking a
screenshot while using software decoding (because obviously GPU readback
won't work on normal in-memory video frames).
2015-04-07 10:17:54 +02:00
Niklas Haas 4f84939310
command: new subproperty for video-params: gamma 2015-04-04 15:49:16 +02:00
wm4 5a2825ec35 video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is
pretty much equivalent.

(On a side note, it seems --video-stereo-mode can't be removed, because
it controls whether to "reduce" stereo video to mono, which is also the
default. In fact I'm not sure how this should be handled at all.)
2015-04-02 23:54:08 +02:00
wm4 83bd128016 player: add --idle --keep-open to pseudo-gui profile 2015-04-02 00:09:43 +02:00
wm4 550d908ba8 player: add "pseudo-gui" profile
This can be set to select a number of default settings that help mpv
pretend that it has a GUI.

I haven't decided yet whether I really want to use the profile mechanism
for this. There are a number of weird details that are not so easy to
handle with profiles, such as disabling pseudo-gui mode again (you can't
unset profiles directly). So this might change. But for now it will do.

There also should be a better way to store builtin profiles.
Unfortunately, the old crappy MPlayer config file parser needs on-disk
files, so just use a bunch of function calls for now.
2015-04-02 00:08:38 +02:00
wm4 9b59c175e3 lua: reject Lua 5.3
It simply doesn't work, and is hard to make work. Lua 5.3 is a different
language from 5.1 and 5.2, and is different enough to make adding
support a major issue. Most importantly, 5.3 introduced integer types,
which completely mess up any code which deals with numbers.

I tried to make this a compile time check, but failed. Still at least
try to avoid selecting the 5.3 pkg-config package when the generic "lua"
name is used (why can't Lua upstream just provide an official .pc
file...). Maybe this actually covers all cases.

Fixes #1729 (kind of).
2015-04-01 23:59:15 +02:00
wm4 72fcdc32db command: remove unused function 2015-04-01 01:01:15 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
wm4 39f6f6b104 build: make posix_spawn() mandatory
It was already accidentally used unconditionally by command.c.
Apparently this worked well for us, so don't change anything about,
but should it be unavailable, fail at configure time instead of compile
time.
2015-03-30 19:49:24 +02:00
wm4 fb61858b63 video: fix seek-to-last-frame
Accidentally broken in 79779616; we really need to check for true EOF,
not just whether there are no frames yet.
2015-03-26 11:57:48 +01:00
Niklas Haas 4bcd6ec41d player: relax assertion on mp_set_playlist_entry
This assertion crashed when e was NULL, which can happen when using
force.
2015-03-26 00:04:08 +01:00
wm4 83476433b5 video: make frame skipping code slightly more readable 2015-03-25 13:58:14 +01:00
wm4 7977961671 video: refactor aspects of queue and EOF handling
Instead of touching the 2-entry queue in mpctx->next_frame directly,
move some of it to functions.
2015-03-25 13:33:34 +01:00
wm4 08df18aea3 lua: replace getcwd() implementation 2015-03-24 22:04:27 +01:00
wm4 36c4ac8464 command: add property returning current working directory
Requested; fixes #1717.
2015-03-24 22:00:01 +01:00
wm4 8c8d6e6878 audio: increase maximum amount of audio skipped for seeking
Precise seeking requires skipping audio, since the demuxer usually
doesn't seek precisely enough. There is a sanity check that prevents
skipping more than 300 seconds of audio. This still fails with very
large mp3s. For example, with a 1GB sized mp3 with Xing headers, entries
will be 4 MB apart on average, and occasionally much more.

Just bump the limit. I'm not even sure why it was added in the first
place; I suppose it's most important for files with real PTS resets.
2015-03-24 15:38:51 +01:00
wm4 b5e67ca178 client API: remove dead assignment
Probably a leftover from an earlier refactoring. Now data is always in
the format MPV_FORMAT_NODE.
2015-03-23 18:07:33 +01:00
wm4 a5c66601ff video: use less technical language for PTS warning
"Non-monotonic" isn't even 100% correct; it's missing "strictly" (for
briefness I guess), and also the message is printed if the PTS jumps
forward. So just print something that is likely a bit easier to
understand.
2015-03-23 17:46:42 +01:00
wm4 331b21f267 encode: make --audio-channels=auto work
Basically requested. Not that anyone cares.
2015-03-23 17:41:50 +01:00
wm4 6c2f25a7b0 video: fix update of vo-configured property
It obviously needs to be updated after the VO was destroyed.
2015-03-23 16:34:14 +01:00
wm4 167b75c50c vo_opengl_cb: don't render OSD while VO is not created
Unlike other VOs, this rendered OSD even while no VO was created
(because the renderer lives as long as the API user wants). Change this,
and refactor the code so that the OSD object is accessible only while
the VO is created.

(There is a short time where the OSD can still be accessed even after VO
destruction - this is not a race condition, though it's inelegant and
unfortunately unavoidable.)
2015-03-23 16:32:59 +01:00
Sai Ke WANG 3f3d71b0a8 command: use mp_set_playlist_entry
Signed-off-by: wm4 <wm4@nowhere>
2015-03-22 14:28:52 +01:00
wm4 055720fbce player: fix seekability test
Commit 39ed9b7d9 got this wrong, because these shitty flags are so
goddamn confusing.
2015-03-20 00:36:42 +01:00
wm4 47c131bb0c player: warn against non-monotonic video PTS only once
For some reason there were two points in the code where it warned
against non-monotonic video PTS. The one in video.c triggered on PTS
going backwards or making large jumps forwards, while dec_video.c
triggered on PTS going backwards or PTS not changing. Merge them into a
single check, which warns against all cases.
2015-03-18 22:26:49 +01:00
wm4 39ed9b7d96 player: refuse to write resume file with unseekable files
In fact this should happen on resume, not on saving, but it's simpler
this way.

Fixes #1701.
2015-03-18 22:15:02 +01:00
wm4 51befc9deb osd: simplify an aspect of change detection handling
There was a somewhat obscure optimization in the OSD and subtitle
rendering path: if only the position of the sub-images changed, and not
the actual image data, uploading of the image data could be skipped. In
theory, this could speed up things like scrolling subtitles.

But it turns out that even in the rare cases subtitles have such scrolls
or axis-aligned movement, modern libass rarely signals this kind of
change. Possibly this is because of sub-pixel handling and such, which
break this.

As such, it's a worthless optimization and just introduces additional
complexity and subtle bugs (especially in cases libass does the
opposite: incorrectly signaling a position change only, which happened
before). Remove this optimization, and rename bitmap_pos_id to
change_id.
2015-03-18 13:15:20 +01:00
wm4 699fc0e51e command: don't drop audio buffers when switching filters
This partially reverts commit ae7228c6. I guess the old behavior was
slightly more popular.

Fixes #1693 (probably).
2015-03-16 19:14:08 +01:00
wm4 fadf03354e command: make "media-title" observable
If metadata changes, its value could change.
2015-03-15 15:41:01 +01:00