summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* matroska: warn against mismatching segmentswm42015-02-041-0/+49
| | | | | | | | Matroska ordered chapters require all segment files to have the same layout. If a referenced file has more tracks than the main file or misses some tracks, the file is invalid. Also see issue #1553.
* player: move timeline specific handling to timeline loaderswm42015-02-044-14/+14
| | | | In particular, gets rid of the Matroska specifics from the common code.
* command: add on_unload hookwm42015-02-041-0/+10
| | | | Fixes #1552.
* player: make --force-window create the window immediately on startwm42015-02-031-0/+1
| | | | | | | | | | | | | | | | Before this change, window creation was delayed until the video was initialized. This guaranteed that the first window size was that of the video, so the WM would place it correctly. Some time ago, it was requested on the IRC channel that --force-window should not do this. Sometimes, it can take a while until video is initialized, e.g. when youtube-dl is used (which incurs lots of network delay). In this case, it's awkward that it takes so long until a window (any window) is shown. On the other hand, this can cause incorrect window placement with some WMs. We simply hope that this won't happen with modern WMs. (Although it does with the WM I use, crappy old IceWM.)
* player: remove --fixed-vowm42015-02-033-7/+2
| | | | | | | In ancient times, this was needed because it was not default, and many VOs had problems with it. But it was always default in mpv, and all VOs are required to deal with it. Also, running --fixed-vo=no is not useful and just creates weird corner cases. Get rid of it.
* command: new commands audio_add/audio_remove/audio_reloadxylosper2015-02-033-34/+37
| | | | | | | | These commands are counterparts of sub_add/sub_remove/sub_reload which work for external audio file. Signed-off-by: wm4 <wm4@nowhere> (minor simplification)
* command: add property returning detected audio deviceStefano Pigozzi2015-02-031-1/+11
| | | | | This can be useful to adjust some other audio related properties at runtime depending on the audio device being used.
* command: add property returning detected hwdec APIwm42015-02-021-1/+32
| | | | | | | | | This is somewhat imperfect, because detection of hw decoding APIs is mostly done on demand, and often avoided if not necessary. (For example, we know very well that there are no hw decoders for certain codecs.) This also requires every hwdec backend to identify itself (see hwdec.h changes).
* player: add external audio file auto-loadingwm42015-02-021-44/+58
| | | | | | Apparently some people want this. Not enabled by default. Fixes #967.
* command: add properties returning the current VO and AO driverwm42015-02-021-2/+18
| | | | This wasn't possible before.
* client API: add mpv_wait_async_requests()wm42015-02-021-8/+12
| | | | | | | | | | | | | | | | | | | | This does what it's documented to do. The implementation reuses the code in mpv_detach_destroy(). Due to the way async requests currently work, just sending a synchronous dummy request (like a "ignore" command) would be enough to ensure synchronization, but this code will continue to work even if this changes. The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed. (If a client is somehow very slow to terminate, this could silence an annoying queue overflow message, but all in all it does nothing.) Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is in theory allowed, so change pthread_cond_signal() to pthread_cond_broadcast() to avoid missed wakeups. As requested in issue #1542.
* command: add dummy get implementation for tv-channel propertywm42015-02-021-0/+2
| | | | | A small cosmetic change with the effect that pressing 'k' shows "unavailable" instead of "error" (even if no TV code is active).
* player: dump audio jitter to stats filewm42015-02-011-4/+5
| | | | | This allows us to plot the difference between video timestamps, and the adjusted video timestamps due to syncing video to audio speed.
* command: send additional property change events in-between loadingwm42015-02-013-0/+3
| | | | | | | | Opening the stream and opening the demuxer are both done asynchronously, meaning the player reacts to client API requests. They also can potentially take a while. Thus it's better to process outstanding property changes, so that change events are sent for properties that were changed during opening.
* command: improve observability of some audio propertieswm42015-02-011-1/+2
| | | | | | | | | In particular, this would fix the sending the initial change event. It was easily missed because MPV_EVENT_FILE_LOADED usually triggered it, but the actual property could change only later, because audio initialization really is kind of asynchronous to it. This probably fixes #1544.
* player: don't treat audio playback restart while paused specialwm42015-01-301-4/+1
| | | | | | I guess this was supposed to be some sort of optimization, but even though it probably works, it's pretty meaningless and I couldn't measure a difference. One special case killed.
* player: minor simplification in A/V-sync related codewm42015-01-302-10/+6
| | | | Just minor things.
* Revert "player: allow seeking audio between video frames"wm42015-01-301-9/+1
| | | | | | | | This reverts commit 7b3feecbc23e3e0b0d9cf66f02af53d127a0b681. It's broken, hr-seek never ends at a video position before seek pts. Not sure what I was thinking, although it did work anyway when artificially forcing a video frame to display before seek pts.
* player: print desync message on negative A/V-sync toowm42015-01-301-1/+1
| | | | | | | | At least there is _some_ problem if this happens. It would mean that audio is playing slower than video. Normally, video is synced to audio, so if audio stops playback completely, video will not advance at all. But using things like --autosync, it's well possible that this kind of desync happens.
* player: rearrange some A/V-sync related codewm42015-01-301-6/+5
| | | | | | | | | | | | Move the update_avsync_before_frame() call further down. Moving it closer to where the time_frame value is used (and which the function updates) should make the code more readable. With this change, there's no need anymore to reset the time_frame value on the video reconfig path. Move the update_avsync_after_frame() up. Now no meaningful amount of time passes since the previous get_relative_time() call anymore, and the second one can be removed.
* player: use correct type for some relative timeswm42015-01-301-3/+3
| | | | | | We use double for these things everywhere, just this code didn't. It likely doesn't matter much, and this code is for an optional feature too.
* command: change sub-visibility OSD messagewm42015-01-291-1/+2
| | | | | | | | | | | | | Now it shows one of: - "Subtitles hidden" (sub-visibility=no) - "Subtitles visible" (sub-visibility=yes, sub!=no) - "Subtitles visible (but no subtitles selected)" (otherwise) It should be a bit more self-explanatory than before. On the other hand, I have no clue about UI issues. This also gets close to what's reasonably possible with the OSD expansion string syntax, which is why it looks so awful.
* player: move more code out of central playloop functionwm42015-01-291-58/+73
| | | | | | | | | | ...into its own functions. The central playloop function is still too big, but looks much cleaner now. No changes in functionality. The code moved to handle_playback_restart() is unindented by 1 level and moving it out of the if condition around. The if condition is inverted and early-exits from the function. Also some comments are changed.
* player: remove redundant variablewm42015-01-295-12/+9
| | | | | | mpctx->audio_delay always has the same value as opts->audio_delay. (This was not the case a long time ago, when the audio-delay property didn't actually write to opts->audio_delay. I think.)
* player: allow seeking audio between video frameswm42015-01-281-1/+9
| | | | | | | | | | | | | | | This allows seeking audio between two video frames that are relatively far away. The implementation of this is a bit subtle. It pretend the audio position is different, and the actual PTS adjustment happens in audio.c with this line: sync_pts -= mpctx->audio_delay - mpctx->delay; Effectively this is the same as setting sync_pts to hrseek_pts after this line, though. (I'm actually not sure if this could be written in a more straightforward way; probably yes.)
* player: enable hr-seek on audio after video endwm42015-01-281-1/+2
| | | | | | | | | | | | | | | | | | Some files can have audio after video has ended, and playback of the audio-only remainder is supposed to work just fine. Seeking is broken-ish though. Not much can be done about this, since it's the way demuxers work. Also, such files are obscure corner cases. But enabling hr-seek for audio after video end can improve the situation a lot. This helps with issue #1533. The reported also provided a command line to produce such a file: ffmpeg -i image.jpg -i audio.flac -threads $(nproc) \ -c:v libvpx -crf 10 -qmin 5 -qmax 55 \ -vf scale=360:-1 -sws_flags lanczos -c:a libvorbis -ac 2 \ -b:a 128K out.webm
* player: demote matroska ordered chapter scanning messages to VerboseDiogo Franco (Kovensky)2015-01-281-1/+1
| | | | | Causes a lot of terminal spam on large folders and is not actually useful except maybe for debugging.
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-1/+1
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* command: export more details about file seekabilitywm42015-01-261-0/+10
| | | | | | | | | | If a file is unseekable (consider e.g. a http server without resume functionality), but the stream cache is active, the player will enable seeking anyway. Until know, client API user couldn't know that this happens, and it has implications on how well seeking will work. So add a property which exports whether this situation applies. Fixes #1522.
* player: fix framestep over timeline segment boundarieswm42015-01-261-0/+2
| | | | | | | | | | | This was subtly broken by commit a937ba20. Instead of framestepping over the timeline segment boundary, it would just unpause playback, because seeking now resets mpctx->step_frames. This was especially apparent when doing something like "mpv *.jpg --merge-files". Fix by restoring the step_frames field specifically if the seek is done for switching segment boundaries. Hopefully the number fields which need such an exception on seeking won't grow and turn this code into a mess.
* options: list correct default value for --screenshot-templatewm42015-01-261-1/+1
| | | | | | Make the default value part of the option metadata, instead of doing this in the screenshot code. Makes more sense with --list-options and the command.c option metadata properties.
* lua: do not use math.pow()wm42015-01-251-1/+1
| | | | | It's the first thing that breaks with Lua 5.3. I don't know if there are other failures because I don't care enough.
* vo: simplify VOs by adding generic screenshot supportwm42015-01-241-1/+1
| | | | | | | | | | | At the time screenshot support was added, images weren't refcounted yet, so screenshots required specialized implementations in the VOs. But now we can handle these things much simpler. Also see commit 5bb24980. If there are VOs in the future which can't do this (e.g. they need to write to the image passed to vo_driver->draw_image), this still could be disabled on a per-VO basis etc., so we lose no potential performance advantages.
* ytdl: implement user-agent and cookie overrideswm42015-01-241-5/+34
| | | | | | | | | | | | | | | | For some sites, youtube-dl sends a special user-agent. If we don't send the same user-agent, the server will reject mpv's connection attempt. This was observed with trailers.apple.com. Fix it by forcing the user-agent youtube-dl uses. Some sites set cookies when doing a website access, and require the client to provide these cookies when downloading the actual media. This is needed at least by nicovideo.jp. Fix by adding youtube-dl's cookies to our request headers. Both of these require a very recent youtube-dl version (youtube-dl added the necessary headers a few hours ago). The script still works with older youtube-dl versions, though.
* video: separate screenshot modeswm42015-01-231-24/+25
| | | | | | | | | Use different VOCTRLs for "window" and normal screenshot modes. The normal one will probably be removed, and replaced by generic code in vo.c, and this commit is preparation for this. (Doing it the other way around would be slightly simpler, but I haven't decided yet about the second one, and touching every VO is needed anyway in order to remove the unneeded crap. E.g. has_osd has been unused for a long time.)
* input, player: new command for mouse eventxylosper2015-01-231-0/+19
| | | | | | | New command `mouse <x> <y> [<button> [single|double]]` is introduced. This will update mouse position with given coordinate (`<x>`, `<y>`), and additionally, send single-click or double-click event if `<button>` is given.
* command: export file format as propertywm42015-01-231-0/+12
| | | | | | | | | | | | Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
* player: some fixes for property notificationxylosper2015-01-232-4/+4
| | | | | | | | | | `core-idle` depends on seeking state `mpctx->restart_complete`, so make `core-idle` notified whenever `seeking` is notified, too. `paused-for-cache` can be changed on MPV_EVENT_CACHE_UPDATE obviously. Finally, `MPV_EVENT_PLAYBACK_RESTART` should be notified after `mpctx->restart_complete` changed.
* video: handle hwdec screenshots differentlywm42015-01-221-0/+10
| | | | | | | | Instead of converting the hw surface to an image in the VO, provide a generic way to convet hw surfaces, and use this in the screenshot code. It's all relatively straightforward, except vdpau is being terrible. It needs a huge chunk of new code, because copying back is not simple.
* client API: check locale, and reject anything other than "C" localewm42015-01-201-0/+16
| | | | | | | | | | | | | | | Sigh... The C locale system is incredibly shitty, and if used, breaks basic string functions. The locale can change the decimal mark from "." to ",", which affects conversion between floats and strings: snprintf() and strtod() respect the locale decimal mark, and change behavior. (What's even better, the behavior of these functions can change asynchronously, if setlocale() is called after threads were started.) So just check the locale in the client API, and refuse to work if it's wrong. This also makes the lib print to stderr, which I consider the lesser evil in this specific situation.
* win32: remove check for SetPriorityClass()wm42015-01-201-3/+3
| | | | | | | | | | This function is always available, which is reflected by the fact that the configure check doesn't actually bother to check for its existence. Instead, MinGW and Cygwin imply it. The check was probably "needed" when the priority code was still in a separate source file. Remove the check, and use _WIN32 for testing for the win32 API (in a bunch of other places too).
* audio: don't force any parameters if spdif is usedwm42015-01-201-5/+3
| | | | | | The existing code only ignored --audio-channels, but not --audio-rate or --audio-format if spdif passthrough is used. Setting these makes no sense.
* demux_disc: pass seek flags to stream layerwm42015-01-191-3/+6
| | | | | | | | | | | | | | | | Pass through the seek flags to the stream layer. The STREAM_CTRL semantics become a bit awkward, but that's still the least awkward part about optical disc media. Make demux_disc.c request relative seeks. Now the player will use relative seeks if the user sends relative seek commands, and the demuxer announces it wants these by setting rel_seeks to true. This change probably changes seek behavior for dvd, dvdnav, bluray, cdda, and possibly makes seeking useless if the demuxer-cache is set to a high value. Will be used in the next commit. (Split to make reverting the next commit easier.)
* client API: minor cleanupwm42015-01-191-17/+28
| | | | | Try not to put "everything" into mpv_wait_event: move out the code for generating log message events.
* client API: notify API user on event queue overflowwm42015-01-192-11/+23
| | | | | | | | | | | | | | | Before this, we merely printed a message to the terminal. Now the API user can determine this properly. This might be important for API users which somehow maintain complex state, which all has to be invalidated if (state-changing) events are missing due to an overflow. This also forces the client API user to empty the event queue, which is good, because otherwise the event queue would reach the "filled up" state immediately again due to further asynchronous events being added to the queue. Also add some minor improvements to mpv_wait_event() documentation, and some other minor cosmetic changes.
* player: mention mpv encoding support for transcoding in desync. warningwm42015-01-191-1/+1
|
* video: fix waiting for last frame/format reconfigwm42015-01-191-1/+1
| | | | | | | | | | | We still need to send the VO a duration in these cases. Disabling framedrop has logically absolutely nothing to do with these cases; it was overlooked in commit 918b06c4. So we always send the frame duration (or a guess for it), and check whether framedropping is actually enabled in the VO code. (It would be cleaner to send framedrop as a flag, but I don't care about that right now.)
* x11: add --on-all-workspaces option and propertywm42015-01-161-0/+9
| | | | Fixes #1469.
* command: unify handling of fullscreen and other VO flagswm42015-01-161-21/+12
| | | | | | | | The "ontop" and "border" properties already used a common mp_property_vo_flag() function, and the corresponding VOCTRLs used the same conventions. "fullscreen" is pretty similar, but was handled slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same helper function for "fullscreen" as the other flags.
* player: don't enable demuxer readahead before selecting trackswm42015-01-162-5/+6
| | | | | | | | | | This is for the ordered chapters case only. In theory this could have resulted in initial audio, video or subs missing, although it didn't happen in practice (because no streams were selected, thus the demuxer thread didn't actually try to read anything). It's still better to make this explicit. Also, timeline_set_part() can be private to loadfile.c.
* player: respect --untimed on last framewm42015-01-161-1/+3
| | | | | | | | | | | | | | The last video frame is another case that has a separate code path, although it's pretty similar to the one in commit 73e5aa87. Fix this in a different way, which also takes care of the last frame case, although without context the code becomes slightly more tricky. As further cleanup, move the decision about framedropping itself to the same place, so the check in vo.c becomes much simpler. The check for the vo->driver->encode flag, which is remvoed completely, was redundant too. Fixes #1480.
* player: respect --untimed on video format changeswm42015-01-161-1/+1
| | | | | | | | | | | If the video format changes (e.g. different frame size), a special code path is entered to wait until the currently displayed frame is done. Otherwise, the frame before the change would be destroyed by the vo_reconfig() call. This code path didn't respect --untimed; correct this. Fixes #1475.
* ytdl_hook: Check for empty playlistsChrisK22015-01-161-1/+7
| | | | | Sometimes we get empty playlists back, print a warning message instead of crash
* OSC: Reset all styles for idle messageChrisK22015-01-161-6/+6
|
* player: don't fall asleep on audio decoding errorswm42015-01-151-0/+2
| | | | | | This makes it retry later. Fixes #1474.
* player: fix --stop-playback-on-init-failure on audio init failurewm42015-01-151-2/+1
| | | | | | | This was forgotten when the option was implemented, and makes this option work as advertised. Fixes #1473 (though the default behavior is probably still stupid).
* osc: fix disabling OSCwm42015-01-151-1/+5
| | | | | | | Upon the "DEL" key binding or the "disable-osc" message, the OSC should stay permanently invisible. This was recently broken (not sure by what), because other code accidentally reenables it anyway, which resulted in the OSC appearing again when moving the mouse.
* player: fallback to seek time for percent-pos propertywm42015-01-141-2/+2
| | | | | | | | | | | | | The percent-pos property normally goes by time, except for file formats like .ts or .ogg, where you can't trust the timestamps and duration info to compute the position in the overall files. These use the byte position and size instead. When the file position was unavailable (e.g. due to an ongoing seek), the percent-pos was unknown. Change it to use the time position instead. In most cases, it's actually accurate enough, and the temporary unavailability of the property can be annoying, e.g. on the terminal status line.
*