summaryrefslogtreecommitdiffstats
path: root/sub/ass_mp.c
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.
* ass_mp: change license to LGPLwm42017-04-201-7/+7
| | | | | | | 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.
* 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: add justify of subtitlesDan Oscarsson2017-02-011-0/+3
| | | | | | | | 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.
* sub: change how libass output is converted to RGBA in some caseswm42016-07-031-2/+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: 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-301-31/+103
| | | | | | | | | | | | | | | | 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.
* osd: add italic font for osdst4t1k2016-04-081-0/+1
|
* osd: refactor how mp_ass_render_frame() is calledwm42016-03-081-4/+3
| | | | | | | | Instead of passing an explicit cache to the function, the res parameter is used. Also, instead of replacing its contents, sub bitmaps are now appended to it (all assuming the format doesn't actually change). This is preparation for the following commits.
* ass_mp: add mp_ass_flush_old_events()Aman Gupta2016-01-181-0/+14
|
* sub: remove unused function, move another onewm42015-11-291-36/+0
| | | | | mp_ass_default_track() was not used by anything anymore (commit 5a89150a got rid of it). mp_ass_add_default_styles() is used by sd_ass.c only.
* osd: fix and cleanup font style managementwm42015-11-291-0/+3
| | | | | | | | | | | Commit 2b07d3eb merged progbar and OSD text renderer into one ASS_Track, but it confused the styles. Specifically, if both progbar and OSD are visible, the create_ass_track() call made by the progbar code will reset the style adjusted by the OSD text code. Change create_ass_track() not to add any styles. Instead let the caller manage the styles. They are now referenced by name, and lazily added if they don't exist yet. This is also much cleaner.
* sub: remove use of semi-deprecated libass fieldwm42015-10-281-1/+0
| | | | | In newer libass version, this does nothing, and will be removed on the next API/ABI bump.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* sub: add --sub-text-bold optionwm42015-04-011-0/+1
| | | | This was basically requested.
* osd: simplify an aspect of change detection handlingwm42015-03-181-4/+2
| | | | | | | | | | | | | | | | | | There was a somewhat obscure optimization in the OSD and subtitle rendering path: if only the position of the sub-images changed, and not the actual image data, uploading of the image data could be skipped. In theory, this could speed up things like scrolling subtitles. But it turns out that even in the rare cases subtitles have such scrolls or axis-aligned movement, modern libass rarely signals this kind of change. Possibly this is because of sub-pixel handling and such, which break this. As such, it's a worthless optimization and just introduces additional complexity and subtle bugs (especially in cases libass does the opposite: incorrectly signaling a position change only, which happened before). Remove this optimization, and rename bitmap_pos_id to change_id.
* sub: fully update plaintext subtitle styles at runtimewm42015-02-241-1/+0
| | | | | | | | | | | | | | | Update options like --sub-text-margin-y at runtime. These are somewhat of a problem, because ass_set_selective_style_override() (intentionally) does not override them. This should be fixed in libass (by providing additional override modes), but for now this will do. Also change the signature of mp_ass_configure(), so we can get access to the track. Additionally, drop the redundant setting of the style Alignment (it's overwritten by mp_ass_set_style()). See #1622 (again).
* sub: move mp_ass_configure() codewm42015-02-241-57/+0
| | | | | sd_ass.c is the only user, and the function is starting to become extremely "special". No other changes.
* sub: apply text subtitle style overrides more eagerlywm42015-02-241-1/+3
| | | | | | | | | | Basically abuse the style override mechanism meant for ASS (mp_ass_set_style()) to update text subtitle styling at runtime too. This even has the advantage that the style will be overridden, even if the text subtitle converted (like sd_lavc_conv.c) dares to add a fixed style in the styles section. Probably helps with #1622.
* libass: remove redundant checks for LIBASS_VERSIONBen Boeckel2015-02-241-19/+0
| | | | Since 0.12.1 is the minimum, just assume it in the code too.
* sub: mess with styling defaults, change --ass-use-margins behaviorwm42015-02-161-13/+22
| | | | | | | | | | | | | | | | | | | Now --ass-use-margins doesn't apply to normal subtitles anymore. This is probably the inverse from the mpv behavior users expected so far, and thus a breaking change, so rename the option, that the user at least has a chance to lookup the option and decide whether the new behavior is wanted or not. The basic idea here is: - plain text subtitles should have a certain useful defalt behavior, like actually using margins - ASS subtitles should never be broken by default - ASS subtitles should look and behave like plaintext subtitles if the --ass-style-override=force option is used This also subtly changes --sub-scale-with-window and adds the --ass- scale-with-window option. Since this one isn't so important, don't bother with compatibility.
* osd: customizable subtitle and OSD positionwm42015-02-161-0/+1
| | | | | | You can set in which "corner" the OSD and subtitles are shown. I'd prefer it a bit more general (so you could set the alignment using a factor), but the libass API does not provide this.
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-1/+1
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* sub: add option to not scale subtitles with windowwm42015-01-051-0/+5
| | | | | | | | | | | | | --sub-scale-by-window=no attempts to keep subs always at the same pixel size. The implementation is a bit all over the place, because it compensates already done scaling by an inverse scale factor, but it will probably do its job. Fixes #1424. (The semantics and name of --sub-scale-with-window are kept, and this adds a new option - the name is confusingly similar, but it's actually analogue to --osd-scale-by-window.)
* sub: adjustments to --ass-style-override optionwm42014-10-171-4/+7
| | | | | | | | | | Now requires newest libass git. Since this feature wasn't part of a libass release yet, I'm not bothering making the mpv code compatible with as how it was previously implemented (it will just be disabled with any older libass). CC: @mpv-player/stable (because mpv-build uses libass git, and this breaks the feature)
* ass: remove some pointless ifdefferywm42014-07-221-4/+0
| | | | | This will print compiler warnings about unused variables with older libass versions, but that's harmless.
* Basic xdg directory implementationKenneth Zhou2014-06-261-2/+2
| | | | | | | | | | Search $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS for config files. This also negates the need to have separate user and global variants of mp_find_config_file() Closes #864, #109. Signed-off-by: wm4 <wm4@nowhere>
* sub: add --sub-scale-with-window optionwm42014-06-141-4/+7
| | | | Implements the feature requested in #839 and #186.
* Add more constwm42014-06-111-1/+1
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* sub: add --ass-style-override=force optionwm42014-06-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (The old "force" choice of that option is renamed to "force-default".) This allows overriding native ASS script subtitle styles with the style provided by the --sub-text-* options (like --sub-text-font etc.). This is disabled by default, and needs to be explicitly enabled with the --ass-style-override=force option and input property. This uses in fact exactly the same options (--sub-text-*) and semantics as the ones used to configure unstyled text subtitles. It's recommended to combine this with this in the mpv config file: ass-force-style="ScaledBorderAndShadow=1" # work around dumb libass behavior Also, adding a key binding to toggle this behavior should be added, because overriding can easily break: L cycle ass-style-override This would cycle override behavior on Shift+L and allows quickly disabling/enabling style overrides. Note: ASS should be considered a vector format rather than a subtitle format. There is no easy or reliable way to determine whether the style of a given subtitle event can be changed without destroying visuals or not. This patch relies on a simple heuristic, which often works and often breaks.
* osd/libass: use BorderStyle=4 for backgroundwm42014-06-011-0/+11
| | | | Avoids (some) overlaps. Hopefully fixes #822.
* ass_mp: don't use --subcp for --ass-styleswm42014-03-311-1/+1
| | | | | | | | | | | | | The --ass-styles option is implemented by calling ass_read_styles(). This function can take a codepage (so libass will use iconv to convert it). This was implemented before our --subcp option was changed, and this code was not updated. Now libass fails opening iconv, because --subcp is not always (and not by default) a valid iconv codepage. Just always pass NULL, which means the file passed to --ass-styles must be in UTF-8. The --ass-styles option is a fringe option anyway (and will destroy your subtitles), so having codepage support for it isn't important at all.
* msg: rename mp_msg_log -> mp_msgwm42013-12-211-2/+2
| | | | Same for companion functions.
* msg: convert defines to enumwm42013-12-211-2/+2
| | | | Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
* path lookup functions: mp_msg conversionswm42013-12-211-10/+8
| | | | | | | | | | | | | | | | | There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
* sub/osd: mp_msg conversionswm42013-12-211-7/+11
|
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-2/+2
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* osd_libass: update styles when OSD changes PlayReswm42013-12-151-3/+5
| | | | | | | The OSD style settings depend on the PlayRes, simply because all style values are implicitly scaled by the PlayResY in libass. Also, the OSC changes the PlayResY in certain situations, so something could go wrong. But not sure if this actually matters in practice.
* osd: use separate ASS_Renderer for each OSD objectwm42013-12-151-2/+3
| | | | | | | | This simplifies things, although it is slightly less efficient (probably uses a bit more memory). This also happens to fix that the OSC dropped the libass cache on every frame.
* osd: add option for "unscaled" OSDwm42013-12-101-1/+1
|
* Rename sub.c/.h to osd.c/.hwm42013-11-241-1/+1
| | | | | This was way too misleading. osd.c merely calls the subtitle renderers, instead of actually dealing with subtitles.
* osd_libass: add "Default" dummy stylewm42013-09-261-1/+2
| | | | | | This is pretty much a hack for the OSC. It will allow it to rely on a somewhat predictable style, instead of having to overwrite all user OSD settings manually with override tags.
* options: allow selecting the libass shaperwm42013-09-251-0/+3
| | | | | | I'm using the word "languages" instead of "scripts" in the manpage, but I think that's easier to understand with a smaller amount of descriptions.
* options: make --ass-hinting a choice, instead of using magic numberswm42013-09-251-1/+1
| | | | | options.c still doesn't use the constants defined by the libass headers, but it's still better than exposing those to the user directly.
* sub/ass_mp: remove superfluous message prefixesMartin Herkt2013-09-231-3/+2
|
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* sub: add demux_libass wrapper, drop old hackswm42013-06-251-28/+0
| | | | | | | | | | | | demux_libass.c allows us to make subtitle format detection part of the normal file loading process. libass has no probe function, but trying to load the start of a file (the first 4 KB) is good enough. Hope that libass can even handle random binary input gracefully without printing stupid log messages, and that the libass parser doesn't accept too many non-ASS files as input. This doesn't handle the -subcp option correctly yet. This will be fixed later.
* Move/rename subreader.cwm42013-06-251-1/+0
|
* stream: remove padding parameter from stream_read_complete()wm42013-06-231-1/+1
| | | | | | | | Seems like a completely unnecessary complication. Instead, always add a 1 byte padding (could be extended if a caller needs it), and clear it. Also add some documentation. There was some, but it was outdated and incomplete.
* ass_mp: provide function to add default styleswm42013-06-031-13/+24
|
* sub: turn subassconvert_ functions into sub converterswm42013-06-031-79/+0
| | | | | | | | | | | | | | | | | This means subassconvert.c is split in sd_srt.c and sd_microdvd.c. Now this code is involved in the sub conversion chain like sd_movtext is. The invocation of the converter in sd_ass.c is removed. This requires some other changes to make the new sub converter code work with loading external subtitles. Until now, subtitles loaded via subreader.c was assumed to be in plaintext, or for some formats, in ASS (except in -no-ass mode). Then these were added to an ASS_Track. Change this so that subtitles are always in their original format (as far as decoders/converters for them are available), and turn every sub event read by subreader.c as packet to the dec_sub.c subtitle chain. This removes differences between external/demuxed and -ass/-no-ass code paths further.
* sub: remove some global variableswm42013-05-301-2/+2
|
* sub: remove check_duplicate_plaintext_event()wm42013-05-301-19/+0
| | | | | | | | | | | | | This was once needed to handle subtitle packages coming from a demuxer, where seeking back might repeat previous events. This doesn't happen anymore, and this code is used to convert complete files. So if there are any duplicate lines, they must have been duplicated in the file, and the old subtitle renderer would have shown them twice as well. Today checking for duplicate events happens in sd_ass.c (and has been for a while). There's no reason to keep this code, and it actually causes trouble. Loading big subtitle files is extremely slow because this makes adding n subtitles O(n^2).
* sub: add --osd-blur and --sub-text-blur optionswm42013-04-131-0/+3
| | | | | | | | | These require bleeding edge libass (latest git version), and will be ignored otherwise. I'm not sure about the blur factor and scaling. The ASS/VSFilter semantics for blur scaling are a bad mess. Might require further investigation.
* sub: print messages before and after font setupwm42013-03-201-0/+2
| | | | | | | Helps on Windows, where fontconfig may take some time to finish. Print it with -v only, because that message would be annoying anywhere else.
* Check return values of some mp_find_..._config_file function calls for NULLwm42013-02-091-2/+3
|
* sub: add --sub-text-* options to unstyled text subtitles fontwm42013-01-051-1/+1
| | | | | | | Before this commit, the --osd-* options (like --osd-font-size etc.) configured both the OSD and subtitle font. Make them separate, and add --sub-text-* options (like --sub-text-size etc.). Now --osd-* affects the OSD font only, and --sub-text-* unstyled text subtitles only.
* demux_mpg, ass_mp: fix warningsRudolf Polzer2012-12-281-0/+4
| | | | | | | | The warnings in demux_mpg were silenced by additional no-operation casts. A variable in ass_mp was used only for some versions of libass; now the declaration is in that version #ifdef too to avoid a compiler warning.
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-151-12/+7
| | | | | | | | | | | | | |