Commit Graph

1034 Commits

Author SHA1 Message Date
wm4 302e8ff464 vo_opengl: don't assume there'a always 1 fbconfig on success
Seems to be a reasonable assumption, but it's probably not guaranteed.
2014-01-21 23:34:02 +01:00
Stefano Pigozzi 369e88c99b cocoa: remove dead code
This became dead code in commit 3f594c2e.
2014-01-21 23:32:07 +01:00
James Ross-Gowan 63a76b3d1c w32_common: Fix extended keys
The KF_* flags work on the HIWORD of lParam. Whoops
2014-01-21 00:41:56 +01:00
James Ross-Gowan 32c0df1b53 w32: use the w32_common keymap in terminal-win too 2014-01-19 14:42:15 +01:00
wm4 7f4a09bb85 sub: uglify OSD code path with locking
Do two things:
1. add locking to struct osd_state
2. make struct osd_state opaque

While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses
lots of osd_state (and osd_object) members. To make sure everything is
accessed synchronously, I prefer making osd_state opaque, even if it
means adding pretty dumb accessors.

All of this is meant to allow running VO in their own threads.
Eventually, VOs will request OSD on their own, which means osd_state
will be accessed from foreign threads.
2014-01-18 01:27:43 +01:00
James Ross-Gowan 80c11eba66 w32_common: add extended keys
Also VK_APPS/MP_KEY_MENU was missing.
2014-01-15 16:15:30 +01:00
James Ross-Gowan 4276e9443d w32_common: prevent decoding certain keys twice
This is a bit of a hack, but in order to prevent TranslateMessage from
seeing WM_KEYDOWN messages that we already know how to decode, move the
decoding logic to the event loop. This should fix #476, since it stops
the generation of extraneous WM_CHAR messages that were triggering more
than one action on keydown.
2014-01-15 13:32:25 +01:00
wm4 ad654f3803 options: remove --screenw and --screenh
Doesn't make any sense anymore. X11 (which was mentioned in the manpage)
autodetects it, and everything else ignored the option values.

Since for incomprehensible reasons the backends and vo.c still need to
exchange information about the screensize using the option fields,
they're not removed yet.
2014-01-11 18:58:07 +01:00
wm4 905029ec0c video/out: remove pointless x/y parameter from vo_x11_config_vo_window
This never made any real sense; the "backend" has to access vo->dx/dy
anyway.
2014-01-11 18:58:07 +01:00
wm4 d956bbc065 video/out: simplify monitor aspect handling
For some reason, this made all VO backends both set the screen
resolution in opts->screenwidth/height, and call
aspect_save_screenres(). Remove the latter. Move the code to calculate
the PAR-corrected window size from aspect.c to vo.c, and make it so that
the monitor PAR is recalculated when it makes sense.
2014-01-11 18:58:06 +01:00
wm4 3b8e457379 video/out: remove fallback handling for screensize/monitor pixel aspect
When using --monitoraspect, but either the screen width or height or
both are unknown, a fallback is applied. This is a completely useless
obscure corner case that's going to help nobody, so get it out of the
way.
2014-01-11 18:58:06 +01:00
Stefano Pigozzi 6a3ab66427 cocoa: fix window placement on secondary screens
For a long time the cocoa backend set the xinerama_x/y and used dx/dy from the
VO instance. This somewhat worked with some workarounds but wasn't really
what was supposed to be happening. Moreover 27e4360, which touched this
workaround introduced a regression.

New code doesn't set the xinerama_x/y values so that dx/dy are offsets in the
current screen (not a virtual screen composed of all the screens). The screen
reference detected during VOCTRL_UPDATE_SCREENINFO is also passed down to the
window initialization code.

Fixes #472
2014-01-11 14:06:40 +01:00
wm4 3433f25697 vd_lavc: matroska: remove weird code setting extra_huff for mjpeg
Like with the previous commit, this is probably not needed, but it's
unclear whether that really is the case. Most likely, it used to be
needed by some demuxer, and now the only demuxer left that could
_possibly_ trigger this is demux_mkv.c.

Note that mjpeg is the only decoder that reads the extra_huff option,
and nothing in libavformat actually sets the option. So maybe it's
fundamentally not needed anymore.
2014-01-11 01:49:20 +01:00
wm4 589f4871ea vd_lavc: matroska: remove weird realvideo special handling
This case can't happen with the normal realvideo codepath in
demux_mkv.c, because the code would errors out if the extradata is too
small, and everything would be broken anyway in the case the vd_lavc.c
condition is actually triggered.

It still might happen with VfW-muxed realvideo in Matroska, though.
Basically, I'm hoping this doesn't matter anyway, and that the vd_lavc.c
code was for other old demuxers, like demux_avi or demux_rm. Following
the commit history, it's not really clear for what demuxer this code
was added.
2014-01-11 01:47:14 +01:00
wm4 85e90668ae vd_lavc: minor simplification 2014-01-11 01:33:07 +01:00
wm4 4b4926bbb3 Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
Stefano Pigozzi 27e4360b0b cocoa: refactor init window positioning code 2014-01-10 20:39:25 +01:00
Nyx0uf 0f8558a723 cocoa: allow to drag and drop URLs
This commit also improves the visual feedback to the user by showing a plus
icon in the mouse cursor when dragging supported types.

Fixes #469
2014-01-10 10:48:54 +01:00
Alexander Preisinger c555b2ae55 wayland: properly empty output list 2014-01-08 22:16:41 +01:00
Alexander Preisinger 525c7f1add wayland/shm: don't crash if initialization failed 2014-01-08 22:15:40 +01:00
wm4 34abe7e255 wayland: fix crash when initialization fails
On X11, if no wayland compositor is running, wl_list_init() will never
be called. This will cause destroy_display() to segfault when trying to
iterate over the list.
2014-01-08 21:49:18 +01:00
Alexander Preisinger 3e6fdc94d6 wayland/shm: tone down warnings
Those warnings are printed far too often and actually aren't usefull at all.
2014-01-08 21:03:57 +01:00
Alexander Preisinger 4b10255008 wayland: fix memory leaks
There are still some leaks from wayland-cursor stuff, but there is no way to
free the memory as user of the cursor library.
2014-01-08 20:59:40 +01:00
Alexander Preisinger 61e5670684 wayland: cleanup registry_handle_global
The wl_registry object is already passed as a parameter. No need to create
a temporary variable.
2014-01-08 16:23:19 +01:00
Alexander Preisinger 74d9504b65 wayland: remove set_user_data from seat_listener
The user_data is passed on add_listener and can later be changed with
set_user_data. But because we don't want to change it later and because it is
the same object remove the set_user_data call.

This might be a copy&paste leftover from the initial draft for the wayland
backend.
2014-01-08 16:23:19 +01:00
Alexander Preisinger fa5f1e7800 wayland: use static consistently
Declare everything that is only needed inside wayland_common.c as static.
2014-01-08 16:23:11 +01:00
Alexander Preisinger 374f40de30 wayland: fix fullscreen & resizing for good
I added enough logic to never set ontop or fullscreen twitce.
This commit keeps also the size of the video if multiple videos are played.
If the ratio differs the width will be kept at the same size and only the
height changes.
2014-01-07 21:12:24 +01:00
wm4 2c4c912c15 wayland: silence annoying libwayland-client message
libwayland-client contains the following code [1]:

	runtime_dir = getenv("XDG_RUNTIME_DIR");
	if (!runtime_dir) {
		fprintf(stderr,
			"error: XDG_RUNTIME_DIR not set in the environment.\n");

This means this message will unconditionally and unavoidably be printed
if XDG_RUNTIME_DIR is not set. Since mpv is a terminal program, and we
want to avoid unnecessary output, work it around by not attempting to
use wayland if this environment variable is not set.

[1] http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n636
    (cd0dccd01e16fa404e03974d30ded3aebdb1c4bc)
2014-01-07 01:07:52 +01:00
wm4 326d887a41 wayland: fix some memory leaks on initialization failure
This commonly happens when initializing vo_opengl on a X11-only system.

Unfortunately, most wl_*_destroy() functions appear not to accept NULL
pointers, making partial deinitialization a pain: you have to add your
own NULL checks everywhere to avoid crashes.

xkb.context is uninitialized separately, because you can initialize it
just fine, even if the rest of input initialization fails.
2014-01-07 01:07:50 +01:00
Martin Herkt df116958df w32_common: reformat yet again
I've been told mpv prefers switch/case on the same indent level.
Sorry about the noise :P
2014-01-06 15:37:21 +01:00
Stefano Pigozzi 48e3344f84 cocoa: don't reset window size when the video size doesn't change
Fixes #459
2014-01-06 14:19:04 +01:00
Martin Herkt 1fdc7e6c37 w32_common: don't force topmost on fullscreen
Fixes #457, #444.
2014-01-06 14:12:08 +01:00
Martin Herkt 8bfb20acdc w32_common: reformat slightly
This really needs more whitespace.
2014-01-06 12:26:42 +01:00
xnoreq 43aafc61b0 w32_common: use OLE DnD for text/uri-list support
Signed-off-by: Martin Herkt <lachs0r@srsfckn.biz>
2014-01-06 12:26:28 +01:00
Alexander Preisinger 8a130e08e2 Revert "wayland/egl: use redraw callback"
Because of this commit there were problems displaying the frmase in their right
order.

This reverts commit 96e75d234a.

Conflicts:
	video/out/gl_wayland.c
	video/out/wayland_common.h
2014-01-04 21:18:46 +01:00
Alexander Preisinger 68e179bcf0 wayland: remove workaround
The changes in the vo_wayland_ontop function have no effect on the workaround.

Somehow the problem just disappeared. I guess it is because of the new control
function in gl_wayland.c where the resize happens immediatly after the event
dispatch/flush.
2014-01-04 20:54:51 +01:00
Alexander Preisinger 148918dd53 wayland: fix obvious bug in dnd code
I still don't think this is the right approach.
2014-01-04 20:28:52 +01:00
wm4 7c6bb321eb video/out: remove some code duplication between X11 and wayland
Both X11 and Wayland support the same format for drag & drop operations
(text/uri-list), and the code for that was copied from x11_common.c to
wayland_common.c. Factor it out.
2014-01-04 19:33:40 +01:00
Stefano Pigozzi 1e988c595b cocoa: handle files drag and drop on the player video view 2014-01-04 17:29:53 +01:00
Stefano Pigozzi 082c5c19a1 input: move files drag and drop to a new event.c file
event.c will be used to feed the input queue with 'global' events that don't
mesh well with the usual check_events path in mpv.
2014-01-04 17:28:55 +01:00
Alexander Preisinger bb3ea1580e wayland/egl: misc fixes and cleanups 2014-01-04 17:26:55 +01:00
Alexander Preisinger 96e75d234a wayland/egl: use redraw callback
This solves the issue where we would not receive any frame events. The
difference to my earlier tests is that now it looks like eglSwapBuffers uses
it's own event queue or something similiar along the lines. Becaues the
performance is the same as without any redraw callback.
2014-01-04 17:23:35 +01:00
Alexander Preisinger 17b52cc4a9 wayland/egl: add egl_context to the wayland state
At the moment there are visual glitches when we resize the window. This happens
because in wayland there a special function for resizing EGL windows.

To prevent the glitches move the egl_context to the wayland state in
wayland_common.h and add a new control function to gl_wayland.c to wrap the
vo_wayland_control function to check for resize events.

With the new control wrapper the glitches are gone and the resizing is fluid.
2014-01-04 16:43:58 +01:00
Alexander Preisinger f5565f33c7 wayland: Remove nonsense comment and add warning
The reason a segmentation happend here was because we couldn't get the
requested minor version. The major version is enough for differentiating
between OpenGL 3 and OpenGL 2. If it fails there is still a fallback to any
version available.

Also add a warning if we use the fallback.
2014-01-04 15:37:45 +01:00
Alexander Preisinger 340ab6cd72 wayland: move workaround to fullscreen code
Because of this workaround there was a bug in the wayland vo.
Now it works on both vos (opengl and shm) as it should.
2014-01-04 13:57:47 +01:00
Alexander Preisinger 8f241998c0 wayland: implement dropping files on the VO window
Needs some proper testing.
2014-01-04 13:48:50 +01:00
wm4 7041d8cd37 vo: dropping subtitle files on the VO window adds them as subtitle files
Note that we don't try to be clever about detecting the files as
subtitles: we just check the file extension. We could go all the way and
check the files by opening them with a demuxer, but that would probably
do more bad than good.
2014-01-04 01:27:29 +01:00
wm4 6a1b12158d x11: implement dropping files on the VO window
Drag and drop is pretty complicated (just note how the number of Atoms
in use almost doubles), so I'm not sure whether this works everywhere.

This has been written by looking at the specification [1] or what looks
like the specification, and some external example code [2]. (The latter
one has no code license, but we didn't copy any code.)

We completely ignore the "requirement" of the spec. that the filename
"must" include username and hostname, e.g. "file://user@host/path/file".
In theory, this is required because X is network transparent, but at
this point the so called network transparency is a complete joke, and
Konqueror for one didn't include hostnames in "file://" URIs.

Tested with konqueror as drop source.

[1] http://www.newplanetsoftware.com/xdnd/
[2] http://www.edwardrosten.com/code/dist/x_clipboard-1.1/paste.cc
2014-01-04 01:27:28 +01:00
wm4 0702f642d5 vo: add vo_drop_files()
Intended to be used for GUI drag & drop.
2014-01-04 01:27:28 +01:00
Stefano Pigozzi d4f37174a1 vda: fix build on OS X 10.7
Looks like on 10.8 OpenGL.h recursively includes CGLIOSurface.h. That is not
the case for 10.7 so the build was broken on that version of OS X.
2014-01-02 22:45:39 +01:00
Alexander Preisinger 52fa38079d wayland/opengl: fix garbage borders
It seems mpv draws garbage in those regions. Now we calculate the aspect and
let weston draw the black borders.
2014-01-02 20:33:39 +01:00
Alexander Preisinger ba101abfbe wayland/shm: only commit new frames
Only attach and commit new buffers. This also increases performance when
paused.
2014-01-02 20:33:31 +01:00
Alexander Preisinger e947c72fe9 wayland: don't change set fullscreen twice
Newest weston chrashes if we call set_fullscreen twice. This is a major bug
I which I should probably report.
2014-01-02 20:33:06 +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 392856ed4d vd_lavc: by default, output all frames, even corrupted ones
Set the flag CODEC_FLAG_OUTPUT_CORRUPT by default. Note that there is
also CODEC_FLAG2_SHOW_ALL, which is older, but this seems to be ffmpeg
only.

Note that whether you want this enabled depends on the user. Some might
prefer that only good frames are output, while others want the decoder
to try as hard as possible to output _anything_. Since mplayer/mpv is
rather the kind of player that tries hard instead of being "clever", set
the new default to override libavcodec's default.

A nice way to test this is switching video tracks. Since mpv doesn't
wait for the next key frame, it'll start feeding the decoder with a
packet from the middle of the stream.
2013-12-29 14:19:22 +01:00
ahodesuka 62be13b019 vo/x11_common: do not select motion events when --no-mouse-movements is set 2013-12-28 15:07:01 +01:00
wm4 f146e9b15a Revert "x11: don't set global error handler"
This reverts commit 877303aaa9.

The OpenGL 2.1 fallback for vo_opengl didn't work. Two things come
together: 1. trying to create an OpenGL 3.0 context will fail with
a GLXBadFBConfig error, and 2. X errors are fatal by default. Since
the reverted commit removed the X error handler, the mpv process was
killed, instead of continuing for the fallback.

(Note that this commit is not an exact inverse commit, since mp_msg
changed, but it does about the same thing.)
2013-12-27 23:22:46 +01:00
Stefano Pigozzi b205e63cdc Revert "cocoa: unlock on uninit"
Not sure why but this doesn't seem to be needed anymore.

This reverts commit 6ead6aa005.
2013-12-26 22:26:41 +01:00
Stefano Pigozzi 2e8b6419bd corevideo: fix video initialization when not using VDA
query_format was setting state even if wasn't the correct thing to do. Somehow
it worked by pure luck (until commit e6e6b88b6d).

Fix the initialization by setting state inside of reconfig.
2013-12-26 22:11:49 +01:00
Stefano Pigozzi c7f9c060e4 build: fix shm detection on OpenBSD
Fixes #427
2013-12-26 21:13:10 +01:00
Stefano Pigozzi a410a750c7 cocoa: sanitize window title string and guard against NULL
If the utf8 string used to create the NSString for title was invalid utf8,
-stringWithUTF8String returned nil and triggered an assertion in Cocoa's
framework code.

Sanitize the utf8 string and if the sanitation wasn't enough just avoid
crashing by not setting a title.

Fixes #406
2013-12-25 18:13:09 +01:00
Stefano Pigozzi 7d553a4c26 vo_x11/vo_xv: fix build when using --disable-xext 2013-12-25 17:07:51 +01:00
wm4 6565ec8b41 vaapi: fix initialization error code path
"res" can be uninitialized in the error case.
2013-12-23 11:22:12 +01:00
wm4 79b09592c8 vo_vdpau: fix unintended truncation of 64 bit timestamps to 32 bit
How embarrassing...

This code is inactive for all VOs other than vo_vdpau. For vo_vdpau,
this caused various issues, such as stuttering after about an hour of
running mpv; see github issue #403.
2013-12-22 18:42:19 +01:00
wm4 895932aa0a vo_vdpau: add some debugging messages for frame timing
Note that this will print a difference even with perfect sync, because
the code queues the frames _between_ vsync, probably for error margin
(though I don't understand why it uses the exact values chosen).
2013-12-22 15:49:02 +01:00
wm4 a0e89daf49 gl_lcms: actually acquire mutex
Prevents race conditions (which can happen only in theory anyway).
2013-12-22 12:25:51 +01:00
wm4 4833e92b54 vda: attempt to fix build (2)
Still no OSX here.
2013-12-22 01:44:19 +01:00
wm4 245e5b8441 msg: remove global state 2013-12-21 23:11:12 +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 893aaf8d12 vo_opengl_old: remove leftovers 2013-12-21 21:43:17 +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 0335011f11 stream: mp_msg conversions
We also drop some slave mode stuff from stream_vcd.
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 7bdee8f35e m_option: add mp_log context to sub-module print_help callback 2013-12-21 21:43:16 +01:00
wm4 9242c34fa2 m_option: add mp_log callback to OPT_STRING_VALIDATE options
And also convert a bunch of other code, especially ao_wasapi and
ao_portaudio.
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 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 5f0fbacf16 codecs: mp_msg conversion 2013-12-21 20:50:12 +01:00
wm4 95d94238f4 img_format: drop message about unknown pixel formats
Too bad.
2013-12-21 20:50:11 +01:00
wm4 823bf0029d bitmap_packer: use printf() for fatal message
This is printed right before abort(), which is bad style anyway.
Converting this to mp_msg will help nobody, and passing through a mp_log
is effort.
2013-12-21 20:50:11 +01:00
wm4 70af7ab8e5 vaapi: mp_msg conversions
This ended up a little bit messy. In order to get a mp_log everywhere,
mostly make use of the fact that va_surface already references global
state anyway.
2013-12-21 20:50:11 +01:00
wm4 9e0b84c321 vdpau: mp_msg conversions 2013-12-21 20:50:11 +01:00
wm4 64278128d8 video/fmt-conversion.c: remove unknown pixel format messages
This removes the messages printed on unknown pixel format messages.
Passing a mp_log to them would be too messy. Actually, this is a good
change, because in the past we often had trouble with these messages
printed too often (causing terminal spam etc.), and printing warnings or
error messages on the caller sides is much cleaner.

vd_lavc.c had a change earlier to print an error message if a decoder
outputs an unsupported pixel format.
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 38342436cd sws_utils: mp_msg conversions
This requires the caller to provide a mp_log in order to see error
messages. Unfortunately we don't do this in most places, but I guess we
have to live with it.
2013-12-21 20:50:10 +01:00
wm4 212ce468d8 gl_lcms: use global lock to deal with crappy lcms2 message callback
lcms2 has a global message callback for error reporting. If you don't
set this, these error messages are silently thrown away. I think we
still want the error messages, so we have to do dumb stuff to avoid
clashes. This doesn't handle the case if another library in the same
process sets the message callback, but at least this should exclude
possible memory errors when running multiple instances of mpv.
2013-12-21 20:50:10 +01:00
wm4 c8268701d9 video/out: pass along global context
Will be needed for other parts (especially in gl_lcms.c).
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 877303aaa9 x11: don't set global error handler
This has similar problems as the ALSA message callback, though in theory
we could use the Display handle to find the right mpv instance from the
global callback. It still wouldn't work if another library happens to
set the error handler at the same time. There doesn't seem much of an
advantage overriding the error handler (though it used to be required),
so remove it.
2013-12-21 17:39:40 +01:00
Martin Herkt a4fe95b0d8 w32_common: support file drag and drop 2013-12-20 20:27:56 +01:00
Martin Herkt d2e750ccd6 w32_common: fix mouse clicks
Apparently this has been broken for a year or so. The were three
reasons for the breakage here:

    1. The window dragging hack prevented any DOWN event from
       passing through since it always returned before we even got
       the button.
    2. The window style had CS_DBLCLKS in its flags, so we did not
       get any DOWN events when the OS had detected a double click
       (instead expecting us to handle a DBL event).
    3. We never sent any mouse buttons when mouse movement handling
       was disabled.
2013-12-19 21:04:10 +01:00
wm4 6ae36d3225 vf_lavfi: don't access AVFilterPad directly
Direct access is deprecated.
2013-12-18 17:13:13 +01:00
wm4 2c08bf1bd7 Reduce recursive config.h inclusions in headers
In my opinion, config.h inclusions should be kept to a minimum. MPlayer
code really liked including config.h everywhere, though, even in often
used header files. Try to reduce this.
2013-12-18 17:12:21 +01:00
11rcombs ad92c893a0 Fix OSX build; remove all remaining mpvcore references 2013-12-17 08:44:21 +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 8d5214de0a Move mpvcore/input/ to input/ 2013-12-17 01:23:09 +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 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 a59ebae2ad vf_dsize: fix bug caused by typo 2013-12-14 01:50:32 +01:00
wm4 37319ab644 video: change --video-zoom behavior
Use the scaled video size (i.e. as shown on the window) as reference for
zoom. This is the easiest way to fix different width/height scale
factors  as they happen when zooming video with a pixel aspect ratio
other than 1:1.

Also fix the unscaled mode, so that it 1. doesn't scale even with
--video-zoom, and 2. doesn't scale by small amounts when the video is
cropped by making the window smaller than the video.
2013-12-13 22:25:38 +01:00
wm4 88432b817d dec_video: fix handling of timestamp resets
This code tried to pass a still monotonic (even if not strictly
monotonic) PTS to the player, but as a result it remained stuck on
the PTS before a reset (since the PTS was lower).
2013-12-12 23:46:27 +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 5135e93d0c vo: reset some fields properly
Otherwise, next_pts2 can be == next_pts (and not MP_NOPTS_VALUE), in
which case the player thinks the first frame has duration 0. (Weird
corner case.)
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 5f0585177e vf_vo: remove VO reset on filter uninit
I don't think this has any reason to exist. It's likely that this used
to be required by the old direct rendering infrastructure. (See
git blame output.)
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 398bfbe4c1 compat: add compatibility kludge for Libav 9
Libav 9 still uses the unprefixed PIX_FMT_... symbols, but they will
probably be removed some time in the future.

There are some other deprecations we have yet to take care of, but
there are no clear replacements yet.
2013-12-08 23:51:39 +01:00
wm4 d658b115a0 vf: redo conversion filter insertion/format negotiation
Remove the inconsistent, duplicated, and insufficient scale filter
insertion code, and do it in one place instead. This also compensates
for the earlier removal of vf_match_csp() (which was in fact duplicated
code).

The algorithm to determine where to insert a filter etc. is probably the
same, though it also comes with some changes that should make debugging
easier when trying to figure out why a chain is failing to configure.

Add an "in" pseudo filter, which makes insertion of conversion filters
easier. Also change the vf->reconfig signature. At a later point, I'll
probably change format negotiation such that the generic filter code
will choose the output format, so having separate in and out params will
be useful.
2013-12-07 19:35:55 +01:00
wm4 37fbef2ccb video/filter: make vf->control non-recursive
Reason: I never liked it being recursive. Generally, this seems to
cause more problems than trouble, and is less flexible for access
outside of the chain.
2013-12-07 19:33:38 +01:00
wm4 0af9ede546 vf: remove flags from filter format status
I don't think we need these flags anymore. Simplify the code and get rid
of the vf_format struct.

There still is the vf_format.configured field, but this can be replaced
by checking for a valid image format.
2013-12-07 19:33:11 +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 75d3bf4711 video/filter: remove vf_match_csp()
This function improves automatic filter insertion, but this really
should be done by the generic filter code. Remove vf_match_csp() and all
code using it as preparation for that.

This commit temporarily makes handling of filter insertion worse for
now, but it will be fixed with the following commits.
2013-12-07 19:32:03 +01:00
wm4 6025abffda vf: remove unused function 2013-12-07 19:31:47 +01:00
wm4 a54b775f80 vf: print error when creating filter fails
Before that we relied on the filters printing their own error messages.
2013-12-07 19:31:33 +01:00
agiz a066dae19e cocoa: make borderless window resizable
Fixes #399
2013-12-07 15:43:49 +01:00
wm4 9839bb08df vf: declare config() as legacy 2013-12-05 22:58:54 +01:00
wm4 2d0a9c7af0 video/filter: remove unneeded config callbacks
They didn't do anything.

vf_screenshot.c actually did release the previous image, but that's not
really required. At worst you could take a screenshot and get an old
frame when there's no new frame yet.
2013-12-05 22:58:54 +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 b2c4653b88 vf: move norm_qscale() to the only filter which uses it 2013-12-05 22:58:53 +01:00
wm4 e3809e5b52 vf_sub, vf_dlopen: default struct is not needed 2013-12-05 22:58:53 +01:00
wm4 4904df42e9 vf: cleanup removed filter entry 2013-12-05 22:58:53 +01:00
wm4 f6e68b33bc video/filter: fix some bogus free() calls
The generic filter code frees these; recent regression.
2013-12-05 01:50:05 +01:00
wm4 e9f49ea84d options: remove legacy hacks for sub-option handling 2013-12-04 23:13:46 +01:00
wm4 47c4b5c000 vd_lavc: factor out libavcodec thread setup 2013-12-04 23:12:51 +01:00
wm4 0afd121ae6 vd_lavc: don't check required hwdec fields 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
Alexander Preisinger 6e34b0ec1f wayland: print waylands display erros
This is very usefull especially if you want to use newer wayland stuff like
wl_subsurfaces and xdg_surfaces.
2013-12-04 20:29:16 +01:00
wm4 aeed84bd27 vf_noise: reduce binary size
Same issues as in previous commit.
2013-12-04 02:17:19 +01:00
wm4 0c2a0a67b6 vf_eq: revert unintended binary size increase
The vf_eq context contains a very large lookup table, and the method of
setting default values caused the vf_eq context to be included in the
compiled code.
2013-12-04 01:51:27 +01:00
wm4 437ecc5cad video/filter: remove legacy option handling hacks
All filters now either use the generic option parser, or don't have
options. This finally finishes a transition started in 2003 (see git
commit 33b62af947).

Why are MPlayer devs so monumentally lazy? Sorry, but this takes the
cake. You had 10 years.
2013-12-04 00:07:40 +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 0d5e4ba799 vf_rotate: use option parser 2013-12-04 00:07:40 +01:00
wm4 fabfb23232 vf_pp: use option parser 2013-12-04 00:07:40 +01:00
wm4 a605fae6fa vf_ilpack: use option parser 2013-12-04 00:07:40 +01:00
wm4 e92f4d4726 vf_eq: use option parser 2013-12-04 00:07:39 +01:00
wm4 3201a40234 vf_dsize: use option parser
Mostly backwards compatible, we don't change much because we just want
to get rid of the legacy option string handling.

You can't pass an aspect as first argument anymore.
2013-12-04 00:07:39 +01:00
wm4 43a6dd1ed5 vf_divtc: use option parser 2013-12-04 00:07:39 +01:00
wm4 5b7351ee3a video/filter: remove vf_down3dright
Apparently you can get this with: stereo3d=ab[2]{l,r}:sbs[2]{l,r}

So it seems the filter is redundant and can be removed.

Also see FFmpeg commit 2f11aa141a01.
2013-12-04 00:07:39 +01:00
wm4 66f74d031d vf: remove unneeded field
This was once required for padding, because many filters didn't use
designated initializers, and initialized a removed field with NULL.
2013-12-04 00:07:39 +01:00
wm4 5b48204e84 vf_pullup: change options, reroute to vf_lavfi
The options are probably mostly backwards compatible.
2013-12-04 00:07:39 +01:00
wm4 b21cb279d7 vf_unsharp: change options, reroute to vf_lavfi 2013-12-04 00:07:39 +01:00
wm4 1acb32201b vf_phase: change options, reroute to vf_lavfi
The option change is probably backwards compatible.
2013-12-04 00:07:39 +01:00
wm4 6a2eeedc4c vf_noise: reroute to vf_lavfi
Unfortunately, this forces filtering both luma and chroma, because
otherwise we'd have to deal with libavfilter's vf_noise weird handling
of YUV vs. RGB formats. Would we e.g. filter luma only, it would filter
red in RGB mode only, because it goes by component and there's no way to
distinguish YUV and RGB by just using the filter's options.
2013-12-04 00:07:39 +01:00
wm4 ad950be415 vf_stereo3d: reroute to vf_lavfi 2013-12-04 00:07:39 +01:00
wm4 54d67581d7 vf_hqdn3d: change options, reroute to vf_lavfi 2013-12-04 00:07:39 +01:00
wm4 7d04327e71 vf_gradfun: reroute to vf_lavfi
Also update the manpage. We changed defaults and added a suboption quite
some time ago, and we forgot to update the manpage at all.
2013-12-04 00:07:39 +01:00