summaryrefslogtreecommitdiffstats
path: root/sub
Commit message (Collapse)AuthorAgeFilesLines
* osd: fix OSD bar position markerwm42013-04-021-0/+10
|
* osd: disable border for inner part of the OSD barwm42013-03-311-1/+1
|
* osd: draw the OSD bar with ASS vector drawingswm42013-03-302-67/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | Drawing the bar with vector drawings (instead with characters from the OSD font) offers more flexibility and looks better. This also adds chapter marks to the OSD bar, which are visible as small triangles on the top and bottom inner border of the bar. Change the default position of the OSD bar below the center of the screen. This is less annoying than putting the bar directly into the center of the view, where it obscures the video. The new position is not quite on the bottom of the screen to avoid collisions with subtitles. The old centered position can be forced with ``--osd-bar-align-y=0``. Also make it possible to change the OSD bar width/height with the new --osd-bar-w and --osd-bar-h options. It's possible that the new OSD bar renders much slower than the old one. There are two reasons for this: 1. the character based bar allowed libass to cache each character, while the vector drawing forces it to redraw every time the bar position changes. 2., the bar position is updated at a much higher granularity (the bar position is passed along as float instead of as integer in the range 0-100, so the bar will be updated on every single video frame).
* sub: don't crash on GBRP videowm42013-03-281-2/+4
| | | | | mp_get_yuv2rgb_coeffs() will crash if the colorspace is explicitly set to RGB.
* 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.
* Prefix CODEC_ID_ with AV_wm42013-03-131-5/+5
| | | | | | | | | The old names have been deprecated a while ago, but were needed for supporting older ffmpeg/libav versions. The deprecated identifiers have been removed from recent Libav and FFmpeg git. This change breaks compatibility with Libav 0.8.x and equivalent FFmpeg releases.
* Fix missing ctype.h includeswm42013-03-042-0/+2
| | | | | libavutil/common.h stopped including ctype.h, and some source files were relying on recursive inclusion of this header.
* vo: remove and cleanup globalsAlexander Preisinger2013-03-041-1/+1
| | | | | | | | Removes almost every global variabel in vo.h and puts them in a special struct in MPOpts for video output related options. Also we completly remove the options/globals pts and refresh rate because they were unused.
* fix clang compiler warningsStefano Pigozzi2013-03-031-1/+1
|
* m_option: don't define OPT_BASE_STRUCT by defaultwm42013-03-011-1/+0
| | | | | | | | | | | OPT_BASE_STRUCT defines which struct the OPT_ macros (like OPT_INT etc.) reference implicitly, since these macros take struct member names but no struct type. Normally, only cfg-mplayer.h should need this, and other places shouldn't be bothered with having to #undef it. (Some files, like demux_lavf.c, still store their options in MPOpts. In the long term, this should be removed, and handled like e.g. with VO suboptions instead.)
* vo_caca: remove OSD supportwm42013-02-242-22/+0
| | | | | | Recent changes to the OSD code made vo_caca crash when showing OSD. Since this is a joke VO (== I'd rather not waste my time with it), remove the OSD support. It wasn't that great anyway.
* cleanup: remove duplicated function, move escape parsing functionwm42013-02-161-18/+11
|
* osd: always update already visible OSD bar on seekswm42013-02-161-2/+4
| | | | | | | | | Seeks can be performed with OSD bar invisible (e.g. "osd-msg seek ..." command), and then an already visible bar won't be updated. But the bar will stick around until the OSD text is hidden. This is confusing, so change it that the bar is updated. (Making the bar disappear on such seeks would require much more changes, so we're lazy and go with this commit.)
* osd: add --osd-bar-align-x/y options to control OSD bar positionwm42013-02-141-2/+19
|
* Check return values of some mp_find_..._config_file function calls for NULLwm42013-02-091-2/+3
|
* sub: add experimental --force-rgba-osd-rendering switchwm42013-01-131-1/+6
|
* draw_bmp: use multiple bounding boxeswm42013-01-131-27/+20
| | | | | Seems to make it about up to 20% faster in some cases. Slightly slower in some others.
* img_convert: use multiple bounding boxes for ASS->RGBAwm42013-01-131-26/+47
| | | | | | Should be more efficient in situations both subtitles and toptitles are shown, because no blending has to be performed for the video between them.
* img_convert: add sub_bitmap bounding box functionswm42013-01-135-25/+97
| | | | mp_sub_bitmaps_bb is just sub_bitmaps_bb renamed/moved.
* draw_bmp: don't copy Y plane on up/down-samplingwm42013-01-131-5/+46
| | | | | | | | | | | Image areas with subtitles are upsampled to 4:4:4 in order to render the subtitles (makes blending easier). Try not to copy the Y plane on upsampling. The libswscale API requires this, but this commit works it around by scaling the chroma planes separately as AV_PIX_FMT_GRAY8. The Y plane is not touched at all. This is done for 420p8 only, which is the most commonly needed case. For other formats, the old way is used. Seems to make ASS rendering faster about 15% in the setup I tested.
* draw_bmp: do not reallocate upsample temp image on each framewm42013-01-131-2/+14
| | | | Doesn't seem to help too much...
* draw_bmp: refactorwm42013-01-131-17/+31
|
* draw_bmp: always allocate cachewm42013-01-131-26/+25
| | | | | | Allocate it even if it's needed. The actually done work is almost the same, except that the code is a bit simpler. May need more memory at once for RGB subs that use more than one part, which is rare.
* mp_image: add mp_image_crop()wm42013-01-131-12/+2
| | | | Actually stolen from draw_bmp.c.
* vo_xv, vo_x11: simplify OSD redrawingwm42013-01-134-149/+1
| | | | | | | | | | | | | In order to support OSD redrawing for vo_xv and vo_x11, draw_bmp.c included an awkward "backup" mechanism to copy and restore image regions that have been changed by OSD/subtitles. Replace this by a much simpler mechanism: keep a reference to the original image, and use that to restore the Xv/X framebuffers. In the worst case, this may increase cache pressure and memory usage, even if no OSD or subtitles are rendered. In practice, it seems to be always faster.
* sub: do not copy the target image if there is no OSD/subswm42013-01-132-0/+26
| | | | | | | | | | | | | | | | | | | | | It's not easy to tell whether the OSD/subs are empty, or if something is drawn. In general you have to use osd_draw() with a custom callback. If nothing is visible, the callback is never invoked. (The actual reason why this is so "hard" is the implementation of osd_libass.c, which doesn't allow separating rendering and drawing of OSD elements, because all OSD elements share the same ASS_Renderer.) To simplify avoiding copies, make osd_draw_on_image() instead of the caller use mp_image_make_writeable(). Introduce osd_draw_on_image_p(), which works like osd_draw_on_image(), but gets the new image allocation from an image pool. This is supposed to be an optimization, because it reduces the frequency of large allocations/deallocations for image data. The result of this is that the frequency of copies needed in conjunction with vf_sub, screenshots, and vo_lavc (encoding) should be reduced. vf_sub now always does true pass-through if no subs are shown. Drop the pts check from vf_sub. This didn't make much sense.
* draw_bmp: better way to find 444 formatwm42013-01-131-43/+13
| | | | | | | | | | | | | Even though #ifdef ACCURATE is removed, the result should be about the same. The fallback is only used by packed YUV formats (YUYV, NV12), and doing 16 bit for them instead of 8 bit is not useful. A side effect is that Y8 (gray) is not converted drawing subs, and for alpha formats, the alpha plane is not removed. This means the number of planes after upsampling can be 1-4 (1: gray, 2: gray+alpha, 3: planar, 4: planar+alpha). The code has to be adjusted accordingly to work on the color planes only. Also remove the workaround for the chroma shift 31 hack.
* video: cleanup: replace old mp_image function nameswm42013-01-132-9/+9
| | | | | mp_image_alloc() also changes argument order compared to alloc_mpi(). The format now comes first, then width/height.
* mp_image: simplify image allocationwm42013-01-131-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | mp_image_alloc_planes() allocated images with minimal stride, even if the resulting stride was unaligned. It was the responsibility of vf_get_image() to set an image's width to something larger than required to get an aligned stride, and then crop it. Always allocate with aligned strides instead. Get rid of IMGFMT_IF09 special handling. This format is not used anymore. (IF09 has 4x4 chroma sub-sampling, and that is what it was mainly used for - this is still supported.) Get rid of swapped chroma plane allocation. This is not used anywhere, and VOs like vo_xv, vo_direct3d and vo_sdl do their own swapping. Always round chroma width/height up instead of down. Consider 4:2:0 and an uneven image size. For luma, the size was left uneven, and the chroma size was rounded down. This doesn't make sense, because chroma would be missing for the bottom/right border. Remove mp_image_new_empty() and mp_image_alloc_planes(), they were not used anymore, except in draw_bmp.c. (It's still allowed to setup mp_images manually, you just can't allocate image data with them anymore - this is also done in draw_bmp.c.)
* mp_image: require using mp_image_set_size() for setting w/hwm42013-01-131-5/+1
| | | | | | | | | | | | | | Setting the size of a mp_image must be done with mp_image_set_size() now. Do this to guarantee that the redundant fields (like chroma_width) are updated consistently. Replacing the redundant fields by function calls would probably be better, but there are too many uses of them, and is a bit less convenient. Most code actually called mp_image_setfmt(), which did this as well. This commit just makes things a bit more explicit. Warning: the video filter chain still sets up mp_images manually, and vf_get_image() is not updated.
* cleanup: ass_mp.h: remove dummy declarationswm42013-01-061-15/+1
|
* sub: add --sub-text-* options to unstyled text subtitles fontwm42013-01-052-2/+2
| | | | | | | 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.
* sub: add ASS to RGBA conversionwm42012-12-284-2/+83
| | | | | This makes implementing new VOs easier, because they don't have to support the ASS format.
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-152-14/+9
| | | | | | | | | | | | | | Add `mp_find_config_file` to search different known paths and use that in ass_mp to look for the fontconfig configuration file. Some incidental changes spawned by this feature where: * Buffer allocation for the strings containing the paths is now performed with talloc. All of the allocations are done on a NULL context, but it still improves readability of the code. * Move the OSX function for lookup inside of a bundle: this code path was currently not used by the bundle generated with `make osxbundle`. The plan is to use it again in a future commit to get a fontconfig config file.
* ass_mp: allow to use a custom fontconfig configuration fileStefano Pigozzi2012-12-151-9/+14
| | | | | | This allows to use a fontconfig fonts.conf that is customized for mpv. The configuration file is assumed to be located at `~/.mpv/fonts.conf`. If not found the default fcontconfig config file is used.
* sd_ass: free external subtitle trackswm42012-12-141-0/+6
|
* sd_lavc: keep subs on subtitle track switchingwm42012-12-121-1/+7
| | | | | | | | | | | | | Keep the currently displayed subtitles even when the user cycles through subtitle tracks, and the subtitle is decoded by libavcodec (such as vobsubs). Do this by not clearing the subtitles on reset(). reset() is also called on seek, so check the start PTS whether the subtitle should really be displayed (there's already an end PTS). Note that sd_ass does essentially something similar. The existing code has checks for whether the PTS reported by the demuxer is invalid (MP_NOPTS_VALUE). I don't know under what circumstances this can happens, so fall back to the old behavior if the PTS is invalid.
* configure: remove --disable-sortsubwm42012-12-111-46/+4
| | | | | Apparently this was for debugging. There was a patch to remove it years ago, but it has been forgotten.
* sub: remove vobsub reader in favor of ffmpeg vobsub demuxerwm42012-12-115-1076/+29
| | | | | | | | ffmpeg recently added a demuxer that can read vobsubs (pairs of .sub and .idx files). Get rid of the internal vobsub reader, and use the ffmpeg demuxer instead. Sneak in an unrelated manpage change (autosub default).
* sub: clear libavformat demuxed subtitles on seekingwm42012-12-031-0/+6
| | | | | | libavformat demuxes ass subtitles in a broken way, that forces the player to throw away all subtitle events received so far. See mplayer svn commit 31293.
* subreader: fix some of ASS parser issuesUoti Urpala2012-12-031-45/+22
| | | | | | | | | | | | | | | | | | The subreader.c ASS parser (used when playing an external ASS subtitle file with --no-ass for "plaintext" display) hardcodes dialogue line syntax instead of correctly reading it from the "Format: " line in the file, but tried to support a varying amount of fields by guessing where the text field (which should be last) begins. This guessing code was buggy in many ways. Remove it and hardcode skipping 9 commas before the text field, which should work for most files. I don't consider the --no-ass case important enough to implement correct parsing now. Also fix the code removing formatting tags, which failed to remove the second in a pair of two consecutive tags. Conflicts: sub/subreader.c Merged from mplayer2 commit 91f516. Essentially reverts d5b964.
* subs: remove --utf8, simplify codeUoti Urpala2012-12-033-22/+5
| | | | | | | | | | | | | | | | | | | Remove the options --utf8 and --unicode which had no effect any more (what they once did should be doable with --subcp). The only use of corresponding variables left in code was subreader.c code using sub_utf8 as a flag indicating whether iconv conversion was active. Change the code to test the existence of iconv context instead. Conflicts: DOCS/man/en/options.rst core/cfg-mplayer.h sub/sub.c sub/sub.h sub/subreader.c Merged from mplayer2 commit ea7311. Note: --unicode was already removed
* video: add support for 12 and 14 bit YUV pixel formatsStephen Hutchinson2012-12-031-0/+8
| | | | | | | | | | | | Based on a patch by qyot27. Add the missing parts in mp_get_chroma_shift(), which allow allocation of such images, and which make vo_opengl automatically accept the new formats. Change the IMGFMT_IS_YUVP16_LE/BE macros to properly report IMGFMT_444P14 as supported: this pixel format has the highest numerical bit width identifier (0x55), which is not covered by the mask ~0xfc. Remove 1 bit from the mask (makes it 0xf8) so that IMGFMT_IS_YUVP16(IMGFMT_444P14) is 1. This is slightly risky, as the organization of the image format IDs (actually FourCCs + mplayer internal IDs) is messy at best, but it should be ok.
* subassconverter: correctly handle RRGGBB and unknow formatsStefano Pigozzi2012-11-251-22/+31
| | | | | | | The following HEX formats are now parsed correctly: `#RRGGBB`, `RRGGBB`. Moreover this implementation doesn't show the HTML on screen if the input color is not recognized. A warning is still displayed in the terminal.
* sub: add --sub-gray option to display image subs in grayscalewm42012-11-253-2/+42
| | | | | | | | | | MPlayer/mplayer2 still show DVD subtitles in gray. Depending on who you ask, this can be considered a bug or a feature. Include rendering in gray as explicit feature, so the user can decide what is better. This affects all indexed sub bitmaps entering the OSD rendering path. Currently, this means all image subs are affected by this option, but nothing else.
* sub: reimplement -spugauss as --sub-gausswm42012-11-253-0/+49
| | | | | | | | | | | | | | | | Apparently the -spugauss option was popular. The code originally implementing this is gone (scaler stuff in spudec.c). Reimplement it using libswscale to scale and blur image subtitles if the --sub-gauss option is set. The code does some rather lazy padding to allow the blur to spread pixels past the original image bounding box. (This problem exists with normal bilinear scaling too, but is barely noticable.) Technically, this doesn't just blur subtitles, but anything RGBA (or indexed) that enters the OSD rendering path. But only image subtitles produce these OSD formats currently, so no explicit check is done to prevent blurring in other cases.
* osd: fix z-order of subtitle OSD elementswm42012-11-221-2/+3
| | | | Subs should always be below OSD (meaning they have to be drawn first).
* draw_bmp: add RGB rendering to fix image quality issueswm42012-11-221-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out in commit ed01df, the quality loss due to frequent conversion between RGB and YUV is too much when drawing OSD and subtitles. Fix this by staying in the same colorspace when drawing subtitles. Render directly to RGB, without converting to YUV first. The bad thing about packed RGB is that there are many pixel formats, which would all require special code for blending. It's also completely incompatible to planar YUV. Use planar RGB instead, which allows us to reuse all code originally written for planar YUV. The only thing that needs to be changed is the color conversion in the libass case. (In exchange for simpler code, the image has to be copied, but this is still much better than converting to YUV.) Unfortunately, libswscale doesn't support planar RGB output. Add a hack to sws_utils.c to handle conversion to planar RGB. In the common case, when converting 32 bit per pixel RGB, calling swscale can be avoided entirely. The change in mp_image.c is needed to allocate GBRP images correctly. (The issue with vo_x11 could be easily solved by always backing up the same bounding box as the bitmap drawing RGB<->YUV conversion does, but this commit is probably the better fix.)
* subreader: do not skip the first char of ASS fields.cigaes2012-11-211-1/+1
| | | | | | | | | | | | Without this change, fields that can be sometimes empty and sometimes not, such as the Effect field, are counted in an inconsistent way. Since the number of fields is used to find where the text starts, it leads to internal field arriving on the video. Bug reported anonymously on the users mailing list. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35426 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_xv: don't require frame stepping to remove OSD or subswm42012-11-214-0/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to improve performance, vo_xv didn't create a backup of the video frame before drawing OSD and subtitles during normal playback. It required the frontend to do frame stepping if it wanted to redraw the OSD, but no backup of the video frame was available. (Consider the following use case: enable the OSD permanently with --osd-level=3, then pause during playback and do something that shows an OSD message. The player will advance the video by one frame at the time the new OSD message is first drawn.) This also meant that taking a screenshot during playback with vo_xv would include OSD and subtitles in the resulting image. Fix this by always creating a backup before drawing OSD or subtitles. In order to avoid having to create a full copy of the whole image frame, introduce a complex scheme that tries to backup only the changed regions. It's unclear whether the additional complexity in draw_bmp.c for backing up only the changed areas of the frame is worth it. Possibly a simpler implementation would suffice, such as tracking only Y ranges of changed image data, or even just copying the full frame. vo_xv's get_screenshot() now always creates a copy in order not to modify the currently displayed frame.
* osd: make the OSD and sub font more customizablewm42012-11-205-69/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make more aspects of the OSD font customizable. This also affects the font used for unstyled subtitles (such as SRT), or when using the --no-ass option. This adds back some customizability that was lost with commit 74e7a1 (osd: use libass for OSD rendering). Removed options: --ass-border-color --ass-color --font --subfont --subfont-text-scale Added options: --osd-color --osd-border --osd-back-color --osd-shadow-color --osd-font --osd-font-size --osd-border-size --osd-margin-x --osd-margin-y --osd-shadow-offset --osd-spacing --sub-scale The font size is now specified in pixels as it would be rendered on a window with a height of 720 pixels. OSD and subtitles are always scaled with the window height, so specifying or expecting an absolute font size doesn't make sense. Such scaled pixel units are used to specify font border etc. as well. (Note: the font size is directly passed to libass. How the fonts are actually rasterized is outside of our control, but in theory ASS font sizes map to "script" pixels and then are scaled to screen size.) The default settings should be about the same, with slight difference due to rounding to the new scales. The OSD and subtitle fonts are not separately configurable. It has limited use and would double the number of newly added options, which would be more confusing than helpful. It could be easily added later, should the need arise. Other small details that change: - ASS_Style.Encoding is not set to -1 for subs anymore (assuming subs use VSFilter direction in -no-ass mode too) - use a different WrapStyle for OSD - ASS forced styles are not applied to OSD
* Fix potential bugs and issues, general cleanupsreimar2012-11-203-13/+8
| | | | | | | | | | |