summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* player: add a --loop-file optionwm42014-04-171-0/+1
| | | | Unlike --loop, loops a file instead of the playlist.
* client API: remove mpv_event_pause_reasonwm42014-04-141-5/+5
| | | | | | | | | And slightly adjust the semantics of MPV_EVENT_PAUSE/MPV_EVENT_UNPAUSE. The real pause state can now be queried with the "core-idle" property, the user pause state with the "pause" property, whether the player is paused due to cache with "paused-for-cache", and the keep open event can be guessed with the "eof-reached" property.
* command: add property to indicate when pausing due to --keep-openwm42014-04-141-2/+11
| | | | | | | This property is set to "yes" if playback was paused due to --keep-open. The change notification might not always be perfect; maybe that should be improved.
* command: add a property to indicate core pause statewm42014-04-141-2/+11
| | | | | | | | | Currently this is (probably) equivalent to "paused-for-cache", but the latter is a bit special, while this new property is a bit more general. One case where they might actually be different is dvdnav menus, but I haven't checked. Also add property change notifications for these two properties.
* command: vf-metadata: minor fixup of return statusKevin Mitchell2014-04-141-1/+1
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: add vf-metadata propertyKevin Mitchell2014-04-131-1/+37
| | | | | | | This is a read-only property that uses VFCTRL_GET_METADATA to retrieve mp_tags metadata from a filter specified by label Signed-off-by: wm4 <wm4@nowhere>
* player: remove ASX, SMIL and NSC playlist parserswm42014-04-131-1/+0
| | | | | | | | | | | | | | | | | | | These playlist parsers are all what's left from the old mplayer playlist parsing code. All of it is old code that does little error checking; the type of C string parsing code that gives you nightmare. Some playlist parsers have been rewritten and are located in demux_playlist.c. The removed formats were not reimplemented. ASX and SMIL use XML, and since we don't want to depend on a full blown XML parser, this is not so easy. Possibly these formats could be supported by writing a very primitive XML-like lexer, which would lead to success with most real world files, but I haven't attempted that. As for NSC, I couldn't find any URL that worked with MPlayer, and in general this formats seems to be more than dead. Move playlist_parse_file() to playlist.c. It's pretty small now, and basically just opens a stream and a demuxer. No use keeping playlist_parser.c just for this.
* command: add paused-for-cache, total-avsync-change, drop-frame-count propertiesDavid Weber2014-04-131-0/+33
| | | | | | | | | This is needed if you want to reimplement the status line in lua I could only test drop-frame-count because I didn't find an easy way to trigger paused-for-cache and total-avsync-change Signed-off-by: wm4 <wm4@nowhere>
* cache: allow resizing at runtimewm42014-04-091-0/+29
| | | | | | | | | | | The only tricky part is keeping the cache contents, which is made simple by allocating the new cache while still keeping the old cache around, and then copying the old data. To explain the "Don't use this when playing DVD or Bluray." comment: the cache also associates timestamps to blocks of bytes, but throws away the timestamps on seek. Thus you will experience strange behavior after resizing the cache until the old cached region is exhausted.
* 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
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |