summaryrefslogtreecommitdiffstats
path: root/player/core.h
Commit message (Collapse)AuthorAgeFilesLines
* client API: remove mpv_event_pause_reasonwm42014-04-141-7/+2
| | | | | | | | | 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-0/+1
| | | | | | | 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.
* 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'
* player: use MP_NOPTS_VALUE as rel_time_to_abs() error valuewm42014-03-251-2/+1
| | | | | | And consistently use MP_NOPTS_VALUE as error value for the users of this function. This is better than using -1, especially because negative values can be valid timestamps.
* player: remove weird separation between no chapters and 0 chapterswm42014-03-251-2/+0
| | | | | | For some reason, it mattered whether mpctx->chapters was NULL or not, even if mpctx->num_chapters was 0. Remove this separation; it serves no purpose.
* audio: remove handling of partially written datawm42014-03-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the ao_buffer_playable_samples field. This contained the number of samples that fill_audio_out_buffers() wanted to write to the AO (i.e. this data was supposed to be played at some point), but ao_play() rejected it due to partial fill. This could happen with many AOs, notably those which align all written data to an internal period size (often called "outburst" in the AO code), and the accepted number of samples is rounded down to period boundaries. The left-over samples at the end were still kept in mpctx->ao_buffer, and had to be played later. The reason ao_buffer_playable_samples had to exist was to make sure that at EOF, the correct number of left-over samples was played (and not possibly other data in the buffer that had to be sliced off due to endpts in fill_audio_out_buffers()). (You'd think you could just slice the entire buffer, but I suspect this wasn't done because the end time could actually change due to A/V sync changes. Maybe that was the reason it's so complicated.) Some commits ago, ao.c gained internal buffering, and ao_play() will never return partial writes - as long as you don't try to write more samples than ao_get_space() reports. This is always the case. The only exception is filling the audio buffers while paused. In this case, we decode and play only 1 sample in order to initialize decoding (e.g. on seeking). Actually playing this 1 sample is in fact a bug, but even of the AO doesn't have period size alignment, you won't notice it. In summary, this means we can safely remove the code.
* audio/out: make ao struct opaquewm42014-03-091-0/+5
| | | | | | We want to move the AO to its own thread. There's no technical reason for making the ao struct opaque to do this. But it helps us sleep at night, because we can control access to shared state better.
* player: make separation between user/automatic track selection strongerwm42014-03-031-0/+2
| | | | | | | | | | 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).
* player: cheap hack against idle event feedback loopwm42014-03-011-0/+1
| | | | | | | | | | | The OSC used significant CPU time while the player was paused. It turned out that the "tick" event sent during pause is the problem. The OSC accesses the player core when receiving a tick event, which in turn will cause the core to send another tick event, leading to infinite feedback. Fix this by sending an idle tick only every 500ms. This is not very proper, but the idea behind the tick event isn't very clean to begin with (and the OSC should use timers instead).
* config: don't save options to resume-config that didn't changewm42014-02-251-0/+2
| | | | | | | | | | | | | | | | This is approximate: we read each option value on program start (before starting playback of a file), and when writing the resume config, compare each value to the current state. This also means when a value is changed and then changed back, it's not stored. In particular, option values set in config files and on the command line are considered the default. This should help reducing the numbers of options overridden by the resume config. If too much is overridden, it becomes an inconvenience, because changes in config files will apparently have no effect when resuming a file. Also see github issue #574.
* client API: report pause/unpause reasonwm42014-02-241-2/+7
| | | | | | | | | 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: add events for video and audio reconfigwm42014-02-171-0/+2
|
* player: fix --force-window on OSXwm42014-02-111-0/+1
| | | | | | | | 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.
* build: add option to build a librarywm42014-02-101-0/+1
| | | | | | | | | | | | | 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: port to client APIwm42014-02-101-1/+0
| | | | | | | | | | | | | | | | 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-1/+8
| | | | | | | 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-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sub: uglify OSD code path with lockingwm42014-01-181-0/+2
| | | | | | | | | | | | | | | 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-15/+2
| | | | | | 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-1/+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.
* player: don't use OSD message stack for term OSD subswm42014-01-171-0/+1
| | | | | | | | Showing subtitles on terminal used the OSD message stack (which uses a stack to "pile up" messages that were displayed at the same time). This had a bunch of weird and annoying consequences. This accessed a certain osd_state field, which is a minor annoyance since I want to make that struct opaque. Implement this differently.
* player: redo terminal OSD and status line handlingwm42014-01-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* player: don't select subtitles added from quvi by defaultwm42014-01-051-0/+1
| | | | | | | | | | Quvi subtitles are considered external subtitles (simply because they're separate from the audio/video stream), but for the sake of subtitle auto-selection, they should not be considered external. Change this so that quvi subtitles are treated like muxed subtitles (with default flag never set). This means subtitles won't be selected by default, unless explicitly requested with --sid or --slang.
* player: add --secondary-sid for displaying a second subtitle streamwm42013-12-241-3/+4
| | | | | | | 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/+7
| | | | | 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-5/+7
| | | | | | | 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.
* player: move code aroundwm42013-12-221-1/+0
| | | | | | The only thing that used mp_load_per_file_config() was inside configfiles.c too, so remove the declaration from core.h and move the function before its use.
* player: use separate msg prefix for statuslinewm42013-12-211-0/+1
| | | | | So the user can specifically mute or unmute the status line with --msglevel. Accidentally removed with commit 5e0c4ec3.
* path lookup functions: mp_msg conversionswm42013-12-211-10/+5
| | | | | | | | | | | | | | | | | 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 lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
* m_option, m_config: mp_msg conversionswm42013-12-211-1/+1
| | | | | | | | Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
* sub/osd: mp_msg conversionswm42013-12-211-0/+1
|
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-1/+1
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Rename mp_core.h to core.hwm42013-12-171-0/+459
Get rid of the mp_ prefix.