summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* player: fix --frameswm42014-10-142-2/+4
| | | | | | | | | This could produce an extra frame, because reaching the maximum merely signals the playloop to exit, without strictly enforcing the limit. Fixes #1181. CC: @mpv-player/stable
* command: don't display non-sense if volume is unavailablewm42014-10-111-1/+1
| | | | | | | | | Showed "Volume: (unavailable)%". That was dumb. The message string is now a bit convoluted; mostly because the property expand syntax can't do "if-else", just "if". CC: @mpv-player/stable
* command: make volume/mute unavailable if audio is not initializedwm42014-10-111-6/+4
| | | | | | | | | | This does nothing good. This reverts a change made over a year ago - I don't remember why this was originally done this way. The main problem is that even if the volume option is set (something like "--volume=75"), the volume property will always return "100" until audio is initialized. If audio is uninitialized again, the volume property will remain frozen at its last value.
* client API: check result ptr in mpv_command_nodeJames Ross-Gowan2014-10-121-1/+1
| | | | This follows the docs, which say the result parameter is optional.
* lua: add command_native() functionwm42014-10-111-0/+23
| | | | This is the Lua equivalent of mpv_command_node().
* client API: add mpv_command_node[_async]wm42014-10-111-3/+19
| | | | | | | | | Allows passing native types as arguments. Also some minor doc improvements, including giving some (natural) improvements to mpv_free_node_contents(). Note: mpv_command_node_async() is completely untested.
* input: use mpv_node parser for char** command parserswm42014-10-101-3/+2
| | | | Minor simplification, also drops some useless stuff.
* command: make audio device list available to the client APIwm42014-10-101-0/+32
|
* player: fix terminal status in idle modewm42014-10-101-0/+1
| | | | That's what this variable is for. This was missed in commit 9d5d031b.
* player: don't mess up cursor visibility statewm42014-10-101-1/+1
| | | | | | | | | | | | Manually setting can break things forever, because it puts the VO cursor state out of sync with the remembered state by handle_cursor_autohide(). Use the normal autohide code during idle mode too instead. (Originally the idea was to make the cursor always visible in idle mode, but not so important.) Regression since e1e8b07c. Fixes #1166. CC: @mpv-player/stable
* audio: change internal device listing APIwm42014-10-101-1/+1
| | | | | Now we run ao_driver->list_devs on a dummy AO instance, which will probably confuse everyone. This is done for the sake of PulseAudio.
* player: exit if audio init fails and there's no videowm42014-10-101-0/+2
| | | | | | Seems logical. For some reason, the player allows deselecting both audio and video stream without quitting (a deliberate feature of which I have no idea why it was added years ago), so this is needed.
* player: signal EOF when using --frameswm42014-10-102-2/+2
|
* player: minor simplificationwm42014-10-102-8/+2
|
* player: don't close audio device in gapless modewm42014-10-101-2/+1
| | | | I don't see much of a reason for this extra corner case.
* player: --save-position-on-quit should always work (2)wm42014-10-102-5/+5
| | | | | This reimplements the feature reverted in the previous commit in a different way.
* Revert "player: --save-position-on-quit should always work"wm42014-10-102-5/+1
| | | | | | | | | This reverts commit 45c8b97efbaff7a5031b008223eeed56f7b0607a. Some else complained (github issue #1163). The feature requested in #1148 will be implemented differently in the following commit.
* libmpv/cocoa: don't start the event monitorStefano Pigozzi2014-10-091-1/+2
| | | | | | The event monitor is used to get keyboard events when there is no window, but since it is a global monitor to the current process, we don't want it in a library setting.
* libmpv/cocoa: make global events work and get rid of is_cplayerStefano Pigozzi2014-10-093-6/+6
| | | | | | | After @frau's split of macosx_events from macosx_application, `is_cplayer' is not needed anymore. At the moment only global events such as Media Keys and Apple Remote work, because the VO-level ones were hardcoded to be disabled. (that will be fix in a later commit ).
* client API: add an explanatory commentwm42014-10-091-1/+1
| | | | | So someone reading this at least has a chance to find out what this is needed for.
* audio: add device selection & listing with --audio-devicewm42014-10-091-0/+4
| | | | | | | Not sure how good of an idea this is. This commit doesn't add support for this to any AO yet; the AO implementations will follow later.
* client API: rename --input-x11-keyboard to --input-vo-keyboardwm42014-10-091-1/+1
| | | | | Apparently we need this for Cocoa too. (The option was X11 specific in the hope that only X11 would need this hack.)
* video: try harder to decode cover art picture only oncewm42014-10-091-2/+7
| | | | | | | | | | | | | | | | | For cover art, we pretend that the video stream is infinite, but also stop decoding once we have an image on the VO (this seems advantageous for the case when strange filters are inserted or the VO image gets lost). Since a while ago, the video chain started decoding 2 images though ("Non-monotonic video pts: 0.000000 <= 0.000000"), which is annoying and wasteful. Improve this by handling a certain corner case at initialization, which will decode a second image while the first one is still stuck in the filter chain. Also, just in case there are filters which buffer a lot, also force EOF filtering (which means we tell the filters to flush buffered frames). CC: @mpv-player/stable
* player: don't reset buffering pausing state on seekswm42014-10-091-1/+0
| | | | | | | | This was added with commit 3cbd79b3, but it turns out this unintentionally enables "real" pausing when seeking while buffering. It was done for ensuring correct state of the "cache-buffering-state" property, but it also turns out that this was unneeded (another variable that is reset when seeking happens to take care of this).
* client API: introduce numeric log levelswm42014-10-081-0/+1
| | | | | | | | | | | | | | | | Maybe using strings for log levels was a mistake (too broad and too impractical), so I'm adding numeric log level at least for the receiver side. This makes it easier to map mpv log levels to other logging systems. I'm still too stingy to add a function to set the log level by a numeric value, though. The numeric values are not directly mapped to the internal mpv values, because then almost every file in mpv would have to include the client API header. Coalesce this into API version 1.6, since 1.6 was bumped just yesterday.
* player: minor cosmetic changewm42014-10-081-1/+1
|
* player: remove unnecessary codewm42014-10-071-3/+1
| | | | This part is already done by open_stream_async().
* command: add cache-buffering-state propertywm42014-10-073-1/+31
|
* client API: clarify pause/unpause events, modify core-idle propertywm42014-10-071-1/+2
| | | | | | | | Whether you consider the semantics weird or not depends on your use case, but I suppose it's a bit confusing anyway. At this point, we keep MPV_EVENT_PAUSE/UNPAUSE for compatibility only. Make the "core-idle" property somewhat more useful in this context.
* matroska: look for all known matroska file extensionswm42014-10-061-5/+18
| | | | | | For segment linking (this mechanism matches file extensions to avoid opening files which are most likely not Matroska files in order to speed up scanning).
* osd: don't let slow commands cut OSD messages shortwm42014-10-062-1/+9
| | | | Done for screenshot commands, requested by a user.
* player: --save-position-on-quit should always workwm42014-10-062-1/+5
| | | | | | | | | | | Now any action that stops playback of a file (even playlist navigation) will save the position. Normal EOF is of course excluded from this, as well as commands that just reload the current file. The option name is now slightly off, although you could argue what the word "quit" means. Fixes #1148 (or at least this is how I understood it).
* player: open stream and demuxer asynchronouslywm42014-10-066-19/+146
| | | | | | | | | | | | | | | | | | | | | | | | | Run opening the stream and opening the demuxer in a separate thread. This should remove the last code paths in which the player can normally get blocked on network. When the stream is opened, the player will still react to input and so on. Commands to abort opening can also be handled properly, instead of using some of the old hacks in input.c. The only thing the user can really do is aborting loading by navigating the playlist or quitting. Whether playback abort works depends on the stream implementation; with normal network, this will depend on what libavformat (via "interrupt" callback) does. Some pain is caused by DVD/BD/DVB. These want to reload the demuxer sometimes. DVB wants it in order to discard old, inactive streams. DVD/BD for the same reason, and also for reloading stream languages and similar metadata. This means the stream and the demuxer have to be loaded separately. One minor detail is that we now need to copy all global options. This wasn't really needed before, because the options were accessed on opening only, but since opening is now on a separate thread, this obviously becomes a necessity.
* m_config: add function to copy all optionswm42014-10-061-0/+3
| | | | Needed to copy the global option struct in the next commit.
* player: move some libass setup code to sub.cwm42014-10-034-96/+100
| | | | | | | | | | | | | | | Also recreate ASS_Library on every file played. This means we can move the code out of main.c as well. Recreating the ASS_Library object has no disadvantages, because it literally stores only the message callback, the (per-file) font attachment as byte arrays, and the set of style overrides. Hopefully this thing can be removed from the libass API entirely at some point. The only reason why the player core creates the ASS_Renderer, instead of the subtitle renderer, is because we want to cache the loaded fonts across ordered chapter transitions, so this probably still has to stay around for now.
* player: properly wakeup when delaying OSDwm42014-10-031-1/+3
| | | | | | | Not sure in which situations this could make a difference; probably none in practice, but it's more correct. CC: @mpv-player/stable
* video: return responsibility of video redraw back to playloopwm42014-10-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | When the VO was moved it its own thread, responsibility for redrawing was given to the VO thread itself. So if there was a condition that indicated that redrawing was required, like expose events or certain VOCTRLs, the VO thread was redrawing itself. This worked fine, but there are some corner cases where this works rather badly. E.g. if I fullscreen the player and hit panscan controls with mpv's default autorepeat rate, playback stops. This happens because the VO redraws itself after every panscan change command. Running each (repeated) command takes so long due to redrawing and (involuntary) waiting on vsync, that it never leaves the input processing loop while the key is held down. I suspect that in my case, redrawing in fullscreen mode just gets slow enough that it takes 2 vsyncs instead of 1 on average, and the processing time gets larger than the autorepeat delay. Fix this by taking redraw control from the VO, and instead let the playloop issue a "real" redraw command to the VO if needed. This basically reverts redraw handling to what it was before moving the VO to a thread. CC: @mpv-player/stable
* player: remove central uninit_player() function and flags messwm42014-10-039-227/+184
| | | | | | | | | | | | | | Each subsystem (or similar thing) had an INITIALIZED_ flag assigned. The main use of this was that you could pass a bitmask of these flags to uninit_player(). Except in some situations where you wanted to uninitialize nearly everything, this wasn't really useful. Moreover, it was quite annoying that subsystems had most of the code in a specific file, but the uninit code in loadfile.c (because that's where uninit_player() was implemented). Simplify all this. Remove the flags; e.g. instead of testing for the INITIALIZED_AO flag, test whether mpctx->ao is set. Move uninit code to separate functions, e.g. uninit_audio_out().
* command: don't show message on "osd" command by defaultwm42014-10-031-3/+2
| | | | | | Apparently this was not very popular. CC: @mpv-player/stable
* command: allow passing memory addresses to overlay_addwm42014-10-031-0/+6
| | | | | | | | | For the sake of libmpv. Might make things much easier for the user, especially on Windows. On the other hand, it's a bit sketchy that a command exists that makes the player access arbitrary memory regions. (But do note that input commands are not meant to be "secure" and never were - for example, there's the "run" command, which obviously allows running random shell commands.)
* command: restructure overlay_add codewm42014-10-031-46/+63
| | | | | | | | | Somewhat more flexible: now there's a separate overlay struct, and you don't need to coerce all state into struct sub_bitmap. Also, removing the previous mapping (munmap call) is now all in one place, the replace_overlay function. Makes the next commit easier to implement.
* player: don't print audio/video init failure message twicewm42014-10-022-3/+4
| | | | | | | The messages "Audio: no audio" and "Video: no video" could be printed twice each if initializing them failed. Prevent his silliness. CC: @mpv-player/stable
* audio: enable pitch correction by default when playing fastwm42014-10-021-2/+37
| | | | | | | Apparently this is what users want. When playing with normal speed, nothing is done. When playing slower than normal, resampling is used instead, because scaletempo (which does the pitch correction) adds too many artifacts.
* command: move setting playback speed to a separate functionwm42014-10-023-10/+19
|
* audio: refactor some aspects of filter chain setupwm42014-10-021-37/+37
| | | | | | | | | | | There's no real reason why audio_init_filter() should exist. Just use af_init or af_reinit directly. (We lose a useless message; the same information is printed in a quite close place with more details.) Requires less code, and the way the filter chain is marked as having failed to initialize allows just switching off audio instead of crashing if trying to insert a volume filter in mixer.c fails, and recreating the old filter chain fails too.
* audio: remove --audiodropwm42014-09-302-16/+0
| | | | | | | | | | | | | | | This would play some silence in case video was slower than audio. If framedropping is already enabled, there's no other way to keep A/V sync, short of changing audio playback speed (which would give worse results). The --audiodrop option inserted silence if there was more than 500ms desync. This worked somewhat, but I think it was a silly idea after all. Whether the playback experience is really bad or slightly worse doesn't really matter. There also was a subtle bug with PTS handling, that apparently caused A/V desync anyway at ridiculous playback speeds. Just remove this feature; nobody is going to use it anyway.
* lua: add mpv/lua directories to the lua pathOtto Modinos2014-09-281-0/+25
| | | | Signed-off-by: wm4 <wm4@nowhere>
* client API, X11: change default keyboard input handling againwm42014-09-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 64b7811c tried to do the "right thing" with respect to whether keyboard input should be enabled or not. It turns out that X11 does something stupid by design. All modern toolkits work around this native X11 behavior, but embedding breaks these workarounds. The only way to handle this correctly is the XEmbed protocol. It needs to be supported by the toolkit, and probably also some mpv support. But Qt has inconsistent support for it. In Qt 4, a X11 specific embedding widget was needed. Qt 5.0 doesn't support it at all. Qt 5.1 apparently supports it via QWindow, but if it really does, I couldn't get it to work. So add a hack instead. The new --input-x11-keyboard option controls whether mpv should enable keyboard input on the X11 window or not. In the command line player, it's enabled by default, but in libmpv it's disabled. This hack has the same problem as all previous embedding had: move the mouse outside of the window, and you don't get keyboard input anymore. Likewise, mpv will steal all keyboard input from the parent application as long as the mouse is inside of the mpv window. Also see issue #1090.
* video: change automatic rotation and 3D filter insertionwm42014-09-271-6/+3
| | | | | | | | | | | | | | | | | | | | | We inserted these filters with fixed parameters, which was ok. But this also didn't change image parameters for the filters down the filter chain and the VO. For example, if rotation by 90° was requested by the file, we would insert a filter and rotate the video, but the VO would still receive image parameters that direct rotation by 90°. This wasn't a problem, but it could become one. Fix this by letting the filters automatically pick up the image params. The image params are reset on application. (We could probably also always try to apply and reset image params in a filter, instead of having special "auto" parameters. This would probably work, and video.c would insert a "rotate=0" filter. But I'm afraid this would be confusing and the current solution is cosmetically slightly nicer.) Unfortunately, the vf_stereo3d.c change turned out a big mess, but once the "internal" filter is fully replaced with libavfilter, most of this can be radically simplified.
* input: separate creation and loading of configwm42014-09-271-1/+2
| | | | | | | | | | | Until now, creating the input_ctx was delayed until the command line and config files were parsed. Separate creation and loading so that input_ctx is available from start. This should make it possible to simplify some things. For example, some complications with Cocoa were apparently only because input_ctx was available only "later". (Although I'm not sure if this is still relevant, or if the Cocoa code should even be organized this way.)
* build: add -Wno-format-zero-lengthwm42014-09-262-2/+2
| | | | | | This warning makes absolutely no sense. Passing an empty string to printf-like functions is perfectly fine. In the OSD case, it just sets an empty message, practically clearing the OSD.
* player: do not wrongly clear OSD bar stops, reindentwm42014-09-251-30/+30
| | | | | | | | | | set_osd_bar_chapters() always cleared the OSD bar stops, even if the current bar was not the seek bar. Obviously it should leave the state of the bar alone in this case. Also change the function control flow so that we can drop one indentation level, and do the equivalent change for the other OSD bar functions.
* player: simplify OSD message handling codewm42014-09-252-103/+60
| | | | | | | | | | | Eliminate the remains of the OSD message stack. Another simplification comes from the fact that we do not need to care about time going backwards (we always use a monotonic time source, and wrapping time values are practically impossible). What this code was pretty trivial, and by now unnecessarily roundabout. Merge get_osd_msg() into update_osd_msg(), and add_osd_msg() into set_osd_msg_va().
* player: move code to make playloop smallerwm42014-09-252-9/+9
| | | | | This is basically a cosmetic change, although it weirdly also affects the percent position in encoding mode.
* player: rate-limit OSD text updatewm42014-09-254-10/+18
| | | | | | | | | | | | | | | There's no need to update OSD messages and the terminal status if nobody is going to see it. Since the player doesn't block on video display anymore, this update happens to often and probably burns slightly more CPU than necessary. (OSD redrawing is handled separately, so it's just mostly useless text processing and such.) Change it so that it's updated only on every video frame or all 50ms (whatever comes first). For VO OSD, we could in theory try to lock to the OSD redraw heuristic or the display refresh rate, but that's more complicated and doesn't work for the terminal status.
* player: fix OSD redraw heuristic with audio-only modewm42014-09-251-1/+1
| | | | | | When using --force-window (and no video or cover art), this heuristic prevents any redrawing during seeking. It should be applied only if there is any form of video.
* sub: approximate subtitle display in no-video modewm42014-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | This makes subtitle display somewhat work if no video is displayed, but a VO window exists (--force-window or cover art display). The main problem with normal subtitle display is that it's locked to video: it uses the video PTS as reference, and the subtitles advance only if a new video frame is displayed. In audio-only mode on the other hand, no video frame is ever displayed (or only 1 in the cover art case). You would need a workaround to adjust the subtitle PTS, and you would have to decide with what frequency to update the display. In general, there is no "right" display FPS for subtitles. Some formats (ASS) have animations parameterized by time, and any refresh rate could be used. Sidestep these problems by enabling the text OSD-based subtitle mechanism. This is similar to --no-sub-ass, and updates and renders subtitles with plain OSD. It has some caveats: no bitmap subs, somewhat incorrect timing, no formatting. Timing in particular is a bit strange and depends how often the audio output asks for new data, or other events that happen to wakeup the playloop.
* osc: update cache displayChrisK22014-09-251-3/+14
| | | |