Commit Graph

34547 Commits

Author SHA1 Message Date
wm4 237b7491e2 demux: don't use codec_tag for raw PCM formats
In commit 2dd2d9b, raw PCM was switched to always go through ad_lavc,
and mapping codec IDs to mplayer internal codec tags was removed, as it
was not needed anymore. However, some uncompressed audio lavf demuxers
export  their own codec tags, which collide with the existing internal
mplayer codec tags, leading to incorrect raw PCM codec selection based
on the misinterpreted audio tag. Re-add the mapped codec IDs from
2dd2d9b. Map them to an invalid codec tag, so that the generic lavc
decoder is selected (assumes ad_lavc is the decoder for raw PCM).
2013-01-30 00:54:18 +01:00
Stefano Pigozzi a3322cb171 osx_common: cache OSX version number
This commit makes `is_osx_version_at_least` cache the result of reading
`/System/Library/CoreServices/SystemVersion.plist`. Since that is a file
read operation it was bad to use this function frequently (i.e.: when
processing user events).

Remove `is_lion_or_above` (introduced in c9396c0a) as that was a more
specialized wrapper which had the only advantage of adding it's own cache.
2013-01-27 18:38:25 +01:00
wm4 fddba2d529 vo_x11: fix redrawing on expose events
This part wasn't converted when changing to the new OSD redrawing way.
2013-01-27 13:32:39 +01:00
wm4 df80cd379a x11: simplify handling of X Visuals and Colormaps in VOs
Don't force VOs to pick an arbitrary default Visual and Colormap. They
still can override them if needed. This simplifies the X11 VO interface.

Always create a Colormap for simplicity. Using CopyFromParent fails if
the selected visual is not the same of that of the parent window, which
happens for me with vo_opengl.

vo_vdpau and vo_xv explicitly set CWBorderPixel, do that in x11_common
instead (it was already done for native windows, but not for slave mode
windows).

What gl_common did was incorrect in theory: freeing a colormap while a
window uses it will change the colormap of the window to "None", and
the color mapping for such windows is "undefined".
2013-01-27 13:32:27 +01:00
wm4 75164a0e0a x11: fix some obvious video mode switching bugs
The original video mode wasn't reliably restored, so just store the
mode separately.

For some reason, window decorations got into the picture, possibly due
to an incorrect initial window position or something like this.
Normally, the window is positioned and sized such that it covers the
screen entirely, even though the window still has decorations and is
not in fullscreen mode (fullscreen wouldn't be correct, because the
virtual desktop size is not screen size). Hack-fix by forcing window
decorations off when VM-switching.

All in all, VM switching is still buggy and useless.
2013-01-27 13:30:54 +01:00
wm4 0535a14505 x11: reduce VO mode switching code duplication
Some parts for initiating mode switches were duplicated in every VO
supporting X11 (except vo_opengl/gl_common, which didn't support mode
switching). Move this to x11_common.c.

Note that this might be slightly risky: is it really guaranteed that no
VO needed to do "special" setup that depends on X parameters changing
after a mode switch, such as bit depth, visuals etc.? From what I can
see, this shouldn't be the case (X probably can't even change depth on
the fly). Even if this should be a one-way road, VM switching is in
general very useless, and its implementation buggy, so it can just be
removed should unfixable problems arise.
2013-01-27 13:30:54 +01:00
wm4 e4943165c1 x11_common: do not set custom error handler when calling XSelectInput
Do this because we want to remove the global variables required with the
old code. In particular, there doesn't seem any way to set a secure user
data pointer with xlib.

XSelectInput() causes a BadAccess error when some of the requested event
flags are reserved (for exclusive flags like ButtonPress). The custom
error handler caught this and set a global variable, so that the code
could retry the XSelectInput() call without the conflicting flags. Use a
different approach that doesn't need a custom error handler. (Although
we still assume that the error handler doesn't terminate the program.)
2013-01-27 13:30:54 +01:00
wm4 a243acb1de x11: cleanup, refactor
Move things that are used by vo_xv only into vo_xv, same for vo_x11.

Rename some functions exported by x11_common, like vo_init to
vo_x11_common. Make functions not used outsode of x11_common.c private
to that file. Eliminate all global variables defined by x11_common
(except error handler and colormap stuff).

There shouldn't be any functional changes, and only code is moved
around. There are some minor simplifications in the X11 init code, as
we completely remove the ability to initialize X11 and X11+VO
separately (see commit b4d9647 "mplayer: do not create X11 state in player frontend"),
and the respective functions are conflated into vo_x11_init() and
vo_x11_uninit().
2013-01-27 13:30:53 +01:00
Uoti Urpala 9747227e47 windows support: support 64-bit MS Windows in EXTERN_PREFIX definition
The EXTERN_PREFIX definition changed in 94b7db2 needs a separate case
for _WIN64, as MinGW defines both that and _WIN32 but there is no prefix
unlike 32-bit case.

Patch by redxii on http://devel.mplayer2.org/ticket/226
2013-01-27 13:30:53 +01:00
wm4 83c56799cf vf_scale: fix warning 2013-01-27 13:30:53 +01:00
wm4 15ccb8ef1c sws_utils: use libswscale for GBRP output if available
libswscale added support for this recently.
2013-01-27 13:30:53 +01:00
Wessel Dankers d84b572b8c vo_opengl: always dither
Dithering was disabled if the input bit depth was not larger than the
output bit depth of the screen framebuffer. But since scaling, RGB
conversion, and other filters change the number of significant bits
anyway, dithering could still benefit image quality even in these
cases. Always do dithering, unless dithering is completely disabled.

The original intention of this mechanism was not to change the image
needlessly when playing video that matches the native bit depth of the
screen.
2013-01-27 13:27:32 +01:00
wm4 8a7b8c3dd6 stream: fix reconnecting on broken network connections
This didn't work properly for HTTP with libavformat. The builtin HTTP
implementation reconnects automatically on its own, while libavformat
doesn't. Fix this by adding explicit reconnection support to
stream_lavf.c, which simply destroys and recreates the AVIO context.

It mostly works, though sometimes it mysteriously fails, spamming crap
all over the terminal and feeding broken data to the decoders. This is
probably due to itneractions with the cache. Also, reconnecting to
unseekable HTTP streams will make it read the entire stream until the
previous playback position is reached again.

It's not known whether this change makes behavior with "strange"
protocols like RTP better or worse.
2013-01-24 18:56:02 +01:00
wm4 47cec75291 stream: uncrustify stream.c/.h
The formatting almost made me break out in tears.
2013-01-24 17:45:13 +01:00
wm4 42b47624f8 demux_mkv: support V_UNCOMPRESSED video tracks
Tested with a sample generated by: ffmpeg -i in.mkv -an -vcodec rawvideo out.mkv

Also add proper dependencies for the Matroska Perl stuff in Makefile.
2013-01-24 17:45:13 +01:00
wm4 dd96c11d5e stream: implement some HTTP specific options for stream_lavf
The "http:" protocol has been switched to use ffmpeg's HTTP
implementation some time ago. One problem with this was that many HTTP
specific options stopped working, because they were obviously
implemented for the internal HTTP implementation only.

Add the missing things. Note that many options will work for ffmpeg
only, as Libav's HTTP implementation is missing these. They will
silently be ignored on Libav.

Some options we can't fix:
--ipv4-only-proxy, --prefer-ipv4, --prefer-ipv6
    As far as I can see, not even libavformat internals distinguish
    between ipv4 and ipv6.
--user, --passwd
    ffmpeg probably supports specifying these in the URL directly.
2013-01-24 17:45:13 +01:00
wm4 570271c776 cookies: fix crash
This was broken in 3f85094 (probably merge mistake). I guess nobody ever
uses this feature.
2013-01-24 14:32:35 +01:00
wm4 c162b6d64d vd_lavc: add stupid hack to fix decoding of some files with Libav 0.8.x
The decoder returns with AVFrame.format not correctly set for some h264
files (strangely only some). We have to access AVCodecContext.pix_fmt
instead. On newer libavcodec versions, it's the other way around: the
AVCodecContext.pix_fmt may be incorrectly set on pixel format changes,
and you are supposed to use AVFrame.format.

The same problem probably exists on older ffmpeg versions too.
2013-01-24 12:43:36 +01:00
wm4 64b0395e21 sub: add stupid hack for vobsub decoding with Libav
If we detect Libav, always use the old builtin vobsub decoder (in
spudec.c). Note that we do not want to use it for newer ffmpeg, as
spudec.c can't handle the vobsub packets as generated by the .idx
demuxer, and we want to get rid of spudec.c in general anyway.
2013-01-24 12:41:44 +01:00
Uoti Urpala 458c41c5c7 stream_cdda: support latest libcdio version 2013-01-24 12:01:06 +01:00
Rudolf Polzer 8fa59d4655 configure: for now reject the newer libcdio API
A patch supporting the newer API AND the older API is in the works.
2013-01-24 10:45:36 +01:00
Rudolf Polzer 3b22404e07 mp_msg, getch2: unix tty background support
Now, when backgrounded, mpv plays and outputs messages to stdout, but
statusline is not output.

Background<->foreground transitions are detected by signals and polling
the process groups.
2013-01-23 18:05:34 +01:00
wm4 d275e21d6a vo_xv: always try to use native bit depth
Exactly the same issue as with the previous commit. Just like the vdpau
code, this was apparently copy-pasted from the vo_x11 code, even though
it doesn't make much sense.
2013-01-23 16:20:06 +01:00
wm4 d49b58e78f vo_vdpau: always try to native bit depth (makes 30 bit work)
Using vdpau on an X server configured to a bit depth of 30 (10 bit per
component) failed finding a visual. The cause was a hack that tried to
normalize the bit depth to 24 if it was not a known depth. It's unknown
why/if this is needed, but the following things speak against it:
- it prevented unusual bit depths like 30 bit from working
- it wasn't needed with normal bit depth like 24 bit
- it's probably copy-pasted from vo_x11 (where this code possibly makes
  sense, unlike in vo_vdpau)

Just remove this code and look for a visual with native depth.
2013-01-23 15:48:08 +01:00
wm4 2131bdf5b7 options: make --fullscreen not a global option
This was disabled in 4ea60a3 and 70c455a, when all options were still
forced file local, and resetting fullscreen was annoyingly reset when
switching to the next file. mpv keeps all options by default, so this
isn't needed anymore.
2013-01-23 10:57:02 +01:00
wm4 704c0cb2db video: remove -x/-y/-xy options
-x/-y were rather useless and obscure. The only use I can see is
forcing a specific aspect ratio without having to calculate the aspect
ratio float value (although --aspect takes values of the form w:h).
This can be also done with --geometry and --no-keepaspect. There was
also a comment that -x/-y is useful for -vm, although I don't see how
this is useful as it still messes up aspect ratio.

-xy is mostly obsolete. It does two things: a) set the window width to
a pixel value, b) scale the window size by a factor. a) is already done
by --autofit (--autofit=num does exactly the same thing as --xy=num, if
num >= 8). b) is not all that useful, so we just drop that
functionality.
2013-01-23 10:56:47 +01:00
wm4 7885fce7ea video: add --autofit and --autofit-larger options
--autofit=WxH sets the window size to a maximum width and/or height,
without changing the window's aspect ratio.

--autofit-larger=WxH does the same, but only if the video size is
actually larger than the window size that would result when using
the --autofit=WxH option with the same arguments.
2013-01-23 10:56:36 +01:00
wm4 ccaed5eb07 options: allow using % for width and height in --geometry
Now all numbers in the --geometry specification can take percentages.

Rewrite the parsing of --geometry, because adjusting the sscanf() mess
would require adding all the combinations of using and not using %. As
a side effect, using % and pixel values can be freely mixed.

Keep the aspect if only one of width or height is set. This is more
useful in general.

Note: there is one semantic change: --geometry=num used to mean setting
the window X position, but now it means setting the window width.
Apparently this was a mplayer-specific feature (not part of standard X
geometry specifications), and it doesn't look like an overly useful
feature, so we are fine with breaking it.

In general, the new parsing should still adhere to standard X geometry
specification (as used by XParseGeometry()).
2013-01-23 10:56:27 +01:00
wm4 4c56baba40 options: move -geometry parsing to m_option.c
This also means the option is verified on program start, not when the VO
is created. The actual code becomes a bit more complex, because the
screen width/height is not available at program start.

The actual parsing code is still the same, with its unusual sscanf()
usage.
2013-01-23 10:56:11 +01:00
wm4 f2dcdca0c2 video: move handling of -x/-y/-xy options to VO
Now the calculations of the final display size are done after the filter
chain. This makes the difference between display aspect ratio and window
size a bit more clear, especially in the -xy case.

With an empty filter chain, the behavior of the options should be the
same, except that they don't affect vo_image and vo_lavc anymore.
2013-01-23 10:55:00 +01:00
Mad Fish c9396c0aab cocoa_common: improved trackpad scrolling 2013-01-20 23:43:21 +01:00
Mad Fish ec0bd69619 cocoa_common: handle all pending events instead of just one 2013-01-20 16:53:51 +01:00
Mad Fish 5b7327920b ao_coreaudio: use 0 as timeout for CFRunLoopRunInMode
Handle all pending events and exit instead of waiting. When there are lots of
input events (for example, scrolling with trackpad), timeout can add up
to make a huge frame delay. In my tests, if I scroll fast enough, that loop
would never exit.
2013-01-20 16:37:30 +01:00
wm4 326820b0ff video: reset filters on seek
Drop queued frames on seek. Reset the internal state of some filters
that seem to need it as well: at least vf_divtc still produced some
frames using the previous PTS.

This fixes weird behavior with some filters on seeking. In particular,
this could lead to A/V desync or apparent lockups due to the PTS of
filtered frames being too far away from audio PTS.

This commit does only the minimally required work to fix these PTS
related issues. Some filters have state dependent on previously filtered
frames, and these are not automatically reset with this commit (even
vf_divtc and vf_softpulldown reset the PTS info only). Filters that
actually require a full reset can implement VFCTRL_SEEK_RESET.
2013-01-20 03:25:44 +01:00
Rudolf Polzer f7d96fe032 core: make gapless-audio also apply to format changes within a file
Format changes within a file can e.g. happen in MPEG-TS streams. This
fix also fixes encoding of such files, because ao_lavc is not capable of
reconfiguring the audio stream.
2013-01-18 15:09:19 +01:00
Rudolf Polzer 5bcd52178e encoding-example-profiles: typo fixes
The iPhone profiles recursively included themselves. Wonder why it even
worked somewhat...
2013-01-18 13:58:31 +01:00
wm4 3c9b464a73 vf_format: fix forcing output format
This failed with an assert, because the format of the format of the
output image was not set correctly.
2013-01-17 16:40:07 +01:00
wm4 52d1f3cc53 options: also accept ffmpeg pixel format names
Options that take pixel format names now also accept ffmpeg names.
mpv internal names are preferred. We leave this undocumented
intentionally, and may be removed once libswscale stops printing
ffmpeg pixel format names to the terminal (or if we stop passing the
SWS_PRINT_INFO flag to it, which makes it print these).

(We insist on keeping the mpv specific names instead of dropping them
in favor of ffmpeg's name due to NIH, and also because ffmpeg always
appends the endian suffixes "le" and "be".)
2013-01-17 16:39:26 +01:00
wm4 a410d82ade manpage: fix places that still treat FourCCs and pixel formats equal
The video filter chain traditionally used FourCCs for pixel formats.
This was recently changed, but some parts of the manpage were not
updated properly. Now there are two rypes of options: some which take
a FourCC (as used with raw video formats), and some which take a
symbolic format identifier (as used in the video filter chain).

I realize that it's harder to specify FourCC for RGB formats now (TV
stuff may need RGB). They use non-printable characters as part of the
FourCC, and have to be specified as hexadecimal numbers (instead of
a symbolic identifier). Because I can't be bothered to find out what
these numbers are for the respective formats, just remove the old
pseudo-FourCCs from the documentation.
2013-01-17 16:38:03 +01:00
Stefano Pigozzi 89a49ffd74 osxbundle: cocoa_common: change playlist on fileopen events
When opening new files in Finder when `mpv` is running from an application
bundle, the new files will now replace the current playlist.

Fixes #14
2013-01-16 22:27:04 +01:00
Stefano Pigozzi 60755108a6 input: enqueue commands to the end of the queue
`mp_input_queue_cmd` erroneusly added commands to the head of the queue
resulting in LIFO behaviour instead of the intended FIFO.
2013-01-16 22:16:28 +01:00
Stefano Pigozzi 1bbcb15d8e osxbundle: add header padding to the binary
This avoids install_name_tool to run out of header space when changing the
paths to the dylibs.
2013-01-16 22:16:28 +01:00
wm4 07d14bd323 Silence two compiler warnings
Both should be harmless.
2013-01-16 02:03:21 +01:00
wm4 efcd479e7e vo_opengl_old: add missing include statement
<ctype.h> is needed at least for isalnum(). Most time this worked,
because some ffmpeg or Libav versions recursively include this header
from libavutil/common.h. Fix it so it always works.
2013-01-15 21:16:10 +01:00
Rudolf Polzer 32d2e958a8 vo_sdl: I think the XVidmode hack is no longer needed
I can no longer reproduce the XVidmode related hang.
2013-01-15 12:11:59 +01:00
Rudolf Polzer 708fb47bcb vo_sdl: request "desktop" fullscreen mode if -vm is not used
This is a lot cleaner than our current workaround that first queries the
desktop resolution.
2013-01-15 11:38:04 +01:00
Stefano Pigozzi 645923f634 vo_corevideo: make compile with recent changes
Width and height were removed from mp_image. Use w and h instead.
2013-01-15 01:00:07 +01:00
wm4 a3824d508e video: print filter chain in verbose mode
Somewhat useful to see where filters are auto-inserted and which formats
they take.
2013-01-14 19:19:23 +01:00
wm4 8f5ef883c1 img_format: do not mark hwaccel formats as planar yuv formats 2013-01-14 18:37:17 +01:00
wm4 f0a08a9fdf gl_common: move things used by vo_opengl_old.c only to vo_opengl_old.c
Having this in gl_common is confusing.
2013-01-13 23:30:13 +01:00