summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* 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 timestamps is just a (very) long video frame, or a timestamp reset. Due to the existence of files with sparse video frames (new frame only every few seconds or longer), every heuristic will be arbitrary (in general, at least). But we can use the fact that if video is continuous, audio should also be continuous. Audio discontinuities can be easily detected, and if that happens, reset some of the playback state. The way the playback state is reset is rather radical (resets decoders as well), but it's just better not to cause too much obscure stuff to happen here. If the A/V sync code were to be rewritten, it should probably strictly use PTS values (not this strange time_frame/delay stuff), which would make it much easier to detect such situations and to react to them.
* player: reset playback abort when reloading a filewm42016-01-071-0/+1
| | | | | | | | | | | | PT_RELOAD_FILE is a somewhat obscure case when using DVB or when switching Matroska editions. Both cases were broken, because the asynchronous playback abort mechanism was still triggered. This mechanism is used to force the demuxer and stream layers to exit immediately (instead of blocking on I/O possibly forever), and is normally disabled on playback start. The reopen path is a bit strange, and needs to reset it manually. Pointed out in #2568.
* player: make watch later/resume work when "playing" directorieswm42016-01-062-9/+63
| | | | | | | | | | | | | | If you do "mpv /bla/", and then branch out into sub-directories using playlist navigation, and then used quit and watch later, then playing the same directory did not resume from the previous point. This was because resuming is based on the path hash, so a path prefix can't be detected when resuming the parent directory. Solve this by writing each path prefix when playing directories is involved. (This includes all parent paths, so interestingly, "mpv /" would also resume in the above example.) Something like this was requested multiple times, and I want it too.
* video: fix debug messagewm42016-01-061-1/+1
| | | | Should not be a warning, and the message text was also very useless.
* audio: update outdated commentwm42016-01-051-3/+4
|
* player: make sure streams are selected with ordered chapterswm42016-01-031-3/+3
| | | | | | | | When using --start with timeline/ordered chapters, then the timeline_switch_to_time() function will look at playback_initialized whether to rselect the currently selected streams on the demuxer level. So we need to set this field to true at an earlier stage during initialization, and in particular before the code for --start is called.
* Update copyright yearwm42016-01-011-1/+1
| | | | Merry christmas, or whatever the fuck is going on right now.
* video: do not disable hr-seek framedrop too earlywm42015-12-301-7/+5
| | | | | | This didn't make too much sense, and just made seeking slower. Strictly suggest the decoder to drop a frame if its PTS is before the seek target.
* sub: change how subtitles are readwm42015-12-294-57/+24
| | | | | | | | Slightly change how it is decided when a new packet should be read. Switch to demux_read_packet_async(), and let the player "wait properly" until required subtitle packets arrive, instead of blocking everything. Move distinguishing the cases of passive and active reading into the demuxer, where it belongs.
* sub: refactor initializationwm42015-12-271-16/+20
| | | | | | | | Just simplify by removing parts not needed anymore. This includes merging dec_sub allocation and initialization (since things making initialization complicated were removed), or format support queries (it simply tries to create a decoder, and if that fails, tries the next one).
* sub: minor refactor how video FPS for MicroDVD is setwm42015-12-271-4/+4
| | | | | | | | | So that the video FPs is not required at initialization, and can be set later. (As for whether this MicroDVD crap is worth the trouble to handle it "correctly": MicroDVD files are unfortunately still around, and in at least one case using the video FPS seemed to help indeed.)
* command: replace ROUND() with lrint()wm42015-12-261-5/+4
| | | | | lrint() pretty much does what ROUND() is supposed to do, but it's more precise.
* sub: destroy/recreate ASS_Renderer when disabling/enablings subswm42015-12-261-0/+2
| | | | | | | Keeping ASS_Renderers around for a potentially large number of subtitle tracks could lead to excessive memory usage, especially since the libass cache is broken (caches even unneeded data), and might consume up to ~500MB of memory for no reason.
* sub: always recreate ASS_Renderer on subtitle decoder reinitwm42015-12-264-112/+1
| | | | | | | This includes the case of switching ordered chapter boundaries. It will now be recreated on each timeline part switch. This shouldn't be much of a problem with modern libass. (Older libass versions use fontconfig for memory fonts, and will be very slow to reinitialize memory fonts.)
* sub: cache subtitle state per track instead of per demuxer streamwm42015-12-263-35/+27
| | | | | | | | | | | | Since commit 6d9cb893, subtitle state doesn't survive timeline switches (ordered chapters etc.). So there is no point in caching the state per sh_stream anymore (which would be required to deal with multiple segments). Move the cache to struct track. (Whether it's worth caching the subtitle state just for the situation when subtitle tracks get reselected is questionable. But for now, it's nice to have the subtitles immediately show up when reselecting a subtitle.)
* command: change heuristic for files with 1 chapterwm42015-12-251-2/+3
| | | | | | | | | For files with only 1 chapter, the "cycle" command was ignored. Reenable it, but don't let it terminate playback of the file. For the full story, see #2550. Fixes #2550.
* player: fix previous commitwm42015-12-251-11/+17
| | | | | | | OK, this made the --sub-paths and --audio-file-paths synonyms, which is not what we wanted. Actually restrict the type of file loaded as well. Really fixes #2632.
* options: add --audio-file-pathswm42015-12-251-15/+22
| | | | | | | | Requested. It works like --sub-paths. This will also load audio files from a "audio" sub directory in the config file (because the same code as for subtitles is used, and it also had such a feature). Fixes #2632.
* sub: clear subtitle list when crossing timeline boundarywm42015-12-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When crossing timeline boundaries (such as switching to a new segment or chapter with ordered chapters), clear the internal text subtitle list. This breaks the sub-seek command, but is otherwise not too harmful. Fixes Sub-OC-test-final7.mkv. (The internal text subtitle list is basically a cache to make subtitles show up at the right time when seeking back.) I suspect this was caused by 76fcef61. The sample file times subtitles slightly before the video frame when it should show up. This is to avoid problems with subtitles showing up a frame later than intended. It also means that a subtitle which is supposed to show up on the start of a timeline part boundary actually might first be shown in a different part. Since we now manipulate the packet timestamps, instead of manipulating timestamps after the subtitle decoder, this means this subtitle event would have 2 timestamps, which our code of course does not handle. If the two parts come one after another, this would actually work (since the subtitle would have the same timestamps in the old and new part), but it breaks if the new part (which follows the old part in the physical file) is has a completely different start time in the timeline. Essentially, the trick used to time subtitles correctly is incompatible with the way we cache subtitles (to make them survive seeks). The simple solution is just clearing the cached subtitles when crossing chapter boundaries.
* command: fix eof-reached property change notification in corner caseswm42015-12-241-2/+2
| | | | | | | | | See #2609: "When eof is reached it would be shown on the OSD and in the console. Next try seeking to the middle. Seeking to the middle of the file will only result in the OSD message being updated. Lua seems to fail to observe the change in the property until the video is unpaused."
* demux: remove weird tripple-buffering for the sh_stream listwm42015-12-233-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The demuxer infrastructure was originally single-threaded. To make it suitable for multithreading (specifically, demuxing and decoding on separate threads), some sort of tripple-buffering was introduced. There are separate "struct demuxer" allocations. The demuxer thread sets the state on d_thread. If anything changes, the state is copied to d_buffer (the copy is protected by a lock), and the decoder thread is notified. Then the decoder thread copies the state from d_buffer to d_user (again while holding a lock). This avoids the need for locking in the demuxer/decoder code itself (only demux.c needs an internal, "invisible" lock.) Remove the streams/num_streams fields from this tripple-buffering schema. Move them to the internal struct, and protect them with the internal lock. Use accessors for read access outside of demux.c. Other than replacing all field accesses with accessors, this separates allocating and adding sh_streams. This is needed to avoid race conditions. Before this change, this was awkwardly handled by first initializing the sh_stream, and then sending a stream change event. Now the stream is allocated, then initialized, and then declared as immutable and added (at which point it becomes visible to the decoder thread immediately). This change is useful for PR #2626. And eventually, we should probably get entirely of the tripple buffering, and this makes a nice first step.
* input: add key name to script-binding command responsewm42015-12-231-2/+2
| | | | | | | | | | | | | | | | The "script-binding" command is used by the Lua scripting wrapper to register key bindings on the fly. It's also the only way to get fine- grained information about key events (such as separate key up/down events). This information is sent via a "key-binding" message when the state of a key changes. Extend it to send name of the mapped key itself. Previously, it was assumed that the user just uses an unique identifier for the binding's name, so it wasn't needed. With this change, a user can map exactly the same command to multiple keys, which is useful especially with the next commit. Part of #2612.
* player: minor simplificationwm42015-12-232-5/+3
| | | | This tmp thing had not much of a purpose anymore.
* vf_yadif: change defaultswm42015-12-211-1/+1
| | | | | | | | | | | | | | | | This is for the sake of command.c and the "deinterlace" option/property. Instead of forcing certain "better" defaults when inserting yadif, change the actual "yadif" defaults. I pondered not changing vf_yadif, and instead adding a trivial "yadif- auto" wrapper filter, which would merely have different defaults. But thinking about it, it doesn't make any sense for "deinterlace" to have different defaults from vf_yadif, with vf_yadif having the "worse" defaults. If someone wants the old behavior, the old behavior can be forced in a backward and forward compatible way by setting the suboptions. Fixes #2539 (kind of).
* video: switch from using display aspect to sample aspectwm42015-12-194-21/+19
| | | | | | | | | | | | | | | | MPlayer traditionally always used the display aspect ratio, e.g. 16:9, while FFmpeg uses the sample (aka pixel) aspect ratio. Both have a bunch of advantages and disadvantages. Actually, it seems using sample aspect ratio is generally nicer. The main reason for the change is making mpv closer to how FFmpeg works in order to make life easier. It's also nice that everything uses integer fractions instead of floats now (except --video-aspect option/property). Note that there is at least 1 user-visible change: vf_dsize now does not set the display size, only the display aspect ratio. This is because the image_params d_w/d_h fields did not just set the display aspect, but also the size (except in encoding mode).
* sub: remove unused video width/height headerswm42015-12-181-3/+0
| | | | | | | Apparently, this was replaced by the SD_CTRL_SET_VIDEO_PARAMS set dimensions. But I can't find out when this happened - possibly, these fields were never used by sd_lavc.c, and only by the (long removed) MPlayer dvdsub decoder.
* player: init playback speed correctlywm42015-12-101-0/+2
| | | | | Usually not a problem, but could not be initialized early enough in some corner cases.
* sub: allow feeding bitmap subs in advancewm42015-12-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Until now, feeding packets to the decoder in advance was done for text subtitles only. This was possible because libass buffers all subtitle data anyway (in ASS_Track). sd_lavc, responsible for bitmap subs, does not do this. But it can buffer a small number of subtitle frames ahead. Enable this. Repurpose the sub_accept_packets_in_advance(). Instead of "can take all packets" it means "can take 1 packet" now. (The old meaning is still needed locally in dec_sub.c; keep it there.) It asks the decoder whether there is place for at least 1 subtitle packet. sd_lavc implements it and returns true if its internal fixed-size subtitle queue still has a free slot. (The implementation of this in dec_sub.c isn't entirely clean. For one, decode_chain() ignores this mechanism, so it's implied that bitmap subtitles do not use the subtitle filter chain in any advanced way.) Also fix 2 bugs in the sd_lavc queue handling. Subtitles must be checked in reverse, because the first entry will often have endpts==NOPTS, which would always match. alloc_sub() must cycle the queue buffer, because it reuses memory allocations (like sub.imgs) by design.
* player: remove redundant checkwm42015-12-051-1/+1
| | | | Found by Coverity.
* player: don't make display-sync panic on timestamp discontinuitieswm42015-12-041-2/+2
|
* player: resync audio only on larger timestamp discontinuitieswm42015-12-041-2/+2
| | | | | | | | | Helps with files that have occasional broken timestamps. For larger discontinuities, e.g. caused by actual timestamp resets, we still want to realign audio. (I guess in general, this should be removed and replaced by a more general resync-on-desync logic, but not now.)
* client API: disallow masking MPV_EVENT_SHUTDOWNwm42015-12-021-0/+2
| | | | | | | | | This makes no sense, because the client is obligated to react to this event. This also happens to fix a deadlock with JSON IPC clients sending "disable_event all", because MPV_EVENT_SHU