summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* options: set fs=yes by default on RPI, and change RPI defaults handlingwm42016-02-051-0/+5
| | | | | The main reason for changing the fullscreen default is that not doing it would change the vo_rpi default behavior with the previous commit.
* input: ignore --input-cursor for events injected by input commandswm42016-02-041-6/+6
| | | | | | Apparently useful for window embedding. Fixes #2750.
* sub: implement "sub-seek 0"wm42016-02-041-1/+1
| | | | | | | For bitmap subs, implement it properly. For libass, you need newest git master. Fixes #2791.
* command: fix track cycling logicwm42016-02-031-9/+4
| | | | | | Also remove the unused function argument. Fixes #2784.
* command: show original aspect in video-aspect property toowm42016-02-021-16/+19
| | | | | Basically, just make it append " (original)" if the original aspect ratio is selected.
* player: refactor: reduce some dependencies on current_trackwm42016-02-013-24/+15
| | | | Don't mind me.
* player: use different variable to indicate coverartwm42016-02-014-17/+15
| | | | Slightly better.
* audio/video: merge decoder return valueswm42016-02-012-7/+7
| | | | | | Will be helpful for the coming filter support. I planned on merging audio/video decoding, but this will have to wait a bit longer, so only remove the duplicate status codes.
* audio: use brutal resync only on larger PTS discontinuitieswm42016-01-311-2/+4
| | | | | | | | | Let's fix broken samples with questionable heuristic without real reasoning. Until this gets fixed properly, this is a good compromise, though. A proper fix would properly resync audio and video without brutally resetting the decoders, but on the other hand not doing the brutal reset would cause issues in other obscure corner cases such resyncing might cause.
* audio: fix a case of going to sleep before playback startwm42016-01-311-0/+1
| | | | | | | | | | | | | | | This code is tricky because it has to wakeup the mainloop to make progressing during syncing audio, but also has to avoid waking it up when it's not needed. Failure to do so either burns CPU by not ever going to sleep, or causes apparent "freezes" by going to sleep (and it will continue if the mainloop is woken up e.g. due to user input). In this case, simply starting A/V playback with --start=5 and removing an unrelated wakeup in osd.c can trigger such a "freeze". The unrelated wakeup did hide this bug, nonetheless it's a bug. (Can't wait to rewrite this shitty audio resync code. And it's all my fault.)
* vd_lavc: allow switching between hw/sw decoding any timewm42016-01-291-2/+1
| | | | | | | We just need to provide an entrypoint for it, and move the main init code to a separate function. This gets rid of the messy video chain full reinit in command.c, which completely destroyed and recreated the video state for the purpose of mid-stream hw/sw switching.
* player: refactor: some more minor decoder/output decouplingwm42016-01-293-16/+22
| | | | | | These changes don't make too much sense without context, but are preparation for later. Then the audio_src/video_src fields will be actually be NULL under circumstances.
* audio: refactor: separate audio init and filter/output initwm42016-01-291-47/+62
| | | | | | | | | | | | Before this commit, reinit_audio_chain() did 2 things: create all the management data structures and initialize the decoder, and handling lazy filter/output init (as well as dealing with format changes). For the second purpose, it could be called multiple times (even though it wasn't really idempotent). This was pretty weird, so make them separate functions. The new function is actually idempotent too. It also turns out the reinit functions don't have to call themselves recursively for the spdif PCM fallback.
* audio: move pts reset checkwm42016-01-292-2/+16
| | | | Reduces the dependency of the filter/output code on the decoder.
* player: fix initial audio sync in certain caseswm42016-01-293-6/+2
| | | | | | | | | | | | | | | | | Regression caused by commit 3b95dd47. Also see commit 4c25b000. We can either use video_next_pts and add "delay", or we just use video_pts. Any other combination breaks. The reason why the assumption that delay==0 at this point was wrong exactly because after displaying the first video frame (usually done before audio resync) a new frame might be "added" immediately, resulting in a new video_next_pts and "delay", which will still amount to video_pts. Fixes #2770. (The reason why display-sync was blamed in this issue is because enabling display-sync in the options forces a prefetch by 2 instead of 1 frames for seeks/playback restart, which triggers the issue, even if display-sync is not actually enabled. In this case, display-sync is never enabled because the frames have a unusually high frame duration. This is also what exposed the initial desync issue.)
* video: fix coverart switchingwm42016-01-271-2/+3
| | | | | | If cover art is re-enabled during playback, the covert art picture (which has pts==0) will be discarded. Add another corner case to the list.
* command: always allow setting volume/mute propertieswm42016-01-261-5/+17
| | | | | | | | | | | | | | | | | | | | | | | This seems generally easier when using libmpv (and was already requested and implemented before: see commit 327a779a; it was reverted some time later). With the weird internal logic we have to deal with, in particular the --softvol=no case (using system volume), and using the audio API's mixer (--softvol=auto on some systems), we still can't avoid all glitches and corner cases that complicate this issue so much. The API user is either recommended to use --softvol=yes or auto, or to watch the new mixer-active property, and assume the volume/mute properties have significant values if the mixer is active. Remaining glitches: - changing the volume/mute properties has no effect if no internal mixer is used (--softvol=no) and the mixer is not active; the actual mixer controls do not change, only the property values - --volume/--mute do not have an effect on the volume/mute properties before mixer initialization (the options strictly are only applied during mixer init) - volume-max is 100 while the mixer is not active
* video: slightly improve video stream switchingwm42016-01-261-0/+5
| | | | | Resync newly switched video streams to the current playback position. (Normal seeks will reset playback_pts to NOPTS.)
* audio: fix spdif PCM fallbackwm42016-01-251-0/+2
| | | | | | | | | With the format left untouched, this would just try to reinit with a spdif format again. We're not clearing the format in reset_audio_state() so the audio chain can be recreated any time without having to wait for a frame to be decoded.
* audio: release pending audio frame on seekingwm42016-01-251-0/+2
|
* video: limit maximum number of VO frames correctlywm42016-01-241-1/+1
| | | | | Otherwise, vo_frame.frames can be unintentionally overflown, leading to undefined behavior in corner cases.
* player: free queued audio frame on uninitwm42016-01-231-0/+1
|
* command: add af-command commandwm42016-01-221-0/+6
| | | | Similar to vf-command. Requested. Untested.
* command: add vf-command commandwm42016-01-221-0/+6
|
* video: don't wait for last video frame in the normal casewm42016-01-221-4/+8
| | | | | | | | | | | | | | | | | | Even though the timing logic is correct, it tends to mess with looping videos and such in unappreciated ways. It also has to be admitted that most file formats seem not to properly define the duration of the last video frame (or libavformat does not export it in a useful way), so whether or not we should use the demuxer reported framerate for the last frame is questionable. (Still, why would you essentially just discard the last frame?) The timing logic is kept, but disabled for video with "normal" FPS values. In particular, we want to keep it for displaying images, which implicitly set the frame duration to 1 second by reporting 1 FPS. It's also good for slide shows with mf://. Fixes #2745.
* sub: change when/how subtitles are read completelywm42016-01-221-12/+8
| | | | | | | | | | | | Most text subtitles are read completely on loading (libavformat works this way, and there are good reasons to do it on the higher levels too). This leads to some messy problems. For example, the subtitle path is the only one which might read packets during decoder initialization. This is not neccessary; get rid of it. This fixes a potential problem of seeking to position 0 for image subtitles on init, and if the start position is not at the beginning of the timeline.
* audio: refactor: move MPContext.ao_buffer fieldwm42016-01-222-25/+22
| | | | | | | | | | | | It doesn't need to be part of the big context, but is strictly part of shuffling data from the audio filters to audio output, and thus belongs into ao_chain. It also turns out that clearing it in clear_audio_output_buffers() is completely redundant. (Of course ao_buffer is an abomination in the first place and shouldn't exist at all.)
* player: fix some oversights in video refactoringwm42016-01-221-5/+10
| | | | | | | | | | vo_chain_uninit() isn't supposed to care much about the decoder (although decoders and outputs still go strictly together, so there is not much of an actual difference now). Also unset track.d_video correctly. Remove a stale declaration from dec_video.h as well.
* player: refactor: eliminate MPContext.d_audiowm42016-01-226-37/+57
|
* audio: refactor: work towards unentangling audio decoding and filteringwm42016-01-224-53/+175
| | | | | | | | | Similar to the video path. dec_audio.c now handles decoding only. It also looks very similar to dec_video.c, and actually contains some of the rewritten code from it. (A further goal might be unifying the decoders, I guess.) High potential for regressions.
* player: never show "DS: (unavailable)"wm42016-01-201-3/+6
| | | | Kind of annoying.
* audio: remove initial decoding retry limitationwm42016-01-191-8/+0
| | | | | | | | | | | | | | | Seems useless. This only helped in one case: one audio stream in the sample av_find_best_stream_fails.ts had a AC3 packets which couldn't be decoded, and for which avcodec_decode_audio4() returned 0 forever. In this specific case, playback will now not start, and you have to deselect audio manually. (If someone complains, the old behavior might be restored, but differently.) Also remove the stale "bitrate" field.
* audio: move dec_audio.pool to ad_spdifwm42016-01-191-1/+0
| | | | That's where its only use is.
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-197-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone.
* command: fix NULL pointer deref in "video-codec" propertywm42016-01-181-1/+1
| | | | Fixes #2729.
* demux: disable stream cache if no tracks are selectedwm42016-01-181-1/+4
| | | | | | | | | Slightly helps with timeline stuff, like EDL. There is no need to keep network (or even just disk I/O) busy for all segments at the same time, because 1. the data won't be needed any time soon, and 2. will probably be discarded anyway if the stream is seeked when segment is resumed. Partially fixes #2692.
* demux: remove unused flagwm42016-01-181-3/+1
|
* player: refactor: eliminate MPContext.d_videowm42016-01-179-100/+109
| | | | | | | | | | | | | | Eventually we want the VO be driven by a A->V filter, so a decoder doesn't even have to exist. Some features definitely require a decoder though (like reporting the decoder in use, hardware decoding, etc.), so for each thing which accessed d_video, it has to be redecided if and how it can access decoder state. At least the "framedrop" property slightly changes semantics: you can now always set this property, even if no video is active. Some untested changes in this commit, but our bio-based distributed test suite has to take care of this.
* player: refactor: eliminate MPContext.d_subwm42016-01-175-62/+74
| | | | The same is going to happen to d_video and d_audio later.
* command: modify OSD message when forcing original video aspect ratiowm42016-01-161-0/+7
| | | | | | | Not bothering with anything advanced, so we just show "(original)" if the video-aspect property/option is reset. Fixes #2722.
* video: refactor: disentangle decoding/filtering some morewm42016-01-164-92/+68
| | | | | | | | | | | This moves some code related to decoding from video.c to dec_video.c, and also removes some accesses to dec_video.c from the filtering code. dec_video.ch is starting to make sense, and simply returns video frames from a demuxer stream. The API exposed is also somewhat intended to be easily changeable to move decoding to a separate thread, if we ever want this (due to libavcodec already being threaded, I don't see much of a reason, but it might still be helpful).
* osd: make osd-width/height properties watchablewm42016-01-151-1/+1
|
* global: add client API pointer to library handlewm42016-01-153-0/+9
| | | | | | | Makes the next commit simpler. It's probably a bad idea to add more fields to the global state, but on the other hand the client API state is pretty much per-instance anyway. It also will help with things like the proposed libmpv custom stream API.
* video: refactor: slightly disentangle video filteringwm42016-01-151-43/+32
|
* video: fix interactively changing aspect ratiowm42016-01-141-1/+1
| | | | | | | | | The aspect ratio calculations are cached (mainly so that aspect ratio related messages are not logged on every frame). The cache is not clared anymore when video filters are reconfigured, but changing the video-aspect-ratio property relied on it. Make it explicit. Fixes #2714.
* player: prefer "service_name" as media title.Oliver Freyermuth2016-01-141-0/+3
| | | | | If it is defined, which it rarely is (e.g. mpegts streams) this is the preferred title information.
* player: implement SWITCH for dvb-channel-name property, add binding.Oliver Freyermuth2016-01-141-0/+8
| | | | | | | | The binding is similar to the tv-binding, just with capital letters. Switching the dvb-channel-name property compared to dvb-channel means the channel-name is shown on-screen when switching instead of "dvb-channel (error)" otherwise, and switching anyways happens without changing the card.
* player: remove unused last_dvb_step member.Oliver Freyermuth2016-01-142-4/+0
| | | | | | Channel switching is treated inside the global DVB state by now. Anyways the last switching direction is not really useful and of no interest inside the player.
* player, stream_dvb: implement dvb-channel-name property.Oliver Freyermuth2016-01-141-0/+22
| | | | | | | | | On read, it returns the name of the current DVB program, on write, it triggers a channel-switch to the program if it is found in the channel list of the currently active card. Compared to the dvb-channel property which already exists and is a pair of integers (card + channel number) this has the limitation of not switching the card, but is probably of much more common use.
* video: decouple filtering/decoding slightly morewm42016-01-144-95/+119
| | | | | | | | | | | | | | | | | | | Lots of noise to remove the vfilter/vo fields from dec_video. From now on, video filtering and output will still be done together, summarized under struct vo_chain. There is the question where exactly the vf_chain should go in such a decoupled architecture. The end goal is being able to place a "complex" filter between video decoders and output (which will culminate in natural integration of A->V filters for natural integration of libavfilter audio visualizations). The vf_chain is still useful for "final" processing, such as format conversions and deinterlacing. Also, there's only 1 VO and 1 --vf option. So having 1 vf_chain for a VO seems ideal, since otherwise there would be no natural way to handle all these existing options and mechanisms. There is still some work required to truly decouple decoding.
* player: remove stale declarationwm42016-01-141-1/+0
|
* video: refactor: shuffle code aroundwm42016-01-142-0/+74
| | | | | | struct dec_video should have nothing to do with video filters or outputs, and this huge chunk of code was somehow stuck directly in dec_video.c.
* video: refactor: handle video format fixups closer to decoderwm42016-01-143-7/+9
| | | | | | | | | | Instead of handling this on filter chain reinit, do it directly after the decoder. This makes the code less entangled. In particular, this gets rid of the really weird "override params" concept in the video filter code. The last_format/fixed_formats have some redundance with decoder_output, but unfortunately the latter has a slightly different use.
* player: simplify backsteppingwm42016-01-124-117/+38
| | | | | | | | | | | | | | Basically reimplement it. The old implementation was quite stupid, and was probably done this way because video filtering and output used to be way less decoupled. Now we can reimplement it in a very simple way: when backstepping, seek to current time, but keep the last frame that was supposed to be discarded when reaching the target time. When the seek finishes, prepend the saved frame to the video frame queue. A disadvantage is that the new implementation fails to skip over timeline boundaries (ordered chapters etc.), but this never worked properly anyway. It's possible that this will be fixed some time in the future.
* player: handle hrseek framedrop correctlywm42016-01-122-2/+2
| | | | | This was non-sense and checked the option instead of the actual flag. Possibly could lead to incorrect hr-seeks.
* demux: merge sh_video/sh_audio/sh_subwm42016-01-125-19/+18
| | | | | | | | | | This is mainly a refactor. I'm hoping it will make some things easier in the future due to cleanly separating codec metadata and stream metadata. Also, declare that the "codec" field can not be NULL anymore. demux.c will set it to "" if it's NULL when added. This gets rid of a corner case everything had to handle, but which rarely happened.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-1112-12/+12
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* player: eliminate demux_get_next_pts()wm42016-01-114-20/+6
| | | | | | | | | | | | | | | | This slightly changes behavior when seeking with external audio/subtitle tracks if transport streams and mpeg files are played, as well as behavior when seeking with such external tracks. get_main_demux_pts() is evil because it always blocks on the demuxer (if there isn't already a packet queued). Thus it could lock up the player, which is a shame because all other possible causes have been removed. The reduced "precision" when seeking in the ts/mpeg cases (where SEEK_FACTOR is used, resulting in byte seeks instead of timestamp seeks) might lead to issues. We should probably drop this heuristic. (It was introduced because there is no other way to seek in files with PTS resets with libavformat, but its value is still questionable.)
* ytdl: Include Referer header as wellYen Chi Hsuan2016-01-101-3/+6
| | | | | Some videos require correct Referer header for downloading, or 403 Forbidden is thrown.
* player: detect audio PTS jumps, make video PTS heuristic less aggressivewm42016-01-092-13/+9
| | | | | | | | | | | | | | | | | | | | | | This is another attempt at making files with sparse video frames work better. The problem is that you generally can't know whether a jump in video times