Commit Graph

33292 Commits

Author SHA1 Message Date
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 a7fde0bcd9 windows support: use UTF-8 for screenshot filenames 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
wm4 c9ba8ac9d7 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.
2012-03-17 20:58:16 +01:00
wm4 67fcdcd8a3 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.
2012-03-17 20:58:16 +01:00
wm4 32de5df90c 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.
2012-03-17 20:58:16 +01:00
wm4 2449cbde2c 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.
2012-03-17 20:58:16 +01:00
reimar 1dc73836d9 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
2012-03-17 20:58:15 +01:00
wm4 6de8120822 Merge remote-tracking branch 'origin/master' into my_master
Conflicts:
	command.c
	mp_core.h
	mplayer.c
	screenshot.c
2012-03-16 19:14:44 +01:00
wm4 0eb21226cb 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.
2012-03-14 10:29:35 +01:00
wm4 7608a0fac9 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.
2012-03-14 10:27:36 +01:00
Uoti Urpala a816810266 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.
2012-03-09 20:48:55 +02:00
Uoti Urpala 2a2f867218 configure: fix --enable-static
Hack around shell programming breakage that made Libav check fail with
--enable-static.
2012-03-09 20:48:55 +02:00
Uoti Urpala 3f659fd176 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.
2012-03-09 20:48:55 +02:00
Uoti Urpala 7576885677 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.
2012-03-09 20:48:54 +02:00
wm4 8a6b0b813a 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.
2012-03-09 20:48:54 +02:00
wm4 1f6ba56d6a af: print audio filter chain in verbose mode
The string format used in print_fmt() is taken from init_audio_filters().
2012-03-09 20:48:54 +02:00
Martin Herkt f891939b4d windows: terminal: unicode, --msgcolor, size change
Make mp_msg() support unicode output, --msgcolor and variable screen
sizes.

Patch reintegrated by wm4.
2012-03-09 20:48:54 +02:00
wm4 a1244111a7 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.
2012-03-09 20:48:54 +02:00
wm4 40300e3c0c 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.
2012-03-06 20:01:40 +01:00
wm4 8dc0743571 Merge remote-tracking branch 'origin/master' into my_master
Conflicts:
	mplayer.c
	screenshot.c
2012-03-05 22:24:57 +01:00
wm4 24be34f1e9 cleanup: Silence compilation warnings on MinGW-w64
Some of the code, especially the dshow and windows codec loader parts,
are extremely hacky and likely full of bugs. The goal is merely getting
rid of warnings that could obscure more important warnings and actual
bugs, instead of fixing actual problems. This reduces the number of
warnings from over 500 to almost the same as when compiling on Linux.

Note that many problems stem from using the ancient wine-derived
windows headers. There are some differences to the "proper" windows
header. Changing the code to compile with the proper headers would be
too much trouble, and it still has to work on Unix.

Some of the changes might actually break compilation on legacy MinGW,
but we don't support that anymore. Always use MinGW-w64, even when
compiling to 32 bit.

Fixes some warnings in the win32 loader code on Linux too.
2012-03-01 00:22:30 +02:00
wm4 25417a626d windows: fix format string attributes on MinGW
MinGW maps the "printf" format string archetype to the non-standard
MSVCRT functions, even if __USE_MINGW_ANSI_STDIO is defined and set
to 1. We need to use "gnu_printf" to use the format strings as provided
by vsnprintf and similar functions to get correct warnings.

Since "gnu_printf" isn't necessarily available on other GCC compatible
compilers (such as clang), do this only on MinGW.
2012-03-01 00:22:29 +02:00
wm4 eebe9309ec configure: add __USE_MINGW_ANSI_STDIO on MinGW
This makes MinGW redirect certain stdio functions (such as the sprintf
family) from the MSVCRT libc to a standard compliant MinGW
implementation.

This fixes a crash in talloc.c when compiling mplayer with MinGW-w64.
The problem is most likely with talloc_vasprintf(), which calls
vsnprintf with a small buffer and checks its return value to find out
how much space the formatted string requires. Without this commit,
vsnprintf would always return -1, and then the code calls abort().
(lachs0r figured out this one.)
2012-03-01 00:22:29 +02:00
wm4 3dbb18d91a windows support: remove _UWIN define
The _UWIN define causes the mingw headers not to declare deprecated (on
Windows) function names such as open and mkdir. But the code uses these. I
have no idea why this used to work (if it even did), but the original
reason why it was defined seems to have vanished.
2012-03-01 00:22:29 +02:00
wm4 7332ae76b7 configure: allow changing pkg-config binary with --pkg-config 2012-02-29 23:52:27 +02:00
wm4 2e2c03ecb1 configure: use cross toolchain if --target is given
If --enable-cross-compile is specified, passing
--target=i686-w64-mingw32 for example will check if
i686-w64-mingw32-gcc can be used. This is only done if the compiler
isn't specified via --cc or the CC environment variable.

The same is done for some other build tools, such as pkg-config.
(Only the C compiler will try to use a fallback in this case.)
2012-02-29 23:52:27 +02:00
wm4 cca0b196ba configure: disable cross compilation auto detection
This didn't work very well when cross compiling from Linux to Windows:
it tries to execute an .exe file, which succeeds if wine is installed.
As consequence it detects "no" as result.

In general this won't work if emulation for the target architecture is
available. Remove it.
2012-02-29 23:49:43 +02:00
Kovensky 75bc1591e8 configure: fix target triplet check for mingw targets
mingw32 and mingw64's recommended triplets are i686-pc-mingw32 /
x86_64-w64-mingw32, neither has mingw32 in the middle.
2012-02-29 23:49:43 +02:00
Uoti Urpala 0c2a302948 configure: show PKG_CONFIG_PATH and CFLAGS in config.log
When the build wrapper repo scripts run configure they set a custom
PKG_CONFIG_PATH environment variable. Show the value of this in
config.log to make it easier to rerun configure with a tweaked version
of the same parameters. Also show CFLAGS if set, as it's likely to
break things.
2012-02-29 22:49:18 +02:00
wm4 aebdf4f153 screenshot: don't convert image if it's already in required format 2012-02-29 04:38:28 +01:00
wm4 ea7820ab66 screenshot: move code to open file out of image writer functions
This is a minor simplification. The original intend was to only open a
file if opening the image encoder went well, but this obscure special
case is not worth bothering the image writer functions with more error
handling.
2012-02-29 04:28:27 +01:00
wm4 12c44610ad screenshot: make screenshot filenames configurable
This adds the --screenshot-template option, which specifies a template
for the filename used for a screenshot. The '%' character is parsed as
format specifier. These format specifiers insert metadata into the
filename. For example, '%f' is replaced with the filename of the
currently played file.

The following format specifiers are available:

%n      Insert sequence number (padded with 4 zeros), e.g. "0002".
%0Nn    Like %n, but pad to N zeros (N = 0 to 9).
        %n behaves like %04n.
%#n     Like %n, but reset the sequence counter on every screenshot.
        (Useful if other parts in the template make the resulting
        filename already mostly unique.)
%#0Nn   Use %0Nn and %#n at the same time.
%f      Insert filename of the currently played video.
%F      Like %f, but with stripped file extension ("." and rest).
%p      Insert current playback time, in HH:MM:SS format.
%P      Like %p, but adds milliseconds: HH:MM:SS.mmmm
%tX     Insert the current local date/time, using the date format X.
        X is a single letter and is passed to strftime() as "%X".
        E.g. "%td" inserts the number of the current day.
%{prop} Insert the value of the slave property 'prop'.
        E.g. %{filename} is the same as %f. If the property doesn't
        exist or is not available, nothing is inserted, unless a
        fallback is specified as in %{prop:fallback text}.
%%      Insert the character '%'.

The strings inserted by format specifiers will be checked for
characters not allowed in filenames (including '/' and '\'), and
replaced with the placeholder '_'. (This doesn't happen for text that
was passed with the --screenshot-template option, and allows specifying
a screenshot target directory by prefixing the template with a relative
or absolute path.)
2012-02-29 04:14:54 +01:00
wm4 8b69d8a366 screenshot: allow forcing taking screenshots with the video filter
If the screenshot_force video filter is inserted, taking screenshots will
always use the video filter, and skip the VO specific screenshot code.

This can be useful if the VO code causes problems, or if it's intended to
take screenshots from a specific location in the filter chain.

The 'screenshot' filter is intended as fallback, it's not used if possible.
2012-02-29 03:41:14 +01:00
wm4 5fcd29eb40 core: rename --paused to --pause, and improve how pausing is done
Callign add_step_frame is not necessary, because mplayer always decodes
at least one frame when starting a new file. Calling pause_player is
sufficient, and unlike add_step_frame doesn't play any audio.
2012-02-29 03:07:10 +01:00
Uoti Urpala afecdb681b aviheader.c: silence a warning
libmpdemux/aviheader.c:235:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
2012-02-29 02:49:48 +02:00
wm4 4b553cd676 struct stat.st_blocks is not available on MinGW 2012-02-28 23:01:13 +01:00
Uoti Urpala c3ef8607ae vo_png: set AVCodecContext parameters before opening it
Instead of opening avctx in preinit() and setting paramters later,
(re)open it in config() where parameters can be set first. This fixes
a failure to open the codec with new libavcodec versions that check
pix_fmt during avcodec_open2().
2012-02-28 22:17:24 +02:00
Uoti Urpala 9f63c7f17f configure: remove obsolete messages for mtrr / no w32codecs
Remove "Please check mtrr settings at /proc/mtrr" and "NOTE: Win32
codec DLLs are not supported on your CPU" messages printed at the end
of a configure run. mtrr should be irrelevant on today's machines, and
the DLLs are a lot less important nowadays. Also remove mtrr detection
logic that was only used to decide whether or not to print that
message. Bizarrely, there were --enable-mtrr and --disable-mtrr
options for this too (with no effect except for the message).
2012-02-28 03:56:44 +02:00
Uoti Urpala 0e752d5863 vo: reject vo_redraw_frame() if no frames have been drawn
vo_xv crashed if existing frames had been lost due to a config() call
in the middle of a file and vo_redraw_frame() was called. Add checks
to reject vo_redraw_frame() unless at least one frame has been flipped
after the the last configuration change, so individual VOs do not have
to deal with this case.
2012-02-28 03:17:25 +02:00
Uoti Urpala a43a4aafd0 configure, build: support compiling without libpostproc
libpostproc has been removed from Libav and the library now exists as
a separate project. Because it's not essential, separate it from the
Libav library check and allow compiling without it.
2012-02-27 18:18:49 +02:00
Uoti Urpala 9ab501443c configure, ao_alsa: drop support for obsolete ALSA versions
Drop compatibility code for ALSA versions prior to 1.0.9. Change the
configure check to use pkg-config only.
2012-02-27 16:46:56 +02:00
Uoti Urpala 8d20859716 configure: simplify pkg-config handling, drop other tests
Add helper function pkg_config_add() that checks for the presence of a
package and also adds cflags/ldflags if it is found. Change existing
pkg-config-using feature tests to use that. Also change the freetype
test that used a separate libfreetype-config binary before; using
pkg-config instead helps cross-compiling. Drop other kinds of checks
(such as test compiles) from these tests. It's possible that this
could cause problems on some (broken) systems, but that can't be
verified without user testing.
2012-02-27 15:51:35 +02:00
wm4 e00f4992b8 cue: play .bin files as raw PCM audio (even if it means playing noise)
The cue code will open the .bin file with demux_rawaudio if the file
can't be opened otherwise. In case the .bin file isn't in the exact
format demux_rawaudio uses (usually 44100 Hz, 2 ch, s16le PCM), noise
will be played.

This is done only if no other demuxer could open the file, and the
file extension is ".bin".
2012-02-26 21:38:03 +01:00
wm4 021d012c97 core: sort chapters
Ensure that chapters are sorted by time. There are some broken mkv
files that have chapters in random order. Using simple chapter
skipping with the seek_chapter slave command is very confusing and
just doesn't work if the chapters are not in order.

The chapters are resorted every time a chapter is added, that would
make the chapter list unsorted. While this is algorithmically very
stupid, it doesn't require changes per demuxer, or reasoning when
exactly chapters could be added. Turning this into an insertion sort
isn't worth the code, and the added demuxer_sort_chapters() function
could possibly be moved to the "right" place later.

This is not done when ordered chapters are used, because timeline
support uses different data structures for chapters.
2012-02-26 21:29:03 +01:00
Uoti Urpala 9f9bbb3c8b demux_lavf: update growing file size info for AVSEEK_SIZE
demux_lavf was returning a static size value when libavformat queried
file size with AVSEEK_SIZE. Add code to query the stream for possibly
changed value first. This at least improves seeking with growing MPEG
files; before seeks would never go beyond the part of the file that
existed when the stream was first opened.
2012-02-26 05:53:13 +02:00
wm4 8a10f587fc Fix minor memory leak from 2003 2012-02-25 17:52:34 +01:00
wm4 c8efb6d566 input: restore terminal attributes after resume
Install a signal handler on SIGCONT, and restore the terminal
attributes with tcsetattr() if it happens. This is needed with some
shells (such as tcsh) that don't restore the terminal attributes set
by mplayer. Without this, terminal I/O doesn't work as intended after
resume with these shells.

Fixes #155.
2012-02-25 16:40:14 +01:00
Uoti Urpala d0bae74702 osd: erase terminal OSD line with mp_msg() instead of printf()
The terminal OSD line was written with mp_msg(MSGT_CPLAYER, ...) but
erased with printf(). This meant that disabling MSGT_CPLAYER messages
would prevent the terminal line from being printed, but a line
(probably unrelated) would still be cleared. Change the clearing code
to use mp_msg(MSGT_CPLAYER, ...) too.
2012-02-25 16:40:47 +02:00