summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* video: actually flush filter chainwm42014-07-301-1/+4
| | | | | | | Frames buffered in filters weren't flushed, so on EOF, the last frames were dropped, depending on how much filters buffered. Oops. Test case: "mpv something.jpg --vf=buffer"
* video/filter: add vf_bufferwm42014-07-305-0/+103
| | | | Mostly useful for debugging.
* audio: better sync behavior on bogus EOFwm42014-07-301-1/+3
| | | | | | | In situations when the demuxer reports EOF, but immediately "recovers" after that and returns new data, it could happen that audio sync was skipped. Deal with this by actually entering the EOF state, instead of assuming this will happen later.
* ao_alsa: disable use of non-interleaved formats by defaultwm42014-07-302-0/+10
| | | | | | | | Some ALSA plugins take non-interleaved audio, but treat it as interleaved, which results in various funny bugs. Users keep hitting this issue, and it just doesn't seem worth the trouble. CC: @mpv-player/stable
* cocoa: fix key equivalent dispatchingStefano Pigozzi2014-07-302-22/+7
| | | | | | | | | | Prior to this commit we had a list of key modifiers and checked against that. Actually, the Cocoa framework has a built in way to do it and it involves calling performKeyEquivalent: on the menu instance. Fixes #946 cc @mpv-player/stable: this should apply with no conflicts
* client API: fix typos in documentationwm42014-07-301-2/+2
|
* demux_lavf: don't consider EAGAIN as EOF conditionwm42014-07-301-2/+3
| | | | | | | | | | This happens apparently randomly with rtmp:// and after seeks. This eventually leads to audio decoding returning an EOF status, which basically disables audio sync. This will lead to audio desync, even if audio decoding later "recovers" when the demuxer actually returns audio packets. Hack-fix this by special-casing EAGAIN.
* stream: hack-fix rtmp-level seekingwm42014-07-304-11/+22
| | | | | | | | | | | | | This didn't work, because the timebase was wrong. According to the ffmpeg doxygen, if the stream index is -1 (which is what we used), the timebase is AV_TIME_BASE. But this didn't work, and it really expected the stream's timebase. Quite "surprising", since this feature (avio_seek_time) is used by rtmp only. Fixing this properly is too hard, so hack-fix our way around it. STREAM_CTRL_SEEK_TO_TIME is also used by DVD/BD, so a new STREAM_CTRL_AVSEEK is added. We simply pass-through the request verbatim.
* stream_lavf: allow setting AVOptions with --stream-lavf-owm42014-07-306-0/+38
| | | | | This commit also creates a private option struct for stream_lavf.c, but since I'm lazy, I'm not moving any existing options to it.
* audio: better initial sync for files where audio starts laterwm42014-07-301-5/+15
| | | | | | | Some files have the first audio much later into the video (for whatever reasons). Instead of appending large amounts of silence to the audio buffer (and refusing to sync if the audio to append is "too large"), just wait until enough video has played.
* audio: cosmetics: remove unused return valuewm42014-07-302-11/+9
|
* demux_mf: allow seeking past the endwm42014-07-301-1/+1
| | | | How's this for a corner case.
* player: fix time display wheen seeking past EOF with --keep-openwm42014-07-304-20/+19
| | | | | | | | | | | | | | Regression since commit 261506e3. Internally speaking, playback was often not properly terminated, and the main part of handle_keep_open() was just executed once, instead of any time the user tries to seek. This means playback_pts was not set, and the "current time" was determined by the seek target PTS. So fix this aspect of video EOF handling, and also remove the now unnecessary eof_reached field. The pause check before calling pause_player() is a lazy workaround for a strange event feedback loop that happens on EOF with --keep-open.
* player: let explicitly imprecise seeks cancel precise seekswm42014-07-291-0/+3
| | | | | | | | | | | If an imprecise seek is issues while a precise seek is ongoing, don't wait up to 300ms (herustistic which usually improves user experience), but instead let it cancel the seek. Improves responsiveness of the OSC after the previous commit. Note that we don't do this on "default-precise" seeks, because we don't know if they're going to be precise or not.
* osc: Do precise seeks on simple clicks on seekbarChrisK22014-07-291-11/+19
|
* audio: ignore (some) decoding errors on initializationwm42014-07-292-1/+5
| | | | | | | | | | | | It probably happens relatively often that the first packet (or even the first N packets) of a stream will fail to decode, but decoding will eventually succeed at a later point. Before commit 261506e3, this was handled by an explicit retry loop (although this was also for other purposes), but with then was changed to abort on the first error. This makes it impossible to decode some audio streams. Change this so that errors are ignored for the first 50 packets, which should make it equivalent to the old code.
* player: fix desync when seeking and switching external trackswm42014-07-296-32/+30
| | | | | | | | | | | | If you for example use --audio-file, disable the external track, seek, and enable the external track again, the playback position of the external file was off, and you would get major A/V desync. This was actually supposed to work, but broke at some time ago (probably commit 2b87415f). It didn't work, because it attempted to seek the stream if it was already selected, which was always true due to reselect_demux_streams() being called before that. Fix by putting the initial selection and the seek together.
* player: remove a pointless fieldwm42014-07-292-5/+4
|
* player: disable hr-seek in .ts fileswm42014-07-291-0/+1
| | | | | | | | Seeking in .ts files (and some other formats) is too unreliable, so there's a separate code path for this case. But it breaks hr-seek. Maybe hr-seek could actually be enabled in this case if we're careful enough about timestamp resets, but for now nothing changes.
* player: allow precise seeking with percent seekswm42014-07-291-2/+1
| | | | I'm not sure why this was explicitly disabled. It's from mplayer2 times.
* manpage: lua: document timer timeout and oneshot fieldswm42014-07-291-0/+14
| | | | | Might be useful for scripts, so document them. (Which means scripts are allowed to use them, without risking breakage.)
* vdpau: don't upload video images in advancewm42014-07-293-39/+11
| | | | | | | | | | | | With software decoding, images were uploaded to vdpau surfaces as they were queued to the VO. This makes it slightly more complicated (especially later on), and has no advantages - so stop doing it. The only reason why this was done explicitly was due to attempts to keep the code equivalent (instead of risking performance regressions). The original code did this naturally for certain reasons, but now that we can measure that it has no advantages and just requires extra code, we can just drop it.
* player: update playback position on seekwm42014-07-291-0/+2
| | | | | | | If the actual PTS is not known yet right after a seek, the "time-pos" property will just return the seek target PTS. For this purpose, trigger a change event to make the client API update the "time-pos" and related properties. (MPV_EVENT_TICK triggers this update.)
* player: logically speed up seek logicwm42014-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | Commit 261506e3 made constant seeking feel slower, because a subtle change in the restart logic makes it now waste time showing another video frame. The slowdown is about 20%. (Background: the seek logic explicitly waits until a video frame is displayed, because this makes it easier for the user to search for something in the video. Without this logic, the display would freeze until the user stops giving seek commands.) Fix this by letting the seek logic issue another seek as soon as the first video frame is displayed. This will prevent it from showing a (useless, slow) second frame. Now it seems to be as fast as before the change. One side-effect is that the next seek happens after the first video frame, but _before_ audio is restarted. Seeking is now silent. I guess this is ok, so we don't do anything about it. Actually, I think whether this happens is probably random; the seeking logic simply doesn't make this explicit, so anything can happen.
* vo_x11: fix build with older Libav versionswm42014-07-281-4/+4
| | | | Why does this happen everytime...
* video: add a default color space for files with no videoNiklas Haas2014-07-281-0/+3
| | | | | | | | | | | | | | | | | | Usually mp_image_params_guess_csp takes care of finding *some* default for a video channel, but files with no video (or with extremely broken configurations) end up leaving the colorspace information as MP_CSP_PRIM_AUTO, which has no associated primaries. As a result of this, color managed OSD messages could not display because they were being color managed to match the (non-existing/absurd) video channel. With this change, such non-spaces will have BT.709 primaries as far as color management and the OSD is concerned. This fixes #961. CC: @mpv-player/stable Signed-off-by: wm4 <wm4@nowhere>
* audio: change playback restart and resyncingwm42014-07-2810-281/+328
| | | | | | | | | | | | | | | | | | | | | This commit makes audio decoding non-blocking. If e.g. the network is too slow the playloop will just go to sleep, instead of blocking until enough data is available. For video, this was already done with commit 7083f88c. For audio, it's unfortunately much more complicated, because the audio decoder was used in a blocking manner. Large changes are required to get around this. The whole playback restart mechanism must be turned into a statemachine, especially since it has close interactions with video restart. Lots of video code is thus also changed. (For the record, I don't think switching this code to threads would make this conceptually easier: the code would still have to deal with external input while blocked, so these in-between states do get visible [and thus need to be handled] anyway. On the other hand, it certainly should be possible to modularize this code a bit better.) This will probably cause a bunch of regressions.
* input: be stricter about rejecting mouse input with --no-input-cursorwm42014-07-272-0/+5
| | | | | | | Apparently this switch means all mouse input should be strictly rejected. Some VO backends (such as X11) explicitly disable all mouse events if this option is set, but others don't. So check them in input.c, which increases consistency.
* vo: remove vo_mouse_movement() wrapperwm42014-07-2712-34/+33
| | | | So that VO backends don't have to access the VO just for that.
* vo: different hack for VOs which need to mangle mouse inputwm42014-07-277-40/+47
| | | | | | | | Follow up on commit 760548da. Mouse handling is a bit confusing, because there are at least 3 coordinate systems associated with it, and it should be cleaned up. But that is hard, so just apply a hack which gets the currently-annoying issue (VO backends needing access to the VO) out of the way.
* ao_pulse: allow disabling timing bug workaroundswm42014-07-262-3/+44
| | | | | | | | | | | | | | | | Add an option that enables using native PulseAudio auto-updated timing information, instead of the manual calculations added in mplayer2 times. You can use --ao=pulse:no-latency-hacks to enable the new code. The code is almost the same as the code that was removed with commit de435ed5, but I didn't readd some bits I didn't understand. Likewise, the option will disable the code added with that commit. In my tests this seemed to work well, though the A/V sync display looks funny when seeking. The default is still the old behavior. See issue #959.
* ao_pulse: remove hacks for ancient PulseAudio versionswm42014-07-263-23/+2
| | | | | | | | | | | This was needed by very old (0.9) versions only. Get rid of it. Unfortunately, I can't cross-check with the original bug report, since the bug URL leads to this: Internal Server Error TracError: IOError: [Errno 2] No such file or directory: '/home/lennart/svn/trac/pulseaudio/VERSION'
* manpage: eliminate the word "movie"wm42014-07-264-29/+29
| | | | | | | It's evil and sounds outdated. Use the words "media" and "video" instead. Closes #935.
* win32: remove minor non-sensewm42014-07-261-1/+0
| | | | This is done in the wrong thread. Was harmless and had no effect at all.
* win32: move window handling to a separate threadwm42014-07-261-60/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The windows message loop now runs in a separate thread. Rendering, such as with Direct3D or OpenGL, still happens in the main thread. In particular, this should prevent the video from freezing if the window is dragged. (The reason was that the message dispatcher won't return while the dragging is active, so mpv couldn't update the video at all.) This is pretty "rough" and just hacked in, and there's no API yet to make this easier for other backends. It will be cleaned up later once we're sure that it works, or when we know how exactly it should work. One oddity is that OpenGL is actually completely managed in the renderer thread, while e.g. Cocoa (which has its own threading code) creates the context in the GUI thread, and then lets the renderer thread access it. One strange issue is that we now have to stop WM_CLOSE from actually closing the window. Instead, we wait until the playloop handles the close command, and requests the VO to shutdown. This is done mainly because closing the window apparently destroys it, and then WM_USER can't be handled anymore - which means the playloop has no way to wakeup the GUI thread. It seems you can't really win here... maybe there's a better way to have a thread receive messages with and without a window, but I didn't find one yet. Dragging the window (by clicking into the middle of it) behaves strangely in wine, but didn't before the change. Reason unknown.
* vo: hack to avoid threading issues with mouse inputwm42014-07-265-1/+7
| | | | | | VO backends which are or will run in their own thread have a problem with vo_mouse_movement() calling vo_control(). Restrict this to VOs which actually need this.
* win32: use gcc TLS instead of WM_NCCREATE tricks for window contextwm42014-07-261-10/+9
| | | | | | | | | | | | win32 does not provide a proper per-window context pointer. Although it does allow passing a user-chosen value to WM_CREATE/WM_NCCREATE, this is not enough - the first message doesn't even have to be WM_NCCREATE. This gets us in trouble later on, so go the easy route and just use a TLS variable. __thread is gcc specific, but Windows is a very "special" platform anyway. We support only MinGW and Cygwin on it, so who cares. (C11 standardizes __thread as _Thread_local; we can use that later.)
* Add Plan 9-style barrierswm42014-07-264-0/+64
| | | | | | | | | | | | | | | | | | | | | | | Plan 9 has a very interesting synchronization mechanism, the rendezvous() call. A good property of this is that you don't need to explicitly initialize and destroy a barrier object, unlike as with e.g. POSIX barriers (which are mandatory to begin with). Upon "meeting", they can exchange a value. This mechanism will be nice to synchronize certain stages of initialization between threads in the following commit. Unlike Plan 9 rendezvous(), this is not implemented with a hashtable, because that would require additional effort (especially if you want to make it actually scele). Unlike the Plan 9 variant, we use intptr_t instead of void* as type for the value, because I expect that we will be mostly passing a status code as value and not a pointer. Converting an integer to void* requires two cast (because the integer needs to be intptr_t), the other way around it's only one cast. We don't particularly care about performance in this case either. It's simply not important for our use-case. So a simple linked list is used for waiters, and on wakeup, all waiters are temporarily woken up.
* win32: make a flag explicitwm42014-07-261-1/+1
| | | | | | | | This shouldn't change anything. But it's worth making this explicit, since it's very subtle and unintuitive: if the X parameter is the magic value CW_USEDEFAULT, then the Y parameter is used as nCmdShow parameter to ShowWindow(). And in our case, this is SW_HIDE (0), because we want to create a hidden window.
* win32: simplify some --wid embedding codewm42014-07-261-26/+9
| | | | | | | | | | | This looked a bit overcomplicated. We don't care about the window position (it should always be 0/0, unless the parent program moved it, which it shouldn't). We don't care about the global on-screen position. Also, we will just retrieve a WM_SIZE message if our window is resized, and we don't need to update it manually. The only thing we have to do is making sure our window fills the parent window completely.
* win32: don't use CS_OWNDCwm42014-07-262-46/+64
| | | | | | | | | | | | | CS_OWNDC will make GetDC() always return the same HDC. This might become a problem when OpenGL rendering and window management are on different threads. Although I'm not too sure about this; our code never requests a HDC outside of the OpenGL backend, and it depends on whether win32 will internally request DCs. But in any case, this seems to be cleaner. Move the GL pixelformat setup code to gl_w32.c, where it's actually needed. This also fixes that SetPixelFormat() should be called only once, and not every time video params change.
* win32: remove worthless doxygen commentswm42014-07-261-39/+4
| | | | | | These mostly describe self-explanatory things, and fail to explain actually tricky things. Which means you just waste your time reading this, and have to figure it out from the code anyway.
* win32: make private struct private, refactorwm42014-07-264-221/+201
| | | | | | | | | | | | | | | | Preparation for moving win32 windowing to a separate thread. The codesize is reduced a bit, because some small functions are inlined, which reduces noise. The main change is that now most functions use the private struct directly, instead of accessing it indirectly through vo->w32. Accesses to vo are minimalized. The final goal is adding some sort of new windowing backend API. It would be cleaner to use that as context pointer for all functions (like struct vo was previously used), but since this is work in progress, we just go with this commit.
* ao_null: never fail at initializationwm42014-07-261-1/+1
| | | | | | | | | ao_null is used to stop autoprobing (if all AOs before fail to init). After it come things like ao_pcm, which should never be automatically selected. Remove a certain theoretically possible failure case, and force "some" fallback.
* audio/out: fix initialization failure with win32wm42014-07-261-2/+1
| | | | | | | mp_make_wakeup_pipe() always fails on win32. If this call fails on Linux (and e.g. ao_alsa is used), this will probably burn CPU since poll() won't work on the invalid file descriptor, but whatever, the failure case is obscure enough.
* audio, client API: check mp_make_wakeup_pipe() return valuewm42014-07-252-8/+11
| | | | Could fail e.g. due to FD exhaustion.
* osdep: don't assume errno is positivewm42014-07-252-3/+3
| | | | | Apparently this is not necessarily the case, so just drop the silly idea that depended on this assumption.
* command: fix and simplify overlay_addwm42014-07-251-50/+44
| | | | | | | | | | | | | | | | Actually free the old mmap region when readding an overlay of the same ID without removing it before. (This is explicitly documented as working.) Replace the OSD atomically. Before this commit, the overlays were removed and then readded to avoid synchronization problems. Simplify the code: now there is no weird mapping between index and ID. The OSD sub-bitmap list still needs to be prepared to skip unused IDs (since each sub-bitmap list entry must be in use), but the code for this is relatively separated now. Fixes issue #956.
* command: append entries to the end of the playlist with loadlist appendAlessandro Ghedini2014-07-253-1/+11
| | | | | | Currently entries are added after the current playlist element. This is kinda confusing, more so given that "loadfile append" appends at the end of the playlist.
* audio: cosmetics: collapse a functionwm42014-07-241-14/+6
| | | | | There's no need for build_afilter_chain() to be a separate function anymore.
* audio: fix timestampswm42014-07-243-2/+1
| | | | | | | | | Accidentally broken in b6af44d3. For ad_lavc (and in general), the PTS was not updated correctly when filtering only parts of audio frames, and for ad_mpg123 and ad_spdif the PTS was additionally offset by the frame size. This could lead to incorrect time display, and possibly broken A/V sync.
* audio: adjust format change codewm42014-07-241-8/+9
| | | | | | Execute the format change based on whether we logically detected EOF (after filters), instead of when the decode buffer was drained. It's slightly cleaner. (The requirement of len>0 existed before.)
* audio: fix race condition in EOF codewm42014-07-243-4/+4
| | | | | | | | | | Don't return an EOF code if there's still buffered data. Also, don't call demux_stream_eof() in the playloop. There's probably nothing wrong with it, but it's cleaner not to use it. Also give AD_EOF its own value, so that a decoding error doesn't drain audio by causing an EOF condition.
* audio: cosmeticswm42014-07-241-9/+5
| | | | | | | Move a function call, which does not change semantics. Write the extra buffer sample count in a more straight-forward way; the old code was not meaningful in any way (anymore).
* audio: remove unnecessary codewm42014-07-241-3/+0
| | | | | | | | It's true that the decoder can successfully decode, but return no data (for various reasons). We don't need to handle this specially, though. We just let the decoder decode some more data. This doesn't increase the danger of an endless loop either, because audio_decode() already calls this function until enough is decoded.
* manpage: fix a typowm42014-07-241-1/+1
|
* encode: deal even more with codec->time_base deprecation.Rudolf Polzer2014-07-231-6/+5
| | | | I assume this works too with Libav 10 and FFmpeg d3e51b41.
* command: add append-play loadfile modewm42014-07-