Commit Graph

3844 Commits

Author SHA1 Message Date
wm4 b4aedefe80 vo_gl3: support changing cmdline 2012-08-01 01:35:58 +02:00
wm4 e9a18efa2b VO: add mechanisms to change VO commandline for VOs supporting it 2012-08-01 01:06:59 +02:00
wm4 f752212c62 Change <endian.h> include to <sys/types.h>
This seems to be more portable. Should fix compilation on OSX and
FreeBSD. Apparently also works on MinGW-w64.
2012-07-31 23:37:56 +02:00
wm4 89a17bcda6 mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
  but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
  and playlist_prev added. (See etc/input.conf changes.)
  This is a user visible incompatible change, and will break slave-mode
  applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
  anymore, and playlist entries have always exactly one entry. Whenever
  something adds more than one file (like ASX playlists or dvd:// or
  dvdnav:// on the command line), all files are added as separate
  playlist entries.

Note that some of the changes are quite deep and violent. Expect
regressions.

The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)

The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.

Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.

It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.

Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:

    mplayer file1.mkv file2.mkv --no-audio file3.mkv

This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.

This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.

Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).

One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)

There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.

Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.

Add a way to specify per-file options on command line. Example:

    mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3

will have the following options per file set:

    f1.mkv, f4.mkv: -o0 -o3
    f2.mkv, f3.mkv: -o0 -o3 -o1 -o2

The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 21:33:26 +02:00
wm4 17b69493b7 libvo: remove exit_player_bad()
For some reason, these 3 VOs basically call exit() if something
went wrong.
2012-07-30 15:46:05 +02:00
wm4 3c98615069 vo_gl, vo_gl3: honor global --vsync option
Both VOs will now by default try to set vsync according to the global
vsync setting. By default, vsync is enabled, and passing --no-vsync will
disable it.

The --vsync option used to matter for vo_vesa only, but that VO has been
removed.
2012-07-30 01:42:54 +02:00
wm4 43da1e78c4 Rip out 3DNOW support
Ancient AMD specific enhancement to the MMX instruction set. Officually
discontinued by AMD.

Note that support for this was already disabled in the previous commit.
This commit removes the actual code.
2012-07-30 01:38:14 +02:00
wm4 74df1d8e05 Remove compile time/runtime CPU detection, and drop some platforms
mplayer had three ways of enabling CPU specific assembler routines:
a) Enable them at compile time; crash if the CPU can't handle it.
b) Enable them at compile time, but let the configure script detect
   your CPU. Your binary will only crash if you try to run it on a
   different system that has less features than yours.
   This was the default, I think.
c) Runtime detection.

The implementation of b) and c) suck. a) is not really feasible (it
sucks for users). Remove all code related to this, and use libav's CPU
detection instead. Now the configure script will always enable CPU
specific features, and disable them at runtime if libav reports them
not as available.

One implication is that now the compiler is always expected to handle
SSE (etc.) inline assembly at runtime, unless it's explicitly disabled.

Only checks for x86 CPU specific features are kept, the rest is either
unused or barely used.

Get rid of all the dump -mpcu, -march etc. flags. Trust the compiler
to select decent settings.

Get rid of support for the following operating systems:
- BSD/OS (some ancient BSD fork)
- QNX (don't care)
- BeOS (dead, Haiku support is still welcome)
- AIX (don't care)
- HP-UX (don't care)
- OS/2 (dead, actual support has been removed a while ago)

Remove the configure code for detecting the endianness. Instead, use
the standard header <endian.h>, which can be used if _GNU_SOURCE or
_BSD_SOURCE is defined. (Maybe these changes should have been in a
separate commit.)

Since this is a quite violent code removal orgy, and I'm testing only
on x86 32 bit Linux, expect regressions.
2012-07-30 01:37:28 +02:00
wm4 a4bab723b3 fastmemcpy.h: remove code duplication
Remove the mem2agpcpy_pic function, which is obviously duplicated from
the other function in this file.

Untested, as this is only used by the directx and directfb2 VOs.
2012-07-30 01:36:35 +02:00
wm4 273a6623e7 libvo: remove custom assembler memcpy implementations (aka fastmemcpy)
aclib[_template].c contained inline assembler versions of memcpy using
MMX/SSE/3dnow etc. instructions. It's possible that this gave quite a
speed a decade ago, but it's unlikely to have any use on modern
systems. Also, libc implementations already have their own
optimizations for the native memcpy function.

I did not verify my assumptions eith benchmarks, so I could be wrong.

Also note that some platforms have extremely crappy libc
implementations, and it's well possible that these might suffer from a
major performance loss (hello Windows). Unfortunately, I do not care.
2012-07-30 01:33:40 +02:00
wm4 08caadb9c0 bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstr
Replace all uses of bstr() with bstr0().
Also remove the ridiculous C++ workaround.
2012-07-28 23:47:42 +02:00
wm4 74e7a1e937 osd: use libass for OSD rendering
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.
2012-07-28 23:36:07 +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
wm4 f53dcf163d build: remove bin_to_header.py and use TOOLS/file2string.py instead
TOOLS/file2string.py was recently added upstream, so bin_to_header.py
is not needed anymore. Also fix vo_gl3.c, since file2string.py works
slightly different from my script.
2012-07-28 20:44:07 +02:00
wm4 51e198c2a1 Merge remote-tracking branch 'origin/master'
Conflicts:
	.gitignore
	bstr.c
	cfg-mplayer.h
	defaultopts.c
	libvo/video_out.c

The conflict in bstr.c is due to uau adding a bstr_getline function in
commit 2ba8b91a97. This function already existed in this branch.
While uau's function is obviously derived from mine, it's incompatible.
His function preserves line breaks, while mine strips them. Add a
bstr_strip_linebreaks function, fix all other uses of bstr_getline, and
pick uau's implementation.

In .gitignore, change vo_gl3_shaders.h to use an absolute path
additional to resolving the merge conflict.
2012-07-28 17:24:05 +02:00
Stefano Pigozzi 7dfaaa9510 vo_sharedbuffer: remove from autoprobe list
This video output is headless and only intended to work with GUIs
explicitly asking for it. This makes it useless to have it in the
autoprobe list.
2012-07-27 16:53:57 +03:00
Stefano Pigozzi 02add991fb vo_corevideo, vo_sharedbuffer: put private state in vo->priv
These VOs were already using a struct for all private data but the
struct variable itself was static. Change them to store the address in
vo->priv. Also change them to use the new automatic private data
allocation and option parsing mechanism.
2012-07-27 16:52:22 +03:00
Uoti Urpala 31458a51b5 vo_vdpau: disable refresh-aware frame timing when composited
Under a compositing window manager the current VDPAU implementation
behaves differently than without it. Frame flip timing info becomes
incorrect (I guess it only reflects when the frame was sent to the
compositor, not when it was actually shown), and there is no
limitation to at most one frame switch per refresh like without
compositing. Detect whether a compositing window manager is active and
disable refresh-aware frame timing and dropping in this case,
similarly to what fps=-1 would do. This behavior can be controlled
with the new suboption "composite-detect".

Disabling the refresh-aware logic makes timing somewhat less accurate.
Because the video switch rate limit isn't there, the lack of frame
dropping on player side does not impose a hard limit on video FPS, but
does reduce performance somewhat as redundant frames are drawn in
memory.

The existence of a compositing window manager does not guarantee that
the current window is actually composited, so the current check is not
foolproof. In particular, some WMs have support for a "unredirect
fullscreen windows" option. Support for such things could be improved.
2012-07-27 03:40:38 +03:00
Uoti Urpala 0a1fc392b4 vo_vdpau: fix possible crash after preemption
Preemption recovery code could change the vc->vdp pointer when
recreating the VDPAU device. However, some other code cached the value
of vc->vdp in local variables over calls to handle_preemption(), and
could then crash when using the stale value later. Make the device
creation code keep the same vc->vdp instead of freeing and
reallocating it, so that the old pointer value is never invalidated
now.
2012-07-16 21:08:42 +03:00
Uoti Urpala 39a45c7a17 build: use python3 to generate some files previously in git
Some files used during build are generated with Python scripts in
TOOLS/. Before, the generated files were included in the git tree.
Start creating them at build time. This introduces a build-dependency
on python3.

The files in question are:
libvo/vdpau_template.c
libmpdemux/ebml_types.h
libmpdemux/ebml_defs.c
2012-07-16 21:08:42 +03:00
Uoti Urpala 9426c5f92a VO: implement shared option handling, use for vdpau
Add infrastructure that allows VOs to specify the suboptions they
take, and get the values directly parsed into their private struct.
The option functionality available with the new system is the same as
for top-level player options. Convert vo_vdpau to use the new system
instead of the old subopt_helper.
2012-07-16 21:08:42 +03:00
Stefano Pigozzi dd77d9e912 cocoa: return the real CGLPixelFormatObj
vo_cocoa_cgl_pixel_format is returning a cached CGLPixelFormatObj.
Return the current one by querying the OpenGL context.
2012-05-15 10:37:58 +02:00
Stefano Pigozzi f47f741c5e cocoa: don't request a depth buffer size 2012-05-15 10:37:58 +02:00
Stefano Pigozzi 77be8b1240 cocoa: gl3: make window creation fail on <10.7
Versions of OSX prior to 10.7 do not support OpenGL 3. Fail the window
creation when that is the case.
2012-05-15 10:37:58 +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
Stefano Pigozzi 4a2bd440dd cocoa: handle failure on pixel format creation
This didn't make any difference on with OpenGL 2.1, but with the
introduction of OpenGL3.2 it's possible for the pixel format creation to
fail (if OpenGL3.2 is not supported).

This code handles the failure case accordingly.
2012-05-14 16:28:43 +02:00
wm4 4add4f708e screenshot, vo_png: fix dependency on sizeof(AVFrame)
In order to stay binary compatible with libavcodec, applications should
not dependent on sizeof(AVFrame). This means allocating AVFrame on the
stack is not allowed, and the function avcodec_alloc_frame() must be
used to allocate an AVFrame instead.

Partially based on a patch by uau.
2012-04-29 10:01:55 +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 4251af8d5d cocoa_common: fix problems with alt-tab window changes
Fix alt tabbing to another window in the same workspace. The player
window stayed on top because of a missing call to orderBack:.

Fix alt tabbing to the player window from a different workspace. The
window didn't get activated. Turns out that you must call
makeKeyAndOrderFront: before setLevel: or setPresentationOptions: or
the window will not properly ask for focus.
2012-04-26 21:03:10 +03: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 86790494d3 OSX, input: implement wakeup in response to Cocoa events
Add code to wake up the select() call in input.c when an OSX event is
available and a Cocoa OpenGL backend is initialized.

Fixes the slow response to input or other events in Cocoa-based VOs
during long select() sleeps (e.g., when mplayer2 is paused) introduced
by commit 7040968.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 9646208cc6 vo_sharedbuffer: add this video output
This OSX video output is replaces the previous shared_buffer mode of
vo_corevideo. It manages a shared buffer and a Cocoa distributed
object to communicate with GUIs.

Splitting this code into a separate VO allows to get rid of harmful
code coupling, performance inefficiencies (useless image memory
copies) and ugly code (big if-else conditionals).
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
Stefano Pigozzi d12b9b611a vo_corevideo: use cocoa_common to display the window
Change vo_corevideo to use cocoa_common to create and manage the
window. This doesn't affect external OSX GUIs, since they don't use
vo_corevideo window management, but only read the image data from the
shared buffer.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 237f44db44 vo_corevideo: use soft tabs (4 spaces) 2012-04-26 21:03:10 +03:00
wm4 6bee9a8158 vo_directx: clear panscan borders in windowed mode
The window size is normally clipped against desktop size due to the
usage of WM_SIZING in w32_common.c. This is a useful (if accidental)
feature, but vo_directx didn't handle it well: the areas not covered
by video were filled with the colorkey, which looked ugly.
Explicitly clear these borders with black.
2012-04-24 01:28:09 +02:00
wm4 149d98d244 vo_gl: reject MS Windows native OpenGL as software rasterizer
If the graphics driver doesn't provide its own OpenGL implementation,
applications get Microsoft's OpenGL emulation. Even if it should be the
case that it's not strictly a software renderer, it provides OpenGL 1.1
only, no shaders in any form, and has other limitations that make it
almost completely useless for mplayer.
2012-04-24 01:27:00 +02:00
wm4 025caa9fb5 vo_gl: refuse to use software renderer, unless explicitly requested
vo_gl will now fail at initialization if a software renderer is
detected. This is the same behavior as vo_gl_nosw. Making this the
default behavior is preferable, because it will simplify positioning
vo_gl in the VO autoprobe list (video_out_drivers[]). Also, vo_gl_nosw
exists only if X11 support is configured.

Move gl in place of gl_nosw. Add the "sw" suboption to vo_gl to allow
using vo_gl even if a software renderer is detected.

vo_gl_nosw is now completely equivalent to vo_gl. It is kept in order
not to break too many user configurations, but should be considered
deprecated.
2012-04-24 01:25:33 +02:00
wm4 70fe8d12fa win32: don't crash if vo_w32_uninit() is called without vo_w32_init()
This is a recent regression. At least vo_direct3d uses vo_w32_uninit()
in this way, and crashed if initialization failed at an early point.
2012-04-24 01:25:10 +02: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 b6b09b23f6 win32: fix handling of AltGr
Windows implicitly enables Ctrl+Alt on AltGr. These modifiers are
unwanted for keys that have special mappings on AltGr.

Add warning about different behavior on wine.
2012-04-14 18:29:28 +02:00
wm4 3bb456b14d win32: simplify icon loading
I have no idea why the code used this roundabout method.
Also detab mplayer.rc.
2012-04-14 17:03:11 +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 8c041127d1 win32: use GetKeyState() instead of maintaining the state manually 2012-04-14 17:02:03 +02:00
wm4 47371bdb94 Merge remote-tracking branch 'origin/master'
Conflicts:
	libvo/vo_kva.c
2012-04-13 17:45:27 +02:00
wm4 4dc0e54d4f win32: prevent modifier keys from getting stuck
Especially Alt would get stuck when using Alt+Tab to change focus.
Apparently Windows doesn't send an appropriate key up message. Solve
this by resetting the modifier state on focus change.
2012-04-13 17:27:18 +02:00
wm4 1d527f0cf2 win32: make F10 key not enter the window menu
Normally, F10 enters the window menu (it's invisible at first, and the
blocking/recursive message handling by Windows makes it look like
mplayer was paused, without much visual indication). Stop this almost
completely useless behavior by signalling Windows that the F10 key was
handled. This makes the F10 key usable as normal mplayer shortcut.

This is probably still somewhat questionable.
2012-04-07 15:46:36 +02:00
wm4 440797ca71 win32: fix behavior of enter key
Windows sends the same character code on CTRL+Enter and CTRL+J. I'm not
sure what's the proper way to deal with this, but the hack added with
this commit seems to work fine.

Just to be sure, don't forward the modified wParam to DefWindowProc.
Add the missing "break;" in the switch statement, which sometimes
produced bogus mouse button events.
Fix the F12 key, which wasn't mapped correctly due to a typo.
2012-04-07 14:47:06 +02:00
reimar 1020ae516b vo_directx: do not do aspect scaling in windowed mode.
This matches behaviour of other vos.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34840 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-04-06 23:56:31 +02:00
wm4 a659429f86 win32: use more unicode functions
Use the *W variants instead of the implicit *A functions. (One could
define the UNICODE macro to switch the functions without suffix from
A to W, but I'm too lazy to figure out how portable that is, etc.)

Also make sure io.h defines a unicode aware printf().
2012-04-06 23:56:30 +02:00
wm4 ce7562705e win32: support key modifiers (shift, ctrl, alt)
Support for this is rather simple, and some combinations of modifiers
and keys don't work. For example, Ctrl+Alt+character is not supported,
because Windows doesn't emit a WM_CHAR in this case.

Also add support for the pause and print screen keys. Remove the
pointless KEY_CTRL translation. Remove KEY_CTRL altogether, because it
was not clear what it was actually supposed to mean.
2012-04-06 23:56:30 +02:00
Uoti Urpala e2fc1f640f build: remove OS/2 support 2012-04-06 17:45:56 +03: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 8793a4c77b gl_common: move header hacks into gl_header_fixes.h
Keep this horrible (but unfortunately necessary) kludge out of the main
code.
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
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
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
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 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 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 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 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 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 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 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 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
wm4 1575ba6293 vo: fix EOSD change detection
The case when the EOSD sub-images changed position, but didn't need
re-upload, wasn't handled correctly. If a subtitle script made text move
over the screen (without any other changes), the subtitle display wasn't
updated. vo_vdpau was not affected, because vdpau directly reads the
sub-image positions on every frame.

The fix could be simpler. It could recreate the vertex array every frame.
This commit keeps the optimization that nothing is done when the libass
native change detection doesn't report any change. Maybe this optimization
isn't worth doing, since recreating the vertex array is relatively cheap
compared to amount of work required to render complicated subtitles.

The eosd_packer_generate function returning 3 boolean flags is ugly.
2012-03-17 21:06:30 +01:00
wm4 1bb08fc1e6 win32: properly set window title
Set the window title on win32 based VOs using the same logic as on X11
and Cocoa.

Until now, the window title when using vo_direct3d and vo_gl was hardcoded
to "MPlayer - The Movie Player", and vo_directx showed "MPlayer". Now it
will show "mplayer2", unless the --title or --use-filename-title options
are used.

Change the internal window class name to the string "mplayer2" too.
2012-03-17 21:06:30 +01:00
wm4 7c6a4e1e98 vo_direct3d: implement screenshots
There are 4 code paths when taking a screenshot:
- textured rendering mode
- StretchRect rendering mode with planar formats
- StretchRect with packed formats
- full-window screenshot mode

The implementation of the full-window mode (capturing the window contents,
instead of the video) is very inefficient: it will create a surface of
desktop size, copy the desktop contents, allocate a new memory image, and
copy in the window contents. The code in screenshot.c will (as of now)
allocate and convert the image from BGR to RGB, and allocate a destination
buffer for the libavcodec PNG writer.

If parts of the mplayer window are obscured, the full-window mode wil
contain these parts as seen on the screen. Parts of the window that are
outside the bounds of the desktop are clipped away. It is not known
whether full-window mode works on multi-monitor setups.
2012-03-17 21:06:30 +01:00
wm4 d813a4ede8 win32: fix fullscreen not working on Windows 7
Switching to fullscreen mode on Windows 7 didn't work: the window position
and size weren't set to fullscreen. It turns out that merely calling
SetWindowLong caused windows to send move/resize messages, which changed
the global variables that were supposed to contain the new window size.
Move the SetWindowLong call out of the way to guarantee that always the
correct values are used.
2012-03-17 21:06:30 +01:00
wm4 0ab7c39a1e vo_direct3d: fix dealing with uncooperative devices
If the Direct3D device is "lost" (e,g, when minimizing mplayer, or when
another application uses Direct3D exclusive mode), we free it and try to
recrate the device. This can fail, and may fail for an extended period of
time, until D3D is available again and the device can be created. So we
basically have to provide all VO functionality while d3d_device is NULL.

Don't terminate if device creation fails, and re-add the NULL checks that
were removed in the commit "vo_direct3d: refactor D3D initialization and
reconfigure code".

If mplayer calls the VO's config() while the D3D device can not be
created, the VO will return an error and mplayer will terminate.
config() is typically called when new files are played, when ordered
chapter boundaries are crossed, or on other events.
2012-03-17 21:06:29 +01:00
wm4 032a3b8272 vo_direct3d: add hack for using 2 channel textures for 10 bit pixel formats
This actually applies to YUV formats with 9-16 bit depths. This hack is
disabled by default, and the VO will use 16 bit textures normally.

It can be enabled by passing the no16bit-textures option is passed to
vo_direct3d. Then the VO will use D3DFMT_A8L8 as texture formats for the
YUV plane (instead of D3DFMT_L16), and compute the sampled two color
values back into one.

In some cases it might be undesireable to use 16 bit texture formats. At
least some OpenGL drivers on Linux (Mesa + Intel) round values sampled
from 16 bit textures back into 8 bit, which loses 8 from 10 bit color
information when playing 10 bit formats. It is unknown whether there are
D3D9 drivers which do this, so this commit might be removed later.
2012-03-17 21:06:28 +01:00
wm4 8393796f0b vo_direct3d: add some debugging options
This is for testing. Most of these make no sense, or even if they do, might
not improve anything.
2012-03-17 21:05:39 +01:00
wm4 c67e1ba4a6 vo_direct3d: refactor D3D initialization and reconfigure code
This simplifies the code and removes code duplication.

There should be no actual semantic differences to the previous code. The
only exception is that the new code doesn't query the display adapter's
desktop pixel format on backbuffer resizing anymore. In my opinion the
format can never change anyway, and if it does, it will cause the D3D
device to become "uncooperative" and we will recreate it in flip_page.

Remove attempts to handle d3d_device when it's NULL (outside of the
initialization paths). d3d_device can only be NULL if recreating a D3D
device, that was in "incooperative" state, fails. The current (and
previous) code seems to assume that this never happens. It is unlikely
that these NULL checks improved correct operation in any way, or at least
they won't anymore after the recent changes done to the code.

If it should be possible that a device can't be reset/recreated for a
while (during display resolution changes? when another D3D application is
in fullscreen mode?), another solution has to be found.

It is unknown why the code recreates the IDirect3D9 interface when the
device was uncooperative. At least on Windows XP + reference rasterizer,
resuming works without recreating it. Leave this code just in case.
2012-03-17 21:05:39 +01:00
wm4 6f02fb1cce vo_direct3d: disable using shaders by default, and add direct3d_shaders VO
Now using the "direct3d" VO will never make use of shaders. Instead, users
are supposed to use the direct3d_shaders VO entry, which is exactly the
same as direct3d, except with shaders enabled by default.

"direct3d" always uses the Direct3D StretcRect API call to render videos.
Playing formats not supported by this function will force mplayer to
insert a scale filter to convert video frames in software.

"direct3d_shaders" prefers shader color conversion, but can fall back to
StretchRect if the format can be handled. (This happens only with some
insignificant packed YUV formats.)
2012-03-17 21:05:39 +01:00
wm4 5ee7797bf8 vo_direct3d: use new VO API, and do some minor reformatting
The minor reformats are mainly about adding more line breaks to fit a 80
column limit.

Using the new VO API implies removing all non-const global variables
(because that is one important goal of the new API), so do that as well.
The code already had all variables in a context struct, and changing all
the functions to pass this context struct along was all what had to be
done.

Also handle redrawing properly: if something changes that requires an
immediate redrawing operation (e.g. setting video equalizers when paused
or when playback is slow), vo->want_redraw should be set, instead of
redrawing on your own.
2012-03-17 21:05:38 +01:00
wm4 1eaf5d2626 vo_direct3d: implement YUV conversion using shaders
Use the 3D rendering functions and shaders to render the video frame. This
is very similar to vo_gl. Most planar formats with varying chroma shifts
and bit depths are supported (including 10 bit), as well as some RGB
formats. The old code that used D3D's StretchRect function is still
available, but will by default be used with the least priority.

Also implement video equalizers and colorspace selection. These use the
same code as vo_gl and vo_vdpau, and are available only if shader YUV
conversion is active.

The rendering is extremely simple and naive, there are no filters etc.

Since compiling shaders seems to require the 500 MB DirectX SDK, all
shaders come in pre-compiled form, and there is no make rule to compile
them. mplayer should be compilable without 500 MB of garbage.
The main problem is that compiling shaders within an application seems to
require d3dx9_*.dll, which isn't installed by default.

Add an option ("disable-texture-align") that allows making the video
textures exactly the same size as the source video. The code used to align
the OSD texture size on 16 for unknown reasons, but since this was perhaps
a good reason, this behavior is kept for video textures as well. (There is
a chance that the alignment improves performance and stability with some
drivers.) Passing this option disables this behavior. It is useful for
reducing texture filtering artifacts at the bottom/right borders.
2012-03-17 21:05:34 +01:00
wm4 cd713b4beb vo_direct3d: reduce number of lock calls in OSD rendering
The code locked the texture once for each OSD object that was rendered.
But there doesn't seem to be any good reason to do that, so lock it only
once during OSD rendering.
2012-03-17 20:58:16 +01:00
wm4 968cb269f3 vo_direct3d: use the same texture management for EOSD and OSD
The OSD code used a shadow texture on systems that don't report
D3DDEVCAPS_TEXTURESYSTEMMEMORY. Do that for EOSD as well. Refactor the
OSD texture management code to reduce code duplication.

I have not the slightest clue about Direct3D9 texture management, so it
seems like a good idea not to do something different for EOSD textures,
even though the OSD code does exactly the same as far as texture handling
goes.

It's also worth noting that D3DDEVCAPS_TEXTURESYSTEMMEMORY doesn't seem to
be supported by most real systems [1], and maintaining a shadow copy in
system memory in order to update textures is required. The previous EOSD
texture code may or may not have worked on some or all real systems, I
can't really tell by reading the MSDN documentation only.

[1] http://www.kludx.com/capability.php?capability=17
2012-03-17 20:58:16 +01:00
wm4 bef7f73d64 windows support: prefer vo_direct3d over vo_directx 2012-03-17 20:58:16 +01:00
wm4 e1826826f9 vo_direct3d: make VO re-config faster by not recreating the whole D3D state
The D3D state (the IDirect3DDevice9 and all textures and buffers) were
released and recreated in the config() function. This is completely
unnecessary. Instead explicitly handle changes. The video surface is only
reallocated if the video format or the video size changes. The OSD texture
is only reallocated if the window size is increased. The EOSD texture is
not released. Since the resize code is reused to deal with reconfig
changes, some of these improvements (and possible bugs) apply to normal
window resizing as well.
2012-03-17 20:58:16 +01:00
wm4 83889cebbc vo_direct3d: don't framestep when paused and OSD is updated
The required feature for this, VOCTRL_REDRAW_OSD, was unimplemented for
unknown reasons. It is trivial to add.

There is still a weird issue when switching the fullscreen state while
paused. I have no idea why this happens. The contents of the video should
survive the window reconfiguration (at least we don't free it), and we
explicitly redraw the screen after fullscreen.
2012-03-17 20:58:16 +01:00
wm4 fdc8b0451c vo_direct3d: add EOSD support
This allows rendering subtitles in display resolution. It also makes
inserting the vf_ass video filter unnecessary.
2012-03-17 20:58:16 +01:00
wm4 0d929bc532 vo_direct3d: minor cleanup
The code assumed the last format passed to query_format will be the one
that is used on playback. This is probably true and thus didn't cause any
bugs, but make query_format side effect free just like the other VOs.
2012-03-17 20:58:16 +01:00