summaryrefslogtreecommitdiffstats
path: root/sub
Commit message (Collapse)AuthorAgeFilesLines
* 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 should be a better way to deal with the essentially unknown "rendering position", which is made worse by screenshots or rendering with vf_sub. At the very least, we could handle seeks better, and e.g. either force the VO not to re-render subs after seeks (ugly), or introduce seek sequence numbers to distinguish attempts to render earlier subtitles when a seek is done.
* mp_image: split colorimetry metadata into its own structNiklas Haas2016-07-032-23/+21
| | | | | | | | | | | | | | | | | | This has two reasons: 1. I tend to add new fields to this metadata, and every time I've done so I've consistently forgotten to update all of the dozens of places in which this colorimetry metadata might end up getting used. While most usages don't really care about most of the metadata, sometimes the intend was simply to “copy” the colorimetry metadata from one struct to another. With this being inside a substruct, those lines of code can now simply read a.color = b.color without having to care about added or removed fields. 2. It makes the type definitions nicer for upcoming refactors. In going through all of the usages, I also expanded a few where I felt that omitting the “young” fields was a bug.
* sub: remove unused sub_bitmaps.scaled fieldwm42016-07-032-5/+0
|
* sub: move RGBA scaling to vo_vaapiwm42016-07-032-66/+0
| | | | | | | | | vo_vaapi is the only thing which can't scale RGBA on the GPU. (Other cases of RGBA scaling are handled in draw_bmp.c for some reason.) Move this code and get rid of the osd_conv_cache thing. Functionally, nothing changes.
* sub: change how libass output is converted to RGBA in some caseswm42016-07-035-132/+103
| | | | | | | | | | | | | | | | | This affects VOs (or other code which render OSD) which does not support the LIBASS format, but only RGBA. Instead of having a converter stage in osd.c, make mp_ass_packer_pack() output directly in RGBA. In general, this is work towards refcounted subtitle images. Although we could keep the "converter" design, doing it this way seems simpler, at least considering the current situation with only 2 OSD formats. It also prevents copying & packing the data twice, which will lead to better performance. (Although I guess this case is not important at all.) It also fixes --force-rgba-osd-rendering when used with vo_opengl, vo_vdpau, and vo_direct3d.
* sub: move around some codewm42016-07-031-39/+60
| | | | | Put the packing code into separate functions. Preparation for the following commit.
* sub: pass preferred OSD format to subtitle rendererswm42016-07-039-18/+22
| | | | | | | | The intention is to let mp_ass_packer_pack() produce different output for the RGBA and LIBASS formats. VOs (or whatever generates the OSD) currently do not signal a preferred format, and this mechanism just exists to switch between RGBA and LIBASS formats correctly, preferring LIBASS if the VO supports it.
* sub: set ASS sub bitmap data to correct pointerwm42016-07-011-0/+3
| | | | | Point it to the copied data. Doesn't really matter at this point, but later it might have left dangling pointers.
* sub: pack libass bitmaps directly in sd_ass.c and osd_libass.cwm42016-06-306-54/+148
| | | | | | | | | | | | | | | | Change all producer of libass images to packing the bitmaps into a single larger bitmap directly when they're output. This is supposed to help working towards refcounted sub bitmaps. This will reduce performance for VOs like vo_xv, but not for vo_opengl. vo_opengl simply will pick up the pre-packed sub bitmaps, and skip packing them again. vo_xv will copy and pack the sub bitmaps unnecessarily - but if we want sub bitmap refcounting, they'd have to be copied anyway. The packing code cannot be removed yet from vo_opengl, because there are certain corner cases that still produce unpackad other sub bitmaps. Actual refcounting will also require more work.
* ass_mp.h: remove conditional inclusion guardswm42016-06-241-6/+2
| | | | | This file is only used when libass is enabled. (It used to be different, when code was more entangled.)
* bitmap_packet: let max=0 mean unlimitedwm42016-06-181-1/+0
| | | | | And remove the strange PACKER_MAX_WH define. This is more convenient for users which don't care about limits, such as sd_lavc.c.
* sd_lavc: fix sub-bitmap alignmentwm42016-06-181-1/+1