Merge remote-tracking branch 'origin/master' into my_master

Conflicts:
	mplayer.c
	screenshot.c
ass_mp.c: remove code duplication

mp_ass_configure() (first time setup for subtitle options) and
mp_ass_reload_options() (update options) duplicated the code for
setting some options. There is no reason why they shouldn't use the
same code.
screenshot: enable taking screenshots with subtitles

This will take unscaled snapshots of the video with subs included.

By default nothing changes. You have to trigger this behavior with the
slave command "screenshot 0 2", where the "2" indicates this screenshot
mode.
Add support for playing video from streaming sites with libquvi

This enables playing URLs from libquvi supported streaming sites
directly, e.g. "mplayer http://www.youtube.com/watch?v=...."

Anything opened with mplayer is checked with libquvi. If it looks like
a URL of a supported streaming site, libquvi is used to extract the
media URL, which is then passed to the lower level mplayer code
instead of the HTML URL. Hopefully the libquvi URL checker works well
enough that it doesn't cause any problems with normal URLs, files, or
whatever else mplayer's stream layer accepts.

Add the --libquvi-format option. the option value is directly passed to
libquvi as requested format. The only values that seem to work for any
streaming site seem to be "best" (best quality) and "default" (lowest
quality). The mplayer option defaults to "best" (overriding libquvi's
default).

TODO:
- Does libquvi checking every opened file really not cause problems?
  Should there be a runtime option to disable libquvi use?
  (Probably not an issue.)
- Should we check/set the supported protocol? By default libquvi has
  support for all protocols enabled. In the worst case, it might return
  an URL using a protocol not supported by mplayer, even though it
  could extract URLs with other protocols too.
  (Probably not an issue.)
- Somehow export metadata (like media title) to the mplayer frontend?
windows support: unicode filenames

Windows uses a legacy codepage for char* / runtime functions accepting
char *. Using UTF-8 as the codepage with setlocale() is explicitly
forbidden.

Work this around by overriding the MSVCRT functions with wrapper
macros, that assume UTF-8 and use "proper" API calls like _wopen etc.
to deal with unicode filenames. All code that uses standard functions
that take or return filenames must now include osdep/io.h. stat()
can't be overridden, because MinGW-w64 itself defines "stat" as a
macro. Change code to use use mp_stat() instead.

This is not perfectly clean, but still somewhat sane, and much better
than littering the rest of the mplayer code with MinGW specific hacks.
It's also a bit fragile, but that's actually little different from the
previous situation. Also, MinGW is unlikely to ever include a nice way
of dealing with this.
windows: terminal: unicode, --msgcolor, size change

Make mp_msg() support unicode output, --msgcolor and variable screen
sizes.

Patch reintegrated by wm4.
af: print audio filter chain in verbose mode

The string format used in print_fmt() is taken from init_audio_filters().
af: fix crash when trying to use volume controls with AC3 pass-through

Changing the volume when softvol is enabled or if the audio output driver
doesn't support volume controls causes insertion of the "volume" filter.
This fails with AC3. Since the filter wasn't removed after that, and the
filter chain was in a bogus state, random crashes occured past this
point.

Fix it by reinitializing the filter chain completely on failure. Volume
controls simply won't work. (This can't be fixed, because AC3 is a
compressed format, and would require additional decoding/encoding passes
in order to support arbitrary volume changes.)

This also affects balance controls.
core: remove old EDL mode (--edl option)

Remove the old EDL implementation that was activated with the --edl
option. It is mostly redundant and inferior compared to the newer
demux_edl support, though currently there's no support for using the
same EDL files with the new implementation and the mute functionality
of the old implementation is not supported. The main reason to remove
the old implementation at this point is that the mute functionality
would conflict with following audio volume handling changes, and
working on the old code would be a wasted effort in the long run as at
some point it would be removed anyway.

The --edlout functionality is kept for now, even though after this
commit there is no code that could directly read its output.
configure: disable live555 by default

Latest liblivemedia version disables APIs we need. The code still
exists in the library and the changelog says the old interface can be
enabled with "#define RTSPCLIENT_SYNCHRONOUS_INTERFACE". However, the
code on the library side is disabled by default too, and seems to be
disabled in distro packages, so defining that in the player does not
help (just delays the failure until link time). It's possible the
distro packages will be changed to enable this, but since dropping
live555 support is desirable anyway, change configure to disable
support by default at least for now.

The live555 code is the only part of the source that's in C++.
Including C headers in code compiled as C++ has caused issues at
times, so deleting this code would have a maintenance benefit.
Reportedly the rtsp support in Libav has improved, so there should
be less need for live555.
configure: fix --enable-static

Hack around shell programming breakage that made Libav check fail with
--enable-static.
vo_gl: improve 10-bit YUV->RGB conversion accuracy slightly

Modify the YUV->RGB conversion matrix to take into account the
difference between the same color value being x/255 in a 8-bit texture
and x*256/65535 in a 16-bit texture (actually things are stored as
x*4/65535 for 10-bit color, but that can be ignored here). This 0.4 %
difference in the shader float value could make shades of gray in
10-bit (or generally more than 8 bit) YUV produce RGB values with
green slightly higher than red/blue.
core: do not print garbage with -identify when chapter times are unknown

The current code tried to print -1000 as unsigned integer if the
chapter time was unknown. Print -1 instead. This affects only the
-identify output used for slave mode, such as ID_CHAPTER_0_START.
Use "mplayer2" in version string, not "MPlayer2"

The name "MPlayer2" isn't used anywhere. It's either "MPlayer" or
"mplayer2". Make it more consistent by using "mplayer2" instead.

Note that the version string passed as network user-agent changes from
"MPlayer" to "mplayer2" as well.
Merge remote-tracking branch 'origin/master' into my_master

Conflicts:
	command.c
	mp_core.h
	mplayer.c
	screenshot.c
vo_directx: minor fixes and reformat

Restore hunk disabling overlay when the Window is minimized.

This was accidentally removed in r33657.
Fixes bug 1950.

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

Simplify code handling minimized state.

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

Apply uncrustify to vo_directx.c.

The vast majority of changes are whitespace changes, but in some cases
{} was merged with other lines or a ; was removed after a } from a
switch and similar minor and obviously correct changes.

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

Fix array layout uncrustify messed up.

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

Remove pointless () and {}.

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

Make NULL checks simpler/more consistent.

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

Use FFMIN/FFMAX.

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

Simplify struct initialization.

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

Split out read/write part from data struct and make read-only
struct const.

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

Store fixed-length string directly in struct, avoid pointer indirection.

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

Replace some inappropriate while() loops with for()

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

Simplify some more struct initializations.

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

Avoid typedef.

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

Use struct initializer in one more case.

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

Simplify printing of error strings.

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

Conflicts:

	libvo/vo_directx.c
win32: fix window creation and size handling

This commit fixes various issues with the way the window position and
size is setup. Most importantly, it fixes some bugs with restoring from
fullscreen state.

Rename create_rendering_context() to reinit_window_state(). This function
doesn't create anything, it just sets the window bounds and styles.

Do not use vo_dx/dy for the window position, as video_out.c overwrites it
with each vo_config() call. Use private variables window_x/y instead.

A big cause for issues was that reinit_window_state() accidentally cleared
the WS_VISIBLE style. I suspect that the API call to temporarily hide the
window was a hack to deal with this. Another bug was that the window style
was changed without calling SetWindowPos with SWP_FRAMECHANGED (as the
MSDN documentation says).

Properly initialize window position and size on vo_config following the
same rules as the x11 backend:

- Never change the window position. The window position should be kept, as
  the user might move the window, and resetting the window position e.g.
  during ordered chapter playback is not desired.
- Never change the window size, unless the size of the video changes.

These rules don't apply to fullscreen. When switching from fullscreen to
windowed mode, the backend should restore the previous windowed size and
position. When the VO was reconfigured during playback (vo_config() etc.),
the saved window position and size should be changed according to the
rules above, even if the window was in fullscreen mode during
reconfiguring.

Note that these rules might be perceived as awkward by some users: if you
play multiple files with different resolutions, the window won't be
centered when playing the files after the first. This is not a bug.
win32, vo_directx: don't use vo_dx/dy, directly query window position

This should be a bit robuster than trying to maintain vo_dx/dy.
vo_dy/dy are now completely unused on win32, except for initialization.
win32: different method to force window aspect ratio

The code used WM_WINDOWPOSCHANGING to force an spect ratio. This didn't
behave well if the left/top window borders were used for resizing.
Resizing with these borders changed the screen position of the right/bottom
as well, which is unintuitive and annoying.

Use WM_SIZING instead. Unlike WM_WINDOWPOSCHANGING, WM_SIZING knows about
which border is being used for resizing and can act accordingly.

Note that the calculated window size doesn't necessarily match with the
size mplayer calculates, but this problem exists on x11 as well.
vo_directx: do not clip overlay against screen size

Clipping it makes the video output look extremely crappy. There seems no
good reason to do this, and VirtualBox is fine with overlays larger than
the screen.