Commit Graph

33292 Commits

Author SHA1 Message Date
Stefano Pigozzi bd8ba89cca vo_gl: cocoa: decouple cocoa_common from gl_common
Remove the useless dependency on MPGLContext from cocoa_common, since
it was used just to access the vo struct. Change gl_common to pass the
vo struct directly to all the cocoa_common functions.
2011-12-06 23:10:54 +01:00
wm4 82118dc35e libvo: change default window title to "mplayer2"
Also change the WM_CLASS "application class" string from "MPlayer" to
"mplayer2". This string is visible as application name in Gnome 3.
2011-12-06 20:32:33 +01:00
wm4 3df6dc718a x11: set window titles as UTF-8
Always set the X11 window title properties as UTF-8. This is a bit tricky
for X11 window properties which are not specified to use UTF-8, such as
WM_NAME.

We also properly set WM_ICON_NAME, which means the window caption and the
text used in the task bar (of the WM has one) will be the same on most
window managers. Before this commit, WM_ICON_NAME was always hardcoded to
"MPlayer", even if --title or --use-filename-title was used.

Also update the window title only on reconfigure, like it is done in
mplayer-svn commit 34380.
2011-12-06 20:32:33 +01:00
wm4 d4de92e808 libvo: remove title argument from struct vo_driver.config
This affects only the "new" VO API. The config() title argument was barely
used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa
GUI backends, which are the only ones properly supporting window titles,
ignored this argument. Remove the title argument.

Add the vo_get_window_title function. All GUI VOs are supposed to use it
for the window title.
2011-12-06 20:32:33 +01:00
Uoti Urpala 92e5414897 ad_ffmpeg: avoid avcodec_close() if avcodec_open() failed
Avoid calling avcodec_close() in uninit() if avcodec_open() failed.
Calling avcodec_close() on a non-open codec context causes a crash
with recent Libav versions.
2011-12-06 19:54:03 +02:00
Uoti Urpala ff6c06ea7a core: minor hrseek tweak (affects vo_vdpau deint frames)
Remove no longer necessary tests from hrseek code. As a result each
field of vo_vdpau framerate-doubling deinterlace modes is now
considered as a possible seek target.
2011-12-06 08:41:12 +02:00
Uoti Urpala 7ac154065f commands: playback speed: better responsiveness without audio
Adjust the scheduled time until next frame when changing playback
speed (only affects behavior without audio). The main case where this
makes a difference is when it would take a noticeably long time to
switch frames with the previous speed and you switch to a faster
speed.
2011-12-06 07:47:46 +02:00
Uoti Urpala 253f62c564 core, vo: new window refresh logic, add slow-video OSD redraw
Remove code refreshing window contents after events such as resize
from vo_vdpau, vo_gl and vo_xv. Instead have them simply set a flag
indicating that a refresh is needed, and have the player core perform
that refresh by doing an OSD redraw. Also add support for updating the
OSD contents over existing frames during slow-but-not-paused playback.

The VOs now also request a refresh if parameters affecting the picture
change (equalizer settings, colormatrix, VDPAU deinterlacing setting).
Even previously the picture was typically redrawn with the new
settings while paused because new OSD messages associated with setting
changes triggered a redraw, but this did not happen if OSD was turned
off.

A minor imperfection is that now window system events can trigger a
single one-frame step forward when using vo_xv after pausing so that
vo_xv does not yet have a copy of the current image. This could be
fixed but I think it's not important enough to bother.
2011-12-06 07:47:35 +02:00
Uoti Urpala ad0348cf0a core, vo: modify OSD redraw architecture, support EOSD
Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over
the current frame. Change this to VFCTRL_REDRAW_FRAME followed by
normal EOSD and OSD drawing calls, then vo_flip_page(). The new
version supports changing EOSD contents for libass-rendered subtitles
and simplifies the redraw support code needed per VO. vo_xv doesn't
support EOSD changes because it relies on vf_ass to render EOSD
contents earlier in the filter chain.

vo_xv logic is additionally simplified because the previous commit
removed the need to track the status of current and next images
separately (now each frame is guaranteed to become "visible" soon
after we receive it as "next", with no VO code running in the interval
between).
2011-12-06 05:03:39 +02:00
Uoti Urpala c9553ce82f vo: do final frame draw only near page flip
Separate passing a new frame to VOs using the new API into two steps.
The first, vo_draw_image(), happens after a new frame is available
from the filter chain. In constrast to old behavior, now the frame is
not actually rendered yet at this point (though possible slice draw
calls can already reach the VO before). The second step,
vo_new_frame_imminent(), happens when we're close enough to the
display time of the new frame that we'll commit to flipping it as the
next action and will not change the OSD over the previous frame any
more.

This new behavior fixes a previous problem with vo_vdpau and vo_gl in
the situation where the player is paused after decoding a new frame
but before flipping it; previously changing OSD in that state would
switch to the new frame as a side effect. It would also allow an easy
way to fix extra output files produced with something like "--vo=png
--frames=1" with precise seeking, but this is not done yet.

The code now relies on a new mp_image from the filter chain staying
valid even after the vf_vo put_image() call providing it returns. In
other words decoders/filters must not deallocate or otherwise
invalidate their output frame between passing it forward and returning
from the decode/filter call.
2011-12-06 02:55:13 +02:00
Stefano Pigozzi 421c840b3c vo_gl: add native mac osx Cocoa backend for vo_gl
Add native Cocoa code to display an OpenGL window. Some of the code is
based on the OpenGL parts of vo_corevideo but I took the time to remove
old code based on Carbon.

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

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

The low precision of the GL_LUMINANCE16 format has just been fixed in
upstream Mesa, but it'll take a while before that fix is available in
distros.
2011-11-25 23:59:49 +02:00
wm4 b65ee1f5ac vo_gl: make shader code generation easier to deal with
The shader code was generated from very long strings with lots of
format specifiers with snprintf calls. It was almost impossible to
quickly tell what variables were inserted where in the shader. Make
this more readable by implementing a kind of simple variable
substitution, which allows replacing the format specifiers in the code
templates with with variable names.
2011-11-25 23:59:49 +02:00
Uoti Urpala 8d6fc26bb9 Merge branch 'screenshot' (early part) 2011-11-25 23:59:23 +02:00
wm4 3215ec05fe vo_xv: implement screenshots
Caveat: the OSD will be included in the screenshots when the screenshot is
taken during normal playback. This doesn't happen when a screenshot is
taken while playback is paused.

Fixing this would introduce a small performance reduction during normal
playback, which is unacceptable for a possibly rarely used optional
feature.

Due to the nature of the Xv API, taking a screenshot of the scaled video
isn't possible either.
2011-11-25 23:56:28 +02:00
wm4 28eaf11cf3 vo_gl: implement screenshots 2011-11-25 23:56:28 +02:00
wm4 0440460d0c vo_vdpau: implement screenshots 2011-11-25 23:56:28 +02:00
wm4 a661bd8f0d video: use talloc for mp_image, abort if out of memory
Make new_mp_image() allocate the struct with talloc and abort() if the
av_malloc for image plane data fails.
2011-11-25 23:56:28 +02:00
wm4 3041ee8d6c core: add screenshot mode for actual VO window contents
The screenshot command normally converts the currently displayed video
frame to an image. Add support for an alternative screenshot mode
that is supposed to capture the real window contents. Such a
screenshot contains a possibly scaled version of the frame, the OSD,
and subtitles.

Add a default key binding Alt+s for taking screenshots in this mode.

This needs special VO support, and might not work with all VOs (this
commit does not yet contain an implementation for any VO, only the
infrastructure).
2011-11-25 23:56:28 +02:00
wm4 01cf896a2f core: add infrastructure to get screenshots from VOs
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot
directly from the VO. If VO support is available, screenshots will be
taken instantly (no more 1 or 2 frames delay). Taking screenshots when
hardware decoding is in use will also work (vdpau). Additionally, the
screenshots will now use the same colorspace as the video display.
Change the central MPContext to be allocated with talloc so that it
can be used as a talloc parent context.

This commit does not yet implement the functionality for any VO (added
in subsequent commits).

The old screenshot video filter is not needed anymore if VO support is
present, and in that case will not be used even if it is present in
the filter chain. If VO support is not available then the filter is
used like before. Note that the filter still has some of the old
problems, such as delaying the screenshot by at least 1 frame.
2011-11-25 23:56:28 +02:00
reimar 9fae75b81c ao_coreaudio: fix crash when using mute with S/PDIF output
RenderCallbackSPDIF might call read_buffer with NULL data. The purpose
is to drain data from the buffer when the output is muted. Add a check
to call av_fifo_drain() in this case.

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34242 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-11-25 05:20:23 +02:00
Zongyao Qu 075edf91f1 ao_coreaudio: fix S/PDIF output on OS X 10.7 2011-11-25 05:19:24 +02:00
Uoti Urpala 3a39fc1fea commands, vd_ffmpeg: fix switch_ratio slave command
The implementation of the switch_ratio command was hacky and called
mpcodecs_config_vo() to reconfigure the filter/VO chain from under an
existing decoder. This call no longer worked properly with vd_ffmpeg
after that started using mpcodec_config_vo2(). Add new video decoder
control command VDCTRL_RESET_ASPECT and use this to tell vd_ffmpeg to
reinitialize the output chain properly.
2011-11-14 20:24:39 +02:00
Uoti Urpala 7b9908dda8 options, core/hrseek: add --hr-seek-demuxer-offset
Some demuxers do not accurately seek to a keyframe before a given
time but instead start too late. This means that precise seeks cannot
work either. Most notably the libavformat mpeg demuxer exhibits this
behavior depending on the file being played (with the internal mpeg
demuxer precise seeks don't work at all). Add new option
--hr-seek-demuxer-offset which can be used as a workaround with such
demuxers. The value of the option is subtracted from the seek target
position given to the demuxer when doing a precise seek.
2011-11-14 20:24:39 +02:00
Uoti Urpala 0aa8df2b7d core/hrseek: support precise seeks in audio-only case
Before, precise seeking only worked if there was a video stream; in
the audio-only case playback always started from the demuxer seek
position. Add code to cut away samples from the demuxer seek position
to the seek target position.
2011-11-14 20:24:39 +02:00
Uoti Urpala 32b2242d67 debian: remove leftover references to deleted OSD menu files 2011-11-14 20:24:39 +02:00
Uoti Urpala fb3d13058f subopt-helper: support "no-" prefix to negate suboptions
Support "no-" prefix to negate boolean suboptions in the subopt helper
(used to parse VO etc suboptions). Previously only "no" was supported,
unlike toplevel options which gained "no-" support earlier.
2011-11-14 20:24:39 +02:00
Uoti Urpala 505f94cef9 vd_ffmpeg: disable slice use that fails with size changes
When not using direct rendering, vd_ffmpeg created an mp_image struct
before calling libavcodec decoder, so that possible slice support
could be checked from the mpi_image and output would be ready for
slice-drawing calls. However, this behavior is unsound with decoders
that can change output size, as the parameters can change after the
mp_image was created. Disable the code creating the mp_image at that
point, which also disables use of slices in this case. Slices are
disabled with threading anyway, so I think trying to add workarounds
to support them is not a high priority.

I think this code has always been buggy, but before common thread use
it was rarely executed because the direct-rendering case was used
instead.
2011-11-14 20:24:39 +02:00
Uoti Urpala dd1b848d92 cleanup: vf_scale.c, vf.c: replace numbers by flag macro names 2011-11-14 20:24:39 +02:00
Uoti Urpala 991d7387b3 cosmetics: vf.[ch]: reformat
Also a couple of smaller changes to other files.
2011-11-14 20:24:36 +02:00
wm4 e3f5043233 core, demux: fix --identify chapter output with ordered chapters
Information about individual chapters was printed during demuxer
opening phase, and total chapter count (ID_CHAPTERS) was printed
according to mpctx->demuxer->num_chapters. When playing a file with
ordered chapters, this meant that chapter information about every
source file was printed individually (even though only the chapters
from the first file would be used for playback) and the total chapter
count could be wrong. Remove the printing of chapter information from
the demuxer layer and print the chapter information and count actually
used for playback in core print_file_properties().

Also somewhat simplify the internal chapters API and remove possible
inconsistencies.
2011-10-25 22:09:33 +03:00
Uoti Urpala c0b7851f23 vd_ffmpeg.c: remove useless realvideo avctx->sub_id setting
Libavcodec has ignored the caller-set sub_id value since 2006.
2011-10-25 20:35:03 +03:00
Uoti Urpala 8b5efd6455 libmenu: remove OSD menu functionality (--menu)
Something like the OSD menu functionality could be useful. However the
current implementation has several problems and would require a
relatively large amount of work to get into good shape. As far as I
know there are few users of the existing functionality. Nobody is
working on the existing code and keeping it compiling at all while
changing other code would require extra work. So delete the menu code
and some related code elsewhere that's used by nothing else.
2011-10-25 07:05:47 +03:00
wm4 b200583403 vo_gl: fix crash with backends lacking control() features
Some functionality provided by the windowing backend (such as x11,
win32) is optional. The function pointers in MPGLContext are NULL if
the functionality is not implemented. Check them before calling them,
instead of crashing. This happened at least on Windows with the
"vo_ontop" command.
2011-10-24 08:36:17 +03:00
wm4 2123bff6fa vo_gl: remove support for nvidia register combiners (yuv=1)
The register combiner color conversion is broken and seems to use a
slightly incorrect color matrix (the image looks gray-ish). Completely
remove all code related to nVidia register combiners.

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

Passing yuv=1 (register combiners) as sub option will print a warning and
use yuv=2 (fragment shaders) instead.
2011-10-24 08:36:17 +03:00
wm4 23fa8e9964 vo_gl: fix crash with ati-hack after 20256a8a64
Using the ati-hack and force-pbo suboptions (both can be enabled
automatically when particular ATI drivers are detected) could lead to
segfaults due to incorrect length calculation.

The problem is that width*((bpp+7)/8) == width*(bpp+7)/8 doesn't hold
true in general. The old code used bpp/8, because bpp was always
guaranteed to be divisible by 8. When commit 20256a8a64 fixed bugs
around 10 bit pixel formats, this assumption was broken, and resulted
in out of bounds memory accesses.

Additionally, the color values that were used to clear image borders
were incorrect and showed up as pink borders on the right/bottom sides
of the video when playing 10 bit content. Make the clear value
approximately correct; the borders are still filled with a single byte
value even though formats with 9-16 bits should be cleared with 2-byte
values with the low byte 0.

This commit also contains some other minor cleanups with no functional
changes.
2011-10-24 08:36:13 +03:00
wm4 64f44ad316 vo_gl: remove mesa-buffer suboption
This option enabled using Mesa specific functions, which have never been
widely supported, and were removed from Mesa in 2010.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb2a66fd0c095fe03be5aaf88c8d48f5867425d3
2011-10-24 07:31:09 +03:00
wm4 c66dd9e1ca vo: sdl: handle key modifiers
Now modifiers such as shift, control, and alt are handled.

Unfortunately this requires a hack to deal with a SDL quirks when combining
CTRL and a letter key.

Also add some missing key syms.
2011-10-24 07:21:32 +03:00
wm4 3eeca4838d vo_gl: move window creation functions from vo_gl.c into gl_common.c
Now all windowing specific code is in gl_common.c.

init_mpglcontext() used to set dummy callbacks for non-optional windowing
callbacks. Remove these, as they only lead to confusion.
2011-10-24 07:19:29 +03:00
wm4 f045abb4c0 vo_gl/sdl: use desktop resolution for fullscreen mode
Before the SDL code would change screen resolution when switching to
fullscreen. Try to keep existing desktop resolution instead.
2011-10-24 06:18:29 +03:00
wm4 bb8781a00a vo_gl: add new vo name "gl_sdl" to make SDL+GL mode available
The actual work is done by the existing SDL code. This commit merely
makes it possible to explicitly select the SDL backend ("gl" alone
uses SDL only if the X11 and win32 backends are not available, while
the new "gl_sdl" always forces use of SDL).

Also disable YUV conversion method autodetection when SDL is used.
This gets rid of a temporary window that appears for a moment and is
immediately closed again. SDL can't deal with the VOFLAG_HIDDEN flag,
which is needed to create an invisible GL context (when the
autodetection is run, the video size isn't yet known to the VO, and
creating a window then resizing would cause problems with window
placement). Instead always pick the fragment program method by default
(yuv=2). This change affects the normal "gl" VO too if it chooses the
SDL backend.
2011-10-24 06:14:19 +03:00
wm4 98b89d4aa7 vo_gl: remove "noaspect" suboption
Apparently this is fully redundant given the global "noaspect" option.
Refuse this suboption, and output an error message suggesting the
correct option.
2011-10-24 06:14:19 +03:00
wm4 c852246cdf vo_gl: convert to new API, clean up code
Reformat vo_gl.c, gl_common.c, gl_common.h.
Remove all global variables and move them into a context struct (the
Windows and SDL backends still refer to global_vo though).
Change vo_gl.c to use the "new" VO API.
2011-10-24 06:13:17 +03:00
wm4 821a313ba1 vo_gl2, vo_matrixview: remove these VOs
Delete the vo_gl2 and vo_matrixview implementations.

vo_gl2 was barely useful anymore. It was a hack based on an old
vo_gl.c version, and all it did differently was rendering the video in
tiles instead of using a single texture. That made it work with some
crappy OpenGL implementations. These days all GPUs support textures of
at least 2048x2048 pixels, which is enough for HD playback. On the
other hand, gl2 suffered from various bugs and deficiencies, all of
which are fixed in gl. Its existence also confused users; many thought
that gl2 is the next version of gl and attempted to use it, even
though it's much worse than gl and they should have used that instead.

Should it turn out that tiling is actually useful, it should be
implemented in vo_gl, instead of keeping vo_gl2 alive.

vo_matrixview was a toy that couldn't even properly display a video.
All it did was display a screensaver-like animation that showed "a
Matrix-like running-text effect". (mplayer is not a screensaver.)
2011-10-24 03:08:48 +03:00
Uoti Urpala 66c3915621 Makefile: fix build without OpenGL after 75eab4f72a
After commit 75eab4f72a ("video, options: implement better YUV->RGB
conversion control"), libvo/csputils.c symbols are required by core
code. However, the file was still only compiled if GL was enabled,
causing a build failure with GL disabled. Fix by making csputils.c
compilation unconditional.
2011-10-24 01:26:03 +03:00
Uoti Urpala 07b7503200 demux_demuxers: fix seeking bug (--audiofile)
Demux_demuxers checked a pts value against 0 to see if it was unset,
but other code uses MP_NOPTS_VALUE for that now. As a result audio and
subtitle streams could seek to a large negative position (effectively
to 0) instead of the correct target position. This broke --audiofile;
the --initial-audio-sync code could compensate for wrong demuxer seek
up to 5 minutes from the start of the file, masking the bug, but
seeking further than that audio would seek to 0 instead.

Note that the current --audiofile implementation using the
demux_demuxers wrapper is a fundamentally unsound design and still not
expected to generally work properly even after fixing this particular
problem.
2011-10-23 03:29:42 +03:00
Uoti Urpala 3dd8b7326c cosmetics: vd_ffmpeg.c: reformat 2011-10-22 03:51:37 +03:00
Uoti Urpala 3595dcc089 audio/video: delete buggy "dynamic plugin" code
Codec selection for audio and video decoding had a "dynamic plugin"
feature that tried to load a shared library for any codec that had not
been enabled at compilation (disabled by default, but could be enabled
with --enable-dynamic-plugins configure switch; for unknown reasons
some distro packages have enabled it). The implementation was buggy
and could cause normal codec selection fallback to fail if the feature
was enabled. I'm not aware of any real uses of such dynamic plugins
and the feature seems questionable anyway (there are no ABI guarantees
that would make it safe to use). Remove the buggy feature.
2011-10-20 02:16:35 +03:00