aboutsummaryrefslogtreecommitdiffhomepage
path: root/player/video.c
Commit message (Collapse)AuthorAge
...
* vo: change internal API for drawing framesGravatar wm42015-07-01
| | | | | | | | | | | | | | draw_image_timed is renamed to draw_frame. struct frame_timing is renamed to vo_frame. flip_page_timed is merged into draw_frame (the additional parameters are part of struct vo_frame). draw_frame also deprecates VOCTRL_REDRAW_FRAME, and replaces it with a method that works for both VOs which can cache the current frame, and VOs which need to redraw it anyway. This is preparation to making the interpolation and (work in progress) display sync code saner. Lots of other refactoring, and also some simplifications.
* video: pass future frames to VOGravatar wm42015-07-01
| | | | | | | | | | Now the VO can request a number of future frames with the last parameter of vo_set_queue_params(). This will be helpful to fix the interpolation code. Note that the first frame (after playback start or seeking) will usually not have any future frames (to make seeking fast). Near the end of the file, the number of future frames will become lower as well.
* player: slim down A/V desync warningGravatar wm42015-06-30
| | | | | I don't think most of these suggestions are overly helpful. Just get rid of them.
* player: add some debug output for seekingGravatar wm42015-06-18
|
* player: actually play videoGravatar wm42015-06-18
| | | | Broken by e00e9d65.
* player: make decoding cover art more robustGravatar wm42015-06-18
| | | | | | | | | | | | | | When showing cover art, the decoding logic pretends that the source has an infinite number of frames. This slightly simplifies dealing with filter data flow. It was done by feeding the same packet repeatedly to the decoder (each decode run produces new output). Change this by decoding once at the video initialization. This is easier to follow, and increases robustness in case of broken images. Usually, we try to tolerate decoding errors, so decoding normally continues, but in this case it would just burn the CPU for no reason. Fixes #2056.
* video: remove worthless log messageGravatar wm42015-06-05
| | | | | All this information is already output otherwise. Except the FourCC, which lost most of its importance in mpv.
* vf_sub: minor simplificationGravatar wm42015-06-05
|
* video: do not use MP_NOPTS_VALUE for A/V differenceGravatar wm42015-05-24
| | | | | | There's no need for this, it just creates more corner cases. Also always reset it on seeks etc..
* video: force audio resync after video discontinuityGravatar wm42015-05-20
|
* video: better heuristic for timestamp resetsGravatar wm42015-05-20
| | | | | | | | | | | | | | | Reduce the default tolerance for timestamp jumps from 60 to 15 seconds. For .ts files, where ts_resets_possible coming from AVFMT_TS_DISCONT is set, apply a more sophisticated heuristic. It's clear that such a file wouldn't have a framerate below, say, 23hz. If the demuxer reports a lower fps, we allow longer PTS jumps. This should replace long pauses on discontinuities with .ts files with at most a short stutter. Of course, all kinds of things could go wrong anyway if the source is VFR, or FFmpeg's frame rate detection fails in some other way. I haven't found such a file yet, though.
* player: flush decoder even if cover art is decodedGravatar wm42015-04-24
| | | | | | | | | | | | | | | Fixes PNG cover art not showing up immediately (for example when running with --pause). libavformat exports embedded cover art as a single packet. For example, a PNG attachment simply contains the PNG image, which can be sent to the decoder. Normally you would expect that the PNG decoder would return 1 frame for 1 packet, without any delays. But this stopped working, and it incurs a 1 frame delay. This is perfectly legal (even if unexpected), so let our code feed the decoder packets until we get something back. (In theory feeding the packet instead of a real flush packet is still somewhat questionable.)
* player: don't show A/V desync message in non-sense situationsGravatar wm42015-04-24
| | | | | | | last_av_difference can be MP_NOPTS_VALUE under certain circumstances (like no video timestamp yet). This triggered the desync message, because fabs(MP_NOPTS_VALUE) is quite a large value. We don't want to show a message in this situation.
* player: cleanup update_fps() functionGravatar wm42015-04-20
| | | | | It was called only in 2 places, one of them redundant (the container FPS can not change).
* video: cleanup some old log messagesGravatar wm42015-04-20
| | | | | These are basically MPlayer leftovers, and barely useful due to being redundant with other messages. The FPS message is used somewhere else.
* video: do not show decoder framedrops if they're not requestedGravatar wm42015-04-16
| | | | | | | | | | | libavcodec makes it impossible to distinguish dropped frames (requested with AVCodecContext.skip_frame), and cases when the decoder simply does not return a frame by default (such as with VP9, which has invisible reference frames). This confuses users when decoding VP9 video. It's basically a cosmetic issue, so just paint it over by ignoring them if framedropping is disabled.
* player: silence spam in verbose mode when playing audio with cover artGravatar wm42015-04-14
| | | | | | When playing cover art, it conceptually reaches EOF as soon as the image was put on the VO, causing the EOF message to be repeated every time new audio was decoded. Just silence the message.
* Update license headersGravatar Marcin Kurczewski2015-04-13
| | | | Signed-off-by: wm4 <wm4@nowhere>
* video: cleanup stereo mode parsingGravatar wm42015-04-02
| | | | | | | | | Use OPT_CHOICE_C() instead of the custom parser. The functionality is pretty much equivalent. (On a side note, it seems --video-stereo-mode can't be removed, because it controls whether to "reduce" stereo video to mono, which is also the default. In fact I'm not sure how this should be handled at all.)
* video: fix seek-to-last-frameGravatar wm42015-03-26
| | | | | Accidentally broken in 79779616; we really need to check for true EOF, not just whether there are no frames yet.
* video: make frame skipping code slightly more readableGravatar wm42015-03-25
|
* video: refactor aspects of queue and EOF handlingGravatar wm42015-03-25
| | | | | Instead of touching the 2-entry queue in mpctx->next_frame directly, move some of it to functions.
* video: use less technical language for PTS warningGravatar wm42015-03-23
| | | | | | | "Non-monotonic" isn't even 100% correct; it's missing "strictly" (for briefness I guess), and also the message is printed if the PTS jumps forward. So just print something that is likely a bit easier to understand.
* video: fix update of vo-configured propertyGravatar wm42015-03-23
| | | | It obviously needs to be updated after the VO was destroyed.
* player: warn against non-monotonic video PTS only onceGravatar wm42015-03-18
| | | | | | | | For some reason there were two points in the code where it warned against non-monotonic video PTS. The one in video.c triggered on PTS going backwards or making large jumps forwards, while dec_video.c triggered on PTS going backwards or PTS not changing. Merge them into a single check, which warns against all cases.
* player: use symbolic constant for seek precisionGravatar wm42015-03-04
| | | | Meh.
* player: adjust A/V desync messageGravatar wm42015-02-26
| | | | | | Broken drivers are an issue rather often. Maybe this gives the user an idea that this could be the reason. (We can't dump much more info on a 80x24 terminal.)
* vf_vapoursynth: add display refresh rate propertyGravatar Julian2015-02-13
| | | | | This value is not necessarily trustworthy (it might change) and can be 0.
* player: remove --fixed-voGravatar wm42015-02-03
| | | | | | | 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.
* player: dump audio jitter to stats fileGravatar wm42015-02-01
| | | | | This allows us to plot the difference between video timestamps, and the adjusted video timestamps due to syncing video to audio speed.
* player: minor simplification in A/V-sync related codeGravatar wm42015-01-30
| | | | Just minor things.
* Revert "player: allow seeking audio between video frames"Gravatar wm42015-01-30
| | | | | | | | 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 tooGravatar wm42015-01-30
| | | | | | | | 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 codeGravatar wm42015-01-30
| | | | | | | | | | | | 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 timesGravatar wm42015-01-30
| | | | | | 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.
* player: remove redundant variableGravatar wm42015-01-29
| | | | | | 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 framesGravatar wm42015-01-28
| | | | | | | | | | | | | | | 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: mention mpv encoding support for transcoding in desync. warningGravatar wm42015-01-19
|
* video: fix waiting for last frame/format reconfigGravatar wm42015-01-19
| | | | | | | | | | | 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.)
* player: respect --untimed on last frameGravatar wm42015-01-16
| | | | | | | | | | | | | | 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 changesGravatar wm42015-01-16
| | | | | | | | | | | 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.
* video: fix timeline with some container formatsGravatar wm42015-01-06
| | | | | | Using edl or --merge-files with .avi files didn't work, because the DTS was not offset. Only the PTS was adjusted, which led to nonsense timestamps.
* video: batch query_format callsGravatar wm42015-01-03
| | | | | | | There are currently 568 pixel formats (actually fewer, but the namespace is this big), and for each format elaborate synchronization was done to call it synchronously on the VO. This is completely unnecessary, and we can do with just a single call.
* vf_vapoursynth: pass through container FPS valueGravatar wm42015-01-03
| | | | | | | | This is basically a hack; but apparently a needed one, since many vapoursynth filters insist on having a FPS set. We need to apply the FPS override before creating the filters. Also change some terminal output related to the FPS value.
* video: better pipelining with vf_vapoursynthGravatar wm42015-01-03
| | | | | | | | | | Most of this is explained in the code comments. This change should improve performance with vapoursynth, especially if concurrent requests are used. This should change nothing if vf_vapoursynth is not in the filter chain, since non-threaded filters obviously can not asynchronously finish filtering of frames.
* vo_opengl_cb: pass context directlyGravatar wm42014-12-31
| | | | | This is simpler than setting the context after VO creation, which requires the code to check for the context on every entrypoint.
* video: pass some VO params as structGravatar wm42014-12-31
| | | | | Not particularly elegant, but better than adding more and more stuff to the relevant function signatures.
* player: fix a typo in message outputGravatar wm42014-12-24
| | | | This typo has been around for over a year. Oops.
* client API: expose OpenGL rendererGravatar wm42014-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds API to libmpv that lets host applications use the mpv opengl renderer. This is a more flexible (and possibly more portable) option to foreign window embedding (via --wid). This assumes that methods like context sharing and multithreaded OpenGL rendering are infeasible, and that a way is needed to integrate it with an application that uses a single thread to render everything. Add an example that does this with QtQuick/qml. The example is relatively lazy, but still shows how relatively simple the integration is. The FBO indirection could probably be avoided, but would require more work (and would probably lead to worse QtQuick integration, because it would have to ignore transformations like rotation). Because this makes mpv directly use the host application's OpenGL context, there is no platform specific code involved in mpv, except for hw decoding interop. main.qml is derived from some Qt example. The following things are still missing: - a way to do better video timing - expose GL renderer options, allow changing them at runtime - support for color equalizer controls - support for screenshots
* player: when seeking past EOF with --keep-open, seek to last frameGravatar wm42014-12-07
| | | | | | | | | | | | | | | | | | | | | It feels strange that seeking past EOF with --keep-open actually leaves the player at a random position. You can't even unpause, because the demuxer is in the EOF state, and what you see on screen is just what was around before the seek. Improve this by attempting to seek to the last video frame if EOF happens. We explicitly don't do this if EOF was reached normally to increase robustness (if the VO got a frame since the last seek, it obviously means we had normal playback before EOF). If an error happens when trying to find the last frame (such as not actually finding a last frame because e.g. the demuxer misbehaves), this will probably turn your CPU into a heater. There is no logic to prevent reinitiating the last-frame search if the last-frame search reached EOF. (Pausing usually prevents that EOF is reached again after a successful last-frame search.) Fixes #819.