summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* client API: report pause/unpause reasonwm42014-02-246-31/+72
| | | | | | | | | Not sure about this... might redo. At least this provides a case of a broadcasted event, which requires per-event data allocation. See github issue #576.
* client API: expose the internal clockwm42014-02-242-1/+8
| | | | | | | | | May or may not be useful in some ways. We require a context parameter for this just to be sure, even if the internal implementation currently doesn't. That's one less mpv internal function for the Lua wrapper.
* lua, osc: use properties for chapter/track listswm42014-02-242-82/+5
|
* command: make options property return the list of all optionswm42014-02-241-7/+16
|
* lua: add a bunch of functions to get/set properties by their native typewm42014-02-242-5/+152
| | | | | | There are some complications because the client API distinguishes between integers and floats, while Lua has only "numbers" (which are usually floats). But I think this should work now.
* client API: implement setting options using their native type toowm42014-02-241-4/+13
| | | | | | | | | | | This is only half-implemented: actually the option will first be converted from mpv_node to its native type, then it's converted to a string, and then back to its native type. This is because the option API was made for strings and not anything else. Other than being grossly inelegant, the only downside is probably with string lists and key/value lists, which don't escape strings containing syntax elements correctly.
* client API: add support for accessing properties by their native typewm42014-02-241-33/+158
| | | | | | | | | | | | | | This actually makes use of the client.h declarations and the mpv_node mechanisms added some commits ago. For now, using MPV_FORMAT_STRING will usually fallback to explicit string conversion, but not in the other cases. E.g. reading a numeric property as string will work, but not reading a string property as number. Other than that, only MPV_FORMAT_INT64->MPV_FORMAT_DOUBLE does an automatic conversion. I'm not sure whether these semantics and API are good, so comments and suggestions are welcome.
* client API: adjust error stringswm42014-02-241-2/+2
| | | | | These error codes can be used for setting and getting, not just for settings (although currently there's no API to get options directly).
* client API: change semantics for MPV_FORMAT_STRINGwm42014-02-241-5/+5
| | | | | | | | | | | | With mpv_set_property(h, "property", MPV_FORMAT_STRING, ptr), ptr now has to be of type char** instead of char*. This makes it more consistent with mpv_get_property() and also non-pointer formats, which will be introduced in the following commits. mpv_set_property() of course does not change its interface (only its implementation is adjusted to keep its interface). This also affects mpv_set_option(), but again not mpv_set_option_string().
* command: use DVD volume ID for media-title propertyxylosper2014-02-231-0/+9
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Closes #582.
* command: provide per-file-options for loadfile commandxylosper2014-02-231-1/+9
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Closes #575. Minor changes over original pull request.
* command: remove special casing for strings in input commandswm42014-02-231-4/+4
| | | | | | Until now, strings were the only allowed dynamically allocated argument type in input commands. Extend it so that it works for any type. (The string expansion in command.c is of course still string specific.)
* command: don't use option name in propertieswm42014-02-231-19/+11
| | | | | | | | | | | | | Some code accessed m_option.name to get the property name. (Maybe only show_property_osd() had a significant use of it.) Remove that, and remove setting names and dummy names as well. The old code usually assumed that the name was set, and show_property_osd() used it to get the proper name of deprecated aliases. The "vf" property was listed as "vf*". Not sure why that was done, but it works without anyway.
* lua: fix behavior if no script command handler is registeredwm42014-02-231-1/+3
|
* options: handle escape sequences in e.g. --playing-msg differentlywm42014-02-204-3/+26
| | | | | | | | | | M_OPT_PARSE_ESCAPES was pretty stupid, and broke the (useful) assumption that string variables contain exactly the same value as set by the option. Simplify it, and move escape handling to the place where it's used. Escape handling itself is not terribly useful, but still allows useful things like multiline custom OSD with "\n".
* input: check for abort cmd in multi-commandswm42014-02-201-1/+1
| | | | | | | | | MP_CMD_COMMAND_LIST commands (used to implement key bindings with multiple commands) were not checked for abort commands. Implement it. Remove the remarks about multi-commands being special from the manpage. Seek coalescing is handled differently now, and the issue with abort commands is fixed with this commit.
* command: allow accessing metadata entries as listwm42014-02-191-0/+19
| | | | | | Not sure about these deep path-names. Maybe "metadata/0" should work instead of "metadata/list/0". I'm so unsure about it, that I'm leaving it open.
* command: move metadata entry access to metadata/by-key/wm42014-02-191-1/+4
| | | | | | The old way still works, and is fine to use. Still discourage it, because it might conflict with other ways to access this property, such as the one added in the next commit.
* client API: add event for metadata changeswm42014-02-192-1/+3
|
* input, dvdnav: fix osc stealing input from dvdnavwm42014-02-191-1/+2
| | | | | | | | | | This is a regression introduced from moving Lua scripts (including the OSC) to their own threads. Now OSC and dvdnav can add their bindings at the same time without coordination, which seems to result in the OSC winning most time, and thus overriding the dvdnav menu bindings. Fix this by adding a flag that makes dvdnav menu bindings take priority over all other bindings.
* command: export list of editions as propertieswm42014-02-191-0/+61
|
* command: export codec for each trackwm42014-02-191-0/+4
|
* player: fix start time if timeline is used (ordered chapters, EDL)wm42014-02-191-7/+5
| | | | | | When timeline was used, and the --start option was not used, the initial seek (needed to switch to the first timeline segment) seeked to -1 due to an oversight.
* edl: extend with chapter timestampswm42014-02-191-0/+21
| | | | | | Example see edl-mpv.rst. What is this useful for? No clue...
* edl: fix offset of user-visible chapterswm42014-02-191-1/+1
| | | | | Basically, chapter marks and chapter seek-points were incorrect, while the rest worked.
* client API: add events for video and audio reconfigwm42014-02-175-1/+12
|
* lua: add mechanism for script provided key bindingswm42014-02-172-2/+89
| | | | | | | | | | | | | There was already an undocumented mechanism provided by mp.set_key_bindings and other functions, but this was relatively verbose, and also weird. It was mainly to make the OSC happy (including being efficient and supporting weird corner cases), while the new functions try to be a bit simpler. This also provides a way to let users rebind script-provided commands. (This mechanism is less efficient, because it's O(n^2) for n added key bindings, but it shouldn't matter.)
* client API: add a client message eventwm42014-02-173-0/+30
| | | | | This comes with a "script_message" input command, which sends these messages. Used by the following commits.
* lua: allow giving fallback values in get_property() callswm42014-02-171-2/+5
| | | | | E.g. ``mp.get_property("foo", "value")`` will return ``value`` if the property can't be read.
* lua: remove redundant inline documentationwm42014-02-171-4/+0
| | | | | Nobody will loom at this, and the proper documentation of these functions is in lua.rst.
* command: export chapter list as propertieswm42014-02-161-4/+20
|
* command: export playlist as propertieswm42014-02-161-11/+17
|
* command: expose track list as propertieswm42014-02-161-3/+31
|
* command: export more video params as propertieswm42014-02-161-36/+51
| | | | | This uses the previously added sub-property mechanism to export a bunch of stuff. For example, "video-params/w" now contains the video width.
* options: make --no-config block all auto-loaded configuration fileswm42014-02-141-1/+1
| | | | | | | | | | | | Until now, the --no-config was explicitly checked in multiple places to suppress loading of config files. Add such a check to the config path code itself, and refuse to resolve _any_ configuration file locations if the option is set. osc.lua needs a small fixup, because it didn't handle the situation when no path was returned. There may some of such cases in the C code too, but I didn't find any on a quick look.
* lua: auto-load scripts from ~/.mpv/lua/wm42014-02-141-3/+48
| | | | This is like passing them to --lua.
* lua: make register_event() not overwrite previous event handlerwm42014-02-141-4/+11
| | | | | | | | Instead, chain them. Note that there's no logic to prevent the other event handlers to be run from an event handler (like it's popular in GUI toolkits), because I think that's not very useful for this purpose.
* player: select subtitles added with sub_addwm42014-02-131-2/+5
| | | | | | | | | | In particular, this affects drag & drop of subtitles, which uses sub_add internally. This will make the subtitles show up immediately, instead of requiring manual selection of the added subtitle. Might be not so ideal when adding multiple subtitles at once, because that leads to multiple sub_add commands, and will end up with the last subtitle instead of the first selected. But this is a minor detail.
* command: fix metadata propertywm42014-02-121-2/+2
| | | | This crashed when retrieving the raw property value. Oops.
* player: fix --force-window on OSXwm42014-02-112-4/+9
| | | | | | | | The initialization code was split and refactored for the libmpv changes. One change, moving a part of cocoa initialization, accidentally broke --force-window on OSX, which creates a VO in a certain initialization stage. We still don't know how cocoa should behave with libmpv, so fix this with a hack to beat it back into working. Untested.
* lua: some minor API changeswm42014-02-112-14/+20
|
* lua: add set_property functionwm42014-02-111-0/+10
|
* lua: change error behaviorwm42014-02-111-13/+11
| | | | | | | Return the error Lua-style, instead of raising it as Lua error. This is better, because raising errors is reserved for more "fatal" conditions. Pretending they're exceptions and trying to do exception-style error handling will just lead to pain in this language.
* lua: rename some API functionswm42014-02-112-76/+76
| | | | | | | | | send_command -> command send_commandv -> commandv get_timer -> get_time property_get -> get_property property_get_string -> get_property_osd getopt -> get_opt
* build: add option to build a librarywm42014-02-103-10/+17
| | | | | | | | | | | | | This library will export the client API functions. Note that this doesn't allow compiling the command line player to link against this library yet. The reason is that there's lots of weird stuff required to setup the execution environment (mostly Windows and OSX specifics), as well as things which are out of scope of the client API and every application has to do on its own. However, since the mpv command line player basically reuses functions from the mpv core to implement these things, it's not very easy to separate the command line player form the mpv core.
* lua: add a timer APIwm42014-02-101-10/+79
|
* lua: port to client APIwm42014-02-1010-224/+242
| | | | | | | | | | | | | | | | This is partial only, and it still accesses some MPContext internals. Specifically, chapter and track lists are still read directly, and OSD access is special-cased too. The OSC seems to work fine, except using the fast-forward/backward buttons. These buttons behave differently, because the OSC code had certain assumptions how often its update code is called. The Lua interface changes slightly. Note that this has the odd property that Lua script and video start at the same time, asynchronously. If this becomes an issue, explicit synchronization could be added.
* Add a client APIwm42014-02-108-118/+1056
| | | | | | | Add a client API, which is intended to be a stable API to get some rough control over the player. Basically, it reflects what can be done with input.conf commands or the old slavemode. It will replace the old slavemode (and enable the implementation of a new slave protocol).
* timer: init only oncewm42014-02-101-4/+0
| | | | | | | | | | This avoids trouble if another mpv instance is initialized in the same process. Since timeBeginPeriod/timeEndPeriod are hereby not easily matched anymore, use an atexit() handler to call timeEndPeriod, so that we can be sure these calls are matched, even if we allow multiple initializations later when introducing the client API.
* options: add --no-terminal switchwm42014-02-104-17/+29
| | | | | Mostly useful for internal reasons. This code will be enabled by default if mpv is started via the client API.
* player: fix an assert when reinitializing audio in some caseswm42014-02-091-0/+3
| | | | | | | | This sometimes happened when changing playback speed (= reinitializing audio) after seeking of playback start. The assertion in audio.c:441 was triggered, because buffer_playable_samples wasn't reset correctly when the audio buffer was cleared or shortened. The assertion is correct and should hold up any time.
* player: handle seek delays differentlywm42014-02-075-25/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code removed from handle_input_and_seek_coalesce() did two things: 1. If there's a queued seek, stop accepting non-seek commands, and delay them to the next playloop iteration. 2. If a seek is executing (i.e. the seek was unqueued, and now it's trying to decode and display the first video frame), stop accepting seek commands (and in fact all commands that were queued after the first seek command). This logic is disabled if seeking started longer than 300ms ago. (To avoid starvation.) I'm not sure why 1. would be needed. It's still possible that a command immediately executed after a seek command sees a "seeking in progress" state, because it affects queued seeks only, and not seeks in progress. Drop this code, since it can easily lead to input starvation, and I'm not aware of any disadvantages. The logic in 2. is good to make seeking behave much better, as it guarantees that the video display is updated frequently. Keep the core idea, but implement it differently. Now this logic is applied to seeks only. Commands after the seek can execute freely, and like with 1., I don't see a reason why they couldn't. However, in some cases, seeks are supposed to be executed instantly, so queue_seek() needs an additional parameter to signal the need for immediate update. One nice thing is that commands like sub_seek automatically profit from the seek delay logic. On the other hand, hitting chapter seek multiple times still does not update the video on chapter boundaries (as it should be). Note that the main goal of this commit is actually simplification of the input processing logic and to allow all commands to be executed immediately.
* demux: handle tag updates differentlywm42014-02-061-1/+1
| | | | | | | | | | | | | | | | Instead of printing lines like: Demuxer info GENRE changed to Alternative Rock Just output all tags once they change. The assumption is that individual tags rarely change, while all tags change in the common case. This changes tag updates to use polling. This could be fixed later, although the ICY stuff makes it a bit painful, so maybe it will remain this way. Also remove DEMUXER_CTRL_UPDATE_INFO. This was intended to check for tag updates, but now we use a different approach.
* player: refresh OSD on track switchingwm42014-02-031-0/+2
| | | | Apparently, at least sub_reload was missing a refresh at all.
* command: output more information in colorspace properties and simplifywm42014-02-031-39/+31
| | | | | Instead of trying to be clever to avoid outputting redundant information, simply output everything that we have.
* w32: use safe DLL search paths everywhereJames Ross-Gowan2014-01-271-0/+21
| | | | | | | | | | | | Windows applications that use LoadLibrary are vulnerable to DLL preloading attacks if a malicious DLL with the same name as a system DLL is placed in the current directory. mpv had some code to avoid this in ao_wasapi.c. This commit just moves it to main.c, since there's no reason it can't be used process-wide. This change can affect how plugins are loaded in AviSynth, but it shouldn't be a problem since MPC-HC also does this and it's a very popular AviSynth client.
* w32: enable heap corruption detectionJames Ross-Gowan2014-01-271-0/+3
| | | | | | | | | | Enable the terminate-on-corruption feature. This is recommended for new Windows applications and shouldn't cause a performance hit. It actually shouldn't change anything for 64-bit builds, since Win64 has this switched on by default. See: http://blogs.msdn.com/b/michael_howard/archive/2008/02/18/faq-about-heapsetinformation-in-windows-vista-and-heap-based-buffer-overruns.aspx
* w32: don't disable the error reporting dialogJames Ross-Gowan2014-01-271-1/+1
| | | | | | Windows users expect this when a program crashes. Without it, the program just disappears. Also change the SetErrorMode call to use macros instead of a hardcoded constant.
* demux_mkv: nicer edition outputwm42014-01-231-3/+13
| | | | | | | | | | | If there's more than one edition, print the list of editions, including the edition name, whether the edition is selected, whether the edition is default, and the command line option to select the edition. (Similar to stream list.) Move reading the tags to a separate function process_tags(), which is called when all other state is parsed. Otherwise, that tags will be lost if chapters are read after the tags.
* lua: allow ~ path convention for --luawm42014-01-211-1/+3
| | | | | Paths passed to the --lua option now follow the convention for paths starting with ~ documented in mpv.rst.
* lua: add playback-start eventwm42014-01-203-0/+4
|
* player: fix initial osd progbar statewm42014-01-201-0/+1
| | | | This made seeking show an empty progbar if --osd-level=0 was used.
* player: prevent null pointer deref on uninit after -Vwm42014-01-181-0/+2
| | | | Caused by the OSD changes. Fixes #490.
* sub: uglify OSD code path with lockingwm42014-01-1810-107/+119
| | | | | | | | | | | | | | | 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.
* sub: uglify sub decoder with lockingwm42014-01-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The plan is to make the whole OSD thread-safe, and we start with this. We just put locks on all entry points (fortunately, dec_sub.c and all sd_*.c decoders are very closed off, and only the entry points in dec_sub.h let you access it). I thin