summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* command: add vo-configured propertywm42014-10-241-1/+10
| | | | | | | | | So a client API user can know when a window is created or destroyed. Also might be useful for the OSC: it could disable itself if video is disabled. Before this commit, there were only indirect ways of detecting this.
* player: disable --force-window if VO failswm42014-10-241-1/+5
| | | | Otherwise, it'd retry creating the window all the time.
* video: send MPV_EVENT_VIDEO_RECONFIG on uninitwm42014-10-241-0/+1
| | | | | This event basically means "something about video changed", and uninit is certainly an important change.
* player: adjust uninit order of componentswm42014-10-241-6/+7
| | | | | | | | Most things should be allowed to access the client API unconditionally (for example for sending events), so move destroying the client API down. Also, mp_uninit_ipc() should happen before the point at which all clients are shutdown, or there will be a small time window in which new clients can be created after destroying them all.
* command: fix debug outputwm42014-10-241-1/+1
| | | | It was a bit ugly/annoying.
* osc: make text squuezing layout dependentChrisK22014-10-241-31/+48
| | | | | | | | | | | Wether and when the text of a button should be squeezed when it gets too long can now be configured in the layout: lo.button.maxchars = <number> nil = no squeezing (default) If the button text has more than <maxchars> characters, it will be squeezed to the estimated width of <maxchars>.
* osc: make tooltip_an default propertyChrisK22014-10-241-2/+3
|
* player: fix exiting if both audio and video fail initializingwm42014-10-234-8/+22
| | | | | | | | | | | | | The player was supposed to exit playback if both video and audio failed to initialize (or if one of the streams was not selected when the other stream failed). This didn't work; for one this check was missing from one of the failure paths. And more importantly, both checked the current_track array incorrectly. Fix these issues, and move the failure handling code into a common function. CC: @mpv-player/stable
* lua: fix non-sensewm42014-10-231-1/+1
| | | | Let's actually test our code next time.
* client API: print properties set with -vwm42014-10-231-0/+7
| | | | | Useful for debugging. Considered doing this in command.c, but it's easier here.
* command: print executed commands with -vwm42014-10-231-0/+2
|
* command: add a "cached" mode to sub_addwm42014-10-231-1/+22
| | | | | This avoids reloading a subtitle if it was already added. In all cases, the subtitle is selected.
* osc.lua: add “bottombar” and “topbar” layoutsMartin Herkt2014-10-231-5/+281
|
* command: return error on invalid/absent IDs with ff-sid/ff-aidwm42014-10-231-2/+6
| | | | | | Instead of just disabling the stream. Also, check if the selected track has the right type, or we'd crash.
* player: show busy symbol on OSD if seeking takes too longwm42014-10-221-2/+7
| | | | Same as it's done on the terminal.
* lua: don't let temporary values take the place of argumentswm42014-10-221-1/+13
| | | | | | | Because Lua is so terrible, it's easy to confuse temporary values pushed to the Lua stack with arguments if the arguments are checked after that. Add a hack that should fix this.
* command: make reverse cycle_values match up with forward onewm42014-10-211-4/+3
| | | | | | | | | The behavior of reverse cycling (with the "!reverse" magic value) was a bit weird and acted with a "delay". This was because the command set the value the _next_ command should use. Change this and make each command invocation select and use the next command directly. This requires an "uninitialized" special index in the counter, but that is no problem at all.
* command: fix video-rotate update when pausedwm42014-10-211-11/+11
| | | | | | | | | | | Due to the way video-rotate currently works, the state will be automatically updated once new video is decoded. So the filter chain doesn't need to be reinitialized automatically, but there is a need to trigger the video instant refresh code path instead. Also move the support function closer to an annoying similar yet different function. They probably can be unified next time major changes are done to this code.
* lua: don't use "output" as identifierwm42014-10-211-4/+4
| | | | | I suspect this clashes with libcs,w hich define "stdout" as macro. Hopefully fixes #1206.
* command: add cursor-autohide propertywm42014-10-211-0/+14
| | | | | | | | | | | Allows properly changing/updating the cursor state. Useful for client API window embedding, because the host application may not want the mpv window to grab mouse input, and this has to manually handle the cursor. Changing the cursor of foreign windows is usually not sane. It might make sense to allow changing the cursor icon, but that would be much more complicated, so I won't add it unless someone actually requests it.
* command: add playback-abort propertywm42014-10-211-0/+8
| | | | Now this is obscure.
* command: add video-rotate propertywm42014-10-211-0/+12
|
* player: add stream selection by ffmpeg indexwm42014-10-213-11/+55
| | | | | | | | | Apparently using the stream index is the best way to refer to the same streams across multiple FFmpeg-using programs, even if the stream index itself is rarely meaningful in any way. For Matroska, there are some possible problems, depending how FFmpeg actually adds streams. Normally they seem to match though.
* sd_lavc: strictly letter-box PGS subtitleswm42014-10-211-1/+1
| | | | | | | | | | | | | | Getting subtitle scaling and positioning right even if there are video filters, which completely change the image (like cropping), doesn't seem to have a single, correct solution. To some degree, the results are arbitrary, so we may as well do what is most useful to the user. In this case, if the PGS resolution aspect ratio and the video output aspect ratio mismatch, letter-box it, instead of stretching the subs over the video frame. (This will require additional fixes, should it turn out that there are PGS subtitles which are stretched by design.) Fixes #1205.
* command: add field-dominance propertyKevin Mitchell2014-10-211-0/+1
|
* lua: add convenience function for hookswm42014-10-211-0/+21
| | | | So the user doesn't have to care about the awkward low-level details.
* command: extend sub_add commandwm42014-10-211-2/+10
|
* command: remove hook cancellation mechanismwm42014-10-203-15/+3
| | | | | I doubt anyone will actually use this correctly. Also, there was a bug (a typo) which prevented it from working at all.
* command: allow sub_add at an earlier stagewm42014-10-201-1/+1
|
* osdep: limit thread names to 16 characterswm42014-10-201-1/+1
| | | | | | | | | | | | | | | | It turns out the glibc people are very clever and return an error if the thread name exceeds the maximum supported kernel length, instead of truncating the name. So everyone has to hardcode the currently allowed Linux kernel name length limit, even if it gets extended later. Also the Lua script filenames could get too long; use the client name instead. Another strange thing is that on Linux, unrelated threads "inherit" the name by the thread they were created. This leads to random thread names, because there's not necessarily a strong relation between these threads (e.g. script command leads to filter recreation -> the filter's threads are tagged with the script's thread name). Unfortunate.
* Set thread name for debuggingwm42014-10-193-0/+9
| | | | | | | | | | Especially with other components (libavcodec, OSX stuff), the thread list can get quite populated. Setting the thread name helps when debugging. Since this is not portable, we check the OS variants in waf configure. old-configure just gets a special-case for glibc, since doing a full check here would probably be a waste of effort.
* player: shutdown all clients before actual uninitwm42014-10-191-2/+2
| | | | | This seems safer. It might be possible that commands sent by the clients could recreate e.g. audio or video outputs.
* ipc: decouple from MPContextwm42014-10-192-10/+4
| | | | Just a minor refactor to keep unneeded dependencies on the core low.
* fix build on OS X and BSDStefano Pigozzi2014-10-191-0/+1
|
* lua: fix lua_objlen -> lua_rawlen for lua 5.2Kevin Mitchell2014-10-181-1/+3
|
* lua: strictly free memory on errorswm42014-10-192-29/+30
| | | | | | | Thanks to the recently introduced mp_lua_PITA(), this is "simple" now. It fixes leaks on Lua errors. The hack to avoid stack overflows manually isn't needed anymore, and the Lua error handler will take care of this.
* lua: expose JSON parserwm42014-10-191-0/+26
| | | | | | | The JSON parser was introduced for the IPC protocol, but I guess it's useful here too. The motivation for this commit is the same as with 8e4fa5fc (again).
* lua: add an utility function for starting processeswm42014-10-191-2/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because 1) Lua is terrible, and 2) popen() is terrible. Unfortunately, since Unix is also terrible, this turned out more complicated than I hoped. As a consequence and to avoid that this code has to be maintained forever, add a disclaimer that any function in Lua's utils module can disappear any time. The complexity seems a bit ridiculous, especially for a feature so far removed from actual video playback, so if it turns out that we don't really need this function, it will be dropped again. The motivation for this commit is the same as with 8e4fa5fc. Note that there is an "#ifndef __GLIBC__". The GNU people are very special people and thought it'd be convenient to actually declare "environ", even though the POSIX people, which are also very special people, state that no header declares this and that the user has to declare this manually. Since the GNU people overtook the Unix world with their very clever "embrace, extend, extinguish" strategy, but not 100%, and trying to build without _GNU_SOURCE is hopeless; but since there might be Unix environments which support _GNU_SOURCE features partially, this means that in practice "environ" will be randomly declared or not declared by system headers. Also, gcc was written by very clever people too, and prints a warning if an external variable is declared twice (I didn't check, but I suppose redeclaring is legal C, and not even the gcc people are clever enough to only warn against a definitely not legal C construct, although sometimes they do this), ...and since we at mpv hate compiler warnings, we seek to silence them all. Adding a configure test just for a warning seems too radical, so we special-case this against __GLIBC__, which is hopefully not defined on other libcs, especially not libcs which don't implement all aspects of _GNU_SOURCE, and redefine "environ" on systems even if the headers define it already (because they support _GNU_SOURCE - as I mentioned before, the clever GNU people wrote software THAT portable that other libcs just gave up and implemented parts of _GNU_SOURCE, although probably not all), which means that compiling mpv will print a warning about "environ" being redefined, but at least this won't happen on my system, so all is fine. However, should someone complain about this warning, I will force whoever complained about this warning to read this ENTIRE commit message, and if possible, will also force them to eat a printed-out copy of the GNU Manifesto, and if that is not enough, maybe this person could even be forced to convince the very clever POSIX people of not doing crap like this: having the user to manually declare somewhat central symbols - but I doubt it's possible, because the POSIX people are too far gone and only care about maintaining compatibility with old versions of AIX and HP-UX. Oh, also, this code contains some subtle and obvious issues, but writing about this is not fun.
* command: add "estimated-vf-fps" change notifcationwm42014-10-191-1/+2
|
* lua: add a helper to auto-free temporary C memorywm42014-10-191-6/+32
| | | | | | | | | | | | | | | | | Using the Lua API is a big PITA because it uses longjmp() error handling. That is, a Lua API function could any time raise an error and longjmp() to a lower part of the stack. This kind of "exception handling" is completely foreign to C, and there are no proper ways to clean up the "skipped" stack frames. Other than avoiding such situations entirely, the only way to deal with this is using Lua "userdata", which is basically a malloc'ed data block managed by the Lua GC, and which can have a destructor function associated (__gc metamethod). This requires an awful lot of code (because the Lua API is just so terrible), so I avoided this utnil now. But it looks like this will make some of the following commits much easier, so here we go.
* win32: get rid of mp_stat in the normal source codewm42014-10-172-2/+2
| | | | | | | | | | | mp_stat() instead of stat() was used in the normal code (i.e. even on Unix), because MinGW-w64 has an unbelievable macro-mess in place, which prevents solving this elegantly. Add some dirty workarounds to hide mp_stat() from the normal code properly. This now requires replacing all functions that use the struct stat type. This includes fstat, lstat, fstatat, and possibly others. (mpv currently uses stat and fstat only.)
* input: implement JSON-based IPC protocolAlessandro Ghedini2014-10-172-0/+14
|
* options: don't load per-file config files by defaultwm42014-10-171-11/+11
| | | | | | Generally useless feature, and might be slightly dangerous if paths can "escape" from the profile dir. (Normally this shouldn't be possible, though.)
* audio: don't go to sleep after audio reinitwm42014-10-171-0/+1
| | | | | | | It possibly goes to sleep without actually starting to decode audio. Possibly fixes a problem with --no-osc --no-video reported on IRC. CC: @mpv-player/stable
* player: quote %-starting stringsshdown2014-10-161-0/+2
| | | | | Leading percent sign is a quote indicator so it needs to be quoted itself.
* player: fix crash on early audio uninitwm42014-10-161-2/+2
| | | | | | | Could crash when exiting playback in very early stages of initialization. CC: @mpv-player/stable
* player: free subtitle renderer on exitwm42014-10-161-1/+1
| | | | | | This was probably commented as an oversight. Since the subtitle renderer was uninitialized on reinitialization anyway, this had no negative consequences, except a memory on exit.
* command: add a mechanism to allow scripts to intercept file loadswm42014-10-165-12/+186
| | | | | | | | | | | | | | | | | | | | | | | A vague idea to get something similar what libquvi did. Undocumented because it might change a lot, or even be removed. To give an idea what it does, a Lua script could do the following: -- type ID priority mp.commandv("hook_add", "on_load", 0, 0) mp.register_script_message("hook_run", function(param, param2) -- param is "0", the user-chosen ID from the hook_add command -- param2 is the magic value that has to be passed to finish -- the hook mp.resume_all() -- do something, maybe set options that are reset on end: mp.set_property("file-local-options/name", "value") -- or change the URL that's being opened: local url = mp.get_property("stream-open-filename") mp.set_property("stream-open-filename", url .. ".png") -- let the player (or the next script) continue mp.commandv("hook_ack", param2) end)
* command: allow setting per-file options at runtimewm42014-10-151-7/+24
| | | | | The intended use-case is for doing this at load time, after the load command was issued. (See following commit.)
* player: fix OSD cyclingwm42014-10-141-0/+2
| | | | | | | OSD cycling attempted to remove the current message by setting an empty message with duration 0. Duration 0 tripped up a corner case causing no OSD to be displayed (until the next message was set), so exclude this explicitly.
* client API: allow returning float properties as integerswm42014-10-141-0/+4
| | | | | I'm starting to think that being type-strict with this interface actually sucks. This commit is a step towards being less strict.
* player: fix --frameswm42014-10-142-2/+4
| | | | | | | | | This could produce an extra frame, because reaching the maximum merely signals the playloop to exit, without strictly enforcing the limit. Fixes #1181. CC: @mpv-player/stable
* command: don't display non-sense if volume is unavailablewm42014-10-111-1/+1
| | | | | | | | | Showed "Volume: (unavailable)%". That was dumb. The message string is now a bit convoluted; mostly because the property expand syntax can't do "if-else", just "if". CC: @mpv-player/stable
* command: make volume/mute unavailable if audio is not initializedwm42014-10-111-6/+4
| | | | | | | | | | This does nothing good. This reverts a change made over a year ago - I don't remember why this was originally done this way. The main problem is that even if the volume option is set (something like "--volume=75"), the volume property will always return "100" until audio is initialized. If audio is uninitialized again, the volume property will remain frozen at its last value.
* client API: check result ptr in mpv_command_nodeJames Ross-Gowan2014-10-121-1/+1
| | | | This follows the docs, which say the result parameter is optional.
* lua: add command_native() functionwm42014-10-111-0/+23
| | | | This is the Lua equivalent of mpv_command_node().
* client API: add mpv_command_node[_async]wm42014-10-111-3/+19
| | | | | | | | | Allows passing native types as arguments. Also some minor doc improvements, including giving some (natural) improvements to mpv_free_node_contents(). Note: mpv_command_node_async() is completely untested.
* input: use mpv_node parser for char** command parserswm42014-10-101-3/+2
| | | | Minor simplification, also drops some useless stuff.
* command: make audio device list available to the client APIwm42014-10-101-0/+32
|
* player: fix terminal status in idle modewm42014-10-101-0/+1
| | | | That's what this variable is for. This was missed in commit 9d5d031b.
* player: don't mess up cursor visibility statewm42014-10-101-1/+1
| | | | | | | | | | | | Manually setting can break things forever, because it puts the VO cursor state out of sync with the remembered state by handle_cursor_autohide(). Use the normal autohide code during idle mode too instead. (Originally the idea was to make the cursor always visible in idle mode, but not so important.) Regression since e1e8b07c. Fixes #1166. CC: @mpv-player/stable
* audio: change internal device listing APIwm42014-10-101-1/+1
| | | | | Now we run ao_driver->list_devs on a dummy AO instance, which will probably confuse everyone. This is done for the sake of PulseAudio.
* player: exit if audio init fails and there's no videowm42014-10-101-0/+2
| | | | | | Seems logical. For some reason, the player allows deselecting both audio and video stream without quitting (a deliberate feature of which I have no idea why it was added years ago), so this is needed.
* player: signal EOF when using --frameswm42014-10-102-2/+2
|
* player: minor simplificationwm42014-10-102-8/+2
|
* player: don't close audio device in gapless modewm42014-10-101-2