summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command: remove extra spaceRyan Jacobs2014-08-291-1/+1
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: export demuxer cache info propertieswm42014-08-281-1/+35
|
* audio: restore old speed change behaviorwm42014-08-281-0/+2
| | | | | | | | | | | | | | | | | | | | Don't attempt to resync after speed changes. Note that most other cases of audio reinit (like switching tracks etc.) still resync, but other code paths take care of setting the audio_status accordingly. This restores the old behavior of not trying to fix audio desync, which was probably changed with commit 261506e3. Note that the code as of now wasn't even entirely correct, since the A/V sync values are slightly shifted. The dsync depends on the audio buffer size, so a larger buffer size will show more extreme desync. Also see mplayer2 commit 213a224e, which should fixed this - it was not merged into mpv, because it disabled audio for too long, resulting in a worse user experience. This is similar to the issue this commit attempts to fix. Fixes: #1042 (probably) CC: @mpv-player-stable
* command: change OSD formatting of "speed" propertywm42014-08-251-1/+1
| | | | The "x " prefix annoyed some users.
* video: get rid of video_next_pts fieldwm42014-08-221-1/+1
| | | | | | Not really needed anymore. Code should be mostly equivalent. Also get rid of some other now-unused or outdated things.
* command: add estimated-frame-count & estimated-frame-number propertiesAndrey Morozov2014-08-191-0/+39
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: drop " %" from "cache" property OSD-formattingwm42014-08-181-1/+1
|
* video: add VO framedropping modewm42014-08-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | This mostly uses the same idea as with vo_vdpau.c, but much simplified. On X11, it tries to get the display framerate with XF86VM, and limits the frequency of new video frames against it. Note that this is an old extension, and is confirmed not to work correctly with multi-monitor setups. But we're using it because it was already around (it is also used by vo_vdpau). This attempts to predict the next vsync event by using the time of the last frame and the display FPS. Even if that goes completely wrong, the results are still relatively good. On other systems, or if the X11 code doesn't return a display FPS, a framerate of 1000 is assumed. This is infinite for all practical purposes, and means that only frames which are definitely too late are dropped. This probably has worse results, but is still useful. "--framedrop=yes" is basically replaced with "--framedrop=decoder". The old framedropping mode is kept around, and should perhaps be improved. Dropping on the decoder level is still useful if decoding itself is too slow.
* command: for OSD, format cache property as integerwm42014-08-111-0/+5
| | | | For convenience. Use ${=cache} to get the old formatting.
* command: fix dangling pointer issue in script key bindings codewm42014-08-111-1/+1
| | | | | | | | This code was sending a string to a different thread, and then deallocated the string shortly after, which means most of the time the other thread was accessing a dangling pointer. It's possible that this is the cause for #1002.
* command: run OSD display code even if a property is unavailablewm42014-08-091-4/+2
| | | | | | | | | | | | | | Trying to jump chapters in a gile that has no chapters does nothing, not even show a warning. This is confusing. The reason is that the "add chapter" command will just bail out completely if the property is unavailable. This was because it exited when it couldn't get the property type. Instead of exiting, just don't enter the code that needs the type. (I'm not sure when this behavior changed. I consider it a regression. It was probably caused by changes to the chapter code, which perhaps started returning UNAVAILABLE instead of OK if there are no chapters.)
* command: add a "seeking" propertywm42014-08-081-0/+10
| | | | | | The client API exports this state via events already, but maybe it's better to explicitly provide this property in order to facilitate use on OSD and similar cases.
* client API: minor optimizations for property notificationwm42014-08-021-5/+42
| | | | | | | | | | | | | | | | | | | | | Internally, there are two mechanisms which can trigger property notification as used with "observed" properties in the client API. The first mechanism associates events with a group of properties that are potentially changed by a certain event. mp_event_property_change[] declares these associations, and maps each event to a set of strings. When an event happens, the set of strings is matched against the list of observed properties of each client. Make this more efficient by comparing bitsets of events instead. This way, only a bit-wise "and" is needed for each observed property. Even better, we can completely skip clients which have no observed properties that match. The second mechanism just updates individual properties explicitly by name. Optimize this by using the property index instead. It would be nice if we could reuse the first mechanism for the second one, but there are too many properties to fit into a 64 bit mask. (Though the limit on 64 events might get us into trouble later...)
* command: add a property that returns a list of all propertieswm42014-08-021-5/+25
| | | | Also remove the undocumented Lua mp.property_list() function.
* client API: don't send internal events to the clientswm42014-07-311-1/+2
| | | | | | | "Internal" events were added in the previous commits to leverage the client API property mechanism, without making weird properties public. But they were sent to clients too (and returned by mpv_wait_event()).
* command: add cache-idle propertywm42014-07-311-1/+14
|
* client API: make "cache" property and similar observablewm42014-07-311-0/+1
| | | | | | Achieve this by polling. Will be used by the OSC. Basically a bad hack - but the point is that the mpv core itself is in the best position to improve this later.
* player: fix time display wheen seeking past EOF with --keep-openwm42014-07-301-1/+3
| | | | | | | | | | | | | | Regression since commit 261506e3. Internally speaking, playback was often not properly terminated, and the main part of handle_keep_open() was just executed once, instead of any time the user tries to seek. This means playback_pts was not set, and the "current time" was determined by the seek target PTS. So fix this aspect of video EOF handling, and also remove the now unnecessary eof_reached field. The pause check before calling pause_player() is a lazy workaround for a strange event feedback loop that happens on EOF with --keep-open.
* command: fix and simplify overlay_addwm42014-07-251-50/+44
| | | | | | | | | | | | | | | | Actually free the old mmap region when readding an overlay of the same ID without removing it before. (This is explicitly documented as working.) Replace the OSD atomically. Before this commit, the overlays were removed and then readded to avoid synchronization problems. Simplify the code: now there is no weird mapping between index and ID. The OSD sub-bitmap list still needs to be prepared to skip unused IDs (since each sub-bitmap list entry must be in use), but the code for this is relatively separated now. Fixes issue #956.
* command: append entries to the end of the playlist with loadlist appendAlessandro Ghedini2014-07-251-1/+1
| | | | | | Currently entries are added after the current playlist element. This is kinda confusing, more so given that "loadfile append" appends at the end of the playlist.
* command: add append-play loadfile modewm42014-07-231-2/+2
| | | | | | | | "loadfile filename append-play" will now always append the file to the playlist, and if nothing is playing yet, start playback. I don't want to change the semantics of "append" mode, so a new mode is needed. Probably fixes issue #950.
* command: potentially fix dvd angle settingwm42014-07-201-5/+4
| | | | | | | | This called demux_flush(), but that doesn't make any sense with an asynchronously running demuxer. It would just keep reading and add new packets again. Explicitly pause the demuxer, so that this can't happen. Also, when flushing, data will be missing, so the decoders should always be reinitialized, even if the operation fails.
* demux: add a demuxer threadwm42014-07-161-50/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a thread to the demuxer which reads packets asynchronously. It will do so until a configurable minimum packet queue size is reached. (See options.rst additions.) For now, the thread is disabled by default. There are some corner cases that have to be fixed, such as fixing cache behavior with webradios. Note that most interaction with the demuxer is still blocking, so if e.g. network dies, the player will still freeze. But this change will make it possible to remove most causes for freezing. Most of the new code in demux.c actually consists of weird caches to compensate for thread-safety issues (with the previously single-threaded design), or to avoid blocking by having to wait on the demuxer thread. Most of the changes in the player are due to the fact that we must not access the source stream directly. the demuxer thread already accesses it, and the stream stuff is not thread-safe. For timeline stuff (like ordered chapters), we enable the thread for the current segment only. We also clear its packet queue on seek, so that the remaining (unconsumed) readahead buffer doesn't waste memory. Keep in mind that insane subtitles (such as ASS typesetting muxed into mkv files) will practically disable the readahead, because the total queue size is considered when checking whether the minimum queue size was reached.
* Revert "Remove DVD and Bluray support"wm42014-07-151-0/+133
| | | | | | This reverts commit 4b93210e0c244a65ef10a566abed2ad25ecaf9a1. *shrug*
* Remove DVD and Bluray supportwm42014-07-141-133/+0
| | | | It never worked well. Just remux your DVD and BD images to mkv.
* command: don't show VO information in colorspace propertieswm42014-07-131-3/+1
| | | | | | | | | | Until now, changing the properties showed the VO colorspace parameters on OSD. This didn't work quite well, because it showed the VO parameters _before_ the change. This is because at least one video frame with the new parameters has to be shown, and this doesn't happen right after changing the property, but a bit later. Also fix a random typo in unrelated code.
* audio: drop buffered audio when switching tracks or filterswm42014-07-131-0/+1
| | | | | | | | No reason to wait until the audio has been played. This isn't a problem with gapless audio disabled, and since gapless is now default, this behavior might be perceived as regression. CC: @mpv-player/stable
* Remove stream_pts stuffwm42014-07-061-17/+0
| | | | | This was used by DVD/BD, but its usage was removed with one of the previous commits.
* dvd: move angle switching codewm42014-07-051-14/+28
| | | | | No need to provide a "nice" API for it; just do this stuff directly in the command code.
* command: include new "playback-time" property in update mechanismwm42014-07-031-1/+1
|
* command: remove some code duplication in cache propertieswm42014-07-021-75/+33
| | | | | | | This also means that the printed size is always rounded to KBs, because the cache properties are returned in KB. I think this doesn't matter much. But if it does, the cache properties should probably changed to return bytes in the first place.
* command: cache can actually have full-size 0wm42014-07-021-4/+4
| | | | Then it's simply empty.
* command: change cache perentage to float, add cache-free and cache-usedAndrey Morozov2014-07-021-2/+97
|
* player: make the time display relative to start PTSTsukasa OMOTO2014-06-291-3/+13
| | | | | | This commit makes the playback start time always at time 0. Signed-off-by: wm4 <wm4@nowhere>
* command: fix tv-channel propertywm42014-06-251-0/+3
| | | | | Now it's at least actually relayed to the TV code. I didn't/couldn't test whether it actually works, though.
* options: Expose --colormatrix-primaries to the userNiklas Haas2014-06-221-0/+29
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: redo the property typewm42014-06-131-506/+599
| | | | | | | | | | | | | | | | | | | | | | | Instead of absuing m_option to store the property list, introduce a separate type for properties. m_option is still used to handle data types. The property declaration itself now never contains the option type, and instead it's always queried with M_PROPERTY_GET_TYPE. (This was already done with some properties, now all properties use it.) This also fixes that the function signatures did not match the function type with which these functions were called. They were called as: int (*)(const m_option_t*, int, void*, void*) but the actual function signatures were: int (*)(m_option_t*, int, void*, MPContext *) Two arguments were mismatched. This adds one line per property implementation. With additional the reordering of the parameters, this makes most of the changes in this commit.
* Add more constwm42014-06-111-5/+5
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* command: redo ancient TV/DVB/PVR commandswm42014-06-111-153/+107
| | | | | | | | | | | | | | | | | | Convert all these commands to properties. (Except tv_last_channel, not sure what to do with this.) Also, internally, don't access stream details directly, but dispatch commands with stream ctrls. Many of the new properties are a bit strange, because they're write- only. Also remove some OSD output these commands produced, because I couldn't be bothered to port these. In general, this makes everything much cleaner, and will also make it easier to e.g. move the demuxer to its own thread. Don't bother updating input.conf, but changes.rst documents how old commands map to the new ones. Mostly untested, due to lack of hardware.
* player: show "neutral" position markers for OSD barswm42014-06-081-2/+12
| | | | This commit implements them for volume and some video properties.
* command: format_bitrate: fix conversion to kbits and mbitsMarcoen Hirschberg2014-06-021-2/+2
| | | | | | | Bitrates are now expressed in bits/second. This commit fixes conversions which assumed it was still in bytes/second. Signed-off-by: wm4 <wm4@nowhere>
* command: improve video-bitrate propertyAndrey Morozov2014-06-011-1/+4
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Includes some cosmetic changes over the original PR.
* client API: report success status when running commandswm42014-06-011-26/+42
| | | | | | Until now, an error was reported only if the command couldn't be parsed. Attempt to do more fine-grained reporting. This is not necessarily perfect, but it's an improvement.
* command: property notification when changing af/vfwm42014-06-011-0/+1
|
* command: add const to mp_notify_propertywm42014-06-011-1/+1
|
* audio: rename i_bps to 'bitrate' to avoid confusionMarcoen Hirschberg2014-05-281-4/+4
| | | | Since i_bps now contains bits/sec, rename it to reflect this change.
* audio: change values from bytes-per-second to bits-per-secondMarcoen Hirschberg2014-05-281-1/+1
| | | | | | | The i_bps members of the sh_audio and dev_video structs are mostly used for displaying the average audio and video bitrates. Keeping them in bits-per-second avoids truncating them to bytes-per-second and changing them back lateron.
* command: add write_watch_later_config commandMartin2014-05-261-0/+5
| | | | | | Closes #808. Signed-off-by: wm4 <wm4@nowhere>
* stream: don't use end_poswm42014-05-241-7/+4
| | | | | | | | | | | | | | | | | | | Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The advantage is that always the correct size will be used. There can be no doubt anymore whether the end_pos value is outdated (as it happens often with files that are being downloaded). Some streams still use end_pos. They don't change size, and it's easier to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a STREAM_CTRL_GET_SIZE implementation to these streams. Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was uint64_t before). Remove the seek flags mess, and replace them with a seekable flag. Every stream must set it consistently now, and an assertion in stream.c checks this. Don't distinguish between streams that can only be forward or backwards seeked, since we have no such stream types.
* stream: kill start_pos, remove --sb optionwm42014-05-241-13/+1
| | | | | | | | | | | | | | | | | | | | stream.start_pos was needed for optical media only, and (apparently) not for very good reasons. Just get rid of it. For stream_dvd, we don't need to do anything. Byte seeking was already removed from it earlier. For stream_cdda and stream_vcd, emulate the start_pos by offsetting the stream pos as seen by the rest of mpv. The bits in discnav.c and loadfile.c were for dealing with the code seeking back to the start in demux.c. Handle this differently by assuming the demuxer is always initialized with the stream at start position, and instead seek back if initializing the demuxer fails. Remove the --sb option, which worked by modifying stream.start_pos. If someone really wants this option, it could be added back by creating a "slice" stream (actually ffmpeg already has such a thing).
* player: give quit_watch_later an exit code argument like quitwm42014-05-221-6/+3
| | | | | | | | The quit command has an optional argument that is used as exit code. Extend that to the quit_watch_later command. Actually, unify the implementations of the two commands. Requested in #798.
* options: unify code for setting string and "raw" optionswm42014-05-181-6/+5
| | | | | | | | | The code paths for setting options by string and by direct "raw" value were too different, which resulted in some weird code. Make the code paths closer to each other. Also, use this to remove the weirdness in the mpv_set_option() implementation.
* command: add a disc-menu-active propertywm42014-05-181-0/+11
| | | | Returns whether a DVD/BD menu is active. As requested by #788.
* player: reorganize how lua scripts are loadedwm42014-05-131-1/+0
| | | | | | Make loading of scripts independent of Lua. Move some of the loading code from lua.c to scripting.c, and make it easier to add new scripting backends.
* input: remove pausing command prefixeswm42014-05-111-9/+0
| | | | | | These are now equivalent to combining commands with the "cycle pause" or "set pause" commands, and thus are not needed anymore. They were also obscure and undocumented.
* command: add property that estimates current video FPSwm42014-05-081-0/+27
| | | | | | | | | | | | | | | | | | This is done after filters, so things like framerate-doubling deinterlacing is accounted for. Unfortunately, framedropping can cause inaccuracies (especially after precise seeks), and we can't really know when that happens. Even though we know that the decoder might drop a frame if we request it to do so, we don't know when the dropped frame will start or stop affecting the video filter chain. Video filters can have frames buffered, and we can't tell at which point the dropped frame would have been output. It's not even possible to mark a discontinuity after seek, because again we don't know if the filter chain still has the discontinuity within its buffers. So we have to live with the fact that the output of this property can be completely broken after seek, unless --no-hr-seek-framedrop is used.
* command: rename stream-length to file-size, format file sizeAndrey Morozov2014-05-061-13/+44
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: remove ifdefs for deint filterswm42014-05-061-4/+0
| | | | Doesn't have much of a purpose.
* common: change mp_snprintf_append semanticswm42014-05-051-2/+2
| | | | | | | | Make it more suitable for chaining. This means a function formatting a value to a string using a static buffer can work exactly like mp_snprintf_append itself. Also rena