summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* lavfi: fix minor memory leakwm42017-02-131-9/+11
| | | | | | | | | | | The AVFrame in the tmp_frame field was never actually deallocated. Since this AVFrame holds data temporarily only, and is unreferenced immediately after use, there is actually no need to make it per-pad, so simplify it a bit. (There's also no real value in caching this tmp_frame at all, but I guess it makes the control flow slightly simpler.)
* atomic: remove __atomic builtin usagewm42017-02-131-1/+1
| | | | | | | | Using these was a temporary solution while some compilers implemented the underlying atomic mechanisms, but not the C11 language parts (or that's what I guess). Not really useful for us anymore. Also, there is the slight risk of having subtly incorrect semantics by using potentially changing compiler internals and such.
* ytdl_hook: support livestream segmented DASH VODsRicardo Constantino2017-02-101-4/+6
| | | | | | | | | | | | Seen with a VOD of a recently ended livestream on Youtube. They seem to use segmented DASH but unlike normal Youtube segmented DASH, the segments don't seem to need the initialization segment. The video actually fails to start to play if the init segment is prepended with a lot of 'Found duplicated MOOV Atom. Skipped it' errors popping up.
* lavfi: cosmetics: more consistent variable namingwm42017-02-091-3/+3
|
* lavfi: slightly better disconnected output handlingwm42017-02-081-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | If we have a disconnected output, read data only passively (and don't cause input to be written). Otherwise, we're in danger of making libavfilter queue too many frames on other outputs which are connected to the same input, but don't read as quickly. Also don't set pad->output_needed in this specific case, because it would nonsensically make lavfi_process() return true, even if nothing is going on. This commit breaks if there is a simple filter chain with a connected input, but a disconnected output, like --lavfi-complex='[aid1] copy [ao]' and the audio output didn't initialize correctly. This will eventually starve video as the audio packet queue get full (it will print a warning, and then assume video EOF and exit). But whatever. Probably fixes #4118.
* player: add experimental stream recording featurewm42017-02-074-0/+126
| | | | | This is basically a WIP, but it can't remain in a branch forever. A warning is print when using it as it's still a bit "shaky".
* ytdl_hook: reenable support for length-less segments in EDLRicardo Constantino2017-02-061-12/+28
| | | | They're unsupported only in MP4 DASH mode.
* ytdl_hook: fix EDL syntaxwm42017-02-051-1/+1
| | | | | All entries must be separated by ";" or "\n". The parser just doesn't enforce it if an entry uses quoting.
* ytdl_hook: Add non-dash fallbacks to default formatsRicardo Constantino2017-02-041-3/+3
|
* ytdl_hook, edl: implement pseudo-DASH supportwm42017-02-041-3/+9
| | | | | | | | | We use the metadata provided by youtube-dl to sort-of implement fragmented DASH streaming. This is all a bit hacky, but hopefully a makeshift solution until libavformat has proper mechanisms. (Although in danger of being one of those temporary hacks that become permanent.)
* ytdl: support segmented dashRicardo Constantino2017-02-041-12/+16
|
* sub: remove .txt as text subtitle extensionwm42017-02-031-1/+1
| | | | | | | | | | | | | | | | If used with fuzzy matching, the player tends to pick up random text files, sometimes with interesting results. The most interesting interaction is when the user uses --log-file=something.txt, and mpv tries to open its own log file. It essentially "freezes" during probing, because every time it reads from it, it will write some more data, which in turn will cause more data to be read - until the 2MB max. probing size is slowly reached. This is not even an obscure corner case, but happened to multiple users. The .txt extension has been considered a subtitle extension ever since the code was added to MPlayer's subreader.c, but I'm not seeing many actual subtitle files with this extension, so just get rid of it.
* player: different way to auto-enable the demuxer cachewm42017-02-021-5/+7
| | | | | | | | | | | | | | | Instead of enabling it only when a stream-cache is enabled, also try to enable it independently from that if the demuxer is marked as is_network. Also add some code to the EDL code, so EDLs containing network streams are automatically cached this way. Extend the OSD info line so that it shows the demuxer cache in this case (more or less). I didn't find where or whether options.rst describes how the demuxer cache is enabled, so no changes there.
* osx: consistent normalisation when searching for external filesAkemi2017-02-021-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | several unicode characters can be encoded in two different ways, either in a precomposed (NFC) or decomposed (NFD) representation. everywhere besides on macOS, specifically HFS+, precomposed strings are being used. furthermore on macOS we can get either precomposed or decomposed strings, for example when not HFS+ formatted volumes are used. that can be the case for network mounted devices (SMB, NFS) or optical/removable devices (UDF). this can lead to an inequality of actual equal strings, which can happen when comparing strings from different sources, like the command line or filesystem. this makes it mainly a problem on macOS systems. one case that can potential break is the sub-auto option. to prevent that we convert the search string as well as the string we search in to the same normalised representation, specifically we use the decomposed form which is used anywhere else. this could potentially be a problem on other platforms too, though the potential of occurring is very minor. for those platforms we don't convert anything and just fallback to the input. Fixes #4016
* osc: allow playlist buttons when loopingRicardo Constantino2017-02-011-2/+3
| | | | Closes #4092
* osc: box: clip with ellipsis after too much stretchingRicardo Constantino2017-01-311-2/+9
|
* osc: bottom/topbar: clip title instead of stretchingRicardo Constantino2017-01-311-4/+6
|
* player: add .scc subtitle extensionwm42017-01-311-1/+2
| | | | | | | | | Requested. Supposedly "scenarist closed captions". (The list of getting quite full. But it's probably still better than trying to probe the files by contents, because the external subtitle loader code will initially look at _all_ files in the same directory as the main file.)
* command: nicer OSd-formatting for loop-filewm42017-01-311-0/+1
|
* ytdl_hook: refactor edl track joiningRicardo Constantino2017-01-301-20/+28
| | | | | | Only used once for now. Also, support switched format strings, like bestaudio+bestvideo.
* ytdl_hook: respect --no-audio, don't force-select trackRicardo Constantino2017-01-301-1/+1
|
* player: print hw format on "VO: " line toowm42017-01-291-2/+5
| | | | | | | Useful for distinguishing bit depth when hardware decoding. (To the degree it's useful to show it at all. This just brings the hardware decoding case on the same level of showing information as the software decode call.)
* ytdl_hook: fix opening hitbox.tv rtmp streamRicardo Constantino2017-01-291-0/+2
| | | | | Worked with librtmp, but ffrtmp needs to set rtmp_swfurl in addition to rtmp_swfverify, even if they're the same value.
* win32: snap to screen edgespavelxdd2017-01-271-0/+1
| | | | | | | Disabled by default. The snap sensitivity value depends on the screen DPI. The default value is 16px on a 96 DPI screen. Fixes #2248
* command: shorten long playlists on OSDwm42017-01-261-4/+77
| | | | | | | | | | | | A hacky, convoluted, half-working mess that attempts to cut off overlong playlists. It does so by relying on the ASS formatting rule that the font size is specified in the virtual PlayResY resolution. This means we can (normally) easily tell how many lines fit on the screen. On the other hand, this does not work if the text is wrapped. This as a kludge until a Betterâ„¢ solution is available.
* stream_lavf: add support for data URIsRicardo Constantino2017-01-251-1/+1
| | | | | | | Only FFmpeg supports them and they need to be in the format data:// like other protocols or prefixed with ffmpeg:// or lavf://. Closes #4058
* osc: fix crashes related to field eventresponder being nilRoland Hieber2017-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm still getting some crashes after issue #3210 was fixed in commit 5beb2306904b4437b5acf136b02aeaa073c351c7. It's hard to reproduce those crashes, they happen maybe once a month, so I guess it could be a race condition. But in any case, I don't see anything wrong in applying some defensive programming here. For reference, here is what was happening on 0.23.0-1 from Debian testing: Playing: ytdl://usL5CeP_row (+) Video --vid=1 (*) (h264) (+) Audio --aid=1 --alang=und (*) (aac) [osc] [osc] stack traceback: [osc] @osc.lua:2074: in function 'process_event' [osc] @osc.lua:2246: in function 'cb' [osc] mp.defaults:107: in function 'fn' [osc] mp.defaults:60: in function 'handler' [osc] mp.defaults:339: in function 'handler' [osc] mp.defaults:448: in function 'call_event_handlers' [osc] mp.defaults:485: in function 'dispatch_events' [osc] mp.defaults:441: in function <mp.defaults:440> [osc] [C]: in ? [osc] [C]: in ? [osc] Lua error: @osc.lua:2074: attempt to index field 'eventresponder' (a nil value) Note that the location is different from where issue #3210 happens. Signed-off-by: Roland Hieber <rohieb@rohieb.name>
* command: fix potential crash for script-binding with multi-commandswm42017-01-241-1/+2
| | | | | | | | "show-text test; script-binding display_stats" can potentially crash. It sends a message event. None of the string arguments can be NULL, which fails if cmd->key_name is NULL. This in turn can be due to commands combined with ";" (basically the key association doesn't consider nested commands).
* player: actually initialize/destroy MPContext.lockwm42017-01-221-0/+3
| | | | | | | | Seems like quite on oversight. For most of the better pthread implementations, pthread_mutex_init() on an already 0-initialized memory block is probably a no-op, but of course we should do things correctly. Also could setup analysis tools.
* player: remove --stream-capture option/propertywm42017-01-213-29/+18
| | | | | | | | | | | | | | | This was excessively useless, and I want my time back that was needed to explain users why they don't want to use it. It captured the byte stream only, and even for types of streams it was designed for (like transport streams), it was rather questionable. As part of the removal, un-inline demux_run_on_thread() (which has only 1 call-site now), and sort of reimplement --stream-dump to write the data directly instead of using the removed capture code. (--stream-dump is also very useless, and I struggled coming up with an explanation for it in the manpage.)
* command: rename framedrop propertieswm42017-01-201-6/+10
| | | | | | | | | | "drop-frame-count" -> "decoder-frame-drop-count" "vo-drop-frame-count" -> "frame-drop-count" This gets rid of the backwards "drop-frame" part in the name. Maybe calling the new property "frame-drops" would be better, but there are already a bunch of similar properties that end in "-count".
* player: actually let cache readahead after opening demuxer for prefetchwm42017-01-191-0/+1
| | | | | | | | | | | Disabling cache readahead by default until at least 1 track is selected is mainly for external files and such, where you don't want them to use up resources until they're actually used. It doesn't make sense to disable the cache for the demuxer opened for prefetch. Also, it's fine to let it do that for the main file too (doing or not doing it is of little consequence). That saves us from having to distinguish them.
* player: also log if completely prefetched URL is discardedwm42017-01-191-1/+4
| | | | Seems like quite an important/interesting case?
* player: add prefetching of the next playlist entrywm42017-01-185-91/+142
| | | | | | | | | | | | Since for mpv CLI, the player state is a singleton, full prefetching is a bit tricky. We do it only on the demuxer layer. The implementation reuses the old "open thread". This means there is significant potential for regressions even if the new option is not used. This is made worse by the fact that I barely tested this code. The generic mpctx_run_reentrant() wrapper is also removed - this was its only user, and its remains become part of the new implementation.
* player: restructure cancel callbackwm42017-01-185-5/+40
| | | | | | | | | | | | As preparation for file prefetching, we basically have to get rid of using mpctx->playback_abort for the main demuxer (i.e. the thing that can be prefetched). It can't be changed on a running demuxer, and always using the same cancel handle would either mean aborting playback would also abort prefetching, or that playback can't be aborted anymore. Make this more flexible with some refactoring. Thi is a quite shitty solution if you ask me, but YOLO.
* player: move some minor demuxer setup codewm42017-01-181-3/+4
| | | | | In particular, move demux_set_ts_offset() out of the loader thread. There's no discernible reason for that, probably.
* lua: close directory after reading its entriesWilliam Woodruff2017-01-171-0/+1
| | | | Fixes #4045.
* video: support filtering hardware frames via libavfilterwm42017-01-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Requires a bunch of hacks: - we access AVFilterLink.hw_frames_ctx. This is not a public API in FFmpeg and Libav. Newer FFmpeg provides an accessor (av_buffersink_get_hw_frames_ctx), but it's not available in Libav or the current FFmpeg release or Libav. We need this value after filter graph creation, so We have no choice but to access this. One alternative is making filter creation and format negotiation fully lazy (i.e. delay it and do it as filters are output), but this would be a huge change. So for now, we knowingly violate FFmpeg's and Libav's ABI and API constraints because they don't provide anything better. On newer FFmpeg, we use the (quite ugly) accessor, though. - mp_image_params doesn't (and can't) have a field for the frames context AVBufferRef. So we pass it via vf_set_proto_frame(), and even more hacks. - if a filter needs a hw context, but we haven't created one yet (because normally we create them lazily), it will fail at init. - we allow any hw format now, although this could go horrible wrong. Why all this effort? We could move hw deinterlacing filters etc. to FFmpeg, which is a very worthy goal.
* lua: allow unregistration of idle handlersOlivier Perret2017-01-151-0/+10
|
* scripting: don't call dlclose() on C pluginswm42017-01-141-2/+2
| | | | | | | | Can break things quite badly. Example: reloading a plugin linked against GTK 3.x can cause a segfault if you call dlclose() on it. According to GTK developers, unloading the GTK library is unsupported.
* scripting: minor logging improvementswm42017-01-144-5/+9
| | | | | | | | Give scripting backends a proper name, instead of calling everything "scripts". Log client exit directly in client.c, as that is more general (doesn't change actual output).
* player: add experimental C plugin interfacewm42017-01-121-0/+34
| | | | | | | | | | | | | | | | | This basically reuses the scripting infrastructure. Note that this needs to be explicitly enabled at compilation. For one, enabling export for certain symbols from an executable seems to be quite toolchain-specific. It might not work outside of Linux and cause random problems within Linux. If C plugins actually become commonly used and this approach is starting to turn out as a problem, we can build mpv CLI as a wrapper for libmpv, which would remove the requirement that plugins pick up host symbols. I'm being lazy, so implementation/documentation are parked in existing files, even if that stuff doesn't necessarily belong there. Sue me, or better send patches.
* client API: fix freeze when destroying mpv_handle before mpv_initializewm42017-01-121-1/+7
| | | | | | | | | We have to perform some silly acrobatics to make the playback_thread() exit, as the mpv_command() will error out with MPV_ERROR_UNINITIALIZED. Test case: mpv_terminate_destroy(mpv_create()) Reported by a user on IRC.
* cuda: use libavutil functions for copying hw surfaces to memorywm42017-01-121-6/+10
| | | | | | | | mp_image_hw_download() is a libavutil wrapper added in the previous commit. We drop our own code completely, as everything is provided by libavutil and our helper wrapper. This breaks the screenshot code, so that has to be adjusted as well.
* player: change aspects of cover art handlingwm42017-01-102-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | Cover art handling is a disgusting hack that causes a mess in all components. And this will stay this way. This is the Xth time I've changed cover art handling, and that will probably also continue. But change the code such that cover art is injected into the demux packet stream, instead of having an explicit special case it in the decoder glue code. (This is somewhat more similar to the cover art hack in libavformat.) To avoid that the over art picture is decoded again on each seek, we need some additional "caching" in player/video.c. Decoding it after each seek would work as well, but since cover art pictures can be pretty huge, it's probably ok to invest some lines of code into caching it. One weird thing is that the cover art packet will remain queued after seeks, but that is probably not an issue. In exchange, we can drop the dec_video.c code, which is pretty convenient for one of the following commits. This code duplicates a bunch of lower-level decode calls and does icky messing with this weird state stuff, so I'm glad it goes away.
* command: remove worthless error handling codewm42017-01-091-6/+5
| | | | | | The property calls will always succeed anyway. On the other hand, the error handling is kind of incomplete (doesn't check setting ab-loop-a when ab-loop-b is also set), so drop this code.
* client API: handle missing MPV_FORMAT_BYTE_ARRAY case in compare_valuewm42017-01-091-0/+6
| | | | | | Since there's no property yet that uses this type, and the code is used for property change detection only. this is dead code. Add it anyway for completeness.
* audio: stop being dumbwm42017-01-081-1/+1
| | | | | | | | | | | | | | | | | Obvious mistake: we entered EOF drain mode if the decoder returned AD_WAIT, which is very wrong. AD_WAIT means we should retry after waiting for a while (or to be precise, until the demuxer/decoder have more data). We should just pass down this status, and not change the audio chain state. This was exposed by a libavfilter EOF handling bug. Feeding a filter chain with af_dynaudnorm, and sending an EOF before a frame is returned makes it stuck and keeps returning EAGAIN, instead of returning the buffered audio. In combination with the bug at hand, which entered EOG drain mode, it could happen that it got stuck due to libavfilter discarding buffered data each time the demuxer ran out of data. Fixes #3997.
* player: remove dysfunctional edition switching OSD codewm42017-01-054-10/+2
| | | | | | | | | | | | | Was intended to show a "nice" message on edition switching. In practice, the message was never visible. The OSD code checks whether a demuxer is loaded, and if not, discards the message - meaning if the OSD code happened to run before the demuxer was fully loaded, no message was shown. This is apparently a regression due to extensions to the OSD and the situations in which it can be used. Remove the broken code since it's too annoying to fix. Instead, a default property message will be shown, which is a bit uglier, but actually not too unuseful.
* client API: fix mpv_set_property() return value before initwm42017-01-041-0/+1
| | | | | | Did not return success as success. Fixes #3988.
* Update copyright yearwm42017-01-011-1/+1
| | | | What kind of bullshit forces you to do this every year anyway.
* osc: bottombar/topbar: make chapter markers slightly biggerRicardo Constantino2016-12-251-17/+18
| | | | | | | 1px squares to 2px triangles and layout=box markers from 1px squares to 2x1px rectangles. While we're at it, wrap a few lines to 80col again.
* video: use demuxer-signaled duration for last video framewm42016-12-212-0/+9
| | | | | | | | | Helps with gif, probably does unwanted things with other formats. This doesn't handle --end quite correctly, but this could be added later. Fixes #3924.
* options: change --h=... behaviorwm42016-12-161-1/+1
| | | | | Does not match a shell pattern anymore. Instead, a simple sub-string search is done.
* manpage: replace `-vo` with `--vo`Douglas Christman2016-12-081-1/+1
|
* Remove compatibility thingswm42016-12-071-4/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* osc: replace length property with durationpavelxdd2016-12-041-1/+1
| | | | | | Length property is deprecated and no longer works. This fixes a bug when the total file duration wasn't visible if the option to display milliseconds was activated.
* osc: don't hide playlist buttons, just disableRicardo Constantino2016-12-021-5/+6
| | | |