Commit Graph

158 Commits

Author SHA1 Message Date
wm4 b97d10a839 path: fix undefined behavior
The homepath variable was static, and its value was set to a stack
buffer. This means a second invocation of the function would trigger
undefined behavior. Moreover the stack buffer always went out of scope
before homepath was used.
2013-09-18 19:08:51 +02:00
wm4 6da11789ae mplayer: read subtitle packets as soon as possible
Call update_subtitles() on every iteration of the playloop, so that
subtitle packets are read as soon as possible, instead of every time a
video frame is displayed. This helps in case the packet queue is swamped
with subtitle packets, which can happen with certain insane mkv files.
The change will simply cause the subtitle queue to be emptied on each
playloop iteration.

The timestamps update_subtitles() uses for display are the same before
and after this commit. (Important for files which have subtitle packets
with timestamps or duration not set.)
2013-09-16 00:46:14 +02:00
wm4 4f400d2b85 command: force video refresh when changing aspect
Pausing the player and changing the aspect would leave the VO without a
frame to display.
2013-09-15 22:03:29 +02:00
wm4 9aa206a90e screenshot: change %w format to be more like %t
Instead of containing a format string within %w{...}, simply allow %w
to specify one item of a time format string. This is simpler, more like
other format specifiers (%t),  and probably easier to use too.
2013-09-15 19:07:35 +02:00
wm4 884c179177 mplayer: attempt to skip playlist entries which can't be played
This is for situations when repeated attempts at playing a playlist
entry failed, and playlist navigation becomes impossible due to that.
For example, it wasn't possible to skip backwards past an unplayable
playlist entry:

    mpv file1.mkv doesntexist.mkv file3.mkv

You couldn't skip back to file1.mkv from file3.mkv. When running a
single "playlist_prev" command, doesntexist.mkv would be played, which
would fail to load. As reaction to the failure to load it, the next file
would be played, which is file3.mkv.

To make this even worse, the file could successfully load, but run only
for a split second. So just loading successfully isn't good enough.

Attempt to solve this by marking problematic playlist entries as failed,
and by having playlist_prev skip past such playlist entries. We define
failure as not being able to play more than 3 seconds (or failing to
initialize to begin with). (The 3 seconds are in real time, not file
duration.)

"playlist_prev force" still exhibits the old behavior.

Additionally, use the same mechanism to prevent pointless infinite
reloading if none of the files on the playlist exist. (See github issue

All in all, this is a heuristic, and later adjustments might be
necessary.

Note: forward skips (playlist_next) are not affected at all. (Except for
the interaction with --loop.)
2013-09-15 05:03:55 +02:00
wm4 aa43405020 screenshot: make it possible to format playback time in various ways 2013-09-15 02:51:19 +02:00
wm4 58cff195e7 mp_common: add function which accepts a format string to format playback time 2013-09-15 02:51:17 +02:00
wm4 a87298e501 mplayer: don't run heartbeat command while paused
This is commonly used to disable the screensaver with broken/non-
standard X screensavers. During pause, the screensaver should not be
disabled, so not calling this command while paused seems sensible.

See github issue #236.
2013-09-15 02:13:54 +02:00
wm4 534842b694 av_log: show ffmpeg "info" messages with -v only
They are rarely useful in my opinion.

This commit was mainly motivated by this message:

    Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using a tool like VirtualDub or avidemux to fix it.

It's what's left over from the "Invalid and inefficient vfw-avi..."
warning that used to be printed when playing avi/divx files. Although
the new message is much better, it's still rather useless and poses
more questions than it answers. Besides, nobody wants to remux a file
when playing it, especially not if playback appears to be completely
fine. (There are some claims that these files raise CPU usage, but even
my old crappy CPU can decode low res avi/divx files at real time at
about x35 playback speed.)
2013-09-15 00:43:43 +02:00
Stefano Pigozzi 47715fd1f7 mplayer: m_option: fix clang -Wformat compiler warning
Code was using %d format instead %zd to print size_t data.
2013-09-14 20:49:55 +02:00
wm4 a0cdb1ea45 mplayer: print a message when writing watch_later config for resume 2013-09-13 21:36:19 +02:00
wm4 728816e87b mplayer: change "Playing" message printed before playback start
Change it from "Playing file." to "Playing: file". The idea is that it
looks nicer without that trailing dot. (See github issue #229.)
2013-09-13 21:32:29 +02:00
wm4 ea1200111d core: restore user-set video and audio filters with resume functionality
This requires adding a function that converts the filter list back to a
string.
2013-09-13 21:32:28 +02:00
wm4 6cec60a454 core: add --deinterlace option, restore it with resume functionality
The --deinterlace option does on playback start what the "deinterlace"
property normally does at runtime. You could do this before by using the
--vf option or by messing with the vo_vdpau default options, but this
new option is supposed to be a "foolproof" way.

The main motivation for adding this is so that the deinterlace property
can be restored when using the video resume functionality
(quit_watch_later command).

Implementation-wise, this is a bit messy. The video chain is rebuilt in
mpcodecs_reconfig_vo(), where we don't have access to MPContext, so the
usual mechanism for enabling deinterlacing can't be used. Further,
mpcodecs_reconfig_vo() is called by the video decoder, which doesn't
have access to MPContext either. Moving this call to mplayer.c isn't
currently possible either (see below). So we just do this before frames
are filtered, which potentially means setting the deinterlacing every
frame. Fortunately, setting deinterlacing is stable and idempotent, so
this is hopefully not a problem. We also add a counter that is
incremented on each reconfig to reduce the amount of additional work per
frame to nearly zero.

The reason we can't move mpcodecs_reconfig_vo() to mplayer.c is because
of hardware decoding: we need to check whether the video chain works
before we decide that we can use hardware decoding. Changing it so that
this can be decided in advance without building a filter chain sounds
like a good idea and should be done, but we aren't there yet.
2013-09-13 21:32:28 +02:00
Stefano Pigozzi fe7fed590a macosx: always active bundle path lookup if cocoa is active
This is not really something you want to disable anyway. If there is no bundle
the code already does it's falbacks anyway.
2013-09-12 18:45:40 +02:00
Martin Herkt be96a25dad mpvcore/path: Fix non-MinGW builds
Well that was dumb.
2013-09-12 18:26:14 +02:00
Martin Herkt 63c61500b8 mpvcore/path: Fix config path handling on Windows
Previously, mpv incorrectly used the %HOME% environment variable on
MinGW to determine the current user’s home directory. This is wrong;
the correct variable to use would be %HOMEPATH%, which would however
still be wrong since application data goes into the application data
directory, not the user’s home. This patch makes it use the local
AppData path instead of reading an environment variable.

This however exposed another problem (which also affected users who
actually had the %HOME% variable set):
b2c2fe7a37 (discussed in issue #95) introduced some changes that
make mpv load user config files from the executable path on Windows.
The problem with this change is that config_dir was still declared
static, so once a config file had been found in the executable path,
it would set config_dir to an empty string, so mpv would dump e.g.
watch_later data straight into the user’s home. This commit also
fixes that.

One side effect of this is that mpv no longer considers the “mpv”
subdirectory in the executable path (that behavior resulted from
the homedir variable always being empty), unless it is somehow
unable to determine the local AppData path.
2013-09-12 18:02:57 +02:00
wm4 739cd61024 input: fix accidental NULL pointer dereference
This could happen if the input queue was full, and an unmapped key was
used, or something like this.

Possibly fixes github issue #224.
2013-09-11 18:32:36 +02:00
Stefano Pigozzi 763f33424e input: convert to new msg API 2013-09-10 21:31:02 +02:00
Stefano Pigozzi 9f01797eac mplayer: remove duplicated mouse autohide check 2013-09-10 21:24:22 +02:00
wm4 fc18c1ba6e mplayer: print libquvi results in verbose mode
Helpful for debugging.
2013-09-10 17:21:59 +02:00
wm4 6a850b0264 quvi: restore playback position when switching formats
This simply issues a seek after reloading.
2013-09-10 16:50:19 +02:00
wm4 cf0e852fcd quvi: coerce libquvi 0.4 support into allowing format switching
libquvi 0.4 doesn't allow us listing the formats supported by a
streaming site without doing additional network accesses, so switching
formats was not supported with it. (It's different with libquvi 0.9.)

But the most important case is switching between SD and HD. Usually,
--quvi-format=default will get SD, while --quvi-format=best gives HD.
Use this, and pretend that an URL supported by libquvi 0.4 supports both
of these. "cycle quvi-format" will switch between these. If the user
specifies something else via --quvi-format, this is included in the list
of switchable formats additionally to "default" and "best".
2013-09-10 16:38:34 +02:00
wm4 328b951019 command: make title property unavailable if there's no support
Instead of returning 0 if the stream doesn't have title info, make the
property unavailable.
2013-09-10 15:39:05 +02:00
wm4 bf71e28d6b mplayer: mentioned --list-options in --help output
It's annoying for users if you can't get a list of options with --help,
but on the other hand, printing all options would be overkill. So just
mentioned --list-options.
2013-09-10 15:19:37 +02:00
wm4 35fd083828 demux: retrieve per-chapter metadata
Retrieve per-chapter metadata, but don't do much with it. We just make
the metadata of the _current_ chapter available as chapter-metadata
property. Returning the full chapter list with metadata would be no
problem, except that the property interface isn't really good with
structured data, so it's not available for now.

Not sure if it's worth it, but it was requested via github issue #201.
2013-09-08 07:43:23 +02:00
wm4 ba07000b88 demux: refactor tag handling
Make the code somewhat reuseable, instead of bound to a single demuxer
instance. The plan is to add support for per-chapter tags later.
2013-09-08 06:32:48 +02:00
wm4 1aae5981a7 core: remove a minor memory leak 2013-09-08 05:17:05 +02:00
wm4 9ec9bff4c1 mplayer: cosmetics: split some code off of run_playloop()
run_playloop() is already stuffed enough. This function is still quite
big, but all the other code shares various variables, so it's not as
easy to split.
2013-09-08 03:04:21 +02:00
wm4 cecbd8864e mplayer: add --cursor-autohide-fs-only option
This option makes the cursor always visible in windowed mode.
Apparently, this is what (some?) Windows and OSX users expect. It's
disabled by default for now.

Restructure the cursor hide logic a bit for this purpose.
2013-09-08 03:03:58 +02:00
wm4 68e331851a options: remove --(no-)mouseinput option
I have no idea why it exists, as it's redundant to --(no-)mouse-movements.
2013-09-08 03:03:58 +02:00
wm4 0509532d70 options: cosmetics: move cursor_autohide_delay definition
No functional changes.
2013-09-08 03:03:58 +02:00
wm4 f1b5198b35 input: rearrange code
Let all key events go through mp_input_feed_key() internally, and also
do double click and MP_INPUT_RELEASE_ALL handling there. Move
check_autorepeat() to where it's actually used.
2013-09-08 01:50:14 +02:00
wm4 ac927e39bf input: don't deliver mouse events if mouse area is not set
This caused the OSC to be always visible at startup on X11:
- EnterNotify event send a mouse event to input.c
- OSC has not completely initialized yet, and no mouse area is set
- mouse event is dispatched to "showhide" OSC section
- OSC becomes visible, regardless of mouse position

Fix this by treating the mouse area as empty if it's not set, instead of
infinite as it was before this commit. This means an input section must
set a mouse area to receive mouse events at all. We also have to change
the default section to receive mouse events with the new behavior.

Also, if MOUSE_MOVE is unmapped (or mapped to something that doesn't
parse), and produces no command, the mouse position wouldn't be updated
(because the mouse position is bound to input commands), so we have to
generate a dummy command in this case.

(This matters only for the OSC, On Screen Controller, which isn't merged
yet, so these changes shouldn't have much effect right now.)
2013-09-08 01:50:14 +02:00
wm4 0a9919fa2e input: merge consecutive mouse move events
Might give better behavior on load.
2013-09-08 01:49:59 +02:00
wm4 681e829793 input: split queue_add() function
Split it into queue_add_head() and queue_add_tail(). Gets rid of the
weird, rarely used boolean parameter.
2013-09-08 01:49:59 +02:00
wm4 6c19067362 input: redo what input events can be dropped
Until now, any command was dropped as soon as the input queue was full,
and the command was not an abort command (i.e. a command that exits the
player or goes to the next file).

This could cause issues with key down events (especially mouse buttons)
not being released.

Change it so that key up events can never be dropped. This is a bit
involved, because we know whether a key maps to an abort command only
after interpreting it, and interpreting it changes global state, which
in turn requires undoing the event if the input is dropped. Refactor
the code a bit to move more functionality into interpret_key() to make
this easier.
2013-09-08 01:49:59 +02:00
wm4 5f00c3cf20 input: remove separation between key and control queue
This is actually quite useless. It also allows the control queue to
starve the key queue, because the control queue is always checked first.
2013-09-08 01:49:57 +02:00
wm4 c7ab8ea513 mplayer: don't auto-load explicitly loaded subtitle files
Even if a subtitle was explicitly loaded with -sub, it was still auto-
loaded (if auto-loading applied to that file). Fix this by explicitly
checking whether a file is already loaded.

The check is maximal naive and just compares the filenames as strings.
The change in find_subfiles.c is so that "-sub something.ass" happens to
work (auto-loading prepended a "./" to it, so the naive filename
comparison check didn't work).
2013-09-07 20:34:49 +02:00
wm4 082ea0de12 mp_core: fix a comment
track.demuxer is never NULL (anymore).
2013-09-07 20:34:49 +02:00
wm4 c4b935adf7 mplayer: remove unused mp_add_subtitles() parameter 2013-09-07 20:34:49 +02:00
wm4 8894a4b0d2 command: make options writeable in idle mode
Until now, options could be accessed as properties via "options/name",
but the access was read-only. Change it so that write access is possible
in --idle mode. (All options have to support setting options at that
time, simply because of the way MPlayer designed per-file options.
During playback, normal properties take care of changing things,
including things backed by options.)

This is work in progress. There are some issues: at least setting the
"vf" and "af" options won't work for strange reasons.
2013-09-07 20:34:49 +02:00
wm4 d77a924434 command: remove some unneeded code
chapter_display_name() always returns something.

The "chapter < -1" check is not needed, because this is done at the
start of the function.
2013-09-07 20:34:49 +02:00
wm4 ae64f29930 options: fix --volume option range, add some explanations to manpage
The --volume option accepted values up to 10000, but internally, the
value is always clipped to 0-100 range. What makes this even worse is
that --softvol-max suggests that it extends the range of --volume, which
is not the case. (And passing a volume larger than 100 to --volume
didn't even print a warning.)
2013-09-07 08:54:12 +02:00
wm4 db79db8444 input: don't print warning if certain internal keys are not bound
This affects MOUSE_MOVE and MOUSE_LEAVE. Both are needed internally
(such as for the OSC), but not really useful for input.conf. Since the
warning has the purpose of notifying the user that a key is unmapped and
what key name to use for setting up a binding in input.conf, the warning
is rather useless in this case. It's also annoying in combination with
the
--no-input-default-bindings option, since that removes the default
bindings to "ignore" for these keys.
2013-09-06 00:45:03 +02:00
wm4 2d369a39dd mplayer: try to resume playback only if a resume file actually exists
Well, this was dumb. The resume message was printed for every file,
whether a resume config file existed or not.
2013-09-05 18:00:30 +02:00
Martin Herkt 5de277e423 mpvcore/input: Fix build without pthreads 2013-09-05 13:04:40 +02:00
wm4 88503a12c2 mplayer: print informative message when resuming playback
In particular, this informs the user how to disable this.
2013-09-04 18:16:47 +02:00
wm4 62ab8441a6 mplayer: make --save-position-on-quit save only on quit
When enabling --save-position-on-quit, playback position stored not only
on quit, but in any case playback of a file was stopped. This includes
going to the next file with playlist navigation commands.

After some discussion on IRC, it turned out that nobody thought this was
good behavior. Disable it, and really make it save only on quit.

Maybe the option is useless now, as the user could remap the CLOSE_WIN
key binding. On the other hand, CLOSE_WIN sounds and _is_ a bit obscure.
2013-09-04 18:12:11 +02:00
wm4 b8d498da15 mplayer: always write playback resume info, even at start/end of file
Before this commit, the player didn't write resume info if the playback
position was within the first or last percent of the file.

This was sometimes annoying, and with playlist resume can lead to
unintuitive behavior. (It wouldn't resume the playlist if the currently
played file was at 0-1% or 99-100%, even if you were in the middle of a
playlist.)

Moreover, the "percent > 99" check is a bit bogus anyway, because 100
(in integer) is rarely reached.

Drop the check, and make sure using --save-position-on-quit won't write
resume info when reaching EOF. The latter check is needed to make sure
playback of the file starts at beginning when playing it again after
EOF.
2013-09-04 17:08:52 +02:00
wm4 191ac00af2 path: better check for mp_is_url()
The previous check just searched for a "://" substring. This was quite
bad, because "://" can be a valid part of a path. Later, I added
special handling for filenames starting with "." and "/", so that you
could reliably pass arbitrary filenames to mpv, no matter how messed
up they were.

Even though it doesn't really matter in practise anymore, this is still
crap, so add a more reliable check instead.
2013-09-04 16:28:02 +02:00
wm4 3bb217d5e9 mplayer: allow resuming from playlist
This includes the case of passing multiple files to command line
(internally this is the same as loading a playlist).

Resuming works by finding the first playlist entry that can be resumed.

Alternative implementations would be possible, such as hashing the
playlist contents. But this implementation is simpler, and doesn't have
the disadvantage that changes to the playlist (like appending entries)
will throw away the resume point.

This makes loading large playlists a bit slower, because it has to look
into ~/.mpv/watch_later/ for every entry. Loading a 15000 entries
playlist now increases from 150ms to 400ms. Considering you rarely load
playlists this big with mpv (because it's impractical considering the
terminal and non-GUI nature of the player), this is probably ok.
2013-09-04 16:15:09 +02:00
wm4 b0f8e03f17 command: unescape URLs for ${filename} and ${media-title}
Undo URL percent encoding if the filename appears to be an URL. This
will fix display of the actual filename in some cases.

We don't put any effort into checking whether the URL is really percent
encoded, because we don't really know how the protocol handler is going
to interpret the URL. For stream_lavf, we probably can't know. Still,
from the perspective of this commit, it seems to make sense to assume
they are percent encoded.
2013-09-04 16:15:09 +02:00
wm4 efc5ac17bf path: add a common mp_is_url() function
Remove the duplicated code.
2013-09-04 16:15:08 +02:00
wm4 ed3187b41a mplayer: handle --reset-on-next-file=""
The option list contains an empty string member with this option value,
so ignore that. I'm not sure whether the option list should maybe be
empty in this case, but it could be the wrong thing in case of other
options.
2013-09-04 00:43:14 +02:00
wm4 7af15f2d6e mplayer: don't let playback resume force options that are file local
This happens by default with pausing: if a file was paused when doing
quit_watch_later, then resume and unpause, then the file played after
that would start in paused mode. This is because the pause option is
backed up at thr wrong place, so it backs up the state from resuming,
instead of whatever it was set to before that.
2013-09-04 00:31:14 +02:00
Stefano Pigozzi 71335183ec mplayer: fix race condition on uninit with Cocoa
NULL out Cocoa's reference to mplayer's input context before deallocating it
2013-09-01 23:03:51 +02:00
Stefano Pigozzi 3e1115569e input: unlock playloop thread during select
This allows other threads to use mp_input_put_key without blocking if the
playloop is doing the 500ms select call (i.e.: during pause).
Makes Cocoa GUI responsive again (regression since 2d363c3).
2013-09-01 22:48:09 +02:00
Stefano Pigozzi 134c3e148c osx: use MP_KEY_* instead of MK_* for media keys
In 213ad5d6c I added `MK_*` key bindings overlooking the fact that mpv already
has `MP_KEY_*` for media keys.
2013-09-01 20:57:40 +02:00
wm4 6a55fa6793 input: allow window dragging even if mouse is in a mouse area
If the input section is enabled with MP_INPUT_ALLOW_VO_DRAGGING, then
the  VO will be allowed to drag the window with mouse button down +
mouse move even if the mouse is inside the section's mouse area.
2013-09-01 20:17:51 +02:00
wm4 0c7978cf9c input: deal with spurious X11 LeaveNotify events
If the mpv window is unfocus, clicking on the OSC should focus the
window (done by the window manager) and allow interaction with the OSC.
But somehow X sends a spurious LeaveNotify event, immediately followed
by an EnterNotify event. This happens at least with IceWM. The result is
that the OSC will disappear (due to receiving MOUSE_LEAVE). The OSC will
stay invisible, because EnterNotify isn't handled, and there's nothing
that could make the OSC appear again.

Solve this by handling EnterNotify. We cause a redundant MOUSE_MOVE
event to be sent, which triggers the code to make the OSC visible. We
have to remove the code from input.c, which ignores redundant mouse move
events.

Since the code ignoring redundant mouse move events is still needed on
Windows, move that code to w32_common.c. The need for this is documented
in the code, also see commit 03fd2fe. (The original idea was to save
some code by having this code in the core, but now it turns out that
this didn't quite work out.)
2013-09-01 20:17:51 +02:00
wm4 11d2f723d5 input: print more debug infos, raise loglevel 2013-09-01 20:17:51 +02:00
wm4 42fa7cbbf9 input: stay in current input section if mouse button is down
Normally, moving the mouse outside of the mouse area of an input section
will send mouse events somewhere else (because input section mouse areas
are similar to windows/widgets in real GUI toolkits). This was done even
if a mouse button was held down. This is quite different from how GUI
toolkits behave.

Change the code so that if a mouse button is down, the mouse area of the
current input section can't be left. Releasing the mouse button (while
the mouse pointer is outside of the mouse area) will actually leave the
mouse area.

As a side-effect, this commit also tests more often whether the current
mouse input section is valid. This is needed to make releasing a mouse
button trigger the mouse input section change.
2013-09-01 20:17:51 +02:00
wm4 61ba810752 input: add some more X11 multimedia/internet keys
These keys can be found on various "multimedia" and "internet" keyboard.
X defines many keycodes, so I'm not adding all, just what I found on my
own keyboard.

Other key codes can be added on request.
2013-09-01 20:17:51 +02:00
wm4 e366c1a9c6 keycodes: cosmetics: align indentation 2013-09-01 20:17:51 +02:00
wm4 ead525e17a input: comment all default bindings in input.conf
I suspect most users will just copy etc/input.conf when they want to
remap some default bindings. But usually this means the user even copies
bindings he doesn't care about, and it's better if the user maps only
the bindings in his input.conf the user intends to remap.

Comment all bindings in etc/input.conf. Since this file also defines the
builtin defaults and is baked into the mpv binary, we have to do
something to get them anyway, even though they are commented. Do this by
having input.c "uncomment" the bindings in the baked in input.conf. (Of
course this is done only for the builtin config, not configs loaded from
disk.)
2013-09-01 20:17:50 +02:00
Stefano Pigozzi 2d363c39b9 input: lock for accessing struct input_ctx
The previous code was locking only the input queue. That was too weak since it
didn't protect the input_ctx data structure. So remove the locking on the queue
and lock all the public functions that interact with the input_ctx.

The private functions and public functions that do not act on the input_ctx
(there are quite some functions doing mp_cmd manipulations for instance) are
not locked.

Some changes by wm4. Use a recursive mutex, and restructure some code to be
less annoying with locks, such as converting code to single return, or
making use of the recursive mutex.
2013-09-01 18:02:45 +02:00
wm4 4d62b90f88 video: add unscaled mode with --video-unscaled 2013-09-01 03:46:28 +02:00
wm4 c89b162462 input: fix --no-input-default-bindings
The option did nothing. This was probably broken with 5b38a52.
2013-08-29 19:07:20 +02:00
wm4 33c03c4d0a demux_playlist: port ini reference playlist parser
Port it from playlist_parser.c to demux_playlist.c. Also, change the m3u
parser to drop whitespace from the trailing part of the line (will make
it work properly with windows line endings).

(I hoped that this would make MMS URIs with http instead of mmsh
prefixes work, but it doesn't. Instead, it leads to a playlist loop. So
solving this issue would require a change in ffmpeg, probably.)
2013-08-28 23:08:10 +02:00
wm4 8be9c49fcd core: add a playlist demuxer
Modeled after the old playlist_parser.c, but actually new code, and it
works a bit differently.

Demuxers (and sometimes streams) are the component that should be used
to open files and to determine the file format. This was already done
for subtitles, but playlists still use a separate code path.
2013-08-26 10:09:45 +02:00
wm4 53b5227270 audio: make internal audio format 0 an invalid format
Having to use -1 for that is generally quite annoying.

Audio formats are created from bitmasks, and it can't be excluded that
0 is not a valid format. Fix this by adjusting AF_FORMAT_I so that it
is never 0. Along with AF_FORMAT_F and the special formats, all valid
formats are covered and guaranteed to be non-0.

It's possible that this commit will cause some regressions, as the
check for invalid audio formats changes a bit.
2013-08-26 10:09:41 +02:00
wm4 47e92b2f88 video: handle video output levels with mp_image_params
Until now, video output levels (obscure feature, like using TV screens
that require RGB output in limited range, similar to YUY) still required
handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new
mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE
is not needed at all anymore in VOs that use the reconfig callback. The
result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the
colormatrix related properties (basically, for display on OSD).  For
other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config
instead of twice.
2013-08-24 19:40:18 +02:00
wm4 c3a0721d09 video/out: don't require VOs to handle screenshot aspect specially
This affects VOs which just reuse the mp_image from draw_image() to
return screenshots. The aspect of these images is never different
from the aspect the screenshots should be, so there's no reason to
adjust the aspect in these cases.

Other VOs still need it in order to restore the original image
attributes.

This requires some changes to the video filter code to make sure that
the aspect in the passed mp_images is consistent.

The changes in mplayer.c and vd_lavc.c are (probably) not strictly
needed for this commit, but contribute to consistency.
2013-08-24 17:03:06 +02:00
wm4 0d8a62c08d Some more mp_msg conversions
Also add a note to mp_msg.h, since it might be not clear which of the
two mechanisms is preferred.
2013-08-23 23:30:09 +02:00
wm4 1e649f353b demux: remove unused audio_delay parameter from demux_seek()
Used to be needed by demux_avi.
2013-08-22 19:14:26 +02:00
Stefano Pigozzi 94b4a80d45 mp_msg: fix typo in message level for new msg API macros 2013-08-22 11:54:28 +02:00
wm4 45365ad99f mplayer: replace "D:" in status line with "Late:"
Too many people thought "D:" really meant number of dropped frames. But
it's actually the number of frames where the playloop thought it'd be
a good idea to drop them. Of course this does nothing if frame dropping
is disabled, but even with normal frame dropping, this doesn't indicate
whether a frame was _really_ dropped. (Looks like libavcodec doesn't
even give us this information reliably? The decode function can return
no frame in case of codec delay due to threading and such.)
2013-08-21 18:42:18 +02:00
wm4 74e3a29606 options: replace --edition=-1 with --edition=auto
Originally, the objective of this commit was changing --edition to be
1-based, but this was cancelled. I'm still leaving the change to
demux_mkv.c though, which is now only of cosmetic nature.
2013-08-21 18:41:59 +02:00
wm4 c8a7140c73 mplayer: start track IDs from 1 rather than 0
Completely pointless, but makes ChrisK happy for some reason.

Track ID 0 is now rejected by the option parser itself.
2013-08-21 18:32:42 +02:00
wm4 e49abd2fa2 command: simplify video brightness/gamma/etc. handling a bit
We don't need to store the offsets of the options corresponding to the
properties, because the option-property bridge knows about this already.

The check against 1000 was for the case if e.g. the --brightness option
is not used. Always overwrite the option value instead, both when
querying and setting the property. (This is needed to make the settings
persistent even if vf_eq is used and the video chain is reinitialized.)

This commit assumes that VFCTRL_SET_EQUALIZER is always paired with
VFCTRL_GET_EQUALIZER (likewise for VOCTRL), which is the case.
2013-08-20 16:23:44 +02:00
wm4 f05206f899 m_option: make "add speed 0.1" command work
Was broken since the speed property was switched from float to double.
2013-08-19 22:32:25 +02:00
wm4 fb022db423 mp_core: declare seek_type enum outside of nested struct
cosmetic change. See previous commit.
2013-08-19 22:32:25 +02:00
wm4 c5e66dde33 m_option: rename struct member named "new"
Cosmetic change to allow C++ code to include this header.

See github issue #195.
2013-08-19 13:03:08 +02:00
wm4 216e8320b0 video: make it possible to scale/pan the video by arbitrary amounts
Add --video-align-x/y, --video-pan-x/y, --video-scale options and
properties. See the additions to the manpage for description and
semantics.

These transformations are intentionally done on top of panscan. Unlike
the (now removed) --panscanrange option, this doesn't affect the default
panscan behavior. (Although panscan itself becomes kind of useless if
the new options are used.)
2013-08-19 13:03:08 +02:00
wm4 67704e2977 options: remove --panscanrange option
This option allowed you to extend the range of the panscan controls, so
that you could essentially use it to scale the video. This will be
replaced by a separate option to set the zoom factor directly.
2013-08-19 12:55:53 +02:00
wm4 4579cce768 mplayer: reshuffle on every loop if --loop and --shuffle are used
See github issue #194.

Unfortunately, this breaks the property that going back in the playlist
always works as expected. This changes, because the playlist_prev
command will work on the reshuffled playlist, instead of loading the
previously played files in order. If this ever becomes an issue, I
might revert this commit.
2013-08-19 01:05:49 +02:00
wm4 6bbcb861fa mplayer: don't make restored options from quit_watch_later per-file local
Consider:

    mpv file1.mkv file2.mkv

and file1.mkv is restored from an earlier session when quit_watch_later
was used. Then all restored options were reset when file2.mkv is played,
even if the user changed them during playback. This affects for example
the fullscreen setting.

Make it so that after finishing a resumed file, the previously restored
settings are not reset again. (Which means only resuming will forcefully
overwrite the settings.)
2013-08-17 21:56:39 +02:00
Philip Sequeira b018c7d936 command: more intuitive chapter seek behavior
If close to chapter start, skipping back goes to previous chapter (no change).
If more than <threshold> seconds in, skipping back will now go to the beginning
of the current chapter instead.

The threshold is set by the new option --chapter-seek-threshold and defaults to
5 seconds.  A negative value disables the new functionality.
2013-08-17 21:32:52 +02:00
Philip Sequeira 8cebec6262 command: allow seek to "chapter -1"
This will seek to the start of the file regardless of whether the first real
chapter starts there or not.
2013-08-17 21:32:41 +02:00
wm4 76963781df m_option: add missing copy callback for some option types
One reaosn for this is that this broke proper handling of .defval, since
m_option_copy did nothing for these option types.
2013-08-17 19:52:33 +02:00
wm4 c890b8942d m_option: make defval const
There's really no reason why it shouldn't.
2013-08-17 19:50:45 +02:00
wm4 3e6ed76935 sub: don't print detected charset if it's UTF-8
Too noisy. This also fixes that iconv() was called if "utf8" was used
as codepage.
2013-08-15 23:40:04 +02:00
wm4 f9271c2ca2 sub: make --subcp=enca the default. 2013-08-15 23:40:03 +02:00
wm4 fe3c445112 sub: allow specifying a fallback codepage if input is not UTF-8
Normally, --subcp always forces conversion. This really always forces
conversion, even if the UTF-8 check on the input succeeds.

Extend the --subcp to allow codepages as fallback if UTF-8 doesn't
work. So, for example --subcp=utf8:cp1250 will use UTF-8 if the input
looks like UTF-8, and will fall back to use cp1250 if the UTF-8 check
fails.

I think this should actually be the default, but on the other hand,
this changes the semantics of the option, and a user would actually
expect --subcp to force conversion, rather than silently using UTF-8
if that happens to work.
2013-08-15 23:40:03 +02:00
wm4 00f735d5cb bstr: make UTF-8 check stricter
Don't accept overlong sequences. Don't accept codepoints past the
maximum unicode codepoint. Don't accept the UTF-16 surrogate codepoints.

I'm not sure if there are more codepoints that are defined to be
invalid, but we just want to make libavcodec happy, so this is enough.

(libavcodec's subtitle converter checks for valid UTF-8 and throws up
and dies if it's not - now we want to use bstr_sanitize_utf8_latin1() to
force valid UTF-8, so the strictness of our UTF-8 parser has to match at
least that of the libavcodec's check.)

I'm not sure whether the min test is actually 100% correct.

Note that libavcodec also treats BOM codepoints as invalid. This is
definitely a bug: the BOM is really just "zero-width non-breaking space"
redefined by Microsoft, but it is perfectly valid to appear in the
middle of a string. Official Unicode has merely deprecated the old
usage of the BOM codepoint, and didn't make it illegal. Besides, the
string could be from the start of a file, so even this check doesn't
make sense even with libavcodec's insane logic. We don't copy this bug.
2013-08-15 23:40:03 +02:00
wm4 acb51c9243 sub: if charset detection fails, treat it as broken UTF-8
Broken UTF-8 in this context means we treat it as UTF-8, but we also
interpret broken UTF-8 sequences as Latin1.

Also, run our own UTF-8 check function before the charset detectors.
This prevents from ENCA's UTF-8 check possibly messing up (like
detecting 7-bit clean UTF-8 as ASCII, or other things). It also takes
care of UTF-8 detection if no charset detector (ENCA, libguess) is
compiled in, and it lets us deal better with cut-off UTF-8 sequences.
2013-08-15 23:40:02 +02:00
wm4 380fa71fc7 bstr: add UTF-8 validation and sanitation functions 2013-08-15 23:40:02 +02:00
Giuliano Schneider e437ecf729 input: fix build if HAVE_PTHREADS is undefined 2013-08-15 11:22:30 +02:00
Stefano Pigozzi 11dad6d44b macosx: remove platform specific input queue
Since last commit the input queue in the core is thread safe, so there is no
need for all this platform specific stuff anymore.
2013-08-13 23:02:43 +02:00