Commit Graph

33508 Commits

Author SHA1 Message Date
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
wm4 9564e07548 Add bin_to_header.py 2012-03-31 02:58:52 +02:00
wm4 67e7da2d70 mp_msg: double maximum message size 2012-03-31 02:58:48 +02:00
wm4 c161d31eed vo_direct3d: fix crash when using RGB formats
The function mp_get_yuv2rgb_coeffs() expects valid values for
input_bits.

When using RGB formats, input_bits is outside the range of what
mp_get_yuv2rgb_coeffs() expects. This doesn't matter since we don't
use the result of that function in the RGB case, but it triggered an
assertion.

This is a regression from commit a816810266,
"vo_gl: improve 10-bit YUV->RGB conversion accuracy slightly".
2012-03-26 04:12:26 +02:00
Uoti Urpala 81de9a52d0 ao_pulse: add hacks to work around seek problems
pa_stream_flush() seems to work pretty badly in general. The visible
symptoms included at least old audio continuing for a significant time
after the call, and bogus latency reporting causing temporary video
freezes after a seek. Add some hacks to work around these problems.
The result seems to work most of the time on my machine at least...
2012-03-26 03:55:31 +03:00
Uoti Urpala a0de4bc500 ao_pulse, core: make pulse thread wake up core for more data
For ao_pulse, the current latency is not a good indicator of how soon
the AO requires new data to avoid underflow. Add an internal pipe that
can be used to wake up the input loop from select(), and make the
pulseaudio main loop (which runs in a separate thread) use this
mechanism when pulse requests more data. The wakeup signal currently
contains no information about the reason for the wakup, but audio
buffers are always filled when the event loop wakes up.

Also, request a latency of 1 second from the Pulseaudio server. The
default is normally significantly higher. We don't need low latency,
while higher latency helps prevent underflows reduces need for
wakeups.
2012-03-26 03:55:31 +03:00
Uoti Urpala 4fed8ad197 ao_pulse: convert to new AO API 2012-03-26 03:55:31 +03:00
wm4 84b2c79c56 libmpcodecs: rename IMGFMT_GBR24P to IMGFMT_GBRP
This is more in line with the ffmpeg/libav names.
2012-03-25 23:12:57 +02:00
reimar bf3f28f0a8 vf_scale: prefer converting GBR24P to other 8 bit per component RGB formats
Compared to converting to Y444 this should be faster and lossless.

Based on patch by Hans-Kristian Arntzen [maister archlinux us]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34317 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-03-25 23:09:58 +02:00
cehoyos b223805547 libmpcodecs: support planar GBR24 decoding
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34245 b3059339-0415-0410-9bf9-f77b7e298cf2

Note: ffmpeg first introduced PIX_FMT_GBR24P, which was used in this
commit. Later, it was renamed to PIX_FMT_GBRP in ffmpeg and libav. This
was updated in revision 34492 in mplayer, but the mplayer specific
names (such as IMGFMT_GBR24) were left unchanged.
2012-03-25 23:03:15 +02:00
Stefano Pigozzi 9badc1d786 cocoa_common: update screen info before entering fullscreen
If the user moved the window to another screen, fullscreen mode would
still use the original screen. Fix to use the screen the window is
currently on (unless overridden by --xineramascreen).
2012-03-25 22:30:38 +03:00
Uoti Urpala 215035b31a input.c: simplify command definitions
Change command definitions to allow writing the command definition
table in more readable format.
2012-03-25 22:30:38 +03:00
Stefano Pigozzi ae0a38ddf8 macosx_finder_args: use a custom logfile instead of system.log
Change the macosx_finder_args function so that when mplayer2 is
invoked from the Finder in a Mac application bundle, it redirects the
output to ~/Library/Logs/mplayer2.log instead of cluttering the global
system.log.

This doesn't affect terminal use which keeps writing to stdout and
stderr.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi 19458020a6 VO: move gl+cocoa before corevideo in default VO order
The gl video output is faster and has more features than corevideo, so
it should be preferred on mac osx.

This doesn't affect GUI compatibility because they specify the
corevideo video output along with the suboptions for the shared buffer
name to mmap in.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi e37d7b1452 configure: disable X11 opengl backend if Cocoa is enabled
The recommended way to get function pointers to the functions in the
OpenGL library is through dlopen/dlsym/dlclose. This causes problems
in the Cocoa OpenGL backend when -lGL (X11's OpenGL headers) is linked
to the binary together with -framework OpenGL.
The linked OpenGL symbols are always from -lGL, causing all the
function pointers to point to null when getFunctions is called against
a Cocoa OpenGL context.

For this reason change the configure autodetection code to disable
the vo_gl X11 backend when cocoa is active.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi e89ea0c371 cocoa_common: add license information 2012-03-25 22:30:37 +03:00
Stefano Pigozzi d0f0bf7fd2 vo_quartz: remove this video output
This video output is not useful anymore. It is based on Carbon to draw
the mplayer window and this has been deprecated by Apple in 10.5.

The upcoming 10.8 OSX release should deprecate most of Carbon, so it
doesn't make sense to keep vo_quartz in the codebase when there are
modern and better alternatives (vo_gl and vo_corevideo).
2012-03-25 22:30:37 +03:00
Stefano Pigozzi 24e08eb5f2 macosx_finder_args: use cocoa instead of carbon
macosx_finder_args was using Carbon and wasn't usable any longer on
modern versions of MacOSX. This is very useful to embed mplayer in a
mac application bundle.

When using application bundles, the operating system will call the
main function with only one argument that identifies the process
serial number (this is some additional process identifier in osx other
than the pid). File open events are then dispatched to the application
through events that must be handled accordingly.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi 98d399e2f3 cocoa_common: fix double click handling
The Cocoa framework generates only a NS*MouseDown event when handling
the second click of a double click (no NS*MouseUp). If that's the case
put mouse up key in mplayer2's fifo when dealing with the MouseDown
Cocoa event.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi 09beba6e9e cocoa_common: accept window drag event from the whole window surface
Change the window to accept mouse drag events not only on the title
bar, but also on the rest of the window surface; this includes the
video area.

It looks like the changing of the window mask resets the behaviour
specified in the delegate method, probably due to some strange
interaction with NSBorderlessWindow. For this reason call
-setPresentationOptions in the -fullscreen method to remind cocoa the
behaviour we want.
2012-03-25 22:30:37 +03:00
Stefano Pigozzi 495dde4018 options, x11+cocoa: add option --cursor-autohide-delay
Add option --cursor-autohide-delay to control the number of milliseconds
with no user interaction before the mouse cursor is hidden.

There are two negative values with useful special meanings:
* A value of -1 prevents the cursor from hiding (useful for users
  with multiple displays).
* A value of -2 prevents the cursor from showing upon activity.

The default is 1 second to keep the behaviour consistent with the
past X11 backend implementation.

Remove the vo_mouse_autohide field as it was always true.
2012-03-25 22:30:37 +03:00
wm4 f30bf73bf2 etc/input.conf: make file contents match default key bindings
There were some slight differences between what input.conf mapped, and
what was in input.c def_cmd_binds[]. Make them match.

Add some minor documentation improvements in input.cfg.

Also remove double comments ('##'), because they were confusing.
2012-03-25 22:30:37 +03:00
wm4 adf100cd49 x11: remove wskeys.h
Use the <X11/keysym.h> xlib header instead. I'm not sure why mplayer
defined these constants itself.
2012-03-25 22:30:37 +03:00
wm4 f561c19fe1 x11: input: add print and menu keys 2012-03-25 22:30:37 +03:00
wm4 7f6dae08e1 x11: add KP_Separator to key mapping
At least on some keyboards, the key between '0' and 'Enter' on the
key pad is mapped to KP_Separator. Since X11 VOs accept unicode
input, the mplayer keycode this key generates depended on the numlock
state, and with numlock enabled this mapped to an ASCII character.
This is probably not what the user wanted, since two physical keys
will always map to the same key code.

Map it to KP_DEC.
2012-03-25 22:30:37 +03:00
wm4 467817ff9f x11: allow unicode input
This change allows using non-ASCII keys with X11. These keys were ingored
before.

Technically, this creates an invisible, non-interactive input method
context. If creation fails, the code falls back to the old method, which
allows a subset of ASCII only.
2012-03-25 22:30:37 +03:00
wm4 7ea5c4c26c input: handle UTF-8 terminal input
This assumes the terminal uses UTF-8. If invalid UTF-8 is encountered (for
example because the terminal uses a legacy encoding), the code falls back
to the old method and feeds each byte as key code to the input code.

In theory, UTF-8 input could randomly fail, because the code in getch2.c
doesn't try to fill the input buffer correctly with input sequences
longer than a byte. This is a problem with the design of the existing
code.
2012-03-25 22:30:37 +03:00
wm4 166a7de4cf input: allow unicode keys and reassign internal key codes
This moves all key codes above the highest valid unicode code point
(which is 0x10FFFF). All key codes below MP_KEY_BASE now directly map
to unicode (KEY_ENTER is 13, carriage return). Configuration files
(input.conf) can contain unicode characters in UTF-8 to map non-ASCII
characters/keys.

This shouldn't change anything user visible, except that "direct key
codes" (as used in input.conf) will change their meaning.

Parts of the bstr functions taken from libavutil's GET_UTF8 and
slightly modified.
2012-03-25 22:30:37 +03:00
wm4 3e6e80a32c x11: fix setting UTF-8 window titles for some special cases
Setting the WM_NAME/WM_ICON_NAME window properties didn't always work:
apparently there are some characters that can't be represented in the X
STRING or COMPOUND_TEXT encodings, such as U+2013 EN DASH. The function
Xutf8TextListToTextProperty partially converts the string, and returns
a value different from 'Success'. This means vo_x11_set_property_string
didn't set these window properties.

On most modern window managers, this is not a problem, since these use
the _NET_WM_NAME/_NET_ICON_NAME and the UTF8_STRING encoding. Some older
WMs like IceWM don't read these, and the window title remains blank.

It's not clear what exactly we should do in this situation, but fix it
by setting set the WM_NAME/WM_ICON_NAME properties as UTF8_TEXT. This
violates the ICCCM, but at least IceWM seems to handle this well.

See also:
  http://lists.freedesktop.org/archives/xorg/2004-September/003391.html
  http://lists.freedesktop.org/archives/xorg/2004-September/003395.html
2012-03-25 22:30:37 +03: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
Uoti Urpala 06e3dc8eba timeline: subs: keep subtitle tracks in source time
Timeline handling converted the pts values from demuxed subtitles to
timeline scale. Change the code to do most subtitle handling in
original subtitle source pts, and instead convert current playback
timeline pts to those units when deciding which subtitle to show.
The main functionality changes are that now demuxed subtitles which
overlap chapter boundaries are handled correctly (at least for libass
subtitles), and external subtitles are assumed to use same pts scale
as current source (this needs improvements later).

Before, a video subtitle that had a duration continuing past the end
of the chapter would continue to be shown for the original duration,
even if the chapter ended and playback switched to a position in the
source where the subtitle shouldn't exist. Now, the subtitle will
correctly end.

Before, external subtitle files were interpreted as specifying pts
values in timeline scale. Now, they're interpreted as specifying pts
values in source file time scale, for _every_ source file. This is
probably more likely to be what the user wants for the "main" source
file in case there is one, but almost certainly not quite right for
multiple source files where the same subs could be shown over
different scenes. If the user wants them to match some main source
file, it's probably still better to have incorrect extra subs for
video from some files than to have every subtitle appearing at the
wrong time. The new code makes it easier to change the interpretation
of the subtitle times, and some configurability should be added in
the future.
2012-03-25 22:30:37 +03:00
Uoti Urpala 1ff7efe2ec vo_xv: remove direct rendering support
Direct rendering support in vo_xv (used with --dr) had at least two
problems. First, OSD drawing modified the buffers; this meant that
if the buffers were used for reference frames there would be video
corruption. I don't think "performance optimization" with this level
of drawbacks is appropriate with today's machines any more. Direct
rendering could still be used for non-reference frames, but there's a
second problem: with direct rendering enabled the same buffer is used
for every frame, and with the XShm extension that is used by default
there's no checking that the previous frame has been completely
uploaded to the graphics card before it's overwritten by the next one.
This could be fixed, but as Xv is becoming obsolete I don't see it as
a priority to improve it. Thus I'm simply removing the parts of
functionality that were more likely to break things than improve
playback.
2012-03-25 22:30:37 +03:00
Uoti Urpala a3b4f64df4 cosmetics: vf_vo.c: reformat 2012-03-25 22:30:37 +03:00
Uoti Urpala 4f1e4eae99 cosmetics: misc minor cleanups
The deleted ZRM* things were only relevant to vo_zr, which was deleted
earlier.
2012-03-25 22:30:37 +03:00
Uoti Urpala fd50478659 core: improve sub and audio start after timeline part switch
When switching to a timeline part from another file, decoders were
reinitialized after doing the demuxer-level seek. This is necessary
for audio because some decoders read from the demuxer stream during
initialization and the previous stream position before seek could have
been at EOF. However, this initialization sequence could lose first
subtitles or first part of audio.

The problem for subtitles was that the seek itself or audio
initialization could already have buffered subtitle packets from the
new position, and the way subtitles are reinitialized flushes packet
buffers. Thus early subtitles could be lost (even if they were demuxed
- unfortunately demuxers may not know about still active subtitles
earlier in the file, but that's another issue). Fix this by moving
subtitle and video reinitialization before the demuxer seek; they
don't have the problems which prevent that for audio.

Audio initialization can already decode and buffer some output.
However, the seek_reset() call done last would then throw away this
buffered output. Work around this by adding an extra flag to
seek_reset().
2012-03-20 14:51:32 +02:00
Uoti Urpala ec58e5a384 options: move mixer.h options to struct 2012-03-20 14:51:32 +02:00
wm4 7a699cea28 mixer: reindent/cosmetic changes
There should be no real semantic changes.

Remove the mixer_setbothvolume macro, as it was unused.
2012-03-20 14:51:32 +02:00
wm4 7d0c4c3c31 mixer: remove useless includes
These have been unneeded ever since 2004.
2012-03-19 22:55:41 +01:00
Uoti Urpala 7040968be4 core: restructure main play loop, continue audio after video
Restructure parts of the code in the main play loop. The main
functionality difference is that if a video track ends first, now
audio will continue to be played until it ends too.

Now the process also wakes up less often if there's no need to update
video or audio. This will reduce unnecessary wakeups especially when
paused, but may make handling of input events laggier when fd-based
notifications are not supported (like most input on Windows).
2012-03-19 23:05:02 +02:00
wm4 00421e5eec ao_openal: allow setting the OpenAL sub-device
Now "-ao openal:device=<subdevice>" will pass <subdevice> as device to
OpenAL. This allows selecting both the OpenAL backend (OS-level audio
API) and the physical output device.

The available devices can be listed with "-ao openal:device=help".
2012-03-17 21:06:30 +01:00
wm4 c48c0f453b ao_dsound: fix volume controls
The recent changes in mixer.c require the AO to return a volume of
exactly 0 when audio has been muted. Rather than adding just another
special case to mixer.c, fix ao_dsound.c to return previously set
volumes exactly. Because DirectSound volume control is not connected
with the system mixer, which could change the volume without mplayer
knowing, reading the volume back from DirectSound is pointless.

Also, the code tried to calculate log10(0). Clip the volume to 1,
which results in -10000, DirectSound's definition of silence.
2012-03-17 21:06:30 +01:00
wm4 2f9b14916f ao_dsound: don't repeat parts of the audio buffer when playback ends
When layback of a file ends, the audio output doesn't receive new audio
data, but the rest of the data must be played properly. ao_dsound.c
doesn't handle this properly: DirectSound will continue to play the
ringbuffer, even if mplayer doesn't write any data. There's no explicit
way to prevent such a buffer underrun. Try to detect it and stop
playback.
2012-03-17 21:06:30 +01:00
wm4 ea1cc7f3e2 windows support: prefer vo_direct3d_shaders over vo_direct3d
Since "direct3d" has broken color levels with some drivers, and there
is no simple fix for this, prefer "direct3d_shaders".
2012-03-17 21:06:30 +01:00
wm4 8bfac76092 vo_direct3d: fix bug in screenshot code with some pixel formats
A typo caused the height of the image copy to be incorrectly calculated
with some less common pixel formats, when X chroma shift != Y chroma
shift.
2012-03-17 21:06:30 +01:00
wm4 0e92bbef2f vo_direct3d: fix crash when repeatedly reinitializing an uncooperative device 2012-03-17 21:06:30 +01:00
wm4 da4dd6d14b vo_direct3d: stop D3D from switching the FPU to single precision mode
Add the flag D3DCREATE_FPU_PRESERVE, which tells Direct3D not to switch
the FPU to single precision mode. Single precision mode would mean that
all floating point calculations are done in float precision, even if
using double variables.

The MSDN documentation seems to discourage use of this flag with scary
warnings about bad performance and stability, but I suspect in practice
switching off this completely unreasonable behavior is fine.
2012-03-17 21:06:30 +01:00