Commit Graph

393 Commits

Author SHA1 Message Date
wm4 73a5417950 Merge mp_talloc.h into ta/ta_talloc.h 2013-12-17 02:18:16 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
Since m_option.h and options.h are extremely often included, a lot of
files have to be changed.

Moving path.c/h to options/ is a bit questionable, but since this is
mainly about access to config files (which are also handled in
options/), it's probably ok.
2013-12-17 02:07:57 +01:00
wm4 793f85945f Move libquvi stuff to stream/resolve/ 2013-12-17 01:40:26 +01:00
wm4 8d5214de0a Move mpvcore/input/ to input/ 2013-12-17 01:23:09 +01:00
wm4 56eafe3344 Rename mp_core.h to core.h
Get rid of the mp_ prefix.
2013-12-17 01:08:53 +01:00
wm4 e449111429 Move mpvcore/player/ to player/ 2013-12-17 00:53:22 +01:00
wm4 7dc7b900c6 Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsg
The tmsg stuff was for the internal gettext() based translation system,
which nobody ever attempted to use and thus was removed. mp_gtext() and
set_osd_tmsg() were also for this.

mp_dbg was once enabled in debug mode only, but since we have log level
for enabling debug messages, it seems utterly useless.
2013-12-16 20:41:08 +01:00
wm4 3e6cd3ef19 input: remove LIRCCD support
This removes support for the "LIRC Client Daemon", which is separate
from LIRC, and hasn't been maintained for 10 years.

See github issue #413.
2013-12-16 20:21:25 +01:00
wm4 9662e3e509 command: mess with previous commit
Nothing actually used the returned length. Since the remaining time can
easily become 0 or negative (e.g. incorrectly estimated file duration),
the time_remaining function still needs 2 return values, though.
2013-12-16 20:14:43 +01:00
Vivek Jain 908dfa7949 command: scale osd’s time remaining by the current speed
Signed-off-by: wm4 <wm4@nowhere>
2013-12-16 20:07:50 +01:00
wm4 86bf16f449 input: move multi-command parsing somewhere else
I'm planning to add a mode to pass commands as a pre-split list of
strings, and this will probably be useful to reach this goal.
2013-12-16 20:04:51 +01:00
wm4 bc723f1b68 input: adjust code to make quoted/not quoted cases more unified 2013-12-16 20:03:37 +01:00
wm4 19b506ea65 input: better error reporting for missing commands
Don't print an empty string if the command is missing.
2013-12-16 20:03:00 +01:00
wm4 5173900ed4 input: move some command flags into a bitfield 2013-12-16 20:03:00 +01:00
wm4 b65a6c3cd0 input: remove weird syntax for skipping optional arguments 2013-12-16 20:03:00 +01:00
wm4 e8f21b1f0a input: avoid using wakeup pipe if it's not needed
If input is not waiting for select(), writing to the wakeup pipe is
wasteful, and, if there are many wakeups, might even block the wakeup
threads if the pipe gets full.

However, if it's waiting for select(), the wakup pipe must be used to
unblock the waiting thread. Actually there's a small race condition: we
might determine that the main thread is in select(), and write to the
wakeup pipe (whether we do this while unlocked or locked doesn't really
matter). Then, the main thread might leave select() before reading from
the wakup pipe. This should be harmless, because at worst more wakeups
than needed happen, but never fewer.
2013-12-16 20:03:00 +01:00
wm4 048bb2464d mp_msg: define a bunch of convenience macros
In order to use bare mp_log contexts, I find myself creating dummy
structs (with a single "log" field) to use the MP_ERR() etc. macros,
which hardcode the idiom that a context struct has a log field. On the
other hand, just using mp_msg_log() is too much typing (and I want to
rename it to mp_msg() when the transition is done), so it seems nice to
have message printing macros that use mp_log directly.
2013-12-16 20:02:59 +01:00
wm4 cd064c679c input: don't quit with exit status 1 when receiving SIGTERM
Instead, do whatever the normal "quit" command does, which currently
is returning a status of 0.
2013-12-15 18:14:15 +01:00
wm4 ff85afa537 player: don't temporarily disable terminal handling when reloading files
There's no reason why we should do this. For some reason, the existing
code reset terminal handling to default after unloading a file, just to
initialize it again when loading a new file.

Might be related to github issue #412, although I don't think it helps,
since the default SIGTERM handler _should_ kill the mpv process.
(It's still a nice simplification, though.)
2013-12-15 18:06:21 +01:00
wm4 3194058309 player: don't store subtitle renderer in osd_state
This doesn't have much value. It can't be accessed by anything else than
the actual subtitle renderer (sd_ass.c). sd_ass.c could create the
renderer itself, except that we apparently want to save memory (and some
font loading time) when using ordered chapters or multiple subtitle
tracks.
2013-12-15 13:44:39 +01:00
wm4 4ca740ccf9 dvdnav: fix incorrect clipping of highlights 2013-12-15 10:21:33 +01:00
wm4 2f49fbff93 matroska: add --ordered-chapters-files option
This option takes a playlist. The playlist will then be used as list of
potential segment files for use with ordered chapters.
2013-12-14 21:52:37 +01:00
wm4 683d7e88e4 Allow some options taking filenames to refer to mpv config dir
Add the mp_get_user_path() function, and make it expand special path
prefixes. Use it for some things in mpv which take filenames
(--input-config, --screenshot-template, opengl icc-profile suboption).

This allows accessing files in the mpv config dir without hardcoding the
config path by prefixing the path with ~~/. Details see manpage
additions.
2013-12-14 19:54:49 +01:00
wm4 9bd7601c6d dvdnav: crappy hack to respect timed still frames
Before this, they were displayed forever. Since some dvd screens seem
not to allow escaping from the still frame using the menu, this could
get you stuck forever.
2013-12-14 01:40:52 +01:00
wm4 6002520906 dvdnav: block when libdvdnav requests draining buffers
Not sure how this should work. Using libdvdnav with a large FIFO doesn't
make sense either: data and control commands use the same stream, so if
you want to send input to libdvdnav, you just have to read from
libdvdnav all the time to get a reaction, which is not compatible with
maintaining a buffer that could remain full for a long time.

I have no idea either whether this improves or worsens anything, though
it might be more correct.
2013-12-14 01:11:38 +01:00
wm4 dd6d204e9e dvdnav: improve a comment 2013-12-13 22:41:21 +01:00
wm4 ebf6d0004b dvb: prevent seek when reopening the demuxer
Since dvb input is not seekable anyway, this would probably just flush
the stream buffer, but at least it'll avoid a bogus message about
seeking errors.
2013-12-13 00:31:28 +01:00
wm4 b0bd93cbc1 dvdnav: support mouse interaction 2013-12-13 00:19:17 +01:00
wm4 0530447417 Add prelimimary (basic, possibly broken) dvdnav support
This readds a more or less completely new dvdnav implementation, though
it's based on the code from before commit 41fbcee. Note that this is
rather basic, and might be broken or not quite usable in many cases.

Most importantly, navigation highlights are not correctly implemented.
This would require changes in the FFmpeg dvdsub decoder (to apply a
different internal CLUT), so supporting it is not really possible right
now. And in fact, I don't think I ever want to support it, because it's
a very small gain for a lot of work. Instead, mpv will display fake
highlights, which are an approximate bounding box around the real
highlights.

Some things like mouse input or switching audio/subtitles stream using
the dvdnav VM are not supported.

Might be quite fragile on transitions: if dvdnav initiates a transition,
and doesn't give us enough mpeg data to initialize video playback, the
player will just quit.

This is added only because some users seem to want it. I don't intend to
make mpv a good DVD player, so the very basic minimum will have to do.
How about you just convert your DVD to proper video files?
2013-12-12 01:46:45 +01:00
wm4 a937e93fd6 input: fix bogus section disabling, add debugging output
The code to remove a section from the active section array wasn't
correct (it should have tried to copy the elements in reverse), so just
replace it with a macro that does the intended thing.

Add some debug output to print the section stack.
2013-12-12 01:25:21 +01:00
wm4 7c7d214775 osd: add option for "unscaled" OSD 2013-12-10 20:07:39 +01:00
wm4 227d087db6 video: display last frame, drain frames on video reconfig
Until now, the player didn't care to drain frames on video reconfig.
Instead, the VO was reconfigured (i.e. resized) before the queued frames
finished displaying. This can for example be observed by passing
multiple images with different size as mf:// filename. Then the window
would resize one frame before image with the new size is displayed. With
--vo=vdpau, the effect is worse, because this VO queues more than 1
frame internally.

Fix this by explicitly draining buffered frames before video reconfig.

Raise the display time of the last frame. Otherwise, the last frame
would be shown for a very short time only. This usually doesn't matter,
but helps when playing image files. This is a byproduct of frame
draining, because normally, video timing is based on the frames queued
to the VO, and we can't do that with frames of different size or format.
So we pretend that the frame before the change is the last frame in
order to time it. This code is incorrect though: it tries to use the
framerate, which often doesn't make sense. But it's good enough to test
this code with mf://.
2013-12-10 20:07:39 +01:00
wm4 e6e6b88b6d video: move VO reinit from filter chain to player
This gets rid of the vf_vo pseudo-filter. It ends the idea of MPlayer's
architecture that the VO is just a (terminating) video filter. It didn't
really work for us with respect to video timing (the "end" of the video
chain isn't really made for video timing, and making it do so would be
awkward), and now we're removing it entirely. We will be able to fix
some things, such as properly draining video on reconfiguration.
2013-12-10 20:07:39 +01:00
wm4 2f46b23d51 video: move handling of brightness and deinterlacing control
Handling of brightness/gamma/saturation/etc. and deinterlacing is moved
from vf_vo.c to dec_video.c.
2013-12-10 20:07:39 +01:00
wm4 9838bf5565 video: move video filter chain initialization from decoder to player
This should help fixing some issues (like not draining video frames
correctly on reinit), as well as decoupling the decoder, filter chain,
and VO code.

I also wanted to make the hardware video decoding fallback work properly
if software-only video filters are inserted. This currently has the
issue that the fallback is too violent, and throws away a bunch of
demuxer packets needed to restart software decoding properly. But
keeping "backup" packets turned out as too hacky, so I'm not doing this,
at least not yet.
2013-12-10 20:07:39 +01:00
wm4 62925a5c15 options: allow hwaccel formats in -vf format/noformat
There are 3 users of the image format option type: demux_raw,
vf_format, vf_noformat. Allow the hwaccel formats (like vdpau etc.)
in general, so that the filters can use it. This won't work for
demux_raw, so explicitly reject these formats there.
2013-12-07 19:39:45 +01:00
wm4 bb6165342d video: create a separate context for video filter chain
This adds vf_chain, which unlike vf_instance refers to the filter chain
as a whole. This makes the filter API less awkward, and will allow
handling format negotiation better.
2013-12-07 19:32:44 +01:00
wm4 5b19a66cff command: fix compilation with MinGW
This include header is needed for the fork/exec code, which is inactive
on Windows anyway.
2013-12-07 19:29:52 +01:00
wm4 8f3d0b5e53 player: load external subs for uncompressed rar archives
Uncompressed rar archives can be transparently opened, but the filename
the player doesn't have the direct filename (but something starting
with rar://... instead). This will lead to external subtitles not
being loaded.

This doesn't handle multi-volume rar files, but in that cases just use
the --autosub-match=fuzzy option.

Fixes #397 on github.
2013-12-06 23:00:19 +01:00
wm4 66e20ef8ad video: remove --flip
The --flip option flipped the image upside-down, by trying to use VO
support, or if not available, by inserting a video filter. I'm not sure
why it existed. Maybe it was important in ancient times when VfW based
decoders output an image this way (but even then, flipping an image is a
free operation by negating the stride).

One nice thing about this is that it provided a possible path for
implementing video orientation, which is a feature we should probably
support eventually. The important part is that it would be for free for
VOs that support it, and would work even with hardware decoding.

But for now get rid of it. It's useless, trivial, stands in the way, and
supporting video orientation would require solving other problems first.
2013-12-05 22:58:54 +01:00
wm4 e1966e4aae video: allow hardware decoding only for certain codecs
In particular, this disables mpeg4. There are some files out there that
use GMC, a usually rarely used and ineffective feature, which is not
supported by most hardware decoders. In these cases the hw decoder
outputs garbage, while software decoding works perfectly fine. We can't
really fallback to software decoding in these cases, because we don't
know that something is wrong in the first place. I can't see any
advantages of hw decoding of mpeg4, so it's better to disable it.
2013-12-05 22:58:53 +01:00
wm4 e9f49ea84d options: remove legacy hacks for sub-option handling 2013-12-04 23:13:46 +01:00
wm4 59aed93208 ad_lavc: expose an option to enable threading 2013-12-04 23:12:51 +01:00
wm4 47c4b5c000 vd_lavc: factor out libavcodec thread setup 2013-12-04 23:12:51 +01:00
wm4 8a84da8102 av_common: add timebase parameter to mp_set_av_packet()
If the timebase is set, it's used for converting the packet timestamps.
Otherwise, the previous method of reinterpret-casting the mpv style
double timestamps to libavcodec style int64_t timestamps is used.

Also replace the kind of awkward mp_get_av_frame_pkt_ts() function by
mp_pts_from_av(), which simply converts timestamps in a way the old
function did. (Plus it takes a timebase parameter, similar to the
addition to mp_set_av_packet().)

Note that this should not change anything yet. The code in ad_lavc.c and
vd_lavc.c passes NULL for the timebase parameters. We could set
AVCodecContext.pkt_timebase and use that if we want to give libavcodec
"proper" timestamps.

This could be important for ad_lavc.c: some codecs (opus, probably mp3
and aac too) have weird requirements about doing decoding preroll on the
container level, and thus require adjusting the audio start timestamps
in some cases. libavcodec doesn't tell us how much was skipped, so we
either get shifted timestamps (by the length of the skipped data), or we
give it proper timestamps. (Note: libavcodec interprets or changes
timestamps only if pkt_timebase is set, which by default it is not.)
This would require selecting a timebase though, so I feel uncomfortable
with the idea. At least this change paves the way, and will allow some
testing.
2013-12-04 23:12:51 +01:00
wm4 079e0e7963 vf_vo: don't abuse option strings to set VO
Whoever thought this was a good idea should be punched.
2013-12-04 00:07:40 +01:00
wm4 86ba9a7f24 vf_yadif: change options, reroute to vf_lavfi
Also remove the ability to disable deinterlacing at runtime. You can
still disable deinterlacing at runtime by using the ``D`` key and its
automatical filter insertion/removal.
2013-12-04 00:07:38 +01:00
Vivek Jain 6fb020f5de options: add option to disable using right Alt key as Alt Gr
mpv was hardcoded to always consider the right Alt key as Alt Gr, but there
are parituclar combinations of platforms and keyboard layouts where it's more
convenient to treat the right Alt as a keyboard modifier just like the left
one.

Fixes #388
2013-12-02 09:03:31 +01:00
wm4 1136a8b6ac input: don't emit command when using multiple mouse buttons at once
This is for key bindings that use multiple mouse buttons at once. (Yes,
this is weird, but MPlayer always had this feature, and apparently
there are people using it!)

Before this commit, clicking another mouse button while still holding
the previous mouse button forced the command bound to the previous
mouse button to be emitted. This is usually needed to make sure the
input consumer (the player and the OSC) stays in sync with the actual
mouse button state. If there's no command sent, the OSC in particular
would think the button is still held down. However, sending the command
is undesired behavior if you want to use these multiple-key binds.

Solve this by emitting commands in this situation only if a key down
command was sent earlier. Since mouse button key bindings are normally
executed on key-up only, this happens with special commands like
script_dispatch only (used by the OSD to track mouse buttons, but
also used for other OSC bindings).

See github issue #390.
2013-12-01 18:05:08 +01:00
wm4 071ae5613f input: improve some comments
I have the feeling some of these were written before everything was
changed all over again.
2013-12-01 17:34:43 +01:00