aboutsummaryrefslogtreecommitdiffhomepage
path: root/player
Commit message (Collapse)AuthorAge
* player: use virtual time for --audio-file with ordered chaptersGravatar wm42014-08-15
| | | | | | | | | Apparently users prefer this behavior. It was used for subtitles too, so move the code to calculate the video offset into a separate function. Seeking also needs to be fixed. Fixes #1018.
* lua: wake up the core when setting OSDGravatar wm42014-08-15
| | | | | | | | | | The OSD is marked as changed, but the core isn't notified and this doesn't immediately wakeup. (Possibly the OSD code should wakeup the core instead, but maybe that woudl be overkill.) Observed when using "mp.use_suspend = false" in the OSC, and pausing, and moving the mouse pointer out of the window. The last part of the fade remained visible for longer than intended.
* osc: Overhaul (wip)Gravatar ChrisK22014-08-15
| | | | | | | | | | | | Code reorganized to make layouts exchangeable alternative test layout can be tested with layout=slimbox in the OSC config timers are now used to properly animate the fade out when the player is paused duplicate seeks are discarded again
* sub: add option to workaround broken mkv filesGravatar wm42014-08-14
| | | | See additions to options.rst.
* sub: call sub_reset() on seeks onlyGravatar wm42014-08-14
| | | | | | | | | | | | | | | | | sub_reset() was called on cycling subtitle tracks and on seeking. Since we don't want that subtitles disppear on cycling, sd_lavc.c didn't clear its internal subtitle queue on reset, which meant that seeking with PGS subtitles could leave the subtitle on screen (PGS subtitles usually don't have a duration set). Call it only on seeking, so we can also strictly clear the subtitle queue in sd_lavc. (This still can go very wrong if you disable a subtitle, seek, and enable it again - for example, if used with libavformat that uses "SSA" style demuxed ASS subtitle packets. That shouldn't happen with newer libavformat versions, and the user can "correct" it anyway by executing a seek while the subtitle is selected.)
* client API: directly lock playloopGravatar wm42014-08-14
| | | | | | | | Until recently, vo_opengl could be accessed from a single thread only, due to the OpenGL API context being thread-specific. This issue doesn't exist anymore, because VOs run on their own thread. This means we can simply lock/unlock the playloop instead of doing something complicated to get the playloop thread to execute our code.
* lua: allow disabling suspendGravatar wm42014-08-14
| | | | | I'd like to enable this by default, but unfortunately the OSC seems to have some problems with it.
* video: reduce non-sense messages when playing coverartGravatar wm42014-08-13
| | | | Don't print PTS warnings by skipping the normal video path.
* video: don't run new frame processing on every iterationGravatar wm42014-08-13
| | | | | | | This ran adjust_sync() on every playloop iteration, instead of every newly decoded frame. It seems this was idempotent in the common case, but the code was originally designed to be run once only, so restore that.
* video: move some more code aroundGravatar wm42014-08-13
| | | | No functional changes.
* video: move some code aroundGravatar wm42014-08-13
|
* video: exit early when nothing to doGravatar wm42014-08-13
| | | | | These cases were probably confusing. Exit early, which makes it much clearer what's going on. Should not change anything functionally.
* video: minor simplification of the old framedrop codeGravatar wm42014-08-13
| | | | | No changes in functionality, other than being slightly more correct at stream EOF.
* player: don't quit with --loop-fileGravatar wm42014-08-13
| | | | | | Fixes #1009. CC: @mpv-player/stable
* video: fix and simplify video format changes and last frame displayGravatar wm42014-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit broke these things, and fixing them is separate in this commit in order to reduce the volume of changes. Move the image queue from the VO to the playback core. The image queue is a remnant of the old way how vdpau was implemented, and increasingly became more and more an artifact. In the end, it did only one thing: computing the duration of the current frame. This was done by taking the PTS difference between the current and the future frame. We keep this, but by moving it out of the VO, we don't have to special-case format changes anymore. This simplifies the code a lot. Since we need the queue to compute the duration only, a queue size larger than 2 makes no sense, and we can hardcode that. Also change how the last frame is handled. The last frame is a bit of a problem, because video timing works by showing one frame after another, which makes it a special case. Make the VO provide a function to notify us when the frame is done, instead. The frame duration is used for that. This is not perfect. For example, changing playback speed during the last frame doesn't update the end time. Pausing will not stop the clock that times the last frame. But I don't think this matters for such a corner case.
* video: move display and timing to a separate threadGravatar wm42014-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VO is run inside its own thread. It also does most of video timing. The playloop hands the image data and a realtime timestamp to the VO, and the VO does the rest. In particular, this allows the playloop to do other things, instead of blocking for video redraw. But if anything accesses the VO during video timing, it will block. This also fixes vo_sdl.c event handling; but that is only a side-effect, since reimplementing the broken way would require more effort. Also drop --softsleep. In theory, this option helps if the kernel's sleeping mechanism is too inaccurate for video timing. In practice, I haven't ever encountered a situation where it helps, and it just burns CPU cycles. On the other hand it's probably actively harmful, because it prevents the libavcodec decoder threads from doing real work. Side note: Originally, I intended that multiple frames can be queued to the VO. But this is not done, due to problems with OSD and other certain features. OSD in particular is simply designed in a way that it can be neither timed nor copied, so you do have to render it into the video frame before you can draw the next frame. (Subtitles have no such restriction. sd_lavc was even updated to fix this.) It seems the right solution to queuing multiple VO frames is rendering on VO-backed framebuffers, like vo_vdpau.c does. This requires VO driver support, and is out of scope of this commit. As consequence, the VO has a queue size of 1. The existing video queue is just needed to compute frame duration, and will be moved out in the next commit.
* video: don't keep multiple pointers to hwdec info structGravatar wm42014-08-11
| | | | This makes a certain corner case simpler at a later point.
* player: remove cache status from video OSDGravatar wm42014-08-11
|
* video: fix dangling pointer issueGravatar wm42014-08-11
| | | | | | | | | | | The function video_decode_and_filter(), called between initializing the local vf variable and using it, can actually destroy and recreate the filter. Thus, the vf variable turns into a dangling pointer if that happens. Could be observed with: --hwdec=vda --deinterlace=yes --vf=yadif (Also happens with vdpau/vaapi.)
* command: for OSD, format cache property as integerGravatar wm42014-08-11
| | | | For convenience. Use ${=cache} to get the old formatting.
* command: fix dangling pointer issue in script key bindings codeGravatar wm42014-08-11
| | | | | | | | 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.
* player: don't delay OSD redraw when pausedGravatar wm42014-08-10
| | | | We want this heuristic to trigger during normal playback only.
* video: remove "hard" framedrop modeGravatar wm42014-08-09
| | | | | | | | | Completely useless, and could accidentally be enabled by cycling framedrop modes. Just get rid of it. But still allow triggering the old code with --vd-lavc-framedrop, in case someone asks for it. If nobody does, this new option will be removed eventually.
* command: run OSD display code even if a property is unavailableGravatar wm42014-08-09
| | | | | | | | | | | | | | 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" propertyGravatar wm42014-08-08
| | | | | | 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.
* player: indicate on the status line whether a seek is activeGravatar wm42014-08-08
| | | | | | This is delayed by 300ms - before that, the status doesn't change. I feel like it would too annoying if the status line would "flicker" on normal seek by quickly showing and hiding the indicator.
* audio: fix encoding modeGravatar wm42014-08-07
| | | | | | | | | If this code is not skipped, encoding (or dumping with --ao=pcm) will attempt to adjust video timing to audio. Since another commit (0cce8fe6) already avoids writing audio ahead, this didn't slow down encoding to realtime, but it was still significantly slower. This change should actually remove all extra sleeping.
* player: remove unused declarationGravatar wm42014-08-07
|
* client API: trigger MPV_EVENT_VIDEO_RECONFIG on vf recreationGravatar wm42014-08-06
| | | | | Until now, it was done only on VO reconfig, but this easily can miss some events, in case the VO output format doesn't change.
* audio: fix inverted conditionGravatar wm42014-08-06
| | | | | Recent regression. Could perhaps make gapless audio fail to work correctly.
* cocoa: fix build by using the correct HAVE_* macroGravatar Stefano Pigozzi2014-08-06
| | | | | | | | | | This builds but both the libmpv example and the cplayer block infinitely when building libmpv. That's because we wait inifinitely in `dispatch_sync` as there's no event loop in the main thread that allows for libdispatch to work.. Whiel we are at it, we should probably investigate how to use mp_dispatch instead since it is a little lower level and could give us higher control in building and event loop.
* cocoa: move set_input_context to macosx_eventsGravatar FRAU KOUJIRO2014-08-06
|
* sub: fix subtitle timing for TSGravatar wm42014-08-04
| | | | | | | | The subtitle timing logic always used the demuxer's start time as video offset. This made external subtitle files "just work" with file formats like TS, which usually have a non-0 start time. But it was wrong for subtitles muxed with the TS, so adjust the time offset explicitly with external files only.
* sub: don't read packets if video and audio are disabledGravatar wm42014-08-04
| | | | | | | | | Although disabling both video and audio is surely an obscure corner case, it's allowed, and we don't want the demuxer to skip arbitrary packets. Basically, make the heuristic for checking interleaved files affect external files only.
* player: some further playloop cleanupsGravatar wm42014-08-03
| | | | | | | | | | | | | Handle --term-playing-msg at a better place. Move MPV_EVENT_TICK hack into a separate function. Also add some words to the client API that you shouldn't use it. (But better leave breaking it for later.) Handle --frames and frame_step differently. Remove the mess from the playloop, and do it after frame display. Give up on the weird semantics for audio-only mode (they didn't make sense anyway), and adjust the manpage accordingly.
* player: make quit exit immediatelyGravatar wm42014-08-03
| | | | | Stopping playback canceled waiting, but executed the remainder of the playloop, including things like executing pointless seeks.
* player: allow redrawing screen during seeksGravatar wm42014-08-03
| | | | | | | | If seeks take very long, it's better not to freeze up the display. (This doesn't handle the case when decoding video frames is extremely slow; just if hr-seek is used, or the demuxer is threaded and blocks on network I/O.)
* player: don't show the path part for external subtitle filesGravatar wm42014-08-02
| | | | Show the filename only. Feature request on IRC.
* client API: minor optimizations for property notificationGravatar wm42014-08-02
| | | | | | | | | | | | | | | | | | | | | 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 propertiesGravatar wm42014-08-02
| | | | Also remove the undocumented Lua mp.property_list() function.
* Remove the last remains of slave modeGravatar wm42014-08-01
| | | | | | | | | | | Almost nothing was left of it. The only thing this commit actually removes is support for reading input commands from stdin. But you can emulate this via: --input-file=/dev/stdin --input-terminal=no However, this won't work on Windows. Just use a named pipe.
* player: don't ignore first chapterGravatar wm42014-07-31
| | | | | It's a mystery why this was done this way. If the first chapter starts later than the current position, we do have to return -1.
* video: fix attached picture modeGravatar wm42014-07-31
| | | | | | | | | Playing audio files with embedded cover art broke due to some of the recent changes. Treat video EOF properly, and don't burn the CPU. Disable hrseek for video in attached picture mode, since the decoder will always produce a new image, which makes hrseek never terminate. Fixes #970.
* audio: simplify conditionGravatar wm42014-07-31
| | | | | The expression added with the previous commit (0cce8fe6) looked slightly more complicated than it has to be. The code is equivalent.
* audio: fix A/V sync in encoding modeGravatar wm42014-07-31
| | | | | | | | | | | | | | | | | | | | | In encoding mode, the AO pretends to be infinitely fast (it will take whatever we write, without ever rejecting input). Commit 261506e3 broke this somehow. It turns out an old hack dealing with this was accidentally dropped. This is the hunk of code whose semantics were (partially) dropped: if (mpctx->d_audio && (mpctx->restart_playback ? !video_left : ao_untimed(mpctx->ao) && (mpctx->delay <= 0 || !video_left))) { int status = fill_audio_out_buffers(mpctx, endpts); // Not at audio stream EOF yet audio_left = status > -2; } This if condition is pretty wild, and it looked like it was pretty much for audio-only mode, rather than subtle handling for encoding mode.
* client API: don't send internal events to the clientsGravatar wm42014-07-31
| | | | | | | "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 propertyGravatar wm42014-07-31
|
* client API: make "cache" property and similar observableGravatar wm42014-07-31
| | | | | | 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.
* client API: fix deadlock when calling mpv_terminate_destroy before initGravatar wm42014-07-31
| | | | | | | | | | This is perfectly allowed, but was ignored, because it's a corner case. It doesn't actually wait for other clients to be destroyed, but on the other hand I think there's no way to have other clients before initialization. CC: @mpv-player/stable
* player: rename a variableGravatar wm42014-07-30
| | | | | Make it clear that this condition happens when switching to a new timeline segment. It doesn't even need to coincide with a chapter.