Commit Graph

158 Commits

Author SHA1 Message Date
wm4 fd49edccf8 command: add properties for retrieving OSD dimensions 2013-10-05 22:46:55 +02:00
wm4 1be863afdb mplayer: fix some issues with playlist_prev command
You couldn't jump to the first entry in the playlist, if that entry was
marked as "too short". But this is usually fine, because it doesn't get
into the way of the user. (This feature is meant to allow being able to
jump backwards through the playlist even if a file immediately stops
playback right after initialization, not to prevent playing these files
at all.)

Also, apply the skip logic when wrapping around the playlist when going
backwards. This happens with --loop, because looping pretends the
playlist is infinitely repeated forwards and backwards (as long as the
playlist_prev/next commands are concerned).

Also add some comments.
2013-10-05 22:46:55 +02:00
wm4 c3ea08a2d7 mplayer: fix cleanup if VO initialization fails
Just specifying a VO that doesn't exist would make it crash.
Regression caused by commit 6a0408b.
2013-10-05 22:46:14 +02:00
wm4 6a0408be68 mplayer: don't keep previous video frame with --force-window
When for example switching off the video stream, and --force-window is
used, forcefully reconfigure the VO. This will reset the size, and will
clear the window with black.

Needed some effort, because you don't always want to clear the window
on "discontinuity" points like going to a next file: this would
introduce some flicker.
2013-10-04 00:27:54 +02:00
wm4 93b712fa8a command: add sub_seek input command
Essentially reuses the sub_step command, and is subject to the same
restrictions.

Seems to behave a bit strange sometimes, but generally works.
2013-10-02 21:05:04 +02:00
wm4 df5706f156 input: remove strange offset from commands enum
A leftover from 10 years of refactoring.
2013-10-02 20:48:50 +02:00
wm4 a4998e08ef command: don't let "avsync" property print NOPTS value
Can happen when seeking in audio files with attached picture.
MP_NOPTS_VALUE doesn't really make sense outside of mpv internals, so
don't return it.
2013-10-02 20:43:13 +02:00
wm4 4da7630824 mplayer: osd bar depends on VO, not video decoding
The OSD bar wasn't displayed, and instead a fallback message was shown.
2013-10-02 20:39:26 +02:00
wm4 d24bf6e349 mplayer: make VO interaction work in --idle mode
Didn't handle VO events, didn't handle OSD message management.

There is probably still some strangeness left. --idle mode was never
made for direct interaction.
2013-10-02 20:38:10 +02:00
wm4 ca2b05c0fb mplayer: change default window size for --force-window
Closer to the ubiquitous 16:9 screen aspect ratio. Requested by ChrisK3.
2013-10-02 20:34:41 +02:00
wm4 886c3ef999 command: subtitle support depends on VO, not video decoding
We can render subtitles if a VO is open. Whether we're decoding video
(i.e. if mpctx->sh_video is set) doesn't really matter.

Subtitle display with --force-window still doesn't quite work yet,
because there's nothing to actually force redrawing of subtitles in this
mode.
2013-10-02 01:39:28 +02:00
wm4 f01744ac4e core: add --force-window
This commit adds the --force-window option, which will cause mpv always
to create a window when started. This can be useful when pretending that
mpv is a GUI application (which it isn't, but users pretend anyway), and
playing audio files would run mpv in the background without giving a
window to control it.

This doesn't actually create the window immediately: it only does so
only after initializing playback and when it is clear that there won't
be any actual video. This could be a problem when starting slow or
completely stuck network streams (mpv would remain frozen in the
background), or if video initialization somehow is stuck forever in
an in-between state (like when the decoder doesn't output a video
frame, but doesn't return an error either). Well, we can pretend only
so much that mpv is a GUI application.
2013-10-02 01:39:28 +02:00
wm4 3c0333978e core: don't require "refresh" seek for --keep-open
Seeking normally resets the VO and throws away the currently displayed
frame, so if you seek outside the video with --keep-open enabled, the
window would normally be "stuck" and not redraw properly, because there
is no source video frame that could be redrawn. To deal with this, a
precise seek to the position of the last displayed video frame was
issued.

This usually worked, but it can fail for formats where seeking is broken
or not possible (consider reading from a pipe).

Fix this by changing the semantics for vo_seek_reset(): now the video
frame is remembered even after seeking.

Note that this changes behavior a little when trying to seek outside of
a file with --keep-open enabled. Since no actual seek is done anymore,
the video will remain "frozen" on the previous position, and you can't
unpause or framestep to see the video between current position and
actual end of the video. If users complain, I might revert this commit.
2013-10-02 00:42:18 +02:00
wm4 2c6a3cb1f2 mplayer: fix looping of very short files
Commit 884c179 attempted to make it possible to skip backwards through
the playlist, even for files which fail to intitialize, or play for a
very short time. This was also used to prevent mpv from looping forever
and doing nothing if --loop=inf is used, and no file in the playlist is
playable.

This broke looping of very short files, because mpv was assuming that
this case happened. But there are legitimate use cases.

Fix this by making the looping case special. Instead of checking whether
playback was "very short", check whether something could be decoded and
displayed/played. If yes, allow looping.
2013-09-29 21:10:45 +02:00
ChrisK2 0e68ff4fad osc: add options to show OSC only when FS/windowed
The boolean-options showWindowed and showFullscreen can now be set in plugin_osc.conf to control the behaviour.

enhancement for #262
2013-09-27 20:12:13 +02:00
wm4 b7f01957ec network: add options to control TLS verification 2013-09-27 18:09:30 +02:00
wm4 ede652774e input: translate mouse position to OSD space early
Until now, mouse positions were just passed to the core as-is, even if
the mouse coordinates didn't map to any useful coordinate space, like
OSD coordinates. Lua scripting (used by the OSC, the only current user
of mouse input) had to translate mouse coordinates manually to OSD space
using mp_get_osd_mouse_pos(). This actually didn't work correctly in
cases mouse coordinates didn't map to OSD (like vo_xv): the mouse
coordinates the OSC got were correct, but input.c was still expecting
"real" mosue coordinates for mouse areas.

Fix this by converting to OSD coordinates before passing the mouse
position to the core.
2013-09-27 15:39:28 +02:00
wm4 3871024ec3 input: handle MOUSE_LEAVE specially
Do this so that MOUSE_LEAVE can't be combined with other keys. (E.g.
keep 'w' pressed, then move the mouse outside of the mpv window; it will
print a warning what w-MOUSE_LEAVE is not mapped.)
2013-09-27 15:33:47 +02:00
wm4 0d90dd07ff input: more mp_msg conversion
It appears the last run missed all mp_tmsg().

Since the command parser also prints messages, it needs a new parameter
to pass a log context. We go the easy way and just require the input_ctx
to be passed, and use its mp_log.
2013-09-27 15:30:59 +02:00
ChrisK2 2970352b25 osc: Prevent OSD style options from messing with the OSC styles
Should fix #259
2013-09-26 18:29:14 +02:00
Ben Boeckel 828a952c9a matroska: fix uninitialized memory accesses with ordered chapters
There is uninitialized memory access if the actual size isn't passed
along. In the worst case, this can cause a source to be loaded against
the uninitialized memory, causing a false count of found versus required
sources, preventing the "Failed to find ordered chapter part" message.
2013-09-26 18:20:32 +02:00
wm4 5a837ced0b video: let sh_video->disp_w/h always be container size
Nothing really accesses it. Subtitle initialization actually does in a
somewhat meaningful way, but there container size is probably fine, as
subtitles were always initialized before the first video frame was
decoded.
2013-09-26 17:33:57 +02:00
wm4 9a55c4e70c video: let sh_video->aspect always be container aspect ratio
Now writing -1 to the 'aspect' property resets the video to the auto
aspect ratio. Returning the aspect from the property becomes a bit more
complicated, because we still try to return the container aspect ratio
if no frame has been decoded yet.
2013-09-26 17:29:14 +02:00
ChrisK2 0a0d7f43a5 Add the on-screen-controller
Signed-off-by: wm4 <wm4@nowhere>
2013-09-26 01:29:15 +02:00
wm4 6048f87e3c Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).

This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.

One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-26 01:28:58 +02:00
wm4 b0cc3c2cf4 Fix previous commit
This time it broke because I didn't actually test compiling vo_vaapi.c,
and it was using a macro from mp_image.h, which implicitly assumed
FFALIGN was available. Screw that too, and copy the definition of
ffmpeg's FFALIGN to MP_ALIGN_UP, and move these macros to mp_comnon.h.
2013-09-25 22:44:12 +02:00
wm4 200fb7eceb vaapi: fix compilation with Libav
The code using FFSWAP was moved from vo_vaapi.c to vaapi.c, which didn't
include libavutil/common.h anymore, just libavutil/avutil.h. The header
avutil.h doesn't include common.h recursively in Libav, so it broke
there.

Add FFSWAP as MPSWAP in mp_common.h (copy pasted from ffmpeg) to make
sure this doesn't happen again. (This kind of stuff happens all too
often, so screw libavutil.)
2013-09-25 22:22:02 +02:00
wm4 72fbd846db options: allow selecting the libass shaper
I'm using the word "languages" instead of "scripts" in the manpage, but
I think that's easier to understand with a smaller amount of
descriptions.
2013-09-25 21:42:29 +02:00
wm4 1e4f08c50c options: make --ass-hinting a choice, instead of using magic numbers
options.c still doesn't use the constants defined by the libass headers,
but it's still better than exposing those to the user directly.
2013-09-25 21:40:35 +02:00
wm4 641e94cd27 vaapi: allow GPU read-back with --hwdec=vaapi-copy
This code is actually quite inefficient: it reuses the (slow, simple)
screenshot code. It uses an inefficient method to read the image
(vaGetImage() instead of vaDeriveImage()), allocates new memory for
each frame that is read, and it tries all image formats again each
time.

Also, in my tests it always picked NV12 as image format, which is not
ideal if you actually want to filter the video, and vo_xv can't handle
this format without conversion either.

However, a user confirmed that it worked for him, so everything is fine.
2013-09-25 13:53:42 +02:00
xylosper 39d1ab82e5 vaapi: add vf_vavpp and use it for deinterlacing
Merged from pull request #246 by xylosper. Minor cosmetic changes, some
adjustments (compatibility with older libva versions), and manpage
additions by wm4.

Signed-off-by: wm4 <wm4@nowhere>
2013-09-25 13:53:42 +02:00
wm4 fdd5140f43 command: fix short buffer when handling of long property names
This wasn't enough and could lead to a cut off message shown on OSD.
Just make it dynamic, since we already use dynamic memory allocation
at this point anyway.
2013-09-24 21:26:05 +02:00
wm4 cc7f8ee620 mplayer: attempt to make playback resume work with DVD/BD
The problem with DVD/BD and playback resume is that most often, the
filename is just "dvd://", while the actual path to the DVD disk image
is given with --dvd-device. But playback resume works on the filename
only.

Add a pretty bad hack that includes the path to the disk image if the
filename starts with dvd://, and the same for BD respectively. (It's a
bad hack, but I want to go to bed, so here we go. I might revert or
improve it later, depending on user feedback.)

We have to cleanup the global variable mess around the dvd_device.
Ideally, this should go into MPOpts, but it isn't yet. Make the code
paths in mplayer.c take MPOpts anyway.
2013-09-22 03:31:25 +02:00
wm4 b0f7a26f1a network: fix rtsp playback
By default, libavformat uses UDP for rtsp playback. This doesn't work
very well. Apparently the reason is that the buffer sizes libavformat
chooses for UDP are way too small, and switching to TCP gets rid of this
issue entirely (thanks go to Reimar Döffinger for figuring this out).

In theory, you can set buffer sizes as libavformat options, but that
doesn't seem to help.

Add an option to select the rtsp transport, and make TCP the default.

Also remove an outdated comment from stream.c.
2013-09-22 02:40:29 +02:00
wm4 eda596a3f9 command: when changing volume while muted, show an extra message on OSD
So nobody has to wonder why everything is silent, even if they raise the
volume.
2013-09-21 00:08:38 +02:00
wm4 897d4b58a1 command: when changing a property, allow showing an extra OSD message
This is for properties that normally show a bar, and thus do not show an
OSD message (as per classic mplayer behavior). Setting an extra_msg
allows showing an OSD message anyway, except if OSD messages are
explicitly suppressed.

This refactors the whole show_property_osd() function a bit, and
replaces the weird sep field with a more general method.
2013-09-21 00:07:42 +02:00
wm4 f988c63003 m_property: add a way to switch on property values in property expansion
Allows for example: --status-msg='${?pause==yes:(Paused) } ...' to
emulate the normal terminal status line. It's useful in other situations
too.

I'm a bit worried about extending this mini-DSL, and sure hope nobody
will implement a generic formula evaluator at some point in the future.
But for now we're probably safe.
2013-09-20 23:09:43 +02:00
wm4 ab706f9969 m_property: rearrange code 2013-09-20 22:26:08 +02:00
wm4 99576ac483 command: don't append, but prepend deinterlace filter by default
In most cases, it's better if deinterlacing happens before any other
filtering, so prepend the filter to the user's filter list, instead
of appending it.
2013-09-20 16:48:08 +02:00
wm4 0611c43b97 command: use a list of potential deinterlacer filters
Instead of hardcoding a single filter. This might be helpful for
modeling the vaapi deinterlacer as a video filter. The idea is that a
software deinterlacer would be tried first, and if that fails (because
vaapi hardware decoding uses HW surfaces, which a software deinterlacer
does not accept), the vaapi filter would be tried.
2013-09-20 15:09:29 +02:00
wm4 3e5b632559 Merge branch 'volume_restore' 2013-09-20 13:48:36 +02:00
wm4 0162271725 mixer: make struct opaque
Also remove stray include statements from ao_alsa and ao_oss.
2013-09-20 13:23:25 +02:00
wm4 327a779a81 mixer: allow accessing volume and mute property on disabled audio
The volume is set as soon as the audio chain is created again. This
works only in softvol mode. For system wide volume or otherwise
externally user controllable volume, this code is intentionally
disabled. It would be extremely weird if changing volume (while audio is
not initialized) would do nothing, and then suddenly change it when the
audio chain is created.

There's another odd corner case: the user-set volume will be thrown away
if it's set before the _first_ audio chain initialization. This is
because the volume restore logic recognizes a change from nothing to
softvol or an AO, and circumventing that would require additional code.
Also, we don't even know the start volume before that point.

Forcing the volume with --volume will can override the volume set during
no-audio mode, depending on the situation.
2013-09-20 13:23:25 +02:00
wm4 b8e42ae13c mixer: restore volume with playback resume
Note that this is intentionally never done if the AO or softvolume is
different, or if the current volume control method is thought to control
system wide volume (such as ALSA) or otherwise user controllable (such
as PulseAudio). The intention is to keep things robust and to avoid
messing with the user's audio settings as far as possible, while still
providing the ability to resume volume if it makes sense.
2013-09-20 13:23:25 +02:00
wm4 6599677b98 mplayer: rename a somewhat misnamed function 2013-09-19 17:28:27 +02:00
wm4 38b2c97fd6 mixer: refactor, fix some aspects of --volume handling
Refactor how mixer.c does volume/mute restoration and initialization.
Move to handling of --volume and --mute to mixer.c. Simplify the
implementation of these and hopefully fix bugs/strange behavior related
to using them as file-local options (this uses a somewhat dirty trick:
the option values are reverted to "auto" after initialization). Put most
code related to initialization and volume restoring in probe_softvol()
and restore_volume(). Having this code all in one place is less
confusing.

Instead of trying to detect whether to use softvol at runtime, detect it
at initialization time using AOCONTROL_GET_VOLUME (same with mute,
AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work
if the GET variants work. Hopefully this is always the case.

This is also preparation for being able to change volume/mute settings
if audio is disabled, and for allowing restoring value with playback
resume.
2013-09-19 14:32:09 +02:00
wm4 296531ad00 mixer: minor refactoring
Let struct mixer access access MPOpts to simplify some things. Rename
some variables and functions. There should be no functional changes.
2013-09-19 14:31:43 +02:00
wm4 5249cccfcf Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
2013-09-18 19:56:15 +02:00
Stefano Pigozzi af018f7e4f macosx: move bundle path stuff to path-macosx.m
This makes the code uniform to how stuff was handled for Windows in 1cb55ceb.
2013-09-18 19:30:11 +02:00
wm4 1cb55cebf9 path, win32: redo user configfile path handling
Remove the ifdef hell from mp_find_user_config_file(). Move the win32
specific code (for MinGW and Cygwin) to path-win.c. The behavior should
be about the same, but I can't be sure due to lack of testing and
because the old path.c code was hard to follow. (I expect those who care
about windows will fix things, should issues pop up - sorry.)

One difference is that the new code will always force MPV_HOME. It looks
like the old code preferred the mpv config dir in the exe dir if it
exists.

Also, make sure MP_PATH_MAX has enough space, even if the equivalent
wchar_t string is not 0-terminated with PATH_MAX (because apparently the
winapi doesn't require this). (Actually, maybe we should just kill all
uses of PATH_MAX/MP_PATH_MAX.)
2013-09-18 19:08:51 +02:00