summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command: property set commands should send property change notificationswm42014-04-081-1/+21
| | | | | | | | | Some of these property implementations already send notifications on their own, but most don't. This takes care of them. Of course this still doesn't handle all propertry changes - this is impossible without special-casing each property that can change on its own.
* client API: add a way to notify clients of property changeswm42014-04-061-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | This turned out ridiculously complex. I think it will have to be simplified some day. Main reason for the complexity are: - filtering properties by forcing clients to observe individual properties explicitly (to avoid spamming clients with changes they don't want) - optional retrieval of property value with the notification (the basic idea was that this is more user friendly) - allowing to the client to specify a format in which the value should be retrieved (because if a property changes its type, the client API couldn't convert it properly, and compatibility would break) I don't know yet which of these are important, and everything could change. In particular, the interface and semantics should be adjusted to reduce the implementation complexity. While I consider the API complete, there could (and probably will) be bugs left. Also while the implementation is complete, it's inefficient. The complexity of the property matching is O(a*b*c) with a clients, b observed properties, and c properties changing at once. I threw away an earlier implementation using bitmasks, because it was too unwieldy.
* command: change what the metadata property returnswm42014-03-301-8/+20
| | | | | | | Change the type of the property from a string list (alternating key/value entries) to a map. Using the client API, this will return MPV_FORMAT_NODE_MAP, while Lua mp.get_property_native returns a dictionary-like table.
* command: minor simplificationwm42014-03-301-6/+3
|
* command: add helper function to split property pathswm42014-03-301-5/+8
| | | | | | We've just checked whether a sub-path started with "name/", but that changes behavior whether the property name has a trailing '/' or not. Using a helper function to split of path components avoids this problem.
* Merge remote-tracking branch 'mpv/pr/676'wm42014-03-301-1/+1
|\
| * player: rename dvdnav to discnavxylosper2014-03-301-1/+1
| | | | | | | | | | Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore, rename all 'dvdnav' strings which are not DVD specific to 'discnav'
* | video/out: remove legacy colorspace stuffwm42014-03-291-9/+9
|/ | | | | | | | | Reduce most dependencies on struct mp_csp_details, which was a bad first attempt at dealing with colorspace stuff. Instead, consistently use mp_image_params. Code which retrieves colorspace matrices from csputils.c still uses this type, though.
* player: fix unchecked access for chapter metadatawm42014-03-261-3/+1
| | | | | | | | | | It's possible that MPContext has a chapter list, but the demuxer doesn't. In this case, accesing the chapter-metadata property would lead to invalid accesses. (This fixes the out of bound access, but in theory, the returned data can still be incorrect, since MPContext chapters don't need to map directly to demuxer chapters.)
* player: let chapter_start_time() return MP_NOPTS_VALUE for unknown timeswm42014-03-251-1/+1
|
* command: make 'disc-title' property writablexylosper2014-03-181-2/+8
| | | | | | | | This commit makes 'disc-title' property writable using STREAM_CTRL_SET_CURRENT_TITLE. This commit also contains implementation of STREAM_CTRL_SET_CURRENT_TITLE for stream_bluray. Currently, 'disc-title' is writable only for stream_dvdnav and stream_bluray and stream_dvd is not supported.
* command, lua: change script_message semanticswm42014-03-171-1/+9
| | | | | | | | Change script_message to broadcast the message to all clients. Add a new script_message_to command, which does what the old script_message command did. This is intended as simplification, although it might lead to chaos too.
* command: rename dvd- properties to disc-wm42014-03-151-7/+7
| | | | Since these are not DVD-only, but can also be used with BDs.
* command: prefix DVD title properties with "dvd-"wm42014-03-151-8/+8
| | | | | | | | | | They're strictly DVD-only, so it's better to mark them as such. This also documentes the "title" (now renamed to "dvd-title") property. This also avoids collision with the --title option. (Technically, there was no problem. But it might be confusing for users, since we have a policy of naming properties and options the same if they refer to the same underlying functionality.)
* command: add new property 'title'xylosper2014-03-151-0/+20
| | | | | | This commit adds new property 'title' which indicates current playing title of disc. This property is useful when using a stream whose title can be changed during playback, e.g., dvdnav.
* command: fix wrong condition & remove redundant stream type checkingxylosper2014-03-131-14/+2
|
* command: set 'media-title' property for bluray disc with meta-dataxylosper2014-03-131-5/+15
|
* command: fix osd-height propertywm42014-03-091-1/+1
|
* player: make separation between user/automatic track selection strongerwm42014-03-031-1/+5
| | | | | | | | | | For example, consider the case when audio initialization fails. Then the audio track is deselected. Before this commit, this would have been equivalent to the user disabling audio. This is bad when multiple files are played at once (the next file would have audio disabled, even if it works), or if playback resume is used (if e.g. audio output failed to initialize, then audio would be disabled when resuming, even if the system's audio driver was fixed).
* command: fix null pointer dereference in idle modewm42014-03-021-2/+2
| | | | Pressing 'h' in idle mode -> crash.
* client API: add two properties, 'time-start' and 'seekable'xylosper2014-02-281-0/+21
|
* command: use the step size for "add volume" commandswm42014-02-271-4/+1
| | | | | | | | | | | | The step argument for "add volume <step>" was ignored until now. Fix it. There is one problem: by defualt, "add volume" should use the value set with --volstep. This value is 3 by default. Since the default volue for the step argument is always 1 (and we don't really want to make the generic code more complicated by introducing custom step sizes), we simply multiply the step argument with --volstep to keep it compatible. The --volstep option should probably be just removed in the future.
* command: format volume property as integer for OSDwm42014-02-271-0/+6
| | | | | | | The value range is 0-100, so fractional values don't make much sense. But the underlying data type is probably float to avoid getting "stuck" when doing small volume increments. So step this around and pretend it's an integer just on display.
* options: allow changing options at runtimewm42014-02-251-3/+1
| | | | | Allow changing all options at runtime, except some cherry-picked options, which are disabled with M_OPT_FIXED.
* client API: report pause/unpause reasonwm42014-02-241-5/+5
| | | | | | | | | 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.
* command: make options property return the list of all optionswm42014-02-241-7/+16
|
* 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.
* options: handle escape sequences in e.g. --playing-msg differentlywm42014-02-201-0/+21
| | | | | | | | | | 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".
* 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.
* command: export list of editions as propertieswm42014-02-191-0/+61
|
* command: export codec for each trackwm42014-02-191-0/+4
|
* client API: add a client message eventwm42014-02-171-0/+16
| | | | | This comes with a "script_message" input command, which sends these messages. Used by the following commits.
* 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.
* 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.
* lua: port to client APIwm42014-02-101-45/+12
| | | | | | | | | | | | | | | | 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-101-16/+13
| | | | | | | 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).
* player: handle seek delays differentlywm42014-02-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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.
* lua: add playback-start eventwm42014-01-201-0/+1
|
* 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-181-24/+34
| | | | | | | | | | | | | | | 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.
* player: remove OSD message IDswm42014-01-171-33/+25
| | | | | | These were needed before the last commit, but now they don't do anything anymore. (They were used to decide whether to replace or stack the previous OSD message when a new one was displayed.)
* player: remove OSD stackwm42014-01-171-2/+0
| | | | | | | | | | | If certain OSD messages were displayed at the same time, the hidden messages were put on the stack, and displayed again once the higher priority messages disappeared. The idea was probably that lower priority messages could not hide higher priority ones, and also that the lower messages did not get lost. But in practice, this gives confusing results with OSD messages randomly reappearing for a brief time. Remove it.
* msg: move special declarations to msg_control.hwm42014-01-161-0/+2
| | | | | While almost everything uses msg.h, the moved definitions are rarely needed by anything.
* command: if playback position is unknown, make percent-pos unavailablewm42014-01-151-3/+8
| | | | | | | Before that, it just returned -1. The print case is inconsistent with that, but I'll leave it for now, because it's consistent with status line / show_progress behavior.
* player: redo terminal OSD and status line handlingwm42014-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal OSD code includes the handling of the terminal status line, showing player OSD messages on the terminal, and showing subtitles on terminal (the latter two only if there is no video window, or if terminal OSD is forced). This didn't handle some corner cases correctly. For example, showing an OSD message on the terminal always cleared the previous line, even if the line was an important message (or even just the command prompt, if most other messages were silenced). Attempt to handle this correctly by keeping track of how many lines the terminal OSD currently consists of. Since there could be race conditions with other messages being printed, implement this in msg.c. Now msg.c expects that MSGL_STATUS messages rewrite the status line, so the caller is forced to use a single mp_msg() call to set the status line. Instead of littering print_status() all over the place, update the status only once per playloop iteration in update_osd_msg(). In audio- only mode, the status line might now be a little bit off, but it's perhaps ok. Print the status line only if it has changed, or if another message was printed. This might help with extremely slow terminals, although in audio+video mode, it'll still be updated very often (A-V sync display changes on every frame). Instead of hardcoding the terminal sequences, use terminfo/termcap to get the sequences. Remove the --term-osd-esc option, which allowed to override the hardcoded escapes - it's useless now. The fallback for terminals with no escape sequences for moving the cursor and clearing a line is removed. This somewhat breaks status line display on these terminals, including the MS Windows console: instead of querying the terminal size and clearing the line manually by padding the output with spaces, the line is simply not cleared. I don't expect this to be a problem on UNIX, and on MS Windows we could emulate escape sequences. Note that terminal OSD (other than the status line) was broken anyway on these terminals. In osd.c, the function get_term_width() is not used anymore, so remove it. To remind us that the MS Windows console apparently adds a line break when writint the last column, adjust screen_width in terminal- win.c accordingly.
* command: don't access VO for output parameterswm42014-01-091-12/+18
| | | | | | Use the video chain for this instead. This is for facilitating coming changes, which will clean up the vo->aspdat stuff, and this code would be in the way.
* audio: fix previous commitwm42014-01-061-1/+1
|
* sub: fix previous commitwm42014-01-061-2/+2
| | | | sub_seek and sub_step were broken.
* player: print an error message if run command failswm42014-01-051-1/+5
| | | | | | | | | | | Note that we can't use mp_msg, because it's not async-signal safe (we might be running other threads while forking, so only functions specified to be async-signal safe can be called, and this doesn't include stdio; mp_msg acquires a mutex too). Also, always print a \n before running the program to flush the status line. The effect is that a program running successfully as well as the error message will effectively start on a new line.
* player: add --secondary-sid for displaying a second subtitle streamwm42013-12-241-14/+35
| | | | | | | This is relatively hacky, but it's Christmas, so it's ok. This does two things: 1. allow selecting two subtitle tracks, and 2. include a hack that renders the second subtitle always as toptitle. See manpage additions how to use this.
* player: add infrastructure to select multiple tracks at oncewm42013-12-241-1/+1
| | | | | Of course this does not allow decoding multiple tracks at once; it just adds some minor infrastructure, which could be used to achieve this.
* player: redo demuxer stream selectionwm42013-12-241-3/+2
| | | | | | | Use struct track to decide what stream to select. Add a "selected" field and use that in some places instead of checking mpctx->current_track.
* path lookup functions: mp_msg conversionswm42013-12-211-1/+1
| | | | | | | | | | | | | | | | | 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 loo