summaryrefslogtreecommitdiffstats
path: root/sub
Commit message (Collapse)AuthorAgeFilesLines
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | I've decided that MP_TRACE means “noisy spam per frame”, whereas MP_DBG just means “more verbose debugging messages than MSGL_V”. Basically, MSGL_DBG shouldn't create spam per frame like it currently does, and MSGL_V should make sense to the end-user and provide mostly additional informational output. MP_DBG is basically what I want to make the new default for --log-file, so the cut-off point for MP_DBG is if we probably want to know if for debugging purposes but the user most likely doesn't care about on the terminal. Also, the debug callbacks for libass and ffmpeg got bumped in their verbosity levels slightly, because being external components they're a bit less relevant to mpv debugging, and a bit too over-eager in what they consider to be relevant information. I exclusively used the "try it on my machine and remove messages from MSGL_* until it does what I want it to" approach of refactoring, so YMMV.
* sd_ass: accept otc as fallback OpenType collection file extensionLeo Izen2017-12-131-1/+1
| | | | | | | The OpenType Font File specification recommends that "Collection fonts that use CFF or CFF2 outlines should have an .OTC extension." mpv should accept .otc as a fallback extension for font detection should the mimetype detection fail.
* sd_ass: accept RFC8081 font media typesLeo Izen2017-12-131-0/+4
| | | | | | | | | | IETF RFC8081 added the "font" top-level media type, including font/ttf, font/otf, font/sfnt, and also font/collection. These font formats are all supported by mpv/libass but they are not accepted as valid Matroska mime types. mpv can load them via file extension and they work as expected, so files using the new types should not trigger a warning from mpv.
* osd: don't skip leading whitespace on the first line eitherwm42017-11-021-1/+1
| | | | Stupid libass.
* osd: don't strip leading whitespace in messageswm42017-10-301-0/+7
| | | | Do this by replacing the first space after a line break with "\h".
* lavc_conv: make disable_styles fasterOleg Oshmyan2017-10-301-2/+3
| | | | | | | | | | | | | | The current invocation of bstr_cut is as good as no cutting at all. Almost the entire header is reread in every iteration of the loop. I don't know how many styles libavcodec tends to generate, but if (now or in the future) it generates many, then this loop is slow for no good reason. If anything, the code would be more clear and have the same performance if it didn't call bstr_cut at all. The intention here (and the sensible thing regardless) seems to be to skip the part of the string that bstr_find has already looked through and found nothing. This commit additionally skips the whole substring, because overlapping matches are impossible.
* lavc_conv: clamp timestamps to positive, fixes idiotic ffmpeg issuewm42017-10-271-0/+2
| | | | | | | | | | | In some cases, demux_mkv will detect a start time slightly above 0, but there might still be a subtitle starting at exactly 0. When the player rebases the timestamps to assumed start time, the subtitle will have a slightly negative timestamp in the end. libavcodec's subtitle converter turns this into a larger number due to underflow. Fix by clamping subtitles always to 0, which may or may not be what you want. At least it fixes #5047.
* demux: get rid of demux_packet.new_segment fieldwm42017-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new_segment field was used to track the decoder data flow handler of timeline boundaries, which are used for ordered chapters etc. (anything that sets demuxer_desc.load_timeline). This broke seeking with the demuxer cache enabled. The demuxer is expected to set the new_segment field after every seek or segment boundary switch, so the cached packets basically contained incorrect values for this, and the decoders were not initialized correctly. Fix this by getting rid of the flag completely. Let the decoders instead compare the segment information by content, which is hopefully enough. (In theory, two segments with same information could perhaps appear in broken-ish corner cases, or in an attempt to simulate looping, and such. I preferred the simple solution over others, such as generating unique and stable segment IDs.) We still add a "segmented" field to make it explicit whether segments are used, instead of doing something silly like testing arbitrary other segment fields for validity. Cached seeking with timeline stuff is still slightly broken even with this commit: the seek logic is not aware of the overlap that segments can have, and the timestamp clamping that needs to be performed in theory to account for the fact that a packet might contain a frame that is always clipped off by segment handling. This can be fixed later.
* vo_opengl: don't discard buffered video on redundant resize callswm42017-08-292-1/+3
| | | | | | | | | | If a VO-area option changes, gl_video_resize() is called unconditionally. This function does something even if the size does not change (at least it discards buffered frames for interpolation), which can lead to stutter when you keep firing option change events during playback. Check for an actual resize, and if nothing changes, exit early.
* osd_libass: avoid libass warnings if scripts set ASS text earlywm42017-07-162-19/+30
| | | | | | | | | | | | | | | | Lua scripts can call osd_set_external() early (before the VO window is created and obj->vo_res is filled), in which case the PlayResX field would be set to nonsense, and libass would print a pointless warning. There's an easy and a hard fix: either just go on and pass dummy values to libass (basically like before, just clamp them to avoid the values which make libass print the warning). Or attempt to update the PlayRes field to correct values on rendering (since at rendering time, you always know the screen size and the correct values). Do the latter. Since various things use PlayRes for scaling things, this might still not be fully ideal. This is a general problem with the async scripting interface.
* Replace remaining avcodec_close() callswm42017-07-161-3/+1
| | | | | | | | This API isn't deprecated (yet?), but it's still inferior and harder to use than avcodec_free_context(). Leave the call only in 1 case in af_lavcac3enc.c, where we apparently seriously close and reopen the encoder for whatever reason.
* ad_lavc, vd_lavc, sd_lavc: consistently use avcodec_free_context()wm42017-07-061-3/+1
| | | | | Instead of various ad-hoc ways to achieve the same thing. (The API was added only later.)
* options: slight cleanup of --sub-ass-style-overrideNiklas Haas2017-06-071-2/+2
| | | | | | | | | | | | | | | | | | List of changes: 1. Rename `signfs` to `scale`, to better match what it actually does (force --sub-scale to apply to ASS subtitles), and fix the blatantly wrong documentation (it actually specifically does *not* apply to signs) 2. Rename `--sub-ass-style-override` to `--sub-ass-override` to help reduce confusion between it and `--sub-ass-force-style`, as well as pointing out that it doesn't necessarily actually override styles. (The new `scale` option, for example, only sets ASS_OVERRIDE_BIT_FONT_SIZE, but not ASS_OVERRIDE_BIT_STYLE) 3. Mention that `--sub-ass-override` is generally sort of smart about only overriding dialog, not signs.
* sub: sdh filter fix for nullDan Oscarsson2017-04-281-1/+1
| | | | sdh filter returns NULL when subtitle line should be skipped
* osd-font: make volume muted glyph slightly thickerRicardo Constantino2017-04-221-0/+0
|
* sub/osd_font.otf: replace triangle volume by speaker glyphRicardo Constantino2017-04-201-0/+0
| | | | | The triangle icon has potentially questionable copyright issues, see https://github.com/mpv-player/mpv/commit/a7e9bac13210834abd95380e89b5c3dae2336c52
* sd_lavc: Free extradata in case of init errorcantabile2017-04-201-0/+2
|
* sub/osd: relicense to LGPLwm42017-04-202-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | All contributors of the code used for these files agreed to the LGPL relicensing. There are some unaccounted contributors, but all of their code was completely removed before. (The only exception is one contributor whose only line left was "#include <string.h>". I don't know if that's copyrightable, but it wasn't needed anyway, so just remove it.) These files started out as libvo/sub.* (renamed to sub/sub.*, then renamed again to sub/osd.*). They used to contain code for rendering the OSD (as in, actual pixel manipulation and text layouting). But later all this code was dropped, and libass was used to render the OSD instead. Actual subtitle rendering was reimplemented in other files (the old subtitle rendering path is completely gone). One potential problem are the option declarations, which makes this harder, as these options involve more history. But it turns out most of them were reimplemented since 80270218cb9, rather than taken from old code. (Although not all - but the rest covered by relicensing agreements.) This also affects osd_state.h, which was apparently incorrectly implied to be LGPL.
* sd_lavc: change license to LGPLwm42017-04-201-7/+7
| | | | | | | | | | All contributors have agreed. Compared to sd_ass.c, this has a pretty simple history: av_sub.c -> sub/av_sub.c -> sub/sd_lavc.c At one point, some code from spudec.c was added to it, but it was removed again later.
* sd_ass: change license to LGPLwm42017-04-201-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All contributors of the code used for sd_ass.c agreed to the LGPL relicensing. Some code has a very chaotic history, due to MPlayer subtitle handling being awful, chaotic, and having been refactored a dozen of times. Most of the subtitle code was actually rewritten from scratch (a few times), and the initial sd_ass.c was pretty tiny. So we should be fine, but it's still a good idea to look at this closely. Potentially problematic cases of old code leaking into sd_ass.c are mentioned below. Some code originates from demux_mkv. Most of this was added by eugeni, and later moved into mplayer.c or mpcommon.c. The old demux_mkv ASS/SSA subtitle code is somewhat dangerous from a legal perspective, because it involves 2 patches by a certain Tristan/z80, who disagreed with LGPL, and who told us to "rewrite" parts we need. These patches were for converting the ASS packet data to the old MPlayer text subtitle data structures. None of that survived in the current code base. Moving the subtitle handling out of demux_mkv happened in the following commits: bdb6a07d2a712c, de73d4dd978cb2, 61e4a801913f76. The code by z80 was removed in b44202b69fc4a1. At this time, the z80 code was located in mplayer.c and subreader.c. The code was fully removed, being unnecessary due to the entire old subtitle rendering code being removed. This adds a ass_to_plaintext(), function, which replaces the old ASS tag stripping code in sub_add_text(), which was based on the z80 code. The new function was intended to strip ASS tags in a correct way, instead of somehow dealing with other subtitle types (like HTML-style SRT tags), so it was written from scratch. Another potential issue is the --sub-fix-timing option is based on -overlapsub added in d459e644632cb9b. But the implementation is new, and no code from that commit is used in sd_ass.c. The new implementation started out in 64b1374a4456435. (The following commit, bd45eb468ced22 removes the original code that was replaced.) The code was later moved into sd_ass.c. The --sub-fps option has a similar history.
* ass_mp: change license to LGPLwm42017-04-202-14/+14
| | | | | | | Somewhat chaostic history: libass/ass_mp.* -> ass_mp.* -> sub/ass_mp.* As far as I can tell, everyone who ever touched these files has agreed to the relicensing.
* filter_sdh: remove pointless set_pos functionwm42017-04-201-17/+10
| | | | | This change was requested during patch review, but apparently it was overlooked on merge.
* filter_sdh: change license to LGPLwm42017-04-201-7/+7
|
* sub/osd_font.otf: fix fontforge errors/warningsRicardo Constantino2017-04-191-0/+0
|
* osc: add volume icons to osd font and use themRicardo Constantino2017-04-191-0/+0
| | | | | Glyphs taken and based on U+1F507 to U+1F50A from Symbola, which is available under public domain: http://users.teilar.gr/~g1951d/
* ass_mp: reallocate cached subtitle image data on format changeswm42017-04-181-1/+2
| | | | | | | | When the format of the subtitle bitmaps changes, such as with taking screenshots with vo_vaapi (RGBA for the VO vs. Y8 for screenshots), the cache image obviously needs to be recreated. Fixes #4325.
* sub: minor sdh filter fixesDan Oscarsson2017-04-151-1/+2
| | | | | | | | | | When doing harder filtering not require a space after : results in lines with a clock (like 10:05) to be taken as a speaker label. So require a space after : even when doing harder filtering as missing space is very uncommon. Some like to add text in parentheses in the speaker label, like XXX (loud): or just (loud): allow parentheses when doing harder filtering
* sub: add SDH subtitle filterDan Oscarsson2017-03-253-5/+482
| | | | | | | | | | Add subtitle filter to remove additions for deaf or hard-of-hearing (SDH). This is for English, but may in part work for others too. This is an ASS filter and the intention is that it can always be enabled as it by default do not remove parts that may be normal text. Harder filtering can be enabled with an additional option. Signed-off-by: wm4 <wm4@nowhere>
* sd_ass: disable --sub-fix-timing if sub style override is fully disabledwm42017-03-151-1/+1
| | | | | | | | | This means the subtitles will show as "intended". For some weird reason, --sub-ass-style-override is the option that controls style override, which implies it's specific to ASS. While that seems weird and doesn't always reflect reality, I don't care about that now.
* lavc_conv: pass pkt_timebase to ffmpegAman Gupta2017-02-181-0/+3
| | | | Similar to code used everywhere else we create a lavc context.
* player: add experimental stream recording featurewm42017-02-072-0/+16
| | | | | 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".
* sub: add justify of subtitlesDan Oscarsson2017-02-014-0/+10
| | | | | | | | To make it easier for the eyes, multi line subtitles should be left justified (for most languages). This adds an option to define how subtitles are to be justified inpendently of how they are aligned. Also add option to enable --sub-justify to be applied on ASS subtitles.
* command: shorten long playlists on OSDwm42017-01-263-5/+30
| | | | | | | | | | | | 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.
* osd: move some internal declarations to internal headerswm42017-01-263-10/+7
|
* sub: add option to force using video resolution for image subtitleswm42017-01-231-1/+1
| | | | Basically for debugging and dealing with broken files.
* sd_lavc: remove old broken heuristicwm42017-01-232-39/+10
| | | | | | | | | | | | | | | | | This core of this heuristic was once copied from MPlayer's spudec.c. I think it was meant for the case when the resolution field was missing or so. I couldn't find a file for which this actually does something. On the other hand, there are samples which actually have a smaller resolution than 720x576, and which are broken by this old hack. For subtitles that set no resolution (I'm not sure which codec/container that would be), there's still the fallback on video resolution. Just get rid of this hack. Also cleanup a bit. SD_CTRL_GET_RESOLUTION hasn't been used since DVD menu removal. get_resolution() is left with 1 call site, and would be quite awkward to keep, so un-inline it.
* Remove compatibility thingswm42016-12-072-8/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* dec_sub: avoid full reinit on switches to the same segmentwm42016-11-091-2/+7
| | | | | | | | | | The previous commit means subtitles were reinitialized on every seek (even within a segment). This commit restores the old behavior. To check whether the segment changed at all, we don't reset the current start/end values. This assumes the decoder wrapper is always fed by a stream which doesn't mix segment and non-segment packets, which is currently always true.
* player: show subtitles on VO if --force-window is usedwm42016-10-263-0/+22
| | | | | | | | | | | | | | | | | | | | | If a VO is created, but no video is playing (i.e. --force-window is used), then until now no subtitles were shown. This is because VO subtitle display normally depends on video frame timing. If there are no video frames, there can be no subtitles. Change this and add some code to handle this situation specifically. Set a subtitle PTS manually and request VO redrawing manually, which gets the subtitles rendered somehow. This is kind of shaky. The subtitles are essentially sampled at arbitrary times (such as when new audio data is decoded and pushed to the AO, or on user interaction). To make a it slightly more consistent, force a completely arbitrary minimum FPS of 10. Other solutions (such as creating fake video) would be more intrusive or would require VO-level API changes. Fixes #3684.
* options: rename subtitle optionsDan Oscarsson2016-10-031-4/+4
| | | | | | | | | | | Rename the text subtitle options from --sub-text- to --sub- and --ass- options to --sub-ass-. The intention is to common sub options to prefixed --sub- and special ASS option be seen as a special version of sub options. The OSD options that work like the --sub- options are still named --osd-. Man page updated including a short note about renamed --sub-text-* and --ass-* options to --sub-* and --sub-ass-*.
* sd_ass: fix top alignment of secondary subtitleswm42016-09-251-3/+4
| | | | | | | | | | | Secondary subtitle streams (to be shown on the top of the screen along main subtitle stream) were shown with normal alignment. This is because we tell libass to override the alignment style (a relatively recent change, see commit 2f1eb49e). This would behave differently with old libass versions too. To escape the mess, just set the alignment explicitly with an override tag instead of modifying the style.
* osd: fix OSD redrawing after removing external overlayswm42016-09-201-0/+2
|
* options, command: simplify some option updateswm42016-09-191-0/+2
| | | | | | | Remove wrapper properties for OSD and video position updates, use the new mechanism for them. We can mark the options directly. Update behavior will work for more options (since I've casually marked more affected options than the old less direct mechanism covered).
* osd: fix OSD getting stuck with --blend-subtitles=yeswm42016-09-163-19/+18
| | | | | | | | | | | | | If --blend-subtitles=yes is given, vo_opengl will call osd_draw() multiple times, once for subtitles, and once for OSD. This meant that the want_redraw flag was reset before the OSD was rendered, which in turn meant that update_osd() was never called. It seems like removing the per-OSD object want_redraw wasn't such a good idea. Fix it by reintroducing such a flag for OSDTYPE_OSD only. Also, the want_redraw flag is now unused, so kill it. Another regression caused by commit 9c9cf125. Fixes #3535.
* osd: fix subtitle/overlay update problemswm42016-09-161-2/+6
| | | | | | | | | | | This could in theory lead to missed updates if subtitles were switched or external OSD overlays (via overlay-add) were updated. While the change IDs of each of those were consistent, switching between two separate OSD sources is not, and we have to explicitly trigger a change. Regression since commit 9c9cf125. The new code is actually better, because we do exactly what is needed, and don't just mess with the update ID for libass-based OSD.
* osd: slightly simplify update logicwm42016-09-154-27/+19
| | | | | | | | | | | | | | | | Remove the per-part force_redraw flags, and instead make the difference between flagging dirty state and returning it to the player frontend more explicit. The big issue is that 1. the OSD needs to know the dirty state, and it should be cleared strictly when it is re-rendered (force_redraw flag), and 2. the player core needs to be notified once, and the notification must be reset (want_redraw flag). The call in loadfile.c is replaced by making osd_set_sub() set the change flag. Increasing the change flag on dirty state (the force_redraw check in render_object()) should not be needed, because OSD part renderers set it correctly (at least now). Doing this just because someone pointed this out.
* sub: Add SD_CTRL_UPDATE_SPEEDVladimir Panteleev2016-09-132-0/+4
|
* sub: fix previous commit with older libass releaseswm42016-09-071-0/+2
|
* sub: actually apply text alignment options to non-ASS subtitleswm42016-09-071-0/+2
| | | | | | | | | | | This is a bug fix, and the text alignment functionality probably got lost sometime along the way. For ASS subtitles, this could have unintended consequences, so it's hard to get right - thus it's not applied to ASS subtitles. For other text subtitles, this should be fine, though. It still works on ASS subtitles as promised by the manpage if --no-sub-ass is used.
* sd_lavc: enable teletextwm42016-09-031-0/+11
| | | | | | | | | | | | Whitelisting supported codecs is (probably) still better than just allowing everything, given the weird FFmpeg API. I'm also assuming Libav doesn't even have the codec ID, but I didn't check. Also add a --teletext-page option, since otherwise it decodes every teletext page and shows them in succession. And yes, we can't use av_opt_set_int() - instead we have to set it as string. Because FFmpeg's option system is terrible.
* sd_lavc: always set decoder timebasewm42016-08-291-18/+2
| | | | | | | | Like it's done for audio and video. Just to be uniform. I'm sorry for deleting the anti-ffmpeg vitriol. It's still all true, but since we decided to always set the timebase, the crappiness is isolated to FFmpeg internals.
* sub: don't potentially discard too many subtitles on seekwm42016-08-143-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | The accepts_packet packet callback is supposed to deal with subtitle decoders which have only a small queue of current subtitle events (i.e. sd_lavc.c), in case feeding it too many packets would discard events that are still needed. Normally, the number of subtitles that need to be preserved is estimated by the rendering pts (get_bitmaps() argument). Rendering lags behind decoding, so normally the rendering pts is smaller than the next video frame pts, and we simply discard all subtitle events until the rendering pts. This breaks down in some annoying corner cases. One of them is seeking backwards: the VO will still try to render the old PTS during seeks, which passes a high PTS to the subtitle renderer, which in turn would discard more subtitles than it should. There is a similar issue with forward seeks. Add hacks to deal with those issues. There shoul