Commit Graph

3872 Commits

Author SHA1 Message Date
wm4 cc05910f16 sub: cosmetics: move things around
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).
2012-10-16 07:26:32 +02:00
wm4 34b3a9c5e9 sub, VO: remove vo_osd_resized() function
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.
2012-10-16 07:26:31 +02:00
wm4 2db0d229ef libvo: remove eosd_packer.c
This contains about the same code as bitmap_packer.c. eosd_packer.c was
added first, and then not merged for a year - then it was added as
bitmap_packer.c with slightly different and incompatible interface. Now
replacing eosd_packer.c with bitmap_packer.c is finally done. So much
wasted work...
2012-10-16 07:26:31 +02:00
wm4 ffd6219ecd vo_direct3d: use new OSD API 2012-10-16 07:26:31 +02:00
wm4 7463cff747 vo_corevideo: add EOSD
Completely untested.
2012-10-16 07:26:31 +02:00
wm4 637f1a4dc6 vo_gl: use gl_osd.c
Side effect: no direct support for old OSD format anymore. Instead,
sub.c converts sub-images in that format to the packed, alpha-inverted
version.

osd-color suboption is broken.
2012-10-16 07:26:31 +02:00
wm4 cadff3eec7 vo_gl3: move OSD code to gl_osd.c
Other OpenGL-using VOs can use this.

gl_osd.c includes some code for vo_gl.c. The next commit actually
makes use of it.
2012-10-16 07:26:31 +02:00
wm4 8f8f6e6d9d sub: remove logic for disabling hinting on scaled EOSD
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.
2012-10-16 07:26:31 +02:00
wm4 cf61928eec vo_gl, options: remove doublebuffering option (--double)
Useless. It complicated the code and caused flicker, and was useless
otherwise. The manpage describes this option as "should not normally
be used".

One possibly useful effect from the point of view of the user was that
vsync was disabled. You can do this with the --vsync option, or by
changing X/driver settings directly.
2012-10-16 07:26:31 +02:00
wm4 42572fdcc0 sub, vo_gl3, vo_vdpau: exit early if there are no sub-images to draw
libass may always return a full change if no subtitle images are
rendered in some cases (empty tracks). Also, a full change despite empty
sub-images list may be reported on initialization. Avoid invoking odd
special cases in the VO code by always exiting early if the sub-image
list is empty.

Note that at least for OSD, the code in sub.c doesn't even send a
request VOCTRL_DRAW_EOSD if the image list is empty. But the subtitle
rendering code in vf_vo.c is independent from this (at least for now).
2012-10-16 07:26:31 +02:00
wm4 252ddcc014 sub: cleanup: remove vo_osd_probar_type/value global variables 2012-10-16 07:26:31 +02:00
wm4 bef616ede9 vo_vdpau: use new EOSD for OSD, remove support for old OSD format
This allows vo_vdpau to render OSD directly, without the indirection
through the old OSD API, and without the additional conversions.

Remove support for the old OSD format. Only the mplayer DVD subtitle
decoder still generates this format. Although the new OSD interface does
support this format, remove it from vo_vdpau. It would be relatively
hard to support it in the EOSD code, as it requires two surfaces. (These
two surfaces are blended on top of each other to emulate the mplayer OSD
format.) The correct way to implement direct support for DVD subs would
consist of adding a paletted image format of some sort. But even sd_lavc
converts paletted subtitle images to RGBA, so doing something special
just for DVD subs is not worth it.

This means the frontend (sub.c) converts the subtitles to RGBA if it
detects that vo_vdpau does not support them natively.
2012-10-16 07:26:31 +02:00
wm4 18ab695a72 vo_vdpau: allow multiple EOSD renderers
Preparation for using new OSD rendering method.
2012-10-16 07:26:30 +02:00
wm4 3365514951 sub: allow rendering OSD in ASS image format directly, simplify
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.)
2012-10-16 07:26:30 +02:00
wm4 3099498154 vo_gl3: use old OSD using the emulation layer
This still renders the OSD using essentially the same mechanisms,
except that the EOSD code for texture handling and rendering is reused.
2012-10-16 07:26:30 +02:00
wm4 3c9c1790fe vo_gl3: support RGBA EOSD
This also adds support for multiple EOSD renderers. This capability is
unused yet, but important for the following commits.
2012-10-16 07:26:30 +02:00
wm4 ffb7a2fe17 sub: create sub_bitmap array even when using libass
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.
2012-10-16 07:26:28 +02:00
Stefano Pigozzi 09c5324314 cocoa_common: make fullscreen menubar/dock hiding conditional
cocoa_common was hiding the dock and menubar unconditionally when
going fullscreen. This means they were hidden even if they weren't on
the screen mplayer2 was going fullscreen on, resulting in poor user
experience.

Change the fullscreen function in the cocoa backend to check that
mplayer2 is on the same screen as the menubar/dock before hiding them.
2012-09-18 21:08:20 +02:00
Rudolf Polzer f5b8b6ac12 encode: video encoding now supported using mencoder-like options 2012-09-18 21:08:20 +02:00
Uoti Urpala 1959ba006c subs, vo_vdpau: support RGBA color for PGS subtitles
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
2012-09-18 21:07:30 +02:00
wm4 128bc6a21e Remove VESA/FBDEV remains, clean up example.conf
Remove VESA and FBDEV specific code that was forgotten when the
respective VOs were removed. Remove references to old or broken
stuff from example.conf.
2012-09-18 21:04:46 +02:00
Uoti Urpala fd52cb65f4 subs, vo: do sub bitmap change detection by comparing IDs
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.
2012-09-18 21:04:46 +02:00
Uoti Urpala 62ccf6c5cc vo_vdpau: split bitmap packing code into a separate file
Split the vo_vdpau code that calculates how to pack all subtitle
bitmaps into a larger surface into a separate file. This will allow
using it in other VOs.

Conflicts:
	Makefile
	libvo/vo_vdpau.c

Note: this commit does the same as an earlier commit by me
(4010dd0b1a). My commit added the vo_vdpau packer code as
eosd_packer.c, while this commit by uau uses bitmap_packer.c. Since
bitmap_packer.c has a different interface, and because there are more
commits changing OSD rendering coming, I will pick uau's version.
However, vo_gl, vo_gl3 and vo_direct3d are still using eosd_packer.c,
so to make the transition easier, don't delete eosd_packer.c yet.
2012-09-18 21:04:46 +02:00
wm4 6a5f00b875 cleanup: video_out: remove vo_subdevice global variable
This wasn't accessed anymore.

This is all what was left of mplayer2 commit c54fae82fd16
("vo: fix crash if all VO open fallback attempts fail").
2012-09-18 21:04:46 +02:00
Uoti Urpala 89a5714893 subs: always use sub decoder framework for libass rendering
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
2012-09-18 21:04:46 +02:00
Uoti Urpala 9bb03b7db4 subs: libass: use a single persistent renderer for subtitles
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
2012-09-18 21:04:46 +02:00
Uoti Urpala 435d7c97c9 cleanup: remove pointless #defines
Remove the following #defines, which should never change in practice:

CONFIG_FAKE_MONO, OUTBURST, FAST_OSD, FAST_OSD_TABLE
The configure script hardcoded these to particular values in config.h.
They could only be changed by manually editing it. I don't think
anyone would want to.

X11_FULLSCREEN
This once did something, but became meaningless years ago and was now
always set to true if the files using it were compiled at all.

Conflicts:
	configure
	libvo/osd.c
	libvo/vo_gl.c

Merged from mplayer2. The OSD defines were already removed in this fork.
2012-09-18 21:04:46 +02:00
wm4 7236ad5ff2 video_out: free memory if initializing a VO fails
This was a minor memory leak with no real impact.
2012-09-18 21:04:45 +02:00
Stefano Pigozzi da374c40de cocoa_common: improve conditional dock hiding from 3259e4a7a
Make the conditional hiding logic introduced in commit 3259e4a7a2a938
("cocoa_common: make fullscreen menubar/dock hiding conditional") work
when mplayer is started with the `fs` and `xineramascreen` options.
2012-08-28 23:21:07 +02:00
Uoti Urpala 009d9d8706 Adjust ffmpeg/libav #includes to work with recent upstream changes
The <libavutil/avutil.h> stopped including <libavutil/common.h>
recursively in recent ffmpeg/libav git revisions. As a result, some
files no longer got needed definitions, causing a build failure.
Modify #include lines in various files to fix build with the latest
versions of ffmpeg/libav headers.
2012-08-21 18:22:00 +02:00
cantabile a1380f3945 video: honor the video's colormatrix and color range flags
If either of them is not defined, the old behavior is used:
- the colormatrix is guessed based on resolution.
- the color range is assumed to be tv aka limited range.
2012-08-21 18:17:41 +02:00
wm4 988dad5fc7 osd: get rid of useless initialization function
The function merely printed redundant messages that were not visible by
default.
2012-08-20 15:36:05 +02:00
Stefano Pigozzi e70b5ee2fd cocoa_common: add HiDPI/retina support
With a HiDPI screen, for performance and backwards compatibility
reasons, AppKit requests an OpenGL surface with a pixel number that
equals the user points number. After the image is rendered to this
smaller surface, it is upscaled so that its dimensions are comparable
across screens of different DPIs. The applied scaling is not that good
and makes the video/subtitles blurry; this is not acceptable for a
video player.

Request AppKit to use a high resolution OpenGL surface to back the
mplayer2 OpenGL view. Also set the window pixel size information
correctly in the VO object by converting user points to actual pixels.

All the system version checks are done at runtime so that the feature
is available on OSX 10.7 even with a binary compiled with older SDKs.

Also replace is_lion_or_better() with is_osx_version_at_least(10, 7, 0)
which is defined in osx_common.
2012-08-16 22:41:09 +02:00
Stefano Pigozzi 87c375e6f2 cocoa_common.m: add missing config.h include
This is needed for the check on CONFIG_SDL in this file.
2012-08-16 22:30:06 +02:00
Stefano Pigozzi 13675fc7dc cleanup: osx_common: remove unused functions
Remove functions that aren't called anymore:

 *  `osx_foreground_hack` was replaced by the NSApplication's
    activateIgnoringOtherApps: in cocoa_common.
 *  Aspect ratio functions were not called by the "new" cocoa backend,
    since the corresponding menu item was deleted.
2012-08-16 22:29:42 +02:00
Stefano Pigozzi dcb90fde25 cocoa_common: refactor menu generation
This commit is supposed to make the menu generation a little more
readable. It also fixes menu generation for the `cmd+q` entry.
2012-08-16 22:28:27 +02:00
Stefano Pigozzi 31d0eb86f3 gl_common: fix compilation on OS X 10.8
As of OS X 10.8 Apple completely removed X11 from the system.
gl_common.h was including gl.h using the path <GL/gl.h>. This path
comes from the X11 headers, which are missing in 10.8.

Change gl_common.h to include gl.h from Apple's OpenGL implementation
as <OpenGL/gl.h> if X11/XQuartz is not detected.
2012-08-16 22:25:13 +02:00
wm4 0e2c48a3ce VO: remove vo_directfb2 and vo_directx
While being able to play videos on a framebuffer device would be nice,
I didn't need it, and couldn't even test it (buggy nvidia binary
drivers that disable framebuffers, buggy DirectFB that crashes when
using the X11 backend). It's just dead weight, get rid of it.

vo_directx was very horrible, and by today it's mostly useless. I didn't
remove it, because there was that-guy who told me in amazement how
awesome mplayer was, because it was the only video player fast enough
for fast playback on his system when using vo_directx. Sorry, that-guy.
2012-08-16 17:17:50 +02:00
wm4 4672ff39dd vo_vdpau: fix crash when vo_vdpau initialization fails
This happened on system without a vdpau driver installed. It's
especially bad because vdpau is the default VO.

I'm not sure when this bug was introduced, and it seems to exist in
upstream mplayer2 too.
2012-08-16 17:16:32 +02:00
wm4 1b7b0c93a8 video_out: fix crash when VO autoselection fails
init_best_video_out() did not manage the memory for vo->window_title
correctly, and free'd it twice when initialization failed (that's due
to talloc_free_children() being called). When the next VO was tried,
it reused the dangling pointer. Initialize this member somewhere else
lazily instead.
2012-08-16 17:16:08 +02:00
Stefano Pigozzi 6879d1162c vo_sharedbuffer: remove this VO
Since slave mode is not planned to be kept, this VO is useless and I'm
removing it.

This VO was useful for OSX GUIs. Since in cocoa you can't embed views in
windows from other processes, this VO was writing to a sharedbuffer with
mmap. The OSX GUIs would then read from the buffer and render the image
with an external renderer.

If in the future we will want to support GUIs we will need to reasearch the
IOSurface framework. This allows to share kernel managed image data
across processes and integrates well with OpenGL.
2012-08-15 22:01:39 +02:00
Stefano Pigozzi 7fd43b0bcd osx: fix build
adapt the osx VOs to build against the latest changes.
2012-08-08 21:23:28 +02:00
wm4 477af1c777 osd: remove FAST_OSD code
This code has never been active by default, ever since it was added
back in 2001. You had to edit config.h or configure manually to enable
it.
2012-08-07 02:21:19 +02:00
wm4 2287245136 VO: remove old VO glue
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.
2012-08-07 01:29:56 +02:00
wm4 f3bb6692c7 osx_common: remove old VO include, modify change_movie_aspect()
The only reason the old VO related header old_vo_defines.h was included
was probably to gain access to the current VO struct in the function
change_movie_aspect(). Make that function take a parameter instead.

This function seems to be unused.
2012-08-07 01:13:25 +02:00
wm4 1602bb5a46 vo_directx: convert to new VO API 2012-08-07 01:09:50 +02:00
wm4 89b7cb0331 win32: fix compilation on MinGW
The commit 74df1d8e05 (and f752212c62) replaced the configure
endian check with byte order macros defined by standard headers. It
turns out that MinGW-w64 actually doesn't define these macros in the
sys/types.h system header. (I assumed it does, because a quick test
seemed to work. But that was because gcc -W -Wall doesn't warn against
undefined macros. You need -Wundef for that.) MinGW-w64 has a
sys/params.h header defining these macros, but sys/types.h doesn't
include it, so it's useless without special casing the mplayer code.
Add a hack top configure instead. Define the macros directly, and
assume MinGW-w64 only works on little endian machines.

The other changes are basically random typos and superficial oversights.
2012-08-07 01:09:42 +02:00
wm4 76b98e4c32 vo_null: reformat and use new VO API 2012-08-07 01:09:30 +02:00
wm4 c113e6ed7d Remove V4L2 decoder support (vo_v4l2 and ao_v4l2)
The removed VO and AO took MPEG data and decoded it with V4L2. I'm not
exactly sure what's the use of this today, but get rid of it.

As far as feeding video data to V4L2 is concerned, there are other
ways. For example, there is this script, that feeds yuv4mpeg formatted
raw video data to V4L2:

    https://raw.github.com/umlaeute/v4l2loopback/master/examples/yuv4mpeg_to_v4l2.c
2012-08-07 01:09:30 +02:00
wm4 229380d9bd vo_v4l2: reformat, use new VO API
Actually, this is probably completely broken, and there are better
ways to get mplayer output into a V4L2 device.
2012-08-07 01:09:30 +02:00