Commit Graph

215 Commits

Author SHA1 Message Date
Stefano Pigozzi 5db96c0837 gl_common: remove useless cocoa wrapper functions 2012-10-16 07:19:32 +02:00
Stefano Pigozzi f5de0aac96 cocoa_common: use IOKit to perform power management
This allows to remove the call to the deprecated `UpdateSystemActivity`. The
additional benefit is power management is disabled only if the video is really
playing. A paused video will not stop the system from idling.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi b946197243 cocoa_common: save state in the vo struct
Save the cocoa state in an instance variable for the Objective-C part of the
code and use a field in the vo struct for the raw C part of the code.
2012-10-16 07:19:32 +02:00
wm4 b3b20cc411 gl_common: require GLX 1.3 for vo_gl, remove old pre-1.3 code
Now both GL3 (for vo_gl3) and legacy context context creation (for
vo_gl) use the same code to create the X window. Only actual GL context
creation is different.
2012-10-03 03:17:39 +02:00
wm4 a0b43a11e4 vo_gl3: make it work on OpenGL 2.1
Now vo_gl3 should work with standard OpenGL 2.1, as long as the
GL_ARB_texture_rg extension is available. Optional features, which
require features that are always in OpenGL 3.0, but are available
as extensions only in OpenGL 2.1, are automatically disabled.

The force-gl2 suboption, which was an unreliable hack to run vo_gl3
in an OpenGL 2.1 context, is removed.

Significant changes are done to the extension loader to make it easier
to identify optional OpenGL features.

Context creation is a bit changed to simplify the code and to handle
the fallback better if OpenGL 3 context creation fails, and creating
an OpenGL legacy context is attempted.

Based on the initial work by Rudolf Polzer <divverent@xonotic.org>,
which included making the shader GLSL 1.20 compatible, and more.
2012-10-03 03:17:38 +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 16145ff43f libvo, libao: remove useless video and audio output drivers
Some of these have only limited use, and some of these have no use at
all. Remove them. They make maintainance harder and nobody needs them.
It's possible that many of the removed drivers were very useful a dozen
of years ago, but now it's 2012.

Note that some of these could be added back, in case they were more
useful than I thought. But right now, they are just a burden.

Reason for removal for each module:
    vo_3dfx, vo_dfbmga, vo_dxr3, vo_ivtv, vo_mga, vo_s3fb,
    vo_tdfxfb, vo_xmga, vo_tdfx_vid:
        All of these are for very specific and outdated hardware. Some
        of them require non-standard kernel drivers or do direct HW
        access.
    vo_dga: the most crappy and ancient way to get fast output on X.
    vo_aa: there's vo_caca for the same purpose.
    vo_ggi: this never lived, and is entirely useless.
    vo_mpegpes: for DVB cards, I can't test this and it's crappy.
    vo_fbdev, vo_fbdev2: there's vo_directfb2
    vo_bl: what is this even? But it's neither important, nor alive.
    vo_svga, vo_vesa: you want to use this? You can't be serious.
    vo_wii: I can't test this, and who the hell uses this?
    vo_xvr100: some Sun thing.
    vo_xover: only useful in connection with xvr100.
    ao_nas: still alive, but I doubt it has any meaning today.
    ao_sun: Sun.
    ao_win32: use ao_dsound or ao_portaudio instead.
    ao_ivtv: removed along vo_ivtv.

Also get rid of anything SDL related. SDL 1.x is total crap for video
output, and will be replaced with SDL 2.x soon (perhaps), so if you
want to use SDL, write output drivers for SDL 2.x.

Additionally, I accidentally damaged Sun support, which made me
completely remove Sun/Solaris support. Nobody cares about this anyway.

Some left overs from previous commits removing modules were cleaned up.
2012-07-28 20:44:59 +02:00
Stefano Pigozzi 43337db0a4 cocoa: gl3: support querying of colors bit depth
Add support for querying the bit depth of the colors from the OpenGL
context. This allows to perform dithering correctly.
2012-05-15 10:37:58 +02:00
wm4 97ac824124 Merge remote-tracking branch 'origin/master'
Conflicts:
	bstr.c
	bstr.h
	libvo/cocoa_common.m
	libvo/gl_common.c
	libvo/video_out.c
	mplayer.c
	screenshot.c
	sub/subassconvert.c

Merge of cocoa_common.m done by pigoz.

Picking my version of screenshot.c. The fix in commit aadf1002f8 will
be redone in a follow-up commit, as the original commit causes too many
conflicts with the work done locally in this branch, and other work in
progress.
2012-04-29 10:01:28 +02:00
Stefano Pigozzi d3da92aea4 cocoa_common, gl_common: add OSX specific getProcAddress
Run dlopen on the OpenGL dynamic library instead of on the binary.
This should prevent crashes due to function conflicts when X11/lGL is
linked.

Remove mutual exclusion of the X11 and Cocoa backends.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 768e06b0ac vo_corevideo: restructure this video output
Restructure this video output to be similar to vo_gl, even if simpler
and less feature complete (for example it's still missing EOSD
support). Ideally, it should act as a decent fallback in the case
where something breaks in the OSX support of vo_gl.

Here's a summary of what changed:

 * Remove the shared buffer code since it wasn't using any function
   from the CoreVideo API. Moreover, its presence in vo_corevideo was
   forcing the non-GUI related code to perform more image copies than
   necessary. Equivalent shared-buffer functionality will be added in
   a separate new VO in the next commit (this means OSX GUIs will need
   to specify a different VO).

 * Clean up the code to conform a bit more to the mplayer2
   conventions. Enforce 80 column wrapping, use a private struct for
   file variables, use the new libvo api.

 * Add OSD rendering using OpenGL instead of writing directly on the
   video image data.

 * Simplify the logic for the rendering function when dealing with
   panscan.

 * Add VOCTRL_REDRAW_FRAME support.

 * Add colormatrix support by using the built-in API provided by
   CoreVideo.
2012-04-26 21:03:10 +03:00
wm4 ad20cf4131 gl_common: do not call glXGetClientString() and glXGetServerString()
Only call glXGetClientString(), which contains all supported GLX
extensions. Extensions only returned by glXGetClientString() or
glXGetServerString() are not necessarily actually supported.

This essentially reverts svn commit 29721 (git fe3b9a88ce). It is
not known whether this commit actually fixed anything, such as working
around a broken OpenGL driver.
2012-04-16 21:49:02 +02:00
wm4 923f353d2a win32: move global variables into a struct & some refactoring
This reflects the changes done to x11_common in mplayer2 some years
ago. It makes it possible to open multiple VOs at once.

The removed defines are probably for ancient versions of MinGW with
incomplete headers.

Remove some minor code duplication.
2012-04-14 17:03:11 +02:00
wm4 1aa2e36122 Merge remote-tracking branch 'origin/master'
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
2012-04-01 22:52:33 +02:00
wm4 fea8c85c85 gl_common: minor cleanup/refactor
Remove all platform/GUI specific includes from gl_common.h. Get rid of
the ugly union in MPGLContext. Use function pointers instead of an
ifdef ridden switch statement in uninit_mpglcontext(). Always include
glext.h, not only on Windows.

None of this should actually change any functionality.
2012-03-31 02:58:53 +02:00
wm4 4b883505f6 gl_common: remove unused glValName()
Using helper programs like apitrace is better for debugging.
2012-03-31 02:58:53 +02:00
wm4 98052873da libvo: add vo_gl3
This new vo is heavily based on vo_gl.c. It provides better scale
filters, dithering, and optional color management with LittleCMS2.
It requires OpenGL 3.

Many features are enabled by default, so it will be slower than vo_gl.
However, it can be tuned to behave almost as vo_gl.
2012-03-31 02:58:52 +02:00
Stefano Pigozzi b00c1335c8 gl_common: cocoa: add OpenGL 3.2 context creation code
Add a new option to the cocoa window creation code in order to decide
which OpenGL context to create.
2012-03-31 02:58:52 +02:00
wm4 35c29bdd52 gl_common: slightly change win32 GL 3 context creation
The code used OpenGL 3 specific functions for querying the extension
string when the actual GL 3 context wasn't created yet. This appears to
work fine on nVidia, but could break otherwise. Remove the offending
getFunctions call and retrieve the needed function pointer manually.
(This way the wglCreateContextAttribsARB function pointer can be removed
from struct GL too.)

(Amusingly exposes a wine bug; they made the same mistake.)

Explicitly check the extension string whether the function is available,
although this probably doesn't matter in practice.

Also retrieve bit depth information on win32.
2012-03-31 02:58:52 +02:00
Kovensky 59125ce71e gl_common: OpenGL 3.x context support on windows
Also include GL/glext.h on windows:

Mingw's (and cygwin's) GL/gl.h has GL/glext.h's inclusion commented
out for some reason. Their glext.h is also ancient, so do yourself
a favor and replace your GL/glext.h with the one from
http://www.opengl.org/registry/api/glext.h .

A workaround is needed for NVidia's broken wglCreateContextAtrribsARB:

It'll return an error if the requested OpenGL version is previous to
3.2 *and* you request a profile... which is exactly *not* what the
wgl_create_context spec says should happen.

Handle it by removing the profile request from attribs[] and retrying
the context creation once more if the first try fails.

And after my first foray into OpenGL I already find a driver quirk.
Oh well.
2012-03-31 02:58:52 +02:00
wm4 666915a6f0 gl_common: add OpenGL 3.x context creation
Also add a bunch of GL functions to the function loader, which will be
needed by vo_gl3. Remove some unused legacy GL functions from the
loader.

Use the proper name for glGetProgramivARB. glGetProgramiv is a different
and incompatible function. The ARB variant is used for ARB shaders,
while the proper one is for GLSL.
2012-03-31 02:58:52 +02:00
Stefano Pigozzi 506d9beb66 vo_gl: cocoa: add support for --ontop
Make the cocoa backend change the non-fullscreen window level
according to the value of the ontop property.
2012-03-25 22:30:37 +03:00
wm4 4352f9feca vo_gl: add "backend" suboption to allow selecting the GUI backend
The "backend" suboption allows selecting the GUI backend used by vo_gl.
Normally, it's auto-selected, but sometimes it's desireable to explicitly
select it.

Remove the gl_sdl VO. This can now be done by using: --vo=gl:backend=sdl

This is based on svn commit 34438, and tries to be compatible with it. The
undocumented numeric backend names serve this purpose. (They are
undocumented because names are preferred.)
2012-02-09 04:58:41 +01:00
reimar 93ae55c2c3 vo_gl: minor cleanups
Fix spelling.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34006 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix disabled code.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34007 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove pointless pointer indirection for shader program strings.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34016 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove usage of glColor3f, there is not really a point in it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34149 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-02-09 04:58:27 +01:00
reimar 8767c060cf vo_gl: add noise filter
Add disabled feature: noise filter for vo_gl.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34014 b3059339-0415-0410-9bf9-f77b7e298cf2

Hook up -vo gl noise support.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34015 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-02-09 04:58:07 +01:00
wm4 adc85b0031 vo_gl: use generic eosd code
This is an experiment.

The change probably doesn't matter much.

One issue with the old code was that "large" images caused each sub-image
to be created and rendered as a new texture. "Large" in this case means
larger than 32x32 pixels, which actually isn't very large with screen
sizes beyond 1500x1000 pixels. This means rendering a simple subtitle for
a fullscreened video may allocate many small textures, one for each glyph.
On the other hand, the old code could be fixed by tuning the texture sizes
for "modern" work loads.

Also, the new code uses less deprecated OpenGL features and draws all
sub-images in one batch.

There are two possible issues the new code could cause:
- Drivers could have performance issues with the larger texture sizes and
  the number of glTexSubImage2D calls on it
- There is only one EOSD texture, which could become full (it's enlarged
  on demand, but restricted by driver texture size limitations)

It has been reported that this is faster on OSX with ATI GPUs than the old
code.
2011-12-25 20:42:58 +01:00
Stefano Pigozzi b2a41e20be vo_gl: cocoa: point swapinterval to cocoa_common function
Currently there is no way to set the swap interval with a function
that has a signature compatible with other platforms' gl extensions.

Make a wrapper function around the gui toolkit method of setting the
swap interval property, and point gl->SwapInterval to it.
2011-12-06 23:11:50 +01:00
Stefano Pigozzi bd8ba89cca vo_gl: cocoa: decouple cocoa_common from gl_common
Remove the useless dependency on MPGLContext from cocoa_common, since
it was used just to access the vo struct. Change gl_common to pass the
vo struct directly to all the cocoa_common functions.
2011-12-06 23:10:54 +01:00
wm4 d4de92e808 libvo: remove title argument from struct vo_driver.config
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.
2011-12-06 20:32:33 +01:00
Stefano Pigozzi 421c840b3c vo_gl: add native mac osx Cocoa backend for vo_gl
Add native Cocoa code to display an OpenGL window. Some of the code is
based on the OpenGL parts of vo_corevideo but I took the time to remove
old code based on Carbon.

There is autodetection in the configure script but you can use
--enable[disable]-cocoa to enable[disable] this.
2011-11-26 20:04:16 +02:00
wm4 9ffd1cdaf8 vo_gl: fix cscale=4 and cscale=5 doing nothing
The ARB shader code generated at the end of the shaders for scaling mode 4
and 5 was something like:
   MAD yuv.g, b.r, {0.5}, a.r;
This appears to be semantically equivalent with:
   MAD yuv.g, b.rrrr, {0.5, 0, 0, 0}, a.rrrr;
This has the consequence that the result register, yuv.g, will not contain
the value computed by the scale filter, but a.r. a.r is the unchanged
value sampled from the normal texture coordinates, so the filter did
effectively nothing and behaved as if cscale=0 was specified. The basic
mistake here is that yuv.g does not specify a single register, but it
specifies the full vector register yuv, with writing enabled on the g
channel. This means yuv.g will assigned the g channel of the the result
vector computed by the MAD instruction.
2011-11-25 23:59:49 +02:00
wm4 046692d90b vo_gl: fix 10 bit with Mesa drivers (Intel/Nouveau on Linux)
The GL_LUMINANCE16 texture format had only 8 bit precision on Mesa
based drivers. This caused heavy degradation of the image when playing
formats with more than 8 bits per pixel, such as 10 bit h264. Use
GL_R16 instead, which at least Mesa and Nvidia drivers actually
implement as 16 bit textures. Since sampling from this texture format
doesn't return anything meaningful in the other color components
(unlike luminance textures), the shader code has to be slightly
changed.

GL_R16 requires the GL_ARB_texture_rg extension. Check for it, and fall
back to the old texture format if it's not available.

The low precision of the GL_LUMINANCE16 format has just been fixed in
upstream Mesa, but it'll take a while before that fix is available in
distros.
2011-11-25 23:59:49 +02:00
wm4 b65ee1f5ac vo_gl: make shader code generation easier to deal with
The shader code was generated from very long strings with lots of
format specifiers with snprintf calls. It was almost impossible to
quickly tell what variables were inserted where in the shader. Make
this more readable by implementing a kind of simple variable
substitution, which allows replacing the format specifiers in the code
templates with with variable names.
2011-11-25 23:59:49 +02:00
wm4 28eaf11cf3 vo_gl: implement screenshots 2011-11-25 23:56:28 +02:00
wm4 2123bff6fa vo_gl: remove support for nvidia register combiners (yuv=1)
The register combiner color conversion is broken and seems to use a
slightly incorrect color matrix (the image looks gray-ish). Completely
remove all code related to nVidia register combiners.

Unless you have an ancient nVidia GPU, there's no reason to prefer register
combiners over fragment shaders. Users with ancient GPUs without fragment
shader support can just use -vo xv.

Passing yuv=1 (register combiners) as sub option will print a warning and
use yuv=2 (fragment shaders) instead.
2011-10-24 08:36:17 +03:00
wm4 64f44ad316 vo_gl: remove mesa-buffer suboption
This option enabled using Mesa specific functions, which have never been
widely supported, and were removed from Mesa in 2010.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb2a66fd0c095fe03be5aaf88c8d48f5867425d3
2011-10-24 07:31:09 +03:00
wm4 3eeca4838d vo_gl: move window creation functions from vo_gl.c into gl_common.c
Now all windowing specific code is in gl_common.c.

init_mpglcontext() used to set dummy callbacks for non-optional windowing
callbacks. Remove these, as they only lead to confusion.
2011-10-24 07:19:29 +03:00
wm4 f045abb4c0 vo_gl/sdl: use desktop resolution for fullscreen mode
Before the SDL code would change screen resolution when switching to
fullscreen. Try to keep existing desktop resolution instead.
2011-10-24 06:18:29 +03:00
wm4 c852246cdf vo_gl: convert to new API, clean up code
Reformat vo_gl.c, gl_common.c, gl_common.h.
Remove all global variables and move them into a context struct (the
Windows and SDL backends still refer to global_vo though).
Change vo_gl.c to use the "new" VO API.
2011-10-24 06:13:17 +03:00
reimar 950003b0c3 vo_gl: fix YUY2/YVYU colorspace mixup
Second GL_YCBCR_MESA format is YVYU, not YUY2.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33694 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
reimar 2c7488fe91 vo_gl: Request GL_LUMINANCE16 for 16-bit YUV input
Request GL_LUMINANCE16 as internal format for > 8 bit YUV formats.
Have yet to find a system that actually provides that though.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33453 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 10:49:52 +03:00
reimar 57f48fc1bf vo_gl: don't accept 9/10-bit formats as input
Make mp_get_chroma_shift() simpler/more generic and add an argument
to get the per-component bit depth.
Use this to check more properly for supported formats in
gl and gl2 vos (only 8 and 16 bit are supported, 9 and 10 are not).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33452 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 10:49:41 +03:00
cboesch fe3c4810e1 cleanup: remove NULL checks before free() all over the code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 13:11:20 +02:00
cigaes ce9fcc0730 vo_gl: Move the read_pnm function into a separate file
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32513 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:37 +02:00
reimar 2865993869 vo_gl: Extract code to read a pnm file into a separate function
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32479 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:09 +02:00
reimar ccb6675fbd vo_gl: Add initial stereo support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31633 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:20 +02:00
reimar be6a58d455 vo_gl, csputils: dual-license under LGPL v2.1
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
an alternative to the GPL license.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31375 b3059339-0415-0410-9bf9-f77b7e298cf2

Allow LGPL for csputils as well, they were previously part of gl_common
and are still an important part of it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31376 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:07:42 +02:00
Uoti Urpala 18657beb19 Merge svn changes up to r31145 2010-05-30 15:21:18 +03:00
reimar 6f28f44c8c Handle chroma texture size becoming 0, e.g. due to bad rounding.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31143 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-09 00:16:46 +00:00
Uoti Urpala f38efd166e Merge svn changes up to r31097 2010-04-26 19:23:32 +03:00