summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_vo.c
Commit message (Collapse)AuthorAgeFilesLines
* core: do not try to redraw OSD if VO doesn't support OSDwm42012-10-241-5/+4
| | | | | | | | | | | | This fixes awkward framestepping when seeking with -vo null while paused (caused because seeking by default draws an OSD bar, and mplayer trying to redraw the OSD in that case; this logic is actually needed with vo_xv). It would have been simpler to just check vo->driver->draw_osd (and leave that callback to NULL for VOs which don't support OSD), but for now try to retain the capability to let VOs decide based on the image format whether to support OSD or not.
* VO, sub: refactorwm42012-10-241-5/+0
| | | | | | | | | | | | | | | | | | Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD, VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT. Remove draw_osd_with_eosd(), which rendered the OSD by calling VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes a callback as argument. (This basically works like the old OSD API, except multiple OSD bitmap formats are supported and caching is possible.) Remove all mentions of "eosd". It's simply "osd" now. Make OSD size per-OSD-object, as they can be different when using vf_sub. Include display_par/video_par in resolution change detection. Fix the issue with margin borders in vo_corevideo.
* sub: always go through sub.c for OSD renderingwm42012-10-161-16/+0
| | | | | | | | | | | | | | | | | | | | | | | 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: remove logic for disabling hinting on scaled EOSDwm42012-10-161-1/+0
| | | | | | | | | | | 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.
* subs, vo_vdpau: support RGBA color for PGS subtitlesUoti Urpala2012-09-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* subs, vo: do sub bitmap change detection by comparing IDsUoti Urpala2012-09-181-15/+1
| | | | | | | | | | | | | | | | | 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-181-23/+11
| | | | | | | | | | | | | | | | | | | | | Remove subtitle selection code setting osd->ass_track directly and vf_ass/vf_vo code rendering the track directly with libass. Instead, do track selection and rendering with dec_sub.c functions. Before, mpctx->set_of_ass_tracks[] contained bare libass tracks generated from external subtitle files. For use with dec_sub.c, it now contains struct sh_sub instances with decoder already initialized. This commit breaks the sub_step command ('g' and 'y' keys) for libass-rendered subtitles. It could be fixed, but it's so useless - especially as with the existing implementation there's no practical way to get subtitle delay back to normal after using it - that I didn't bother. Conflicts: command.c mp_core.h mplayer.c
* subs: libass: use a single persistent renderer for subtitlesUoti Urpala2012-09-181-43/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To draw libass subtitles, the code used ASS_Renderer objects created in vf_vo (VO rendering) or vf_ass. They were destroyed and recreated together with the video filter chain. Change the code to use a single persistent renderer instance stored in the main osd_state struct. Because libass seems to misbehave if fonts are changed while a renderer exists (even if ass_set_fonts() is called on the renderer afterwards), the renderer is recreated after adding embedded fonts. The known benefits are simpler code and avoiding delays when switching between timeline parts from different files (libass fontconfig initialization, needed when creating a new renderer, can take a long time in some cases; switching between files rebuilds the video filter chain, and this required recreating the renderers). On the other hand, I'm not sure whether this could cause inefficient bitmap caching in libass; explicitly resetting the renderer in some cases could be beneficial. The new code does not keep the distinction of separate renderers for vsfilter munged aspect vs normal; this means that changing subtitle tracks can lose cache for the previous track. The new code always sets some libass parameters on each rendering call, which were previously only set if they had potentially changed. This should be harmless as libass itself has checks to see if the values differ from previous ones. Conflicts: command.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c mplayer.c sub/ass_mp.c
* VO: remove old VO gluewm42012-08-071-2/+1
| | | | | | | This transition to a new VO API started over 4 years ago. It's time to finally end it, and get rid of the horrible hacks. Also removes some previously undetected dead code from spudec.c.
* VO: remove VO direct renderingwm42012-08-021-1/+1
| | | | | | | | | | | | | | | | | | | This was disabled by default, and could be enabled with -dr. It was disabled by default because it was buggy: there were issues with OSD corruption. It wasn't entirely sane for OpenGL based VOs either. OpenGL can chose to drop mapped pixel buffer objects, requiring the application to map and fill the buffer again. But there was no mechanism in mplayer to fill the lost buffer again. (It seems this rarely happened in practice, though.) On the other side, users liked the --dr flag, because it promised them more speed. I'm not sure if it actually helped with speed, but it's unlikely it had any real advantages on modern systems. In order to evade the --dr cargo culting in mplayer config files, it's best to get rid of it.
* osd: use libass for OSD renderingwm42012-07-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OSD will now be rendered with libass. The old rendering code, which used freetype/fontconfig and did text layout manually, is disabled. To re-enable the old code, use the --disable-libass-osd configure switch. Some switches do nothing with the new code enabled, such as -subalign, -sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that the code for rendering unstyled subtitles with libass doesn't make any attempts to support them. Some of them could be supported in theory.) Teletext rendering is not implemented in the new OSD rendering code. I don't have any teletext sources for testing, and since teletext is being phased out world-wide, the need for this is questionable. Note that rendering is extremely inefficient, mostly because the libass output is blended with the extremely strange mplayer OSD format. This could be improved at a later point. Remove most OSD rendering from vo_aa.c, because that was extremely hacky, can't be made work with osd_libass, and didn't work anyway in my tests. Internally, some cleanup is done. Subtitle and OSD related variable declarations were literally all over the place. Move them to sub.h and sub.c, which were hoarding most of these declarations already. Make the player core in mplayer.c free of concerns like bitmap font loading. The old OSD rendering code has been moved to osd_ft.c. The font_load.c and font_load_ft.c are only needed and compiled if the old OSD rendering code is configured.
* Merge remote-tracking branch 'origin/master'wm42012-04-011-98/+104
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bstr.c bstr.h etc/input.conf input/input.c input/input.h libao2/ao_pulse.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/gl_common.c libvo/x11_common.c mixer.c mixer.h mplayer.c
| * cosmetics: vf_vo.c: reformatUoti Urpala2012-03-251-102/+107
| |
* | mpcodecs: remove mp_image_t.x/ywm42012-02-241-1/+1
| | | | | | | | These were never used.
* | subtitles: create only one instance of ASS_Render instead of twowm42012-01-181-26/+11
|/ | | | | | This simplifies the code. It also can make loading of mkv files faster, as initializing two ASS_Render instances required scanning mkv font attachments twice.
* vo: reset EOSD change detection when VO is re-configuredwm42011-12-121-0/+3
| | | | | | | | | | | | | | | This fixes a crash with vo_gl when the switch_ratio slave command is used while a displaying an animated subtitle. switch_ratio will cause a config() call to vo_gl, which will reset all state, including the EOSD state. Next time the EOSD is rendered, its change detection will indicate that only subtitle positions have changed. The render code will attempt to access the EOSD data structures which have been deleted with config(). Fix this by forcing the change detection to indicate a full change if config() has been called. This only happens when doing switch_ratio with vo_gl, and the current subtitle is only changing positions, i.e. mp_eosd_images_t.changed == 1.
* Merge remote-tracking branch 'wm4/window_title'Uoti Urpala2011-12-071-1/+1
|\
| * libvo: remove title argument from struct vo_driver.configwm42011-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | This affects only the "new" VO API. The config() title argument was barely used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa GUI backends, which are the only ones properly supporting window titles, ignored this argument. Remove the title argument. Add the vo_get_window_title function. All GUI VOs are supposed to use it for the window title.
* | core, vo: modify OSD redraw architecture, support EOSDUoti Urpala2011-12-061-5/+2
|/ | | | | | | | | | | | | | | | Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over the current frame. Change this to VFCTRL_REDRAW_FRAME followed by normal EOSD and OSD drawing calls, then vo_flip_page(). The new version supports changing EOSD contents for libass-rendered subtitles and simplifies the redraw support code needed per VO. vo_xv doesn't support EOSD changes because it relies on vf_ass to render EOSD contents earlier in the filter chain. vo_xv logic is additionally simplified because the previous commit removed the need to track the status of current and next images separately (now each frame is guaranteed to become "visible" soon after we receive it as "next", with no VO code running in the interval between).
* options: move libass-related options to structUoti Urpala2011-09-031-2/+2
|
* options, subs: add --ass-vsfilter-aspect-compatharklu2011-08-121-1/+2
| | | | | | | | | Add option --ass-vsfilter-aspect-compat and corresponding property ass_vsfilter_aspect_compat. The setting controls whether to enable the emulation of traditional VSFilter behavior where subtitles are stretched if the video is anamorphic (previously always enabled for native SSA/ASS subtitles). Enabled by default. Add 'V' as a new default keybinding to toggle the property.
* subs: libass: apply option changes to all track typesUoti Urpala2011-08-081-2/+6
| | | | | | | | | Libass rendering uses two renderer objects to support both VSFilter aspect ratio (mis)behavior emulation and correct rendering. When option values were changed during playback the changes were applied to the renderer used for the currently active track only, and old values could be used if the user then switched to a track using the other renderer object. Fix to update both renderers.
* cleanup: move global ass_force_reload to struct osd_stateUoti Urpala2011-08-081-4/+4
|
* sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-2/+2
|
* cleanup: rename ass_* functions to mp_ass_*Uoti Urpala2011-01-261-7/+7
| | | | | | | | The various ass_* functions were created when libass was part of the MPlayer tree and the distinction between MPlayer-specific and other functions was less clear. Now that libass is a clearly separate library, using the same ass_* namespace for player functions is ugly. Rename the functions to use mp_ass_ prefix instead.
* subs: use correct font aspect ratio for libass + converted subsUoti Urpala2011-01-261-13/+39
| | | | | | | | | | | | | | | | | | | | | | Rendering of ASS subtitles tries to be bug compatible with VSFilter and stretches fonts when the video is anamorphic (some scripts try to compensate for this VSFilter behavior, so trying to render them "correctly" would give the wrong result). However this behavior is not appropriate for subtitles we converted to ASS format ourselves for libass rendering, as they certainly don't have VSFilter bug workarounds. Change the code to use different behavior for "native" ASS tracks and converted ones. It's questionable whether the VSFilter-compatible behavior is appropriate for external .ass files either, as there could be anamorphic and non-anamorphic versions of the same video and the bug-compatible behavior can only be correct for one alternative at most. However it's probably better to keep it as a default at least, so that extracting a muxed subtitle track and using that does not give behavior different from the original muxed one. The aspect ratio setting is per ASS_Renderer, and changing it resets libass caches. For that reason this commit adds separate renderer instances to use for the "correct" and "VSFilter bug compatible" cases.
* cleanup: some random minor code simplification and cleanupUoti Urpala2011-01-261-9/+8
|
* vf_vo: fix EOSD change detection bugUoti Urpala2011-01-181-1/+0
| | | | | | | | | | vf_vo had code setting its prev_visibility variable correctly, then a line that overrode the value just set with an incorrect one. Remove the wrong extra line. As a result of the bug the "contents changed" indicator wasn't forced to true when switching from a subtitle track to "no track" and then back. A visible effect was at least that a currently visible static subtitle disappeared when doing that switch back and forth.
* subtitles: move global ass_track to struct osd_stateUoti Urpala2011-01-151-6/+8
|
* video: simplify some tests with a new IMGFMT_IS_HWACCEL macroreimar2010-11-081-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32575 b3059339-0415-0410-9bf9-f77b7e298cf2
* cosmetics: "struct vf_instance* vf" -> "struct vf_instance *vf"Uoti Urpala2010-05-291-10/+10
| | | | | | | Change 'struct vf_instance' pointer arguments to more standard style as in the subject. Also some other minor formatting fixes. Patch by Diego Biurrun.
* Merge svn changes up to r30683Uoti Urpala2010-03-101-2/+2
|\
| * Rename open() vf initialization function to vf_open().diego2010-02-211-2/+2
| | | | | | | | | | | | | | This avoids clashes with fcntl.h under certain circumstances. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30680 b3059339-0415-0410-9bf9-f77b7e298cf2
| * libass: fix PAR correctiongreg2010-02-091-1/+2
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30530 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r30463Uoti Urpala2010-03-091-0/+18
|\| | | | | | | | | | | Note that r30455 is wrong, that commit does not in fact change the default behavior as claimed in the commit message. It only breaks "-af-adv force=0", which was already pretty much useless though.
| * Add missing license headers to all files in the libmpcodecs directory.diego2010-01-301-0/+18
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30463 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Some ugly hacks to make compiling against a newer external version of libass ↵reimar2009-12-241-0/+4
| | | | | | | | | | | | work. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30107 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Remove more direct includes of libass/ass.hreimar2009-12-241-1/+0
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30105 b3059339-0415-0410-9bf9-f77b7e298cf2
* | vf_vo: Use vo_seek_reset() instead of vo_control()Uoti Urpala2009-12-021-1/+1
| | | | | | | | | | | | | | | | | | Change the vo_control(vo, VOCTRL_RESET, NULL) call done when the vf_vo filter is uninited to vo_seek_reset(vo). The latter also sets vo->frame_loaded to false. Remove the vo->config_ok check from vo_seek_reset(). The reset call should be doable even if config failed.
* | Add yuv_colorspace property, implemented in vo_vdpau and vo_xvUoti Urpala2009-11-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a property to select YUV colorspace. Currently implemented only in vo_vdpau and vo_xv. Allows switching between BT.601, BT.709 and SMPTE-240M (vdpau only). The xv support uses the "XV_ITURBT_709" attribute. At least my NVIDIA card supports that; I don't know whether other xv implementations do. Bind the colorspace switch to the 'c' key by default. 'c' is currently used by vo_sdl for some fullscreen mode change thing, but at the moment that does not conflict and if it will in the future then vo_sdl can change. VDPAU part based on a patch from Lauri Mylläri <lauri.myllari@gmail.com>
* | vf: Remove unused VFCTRL_FLIP_PAGEUoti Urpala2009-10-211-6/+0
| | | | | | | | | | Nothing uses it under MPlayer any more, and under MEncoder it never had any effect.
* | vo_vdpau: Fix memory corruption bug with MP_IMGTYPE_NUMBEREDUoti Urpala2009-09-181-0/+3
| | | | | | | | | | | | | | | | The way vo_vdpau kept references to vf mpi objects was unsafe; with fixed-vo enabled the vf object could be destroyed and a new one created, but vo_vdpau would still keep the now stale references and modify memory through them to adjust usage counts. Send a VOCTRL_RESET from vf_vo uninit() to allow vo_vdpau to erase such references.
* | core/VO: Allow VO drivers to add/modify framesUoti Urpala2009-09-181-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add interfaces to allow VO drivers to add or remove frames from the video stream and to alter timestamps. Currently this functionality only works with in correct-pts mode. Use the new functionality in vo_vdpau to properly support frame-adding deinterlace modes. Frames added by the VDPAU deinterlacing code are now properly timed. Before every second frame was always shown immediately (probably next monitor refresh) after the previous one, even if you were watching things in slow motion, and framestepping didn't stop at them at all. When seeking the deinterlace algorithm is no longer fed a mix of frames from old and new positions. As a side effect of the changes a problem with resize events was also fixed. Resizing calls video_to_output_surface() to render the frame at the new resolution, but before this function also changed the list of history frames, so resizing could give an image different from the original one, and also corrupt next frames due to them seeing the wrong history. Now the function has no such side effects. There are more resize-related problems though that will be fixed in a later commit. The deint_mpi[] list of reserved frames is increased from 2 to 3 entries for reasons related to the above. Having 2 entries is enough when you initially get a new frame in draw_image() because then you'll have those two entries plus the new one for a total of 3 (the code relied on the oldest mpi implicitly staying reserved for the duration of the call even after usage count was decreased). However if you want to be able to reproduce the rendering outside draw_image(), relying on the explicitly reserved list only, then it needs to store 3 entries.
* | Change type names to match upstream libassGrigori Goronzy2009-08-071-3/+3
| |
* | Remove internal libass treeUoti Urpala2009-07-261-3/+5
| | | | | | | | | | Remove the libass/ directory and use the newest standalone version of the library instead.
* | Merge svn changes up to r28655Uoti Urpala2009-02-191-0/+2