Commit Graph

35038 Commits

Author SHA1 Message Date
wm4 58cc0f637f input: do property expansion for all input command string arguments
Also add a "raw" prefix for commands, which prevents property expansion.
The idea is that if the commands are generated by a program, it doesn't
have to know whether the command expands properties or not.
2013-05-18 17:45:55 +02:00
wm4 3e6ec6dfa5 input: accept input command prefixes in any order
This is more consistent, and doesn't bother the user with ordering
rules when new prefixes are added.

Will break obscure uses of legacy commands: if the command is supposed
to be translated by the legacy command bridge, and if that command uses
one of the pausing* prefixes, the command can't be parsed. Well, just
use the new commands in this case.
2013-05-18 17:45:55 +02:00
wm4 b0a60b7321 video/filter: fix option parser memory leak
This happens only if an option actually allocates memory (like strings).

Change filter API such that vf->priv is free'd by vf.c instead by the
filters. vf.c will free the option values as well.
2013-05-18 17:45:55 +02:00
wm4 f569d245ba core: allow changing filter filters at runtime
Add the "vf" command, which allows changing the video filter chain at
runtime. For example, the 'y' key could be bound to toggle deinterlacing
by adding 'y vf toggle yadif' to the input.conf.

Reconfiguring the video filter chain normally resets the VO, so that it
will be "stuck" until a new video frame is rendered. To mitigate this, a
seek to the current position is issued when the filter chain is changed.
This is done only if playback is paused, because normal playback will
show an actual new frame quickly enough.

If vdpau hardware decoding is used, filter insertion (whether it fails
or not) will break the video for a while. This is because vo_vdpau
resets decoding related things on vo_config().
2013-05-18 17:45:54 +02:00
wm4 d1b37aff32 m_option: allow -vf ""
With the current semantics, there's no reason to disallow this.

(Although in my opinion, -vf should rather map to -vf-add than -vf-set,
however that is an independent issue from this change.)
2013-05-18 17:45:54 +02:00
wm4 6b42881791 m_option: add -vf-toggle
Works like -vf-add, except if a filter already exists and has the same
parameters, it's removed instead of added.

Not really useful on the command line itself, but will make sense for
runtime filter changing in the following commit.
2013-05-18 17:32:37 +02:00
wm4 1dad548640 m_option: allow using -vf-del with a name
Until now, -vf-del required a list of indexes. This was a bit
inconvenient, so add support for using filter names too. Also simplify
the code a bit, doing the change would have been too painful otherwise.
2013-05-18 17:32:37 +02:00
wm4 41d38b3a2b vd_lavc: change VDCTRL_REINIT_VO behavior
This tried to use ctx->pic (last decoded AVFrame) for the frame bounds.
However, if av_frame_unref() on the AVFrame is called, the function will
reset _all_ AVFrame fields, even those which are not involved with
memory management. As result, mpcodecs_config_vo() was called with 0
width/height, which made the function exit early, instead of
reconfiguring the filter chain.

Go back to using mpcodecs_config_vo() directly. (That's what it did
before this VDCTRL was originally introduced; the original reason for
it disappeared.)
2013-05-18 17:32:37 +02:00
wm4 c970f5c328 video: rename VDCTRL_RESET_ASPECT to VDCTRL_REINIT_VO
Same thing, and VDCTRL_REINIT_VO implies more generic use.
2013-05-18 17:32:37 +02:00
wm4 f921a675ae manpage: document af_* commands
Except af_cmdline, which is too questionable.
2013-05-18 17:32:37 +02:00
wm4 e40ae27a87 mp_image: align image allocation height
vo_vdpau actually reads past the image allocation when displaying a
non-mod 2 420p image. The vdpau API specifies that VdpVideoSurfacePutBitsYCbCr()
requires a height that is a multiple of 4, and surface allocations are
automatically rounded.

So allocate video images with rounded height. libavutil does the same,
so images coming directly from the decoder or from libavfilter are no
problem. (libavutil does this alginment explicitly, not just because the
decoded image size is aligned to macroblocks.)
2013-05-17 23:45:55 +02:00
wm4 883d03fffd cfg-mplayer: fix some option flags 2013-05-17 00:16:27 +02:00
Stefano Pigozzi f9ed43077f cocoa_common: vo_corevideo: fix window initialization
vo_corevideo doesn't create a hidden window to perform OpenGL extensions
detection. This caused the window to always stay close.
2013-05-16 23:46:31 +02:00
Rudolf Polzer 2958ae39ca vf_dlopen examples: slightly simply the framestep filter
We don't need config() ;)
2013-05-16 20:21:54 +02:00
Rudolf Polzer cfa0515e0e vf_dlopen examples: add framestep filter
Usage: -vf dlopen=./framestep.so:5
2013-05-16 20:14:50 +02:00
wm4 d4987bf5eb options: fix exit code when using help options
Basically a cosmetic change. Fixes github issue #88.
2013-05-15 16:02:52 +02:00
wm4 a32cc6fcb2 mplayer: potentially fix main() return value
The main() function is special, and omitting the return statement would
make it always return 0. And also, mpv_main() actually never returns, it
calls exit() through exit_player() instead. But change it anyway,
because it looks misleading.
2013-05-15 15:48:40 +02:00
wm4 db69e0edd4 options: add -V as alias for --version
This is a common convention.
2013-05-15 15:34:11 +02:00
wm4 759b3bdc47 options: use case-sensitive comparsion for options
This is better for consistency, and also allows using -V as alias
for --version.
2013-05-15 15:30:06 +02:00
wm4 894288457b options: add --version 2013-05-15 15:14:24 +02:00
wm4 4930681e7a command: use "title" tag for media-title property if available
In connection with the previous commit, this will use the Matroska title
for the media-title property.
2013-05-15 15:06:21 +02:00
wm4 c2f96b020d demux_mkv: export Matroska title element as metadata 2013-05-15 15:00:52 +02:00
Paul B Mahol 83570fc0fb add osd-scale command
Signed-off-by: Paul B Mahol <onemda@gmail.com>

Modified to add docs for --osd-scale option, and adjusted to the
previous commit by wm4.
2013-05-14 23:32:07 +02:00
wm4 f562a41ca2 command: simplify sub OSD update
We can just update all OSD elements in these cases. This way we can also
reuse it for commands which need to update the OSD for other reasons.
2013-05-14 23:14:23 +02:00
Rudolf Polzer 3edb563b23 m_option: fix segfault in parse_chmap 2013-05-14 14:45:06 +02:00
wm4 bc8815d69f vd_lavc: hack-fix vdpau decoding with non mod 16 video
This changes the code so that it does the same as MPlayer, mplayer2
and mpv before ref-counted AVFrame. The problem is that get_buffer2
is called with aligned frame dimensions, while get_buffer didn't. This
breaks the mpv video frame size change detection.
2013-05-14 01:10:05 +02:00
Stefano Pigozzi 647291bab2 cocoa_common: order front window only when invisible [2]
Followup to 8df7127. This refines the condition for front ordering the
condition to account for minimized or hidden state where the window should go
to the front only as a consequnce of user interaction.
2013-05-14 00:16:57 +02:00
wm4 4931085a1b chmap: fix oddity due to ambiguous 6.1 ffmpeg channel layout
FFmpeg (as well as Libav) have two layouts called "6.1":
AV_CH_LAYOUT_6POINT1 and AV_CH_LAYOUT_6POINT1_BACK. We call them "6.1"
and "6.1(back)". Change the default layout for 7 channels as well to
return the same layout as av_get_default_channel_layout(). (Looks a bit
questionable, but for now it's better to follow FFmpeg.)
2013-05-13 23:55:39 +02:00
Stefano Pigozzi 8df712781c cocoa_common: order front window only when invisible
Window creation code always made mpv the front window. Fix it to make it front
only if the window is currently invisible.

Fixes #84
2013-05-13 23:49:00 +02:00
Stefano Pigozzi d2960d2e96 cocoa_common: don't use recursive locking
This was in the original change set for the threadsafety changes but I forgot
to squash it in.
2013-05-13 23:41:03 +02:00
Stefano Pigozzi 4878be02ad cocoa_common: remove pointless locking when using -fs
When using --fs `vo_cocoa_fullscreen` was called from the primary thread. This
occurred inside `vo_cocoa_config_window` which is scheduled for excution on the
primary thread with libdispatch).

All of this caused spam from NSRecursiveLock in standard output.
2013-05-13 23:41:03 +02:00
Stefano Pigozzi 4ce808cc2c cocoa_common: fix a bug in window dragging state
When going in and going out of full screen the player lost information on the
movableByWindowBackground behaviour. There were some hacks in place to fix it
but they were broken with the recent native fullscreen changes in 74c15ec6.

This commit removes the problem at the root and removes the hacks. The delegate
method `isMovableByWindowBackground` seems to be called after setFrame and
setPresentationOptions so change fs state in opts before that.

Fixes #83
2013-05-13 23:41:03 +02:00
wm4 a39d369c25 audio: fix ALSA 4 channel surround output
It turns out that ALSA's 4 channel layout is different from mpv's and
ffmpeg's 4.0 layout. Thus trying to do 4 channel output led to incorrect
remixing via lib{av,sw}resample.

Fix the default layouts for the internal filter chain as well, although
I'm not sure if it matters at all.
2013-05-13 18:27:09 +02:00
wm4 636e1edd9e af_lavrresample: fix inverted condition
This was added with the previous commit. It likely broke some obscure
special-cases, which (hopefully) do not happen with normal playback.
2013-05-13 18:05:37 +02:00
wm4 279f4b59dc audio: fix compilation with older libavresample versions
The libavresample version of the current Libav stable release lacks the
avresample_set_channel_mapping() function. (FFmpeg's libswresample seems
to be fine, because they added swr_set_channel_mapping() first.)

Add a cheap/slow workaround to do channel reordering on our own. We
don't use the recently removed MPlayer code (see commit 586b75a),
because that is not generic enough.

The functionality should be the same as with full-featured
libavresample, and any differences are bugs. It's probably slower,
though.
2013-05-13 00:39:07 +02:00
Stefano Pigozzi 35c8f7b608 cocoa_common: fix deadlock when calling resize_redraw
Fixes #82
2013-05-12 23:51:58 +02:00
wm4 bb569b56de ao_coreaudio: fix switched parameters 2013-05-12 22:00:32 +02:00
wm4 989b482bd6 core: re-add -dumpstream as --stream-dump
Apparently useful for dumping DVD. Could also be used to rip streams
with libquvi and such, but for that there are better tools. Actually
I doubt there aren't better tools to dump DVDs, but whatever, this was
a feature request, so I don't need a good reason.
2013-05-12 21:57:02 +02:00
wm4 faad40aad9 core: add --stream-capture
This is a partial revert of commit 7059c15, and basically re-adds
--capture, just with different option names and slightly different
semantics.
2013-05-12 21:51:57 +02:00
wm4 e6e5a7b221 Merge branch 'audio_changes'
Conflicts:
	audio/out/ao_lavc.c
2013-05-12 21:47:55 +02:00
wm4 48f9431151 af: improve filter chain setup retry limit
af_reinit() is responsible for inserting automatic conversion filters
for channel remixing, format conversion, and resampling. We don't
require that a single filter can do all these (even though
af_lavrresample does nearly all of this, sometimes af_format has to be
used instead for format conversions). This makes setting up the chain
more complicated, and a way is needed to prevent endless appending of
conversion filters if a conversion is not possible.

Until now, this used a stupidly simple yet robust static retry limit to
detect failure. This is perfectly fine, and the limit (20) was good
enough to handle about ~5 filters. But with more filters, and if each
filter requires 3 additional conversion filters, this would fail. So
raise the limit to 4 retries per filter. This is still stupidly simple
and robust, but won't arbitrarily fail if the filter count is too large.
2013-05-12 21:45:05 +02:00
wm4 9dd9ccbd8d audio: add double sample format
To make this easier, get rid of the direct mapping of the
AF_FORMAT_BITS_MASK bit field to number of bytes. This way we can throw
away the unused AF_FORMAT_48BIT and don't have to add ..._56BIT.
2013-05-12 21:24:57 +02:00
wm4 f5aec5a2a7 ao_alsa: set fallback if format unknown
The snd_pcm_hw_params_test_format() call actually crashes in alsa-lib if
called with SND_PCM_FORMAT_UNKNOWN, so the already existing fallback
code won't work in this case.
2013-05-12 21:24:57 +02:00
wm4 ecc6e379b2 audio/out: channel map selection
Make all AOs use what has been introduced in the previous commit.

Note that even AOs which can handle all possible layouts (like ao_null)
use the new functions. This might be important if in the future
ao_select_champ() possibly honors global user options about downmixing
and so on.
2013-05-12 21:24:57 +02:00
wm4 ab8f28a672 audio: add channel map selection function
The point is selecting a minimal fallback. The AOs will call this
through the AO API, so it will be possible to add options affecting
the general channel layout selection.

It provides the following mechanism to AOs:
- forcing the correct channel order
- downmixing to stereo if no layout is available
- allow 5.1 <-> 5.1(side) fallback
- handling "unknown" channel layouts

This is quite weak and lots of code/complexity for little gain. All AOs
already made sure the channel order was correct, and the fallback is of
little value, and could perhaps be done in the frontend instead, like
stereo downmixing with --channels=2 is handled. But I'm not really sure
how this stuff should _really_ work, and the new code will hopefully
provides enough flexibility to make radical changes to channel layout
negotiation easier.
2013-05-12 21:24:57 +02:00
wm4 34a139d495 ao_pulse: move format setup code 2013-05-12 21:24:57 +02:00
wm4 5c0c141a55 af_lavrresample: avoid channel reordering with unknown layouts
If one of the input or output is an unknown layout, but the other is
known, it can still happen that channels are remixed randomly. Avoid
this by forcing default layouts in this case. (Doesn't work if the
channel counts are different.)
2013-05-12 21:24:56 +02:00
wm4 9d1f5e8e9f manpage: update --channels 2013-05-12 21:24:56 +02:00
wm4 20a1d0bc5b ao_openal: use channel map instead of ALSA fixed layout
Now mpv's channel map is used to map each channel to a speaker. This
allows in theory for playback of any layout for which ao_openal
actually has a speaker defined. Also add the back-center (BC) speaker,
which allows playback of 6.0 audio. Enabling more layouts by adding
other speakers would be possible, but I'm not sure about the speaker
positions.
2013-05-12 21:24:56 +02:00
wm4 d9582ad0a4 audio/filters: add af_force
Its main purpose is for testing in case channel layout stuff breaks, in
particular in connection with old audio filters.
2013-05-12 21:24:56 +02:00