summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* 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/+1
| | | | I don't see much of a reason for this extra corner case.
* player: --save-position-on-quit should always work (2)wm42014-10-102-5/+5
| | | | | This reimplements the feature reverted in the previous commit in a different way.
* Revert "player: --save-position-on-quit should always work"wm42014-10-102-5/+1
| | | | | | | | | This reverts commit 45c8b97efbaff7a5031b008223eeed56f7b0607a. Some else complained (github issue #1163). The feature requested in #1148 will be implemented differently in the following commit.
* libmpv/cocoa: don't start the event monitorStefano Pigozzi2014-10-091-1/+2
| | | | | | The event monitor is used to get keyboard events when there is no window, but since it is a global monitor to the current process, we don't want it in a library setting.
* libmpv/cocoa: make global events work and get rid of is_cplayerStefano Pigozzi2014-10-093-6/+6
| | | | | | | After @frau's split of macosx_events from macosx_application, `is_cplayer' is not needed anymore. At the moment only global events such as Media Keys and Apple Remote work, because the VO-level ones were hardcoded to be disabled. (that will be fix in a later commit ).
* client API: add an explanatory commentwm42014-10-091-1/+1
| | | | | So someone reading this at least has a chance to find out what this is needed for.
* audio: add device selection & listing with --audio-devicewm42014-10-091-0/+4
| | | | | | | Not sure how good of an idea this is. This commit doesn't add support for this to any AO yet; the AO implementations will follow later.
* client API: rename --input-x11-keyboard to --input-vo-keyboardwm42014-10-091-1/+1
| | | | | Apparently we need this for Cocoa too. (The option was X11 specific in the hope that only X11 would need this hack.)
* video: try harder to decode cover art picture only oncewm42014-10-091-2/+7
| | | | | | | | | | | | | | | | | For cover art, we pretend that the video stream is infinite, but also stop decoding once we have an image on the VO (this seems advantageous for the case when strange filters are inserted or the VO image gets lost). Since a while ago, the video chain started decoding 2 images though ("Non-monotonic video pts: 0.000000 <= 0.000000"), which is annoying and wasteful. Improve this by handling a certain corner case at initialization, which will decode a second image while the first one is still stuck in the filter chain. Also, just in case there are filters which buffer a lot, also force EOF filtering (which means we tell the filters to flush buffered frames). CC: @mpv-player/stable
* player: don't reset buffering pausing state on seekswm42014-10-091-1/+0
| | | | | | | | This was added with commit 3cbd79b3, but it turns out this unintentionally enables "real" pausing when seeking while buffering. It was done for ensuring correct state of the "cache-buffering-state" property, but it also turns out that this was unneeded (another variable that is reset when seeking happens to take care of this).
* client API: introduce numeric log levelswm42014-10-081-0/+1
| | | | | | | | | | | | | | | | Maybe using strings for log levels was a mistake (too broad and too impractical), so I'm adding numeric log level at least for the receiver side. This makes it easier to map mpv log levels to other logging systems. I'm still too stingy to add a function to set the log level by a numeric value, though. The numeric values are not directly mapped to the internal mpv values, because then almost every file in mpv would have to include the client API header. Coalesce this into API version 1.6, since 1.6 was bumped just yesterday.
* player: minor cosmetic changewm42014-10-081-1/+1