Commit Graph

278 Commits

Author SHA1 Message Date
wm4 0b1ba0bf64 player: fix setting smaller timeout on Windows systems
On Windows, we don't have proper input event wakeup handling, so we
need to lower the playloop timeout in order to react fast to input.

Closes #387.
2014-01-08 19:16:30 +01:00
wm4 98ffa7c476 audio: fix previous commit 2014-01-06 18:51:02 +01:00
Martin Herkt cd53de958d Fix audio delay inversion 2014-01-06 18:40:31 +01:00
wm4 936a204e27 sub: fix previous commit
sub_seek and sub_step were broken.
2014-01-06 17:38:10 +01:00
Martin Herkt e62c917abf Fix subtitle delay inversion 2014-01-06 17:09:31 +01:00
wm4 5819f4b7c9 player: always ise [statusline] for terminal OSD
This was inconsistent: the actual statusline used [statusline] as
message prefix, while other parts of the terminal OSD used [cplayer]
(and MSGL_STATUS). This commit makes it consistent.
2014-01-05 20:15:19 +01:00
wm4 2123ca52c9 player: print an error message if run command fails
Note that we can't use mp_msg, because it's not async-signal safe (we
might be running other threads while forking, so only functions
specified to be async-signal safe can be called, and this doesn't
include stdio; mp_msg acquires a mutex too).

Also, always print a \n before running the program to flush the status
line. The effect is that a program running successfully as well as the
error message will effectively start on a new line.
2014-01-05 20:11:01 +01:00
wm4 365cc79d94 player: don't select subtitles added from quvi by default
Quvi subtitles are considered external subtitles (simply because they're
separate from the audio/video stream), but for the sake of subtitle
auto-selection, they should not be considered external.

Change this so that quvi subtitles are treated like muxed subtitles
(with default flag never set). This means subtitles won't be selected by
default, unless explicitly requested with --sid or --slang.
2014-01-05 16:15:30 +01:00
wm4 6534839154 demux_subreader: reject file if not opened by --sub
demux_subreader.c contains the old MPlayer subtitle parser, and I have
absolutely no confidence in this (very crappy) code. There might be
one or two security risks associated with running that code on
arbitrary input.
2014-01-04 19:00:01 +01:00
wm4 79a8018ca2 dvdnav: set correct stride for fake highlights
This didn't really matter, because the fake highlight rectangle is in a
single color, and every pixel has the same color value.
2014-01-03 16:45:59 +01:00
Martin Herkt e9f577eb9a Windows: use the GUI subsystem, attach to console
This is necessary to start mpv without forcing a console window,
but also breaks console usability. A workaround is to call mpv
from a wrapper process that uses the console subsystem and helps
redirecting the standard streams and WriteConsole output to where
they belong.
2014-01-02 05:30:49 +01:00
wm4 9169737a47 player: load encoding-profiles.conf before the main config
Otherwise one can't add profiles based on the encoding profiles.
2014-01-01 19:25:52 +01:00
wm4 aeb9e6ddf5 player: fix DVD playback
Crashed in case of lazily added subtitle streams, which add tracks with
track->stream set to NULL.

Fixes gituhub issue #439.
2014-01-01 16:18:54 +01:00
wm4 66fe4f5713 Update copyright year 2014-01-01 00:00:00 +01:00
wm4 56ce2a39be video: fix --brightness etc. options
They were set before the VO was intitialized, which silently failed.
2013-12-29 22:18:27 +01:00
wm4 15f38b89ee player: add two more font mimetypes recognized by Haali
The Haali Matroska splitter is basically the reference implementation
for this crap, and it knows only:

    application/vnd.ms-opentype
    application/x-font-ttf
    application/x-truetype-font

Two of them were missing in our code. One of them, "application/x-font",
is probably plain incorrect, but I can't really tell.

Also see: http://www.cccp-project.net/beta/test_files/fontsample.mkv
2013-12-29 14:19:22 +01:00
wm4 6878cf2832 player: use arrays to list font mimetypes and font file extensions 2013-12-29 14:19:22 +01:00
wm4 fd4e3af740 Install encoding-profiles.conf by default
This is probably useful.

Note that this includes a small, stupid hack to prevent loading of the
config file if vf_lavfi is not available. The profile by default uses
vf_lavfi, and the config parser will output errors if vf_lavfi is not
available.

As another caveat, we install the example profile even if encoding is
disabled (though we don't load it, since this would print errors).
2013-12-28 16:33:21 +01:00
wm4 a473739fbf player: fix buggy error condition when loading mpv.conf 2013-12-28 15:46:07 +01:00
wm4 dacb6ad98f options: simplify handling of some help options 2013-12-26 19:25:51 +01:00
wm4 f691d8f7b6 player: deselect secondary sub when switching to file with different tracks
This applies the usual logic of resetting stream selections to default
when switching to a file with a different track layout. (This is to
prevent selecting random streams.)
2013-12-25 11:32:33 +01:00
wm4 f751609450 player: fix initial selection with --secondary-sid
Also, make sure that a track can't be selected twice. While this might
work in some situations, it certainly won't work with subtitles demuxed
from a stream.

Fixes #425.
2013-12-25 11:32:29 +01:00
wm4 3720b3f17d player: add --secondary-sid for displaying a second subtitle stream
This is relatively hacky, but it's Christmas, so it's ok. This does two
things: 1. allow selecting two subtitle tracks, and 2. include a hack
that renders the second subtitle always as toptitle. See manpage
additions how to use this.
2013-12-24 17:46:14 +01:00
wm4 9292f537d6 player: add infrastructure to select multiple tracks at once
Of course this does not allow decoding multiple tracks at once; it just
adds some minor infrastructure, which could be used to achieve this.
2013-12-24 17:46:08 +01:00
wm4 2b87415f6f player: do initial seek for external tracks only once
Normally, there can be only one demuxer stream active for each demuxer
of an external file, but this assumption will be broken for multiple
subtitles support.
2013-12-24 17:45:06 +01:00
wm4 1d86134ec1 player: slightly simplify seeking in external files
For some reason, this checked whether there are external tracks at all
before doing any seeks. Possibly this was to avoid multiple
get_main_demux_pts() calls, but calling this multiple times shouldn't be
too bad.
2013-12-24 17:45:06 +01:00
wm4 b796f2bb76 player: redo demuxer stream selection
Use struct track to decide what stream to select.

Add a "selected" field and use that in some places instead of
checking mpctx->current_track.
2013-12-24 17:44:34 +01:00
wm4 b59f2c99e7 player: fix typo in previous commit
Apparently I pushed too quickly.
2013-12-23 17:33:07 +01:00
wm4 d259d88af8 player: warn if Matroska font attachments have incorrect MIME type
Normally we shouldn't load these files. But for some reason it was added
in commit b784346e some years ago, and disabling this hack would
probably be an inconvenience. So just print a warning.
2013-12-23 17:31:42 +01:00
wm4 88fd763e18 player: simplify mp_load_per_file_config
Get rid of the stupid and error-prone buffer size calculations, use
snprintf instead of strcpy.
2013-12-22 23:25:10 +01:00
wm4 ffcf4ece6e player: move code around
The only thing that used mp_load_per_file_config() was inside
configfiles.c too, so remove the declaration from core.h and move the
function before its use.
2013-12-22 23:25:10 +01:00
wm4 2e1c423dff player: remove code duplication for auto-loaded config profiles
Code for loading "[vo.vdpau]" profiles and similar. The messages printed
on loading change, but other than that, everything should behave about
the same.
2013-12-22 23:25:10 +01:00
wm4 3782fa20ed path: change mp_splitext() semantics
Including the "." in the returned extension was too inconvenient. I
think originally, the semantics were supposed to work like in Python,
but screw this.

Also, return NULL instead of "" on failure (which is what its only user
actually seems to expect).
2013-12-22 23:25:08 +01:00
wm4 e6bea0ec5a Don't include version.h from make options.c
I find this annoying. It's the reason common/version.c exists at all.

options.c did this for the user agent, which contains the version
number. Because not including version.h means you can't build the user
agent and use it in mp_default_opts anymore, do something rather awkward
in main.c to initialize the default user agent.
2013-12-22 14:35:45 +01:00
wm4 245e5b8441 msg: remove global state 2013-12-21 23:11:12 +01:00
wm4 8e75cc3339 player: use separate msg prefix for statusline
So the user can specifically mute or unmute the status line with
--msglevel. Accidentally removed with commit 5e0c4ec3.
2013-12-21 22:13:05 +01:00
wm4 eef36f03ea msg: rename mp_msg_log -> mp_msg
Same for companion functions.
2013-12-21 22:13:04 +01:00
wm4 eba5d025d2 msg: convert defines to enum
Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
2013-12-21 22:13:04 +01:00
wm4 ad2199128d path lookup functions: mp_msg conversions
There's a single mp_msg() in path.c, but all path lookup functions seem
to depend on it, so we get a rat-tail of stuff we have to change. This
is probably a good thing though, because we can have the path lookup
functions also access options, so we could allow overriding the default
config path, or ignore the MPV_HOME environment variable, and such
things.

Also take the chance to consistently add talloc_ctx parameters to the
path lookup functions.

Also, this change causes a big mess on configfiles.c. It's the same
issue: everything suddenly needs a (different) context argument. Make it
less wild by providing a mp_load_auto_profiles() function, which
isolates most of it to configfiles.c.
2013-12-21 21:43:17 +01:00
wm4 d9b5652cac quvi: mp_msg conversions 2013-12-21 21:43:17 +01:00
wm4 0335011f11 stream: mp_msg conversions
We also drop some slave mode stuff from stream_vcd.
2013-12-21 21:43:16 +01:00
wm4 3dbc9007b0 demux: mp_msg conversions
The TV code pretends to be part of stream/, but it's actually demuxer
code too. The audio_in code is shared between the TV code and
stream_radio.c, so stream_radio.c needs a small hack until stream.c is
converted.
2013-12-21 21:43:16 +01:00
wm4 9149e2af56 playlist_parser: mp_msg conversion 2013-12-21 21:43:16 +01:00
wm4 8cd1b33a22 x11: mp_msg conversion for fstype help output 2013-12-21 21:43:16 +01:00
wm4 9428e05b3f encode_lavc: mp_msg conversions
Miss two mp_msg calls, because these conflict with future commits.
2013-12-21 21:43:16 +01:00
wm4 09e588662e options: some more mp_msg conversions 2013-12-21 21:43:16 +01:00
wm4 d57eaa7e30 av_log: mp_msg conversion
This is pretty nasty, because FFmpeg/Libav is yet another library with a
global message callback. We do something with mutexes trying to get it
done, but of course we can't actually solve this problem. If more than
one library in a process use FFmpeg/Libav, only one of them will get log
messages.
2013-12-21 21:43:16 +01:00
wm4 d8d42b44fc m_option, m_config: mp_msg conversions
Always pass around mp_log contexts in the option parser code. This of
course affects all users of this API as well.

In stream.c, pass a mp_null_log, because we can't do it properly yet.
This will be fixed later.
2013-12-21 21:05:02 +01:00
wm4 a2d144fc8f m_property: mp_msg conversions
Includes some semi-crappy hacks to avoid changing too much code for this
conversion (allowing NULL log argument for m_property_do()).
2013-12-21 21:04:21 +01:00
wm4 ed71606e65 input: rework how input sources are added
Until now, there were two functions to add input sources (stuff like
stdin input, slave mode, lirc, joystick). Unify them to a single
function (mp_input_add_fd()), and make sure the associated callbacks
always have a context parameter.

Change the lirc and joystick code such that they take store their state
in a context struct (probably worthless), and use the new mp_msg
replacements (the point of this refactoring).

Additionally, get rid of the ugly USE_FD0_CMD_SELECT etc. ifdeffery in
the terminal handling code.
2013-12-21 20:50:13 +01:00
wm4 dadf3a9a46 m_config: add custom context to includefunc callback 2013-12-21 20:50:13 +01:00
wm4 3846fc7587 sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
wm4 92f9b51426 find_subfiles: mp_msg conversions 2013-12-21 20:50:13 +01:00
wm4 15ae64d369 player/timeline: mp_msg conversions 2013-12-21 20:50:13 +01:00
wm4 5f0fbacf16 codecs: mp_msg conversion 2013-12-21 20:50:12 +01:00
wm4 1974c9b49d audio: mp_msg conversions 2013-12-21 20:50:12 +01:00
wm4 4abe6b862f mixer: mp_msg conversions 2013-12-21 20:50:11 +01:00
wm4 57359a1d62 lua: minor simplification
Using m_property_do() is more complicated, and will have to be changed
later for mp_msg conversions.
2013-12-21 20:50:11 +01:00
wm4 fb5ee5bfbe player: use MSGL_SMODE for some slave-mode stuff
Replacement for MSGT_IDENTIFY. Can't kill it off completely yet; certain
people would complain to me personally.
2013-12-21 20:50:11 +01:00
wm4 5beedf1967 image_writer: mp_msg conversions
Adds an awkward mp_log argument for error messages.
2013-12-21 20:50:10 +01:00
wm4 2eefa31c88 video/decode: mp_msg conversions
Doesn't cover vdpau/vaapi parts yet, because these are a bit messier.
2013-12-21 20:50:10 +01:00
wm4 426ebbae5f video/filter: mp_msg conversions 2013-12-21 20:50:10 +01:00
wm4 6a8fc3f5e3 msg: change --msglevel, reduce legacy glue
Basically, reimplement --msglevel. Instead of making the new msg code
use the legacy code, make the legacy code use the reimplemented
functionality.

The handling of the deprecated --identify switch changes. It temporarily
stops working; this will be fixed in later commits.

The actual sub-options syntax (like --msglevel-vo=...) goes away, but I
bet nobody knew about this or used this anyway.
2013-12-20 21:07:57 +01:00
wm4 4d4b822171 terminal: abstract terminal color handling
Instead of making msg.c an ifdef hell for unix vs. windows code, move
the code to separate functions defined in terminal-unix.c/terminal-
win.c.

Drop the code that selects random colors for --msgmodule prefixes.
2013-12-20 21:07:57 +01:00
wm4 2f6144c74b osc: use mp.send_commandv
See previous commit. Drop no-osd prefixes, as this is the default for
send_commandv anyway. send_command should probably be renamed later.
2013-12-20 18:02:01 +01:00
wm4 18930ba7dd input, lua: add functions to take pre-split input commands
So you can pass a command as list of strings (each item is an argument),
instead of having to worry about escaping and such.

These functions also take an argument for the default command flags. In
particular, this allows setting saner defaults for commands sent by
program code.

Expose this to Lua as mp.send_commandv command (suggestions for a better
name welcome). The Lua version doesn't allow setting the default command
flags, but it can still use command prefixes. The default flags are
different from input.conf, and disable OSD and property expansion.
2013-12-20 18:01:04 +01:00
wm4 25d4ae74f1 Rename getch2....c/h to terminal....c/h
"getch2" really tells nothing about what the heck this code does. It'd
be even worse when moving the rest of terminal handling code there.
2013-12-19 21:31:27 +01:00
wm4 5e0c4ec3e8 player: replace some overlooked mp_msgs
There are still some using IDENTIFY, and some without context in
configfiles.c.
2013-12-19 21:31:18 +01:00
wm4 1fe39b75db command: remove radio commands
Remove these because I'm too lazy to convert them to proper
STREAM_CTRLs. Considering that probably nobody uses radio://, caring
about this is a complete waste of time. I will add these commands back
if someone asks for them, but I don't expect this to happen.
2013-12-19 21:25:40 +01:00
wm4 4ed83fe2e5 Remove the _ macro
This was a gettext-style macro to mark strings that should be
translated.
2013-12-18 17:12:07 +01:00
wm4 94369170b8 command: better check whether file duration is available 2013-12-17 13:49:11 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +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 053c743724 Rename mp_lua.c/h to lua.c/h 2013-12-17 01:15:48 +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