summaryrefslogtreecommitdiffstats
path: root/sub
<
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | sub: never decode subs to old OSD formatwm42012-10-169-169/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead, sd_lavc.c and spudec.c (the two image sub decoders) always output indexed/paletted images. For this purpose, add SUBBITMAP_INDEXED, and convert the subs to RGBA in img_convert.c instead. If a VO is used that supports the old OSD format only, the indexed bitmaps are converted to the old OSD format by abusing spudec.c in a similar way sd_lavc.c used to do. The main reason why spudec.c is used is because the images must not only be converted to the old format, but also properly scaled, cropped, and aligned (the asm code in libvo/osd.c requires this alignment). Remove support for the old format (packed variant) from the OpenGL VOs. (The packed formats were how the actual OSD format was handled in some GPU-driven VOs for a while.) Remove all conversions from old to new formats. Now all subtitle decoders and OSD renderers produce the new formats only. Add an evil hack to convert the new format (scaled+indexed bitmaps) to the old format. It creates a new spudec instance to convert images to grayscale and to scale them. This is temporary for VOs which don't support new OSD formats yet (vo_xv, vo_x11, vo_lavc).
| * | | sub: cosmetics: move things aroundwm42012-10-166-63/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move sub-bitmap definitions from dec_sub.h to sub.h. While it's a bit odd that OSD data structures are in a file named sub.h, it's definitely way too strange to have them in a file about subtitle decoding. (Maybe sub.h/.c and the sub/ directory should be split out and renamed "osd" at a later point.) Remove including ass_mp.h (and the libass headers) where possible. Remove typedefs for mp_eosd_res and sub_bitmaps structs. Store a mp_eosd_res struct in osd_state instead of just w/h. Note that sbtitles might be rendered using different sizes/margins when filters are involved (the subtitle renderer is not supposed to use the OSD res directly, and the "dim" member removed in the previous commit is something different).
| * | | sub: cleanup: don't pass parameters via global variableswm42012-10-167-42/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing parameters from caller to subtitle renderer was done by temporarily setting certain members in the osd_state struct (which for all practical purposes are as good as global variables). This was the only purpose of these members. Rather than using such a messy way to pass parameter, put these into a struct sub_render_params. The struct was already introduced in earlier commits, and this commit just removes the parameter passing hack.
| * | | sub: always go through sub.c for OSD renderingwm42012-10-163-10/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, vf_vo.c and vf_ass.c were manually calling the subtitle decoder to retrieve images to render. In particular, this circumvented the sub-bitmap conversion & caching layer in sub.c. Change this so that subtitle decoding isn't special anymore, and draws all subtitles with the normal OSD drawing API. This is also a step towards removing the need for vf_ass auto-insertion. In fact, if auto-insertion would be disabled now, VOs with "old" OSD rendering could still render ASS subtitles in monochrome, because there is still ASS -> old-OSD bitmap conversion in the sub.c mechanism. The code is written with the assumption that the subtitle rendering filter (vf_ass) can render all subtitle formats. Since vf_ass knows the ASS format only, rendering image subs (i.e. RGBA subs) with it simply fails. This means that with vo_xv (vf_ass auto-inserted), image subs wouldn't be rendered. Use a dumb hack to disable rendering subs with a filter, if we detect that the subs are not in ASS format. (Trying to render the subs first would probably result in purging the conversion cache on every frame.)
| * | | sub, VO: remove vo_osd_resized() functionwm42012-10-162-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VOs which could render the OSD in window size (as opposed to video size, like vo_xv) and which could cache the OSD called this when the window size changed. This was needed, because VOs used another OSD function to check whether the OSD changed before passing the new window size to the OSD code. This was really just an artifact of OSD change detection, and now that the affected VOs use the new OSD rendering API, it's done automatically.
| * | | sub: remove logic for disabling hinting on scaled EOSDwm42012-10-164-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was an extremely obscure setting, as it was used only with vo_gl if its scaled-osd suboption was used. If you really want this, you can set the desired ass-hinting value directly, and there will be literally no loss in functionality. Note that this didn't actually test whether the EOSD was scaled. Basically, it only checked whether vo_gl had the scaled-osd suboption set.
| * | | sub: make it easier to set DVD sub decoding with sd_lavcwm42012-10-162-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this commit, the player will still use spudec.c (the "old" DVD sub decoder), rather than ffmpeg. But it brings the changes needed to enable this down to a single line change: --- a/mplayer.c +++ b/mplayer.c @@ -1988,7 +1988,7 @@ static void reinit_subs(struct MPContext *mpctx) #endif vo_osd_changed(OSDTYPE_SUBTITLE); } else if (track->stream) { - if (mpctx->sh_sub->type == 'v') + if (mpctx->sh_sub->type == 'v' && false) init_vo_spudec(mpctx); else sub_init(mpctx->sh_sub, mpctx->osd); Also, copy the DVD resolution heuristics from spudec.c (from the spudec_new_scaled() function). I'm not sure if this is correct or even needed, but the sd_lavc codd explicitly reverted back to spudec with code carrying this comment: // Assume resolution heuristics only work for PGS and DVB so it seems likely that the required heuristics were missing, and that the spudec heuristics may make the DVD compatibility situation at least as good as with spudec. Note that it's unlikely that we enable sd_lavc for DVD subs by default, as there are other problems in combination with direct DVD playback.
| * | | osd_libass: set RTL base direction to neutralwm42012-10-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are using libass for OSD rendering. One problem with that is that libass has to be bug-compatible to VSFilter. This includes the setting for the default RTL base direction. Neutral would be most reasonable, but VSFilter assumes LTR. This commit forces the default to neutral. Unconfirmed whether this actually works as intended. See the following libass commits: 9dbd12d shaper: allow font encoding -1 for neutral base direction a80c45c shaper: always use LTR base direction by default
| * | | sub: cleanup: remove vo_osd_probar_type/value global variableswm42012-10-163-12/+9
| | | |
| * | | sub: cosmetics: turn some defines into enumswm42012-10-162-28/+34
| | | |
| * | | sub: allow converting DVD subs to RGBAwm42012-10-164-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mplayer DVD sub decoder is the only remaining OSD image producer that still requires the old mplayer OSD format (SUBBITMAP_OLD_PLANAR). To make supporting this format optional in VOs, add a step that allows converting these images to RGBA in case the VO doesn't have direct support for it. Note: the mplayer DVD sub decoder uses the old mplayer OSD format (SUBBITMAP_OLD_PLANAR), which is assumed to use premultiplied alpha. However, it seems DVDs allow only binary transparency, so the rendered result will be the same.
| * | | sub: allow rendering OSD in ASS image format directly, simplifywm42012-10-1612-522/+593
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the OSD was drawn using libass, but the resulting bitmaps were converted to the internal mplayer OSD format. We want to get rid of the old OSD format, because it's monochrome, and can't even be rendered directly using modern video output methods (like with OpenGL/Direct3D/VDPAU). Change it so that VOs can get the ASS images directly, without additional conversions. (This also has the consequence that the OSD can render colors now.) Currently, this is vo_gl3 only. The other VOs still use the old method. Also, the old OSD format is still used for all VOs with DVD subtitles (spudec). Rewrite sub.c. Remove all the awkward flags and bounding boxes and change detection things. It turns out that much of that isn't needed. Move code related to converting subtitle images to img_convert.c. (It has to be noted that all of these conversions were already done before in some places, and that the new code actually makes less use of them.)
| * | | sub: add preliminary emulation layer to draw OSD with EOSDwm42012-10-162-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This basically pushes the old OSD bitmaps via VOCTRL_DRAW_EOSD to the VO, instead of using the old callback-based interface. Future commits will change the code such that sub.c pushes images rendered by libass directly, rather than converting them to the old OSD format first.
| * | | sub: create sub_bitmap array even when using libasswm42012-10-164-18/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One sub_bitmaps struct could contain either a libass ASS_Image list, or a mplayer native list of sub-bitmaps. This caused code duplication in vo_vdpau.c and bitmap_packer.c. Avoid this by creating such a sub_bitmap array even with libass. This basically copies the list and recreates it in mplayer's native format. It gets rid of the code duplication, and will make implementing extended subtitle and OSD rendering in other VOs easier. Also do some cosmetic changes and other preparations for the following commits.
* | | | subreader: do not write outside array boundsreimar2012-10-311-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Extra checks to ensure we really do not write outside array bounds. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35313 b3059339-0415-0410-9bf9-f77b7e298cf2
* | | | spudec: set pointers to NULL after freereimar2012-10-311-0/+2
| |_|/ |/| | | | | | | | | | | | | | | | | | | | Set pointers to NULL after free. For the pal_image one it would have been possible to leak the old pointer of the malloc for "image" failed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35303 b3059339-0415-0410-9bf9-f77b7e298cf2
* | | osd_libass: increase robustness when handling internal OSD escapeswm42012-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The \xFF escape is used internally to insert special OSD symbols (which need a font change to the internal OSD font). There was potential for breakage when \xFF was followed by \0, because then "in" would be advanced past the string's end. Normally this can't happen, as it would require invalid UTF-8 input data. But we don't check input for UTF-8 validness, so there's a potential issue here. Garbled output is ok on invalid UTF-8 input, but crashing is not. Make it more robust by checking for this.
* | | osd_libass: fix stupid dangling pointer crashwm42012-10-221-1/+1
| |/ |/| | | | | | | | | | | | | | | | | append_utf8_buffer() reallocates the buffer passed to it, and returns the new pointer. This bug was originally introduced in mplayer2 when that project merged mpv's osd_libass.c. That merge changed some minor things, including ASS escape handling. When mpv used this better method of escape handling too (commit 0ff7dd992fb0), the bug was duplicated.
* | osd_libass: fix \n escapeswm42012-10-141-8/+3
| | | | | | | | | | | | | | | | | | Apparently libass can't be made to not interpret "\n" as escape. That means "\n" can't be printed literally. Use the same hack that was added to mplayer2 when that project merged osd_libass.c: add an invisible zero-width joiner character between "\" and "n". It seems U+FEFF is deprecated, because it has been redefined as BOM mark. Use U+2060, which seems to be the replacement.
* | sub: add --ass-style-override option to disable style overrideswm42012-10-122-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a number of options which modify ASS subtitle rendering. Most of these do things that can interfere with the styling done by subtitle scripts, resulting in incorrect rendering. Add the --ass-style-override option to make it easy to disable all overrides. This helps trouble- shooting, and makes it more practical to use the override features. (You can simply toggle the ass-style-override property at runtime, should one of the style override options break subtitle rendering at a certain point.) This mainly affects whether most --ass-* options are applied, as well as --sub-pos. Some things, like explicit style overrides loaded with --ass-force-style, can't be changed at runtime using the ass-style-override property.
* | sub: enable sub-pos with libasswm42012-10-122-1/+6
|/ | | | | | | | | | The --sub-pos option and sub-pos property control the vertical position of a subtitle. Also change how sub-pos is handled in the old subtitle renderer (used with -no-ass). The new behavior doesn't render subtitles out of the screen if the subtitle is located near the top screen border and has too many lines.
* subs, vo_vdpau: support RGBA color for PGS subtitlesUoti Urpala2012-09-185-12/+143
| | | | | | | | | | | | | | | | | | | | | | Support passing bitmap subtitles to VOs in full RGBA color, and implement this for libavcodec-decoded subtitle formats on decoding side and vo_vdpau on display side. Currently this is enabled for PGS (blu-ray) and DVB subtitles. VDPAU seems to have sampling issues similar to known GL ones when drawing a sub-rectangle from a larger texture with scaling, where adjacent pixels outside the specified source rectangle affect the result. As the bitmap subtitles may be scaled, add padding support to the bitmap packer code. In principle, this could be used for colored DVD subtitles too. However, the libavcodec DVD decoder lacks parts of the resolution and palette handling that are present in spudec.c. Conflicts: libvo/vo_gl.c sub/dec_sub.h sub/sd_lavc.c
* options: remove -subalignwm42012-09-182-2/+0
| | | | | | It can't be re-implemented, because this isn't supported by libass. The -subalign option and the associated sub-align slave property did nothing. Remove them.
* subs: restore support for sub_step command with libasswm42012-09-182-0/+14
| | | | | | This was destroyed by Uoti Urpala in commit "subs: always use sub...". Features should be either kept working or completely removed, but not just crippled, which only inflates the code and frustrates users.
* subs, vo: do sub bitmap change detection by comparing IDsUoti Urpala2012-09-184-9/+22
| | | | | | | | | | | | | | | | | vo_vdpau and vo_gl cache the last subtitle bitmaps uploaded to video card in case they stay the same over multiple frames. Detecting whether the bitmaps have changed and should be re-uploaded was somewhat fragile. Change the VO API to provide a bitmap ID which can be compared with what the VO has to determine whether a new upload of the bitmaps is needed. Conflicts: libvo/vo_gl.c Note: the changes for vo_gl.c were not merged. Instead, eosd_packer is modified to use the new way of detecting EOSD changes. This takes care of vo_gl, vo_gl3 and vo_direct3d, which all render EOSD. They don't need to be updated in turn.
* subs: always use sub decoder framework for libass renderingUoti Urpala2012-09-188-27/+98