Commit Graph

34839 Commits

Author SHA1 Message Date
wm4 b242aa366b stream: silence clang empty statement warnings
clang printed warnings like:

stream/stream.c:692:65: warning: if statement has empty body [-Wempty-body]
            GET_UTF16(c, src < end - 1 ? get_le16_inc(&src) : 0,;

This macro expands to "if(cond) ;". Replace it with an empty statement
that doesn't lead to a clang warning.
2013-03-19 01:27:48 +01:00
wm4 7ba6675847 input/ar: remove unused variable 2013-03-19 00:59:55 +01:00
Rudolf Polzer 3091394edc mp_msg: print MSGL_STATUS to stderr if stderr is redirected
Of course, status output is still hidden when stderr is a tty which is
not the foreground tty.
2013-03-18 20:42:01 +01:00
Rudolf Polzer b1ae33a355 mp_msg: fix status output disappearing when redirecting INPUT.
Instead, we now check stderr's destination against the foreground tty
for deciding whether we want status output or not.
2013-03-18 20:33:29 +01:00
Rudolf Polzer 3ef58d85ba encoding-example-profiles: for Nokia N900, avoid upscaling
This yields generally smaller files, by avoiding upscaling at all times.
This method may or may not be useful for iOS, needs testing there.

Note: this uses three instances of vf_scale:

1. Scale to target dimensions, ONLY if both are <= original video
   dimensions.
2. Failing that, scale to width*<calculated height by display aspect>,
   ONLY if <calculated height by display aspect> <= original video
   height.
3. Failing that, scale to <calculated width by display aspect>*height.
   When the test before failed, we KNOW that <calculated width by
   display aspect> <= original video width.

So basically, only one of the three scalers should ever be active, as
the last two scalers only can ever have an effect if the aspect ratio
mismatches the video.

As for danger of roundoff errors:

If scaler 1 succeeded, we have won. Scalers 2 and 3 will never do
anything, because display resolution == video resolution. Here it is
crucial that no rounding of video size to display size takes place; in
other words, the target display size already MUST be even, which it is
because we pass 2 to the rounding parameter of the dsize filter.

Scaler 2 and 3 are obviously mutually exclusive, as they depend on
opposite aspect ratio conditions.

We later should put this functionality directly into vf_scale...
2013-03-18 13:27:52 +01:00
wm4 d17e0977ea options: fix --wid
A recent change accidentally set the flags options to -1 (probably
confusing it with the defasult value?), which mistakenly set all flags
and rejected all option values (except 0).
2013-03-18 03:13:28 +01:00
wm4 ea03cc6712 x11_common: remove assumption that video is always centered
The vo_x11_clearwindow_part() function assumed that the video is always
centered. Replace it with a new vo_x11_clear_background() function
instead, which essentially does the same as the old function. It takes
the video rectangle instead of just the video size, and doesn't have to
make the assumption that the video rectangle is centered.

Also make vo_x11 use it (seems advantageous).
2013-03-17 23:01:33 +01:00
wm4 79d35b8f01 video: enable panscan calculations even in windowed mode
This was probably enabled to guarantee that panscan is always reset in
windowed mode. However, the window size should be exactly the video size
in windowed mode, unless in cases where the user forcibly changed the
window size (e.g. --geometry). In the former case, panscan will have no
influence at all, and in the latter case we want it to have influence.
2013-03-17 22:12:16 +01:00
wm4 f86deec58b video: apply --no-keepaspect even on fullscreen
If that's what the user asked for, there's no reason to introduce
special cases to ignore it on fullscreen.

The old behavior is perhaps accidentally due to the fact that aspect
calculations used to be disabled in windowed mode, rather than a
deliberate decision.
2013-03-17 22:07:13 +01:00
wm4 b049ffb330 video: remove rounding of display size to multiples of 2
The code that is changed is responsible for scaling the video size to
display size, so that the resulting video rectangle is letter-boxed
inside the display window. This is before panscan calculations, which
can actually enlarge the video and make it larger than the display size
again. (src_dst_split_scaling() in vo.c takes cares of clipping the
video size to window size.)

I'm not sure why this rounding is done, as using panscan controls can
introduce odd sizes again. The rounding has been part of the code since
the initial commit. On the other hand, this rounding can slightly
influence the aspect ratio of the displayed image to the worse. It
forces the image to be scaled by an additional pixel, without actually
correcting the display size into the other direction.

Although video sizes are usually at least aligned on 2 (and often more),
odd sizes can still happen when playing e.g. anamorphic DVDs.

Remove the additional rounding.

(Note that we still round the _source_ image position and size when the
displayed image is larger than the screen, e.g. when panscan is used.
This is needed by some VOs so that the image source rectangle starts on
full chroma pixels. Maybe this rounding should be moved to the
respective VOs, which includes at least vo_direct3d.)
2013-03-17 22:07:13 +01:00
wm4 1ae1939742 video: remove aspect.h includes from files which don't need it 2013-03-17 22:07:13 +01:00
wm4 4b87cb39a3 video: simplify aspect calculation stuff
Remove lots of weird logic and dead code.

The only difference is that when specifying a monitor aspect ratio, it
will always upscale and never downscale.
2013-03-17 22:07:13 +01:00
wm4 59960baa7f vo_xv: minor simplifications
The draw_osd change is a bit tricky: I guess originally, there was some
intention not to second-guess the generic aspect code, but the result is
the same and the code is more confusing.
2013-03-17 19:07:30 +01:00
wm4 36f5d800d5 vo_x11: accept all swscale formats
There's no reason why there should be a separate vf_scale stage.
2013-03-17 19:07:29 +01:00
wm4 5b6da6e286 vo_corevideo: use generic aspect ratio code
The rescaling is rather silly. vo_get_src_dst_rects() doesn't return an
uncropped image, so the texture coordinates have to be recalculated,
which looks more complicated, but is actually what the other OpenGL VOs
also do.

Tested and fixed by Stefano Pigozzi.
2013-03-17 19:07:29 +01:00
wm4 b424dacbe5 vo_opengl_old: use generic aspect ratio code
Make sure scaled_osd still works. Although this is a completely
worthless feature for a deprecated VO.
2013-03-17 18:51:32 +01:00
wm4 b1b982941d vo_x11: use generic aspect ratio code, refactor
Instead of manually calculating aspect ratio etc., use
vo_get_src_dst_rects(). This has the advantage that we can drop some
special cases in aspect.c later.

Simplify the code, and move resizing the X images from draw_image() to a
new resize() function.

Do some other simplifications. The gXErrorFlag check was actually dead
code, even in mplayer-svn. Special-casing on WinID is not needed
anymore (we created an embedded window, and its size is updated by
x11_common.c).
2013-03-17 18:46:03 +01:00
Stefano Pigozzi ad000fb916 cocoa_common: fix regression when changing videos in fullscreen
I introuced this regression in 8fc0b618d5. The backend would go into
incosistent state caused by calling `vo_cocoa_fullscreen` where it wasn't
needed.

Fixes #44
2013-03-15 22:48:57 +01:00
wm4 a9c9999973 video: use new method to get QP table
This only matters for those who want to use vf_pp. The old API is marked
as deprecated, and doesn't work on Libav. It was broken on FFmpeg, but
has recently started working again - the fields in question were not un-
deprecated though. Instead you're supposed to use a new API, which does
exactly the same thing (what...?).

Also don't pass the QP table with mp_image_copy_attributes() - it
probably does more harm than it's useful.

By the way, with -vf=dlopen=TOOLS/vf_dlopen/showqscale.so, it appears
the table as output by recent FFmpeg is offset by 1 macroblock in X
direction and 2 macroblocks in Y direction, which most likely will
interfere with normal vf_pp operation. However, this is not my problem.

The only real reason for this commit is that we can finally get rid of
all libav* related deprecation warnings. (Though they are constantly
deprecating APIs, so this will not last long.)
2013-03-15 14:21:42 +01:00
wm4 e837d8ddac demux_mkv: support ALAC
Test sample was produced with ffmpeg. Extradata handling closely follows
libavformat/matroskadec.c.
2013-03-15 12:17:39 +01:00
wm4 df4b31c869 input: ignore normal mouse click by default
Apparently this annoyed some users.
2013-03-14 00:10:15 +01:00
Stephen Hutchinson 1877d7933e demux_mkv: Support playing Opus streams in Matroska
FFmpeg recently changed how it writes Opus-in-Matroska to match
the A_OPUS/EXPERIMENTAL name that mkvmerge uses, with the caveat
that things will change and compatibility with old files can get
worked out when the spec is finalized.

This adds both A_OPUS and A_OPUS/EXPERIMENTAL so that *hopefully*
it can play both the newer files that use A_OPUS/EXPERIMENTAL, and
older ones muxed by FFmpeg that were simply A_OPUS, since this is
also what FFmpeg seems to be doing to handle the situation.
2013-03-14 00:07:28 +01:00
wm4 21e4f1680c configure: bump minimum FFmpeg/Libav versions, remove compat hacks
We consider FFmpeg 1.x and Libav 0.9.x releases compatible. Support
for FFmpeg 0.9.x and Libav 0.8.x is considered infeasible and has been
dropped in the previous commits. The bits that break compatibility are
mainly the CodecID renaming (trivial, but would require nasty hacks
everywhere), the avcodec_encode_video2() function (missing in older
releases, mandatory in newer ones), and the resampler changes (older
releases miss lib{av,sw}resample, newer versions removed the
libavcodec resampler).

Remove some other compatibility bits that were needed to for releases
for which we drop support.

The comment about Libav 0.9 in compat/libav.h is incorrect and should
have been 0.8 (the symbol is present in Libav 0.9).
2013-03-13 23:52:04 +01:00
Stefano Pigozzi 048ceef655 af_lavrresample: add new resampling filter to replace the old ones
Remove `af_resample` and `af_lavcresample`. The former is a mess while the
latter uses an API that was long deprecated in libavcodec and is now removed.

`af_lavrresample` rougly has the same features and structure of
`af_lavcresample`.

libswresample fallback by wm4.
2013-03-13 23:51:30 +01:00
wm4 514d8a7c9d video: make use of libavcodec refcounting
Now lavc_dr1.c is not used anymore if libavcodec is recent enough.
2013-03-13 23:51:30 +01:00
wm4 71b09be040 video: prepare for libavcodec refcounting
Some minor refactoring and moving code around.
There should be no functional changes.
2013-03-13 23:51:30 +01:00
wm4 dfe7b3898d demux_lavf: use avg_frame_rate instead of r_frame_rate
r_frame_rate was deprecated and was finally removed from Libav and
FFmpeg git.

Not sure what's the correct replacement. avg_frame_rate may or may not
be worse than the fallback of using the time_base as guess. The
framerate is mostly unused, but needed for frame-based subtitles and for
encoding. (It appears encoding guesses a timebase based on the FPS, and
I'm not sure why we don't just use the source timebase.)
2013-03-13 23:51:30 +01:00
wm4 d8bde114fd Prefix CODEC_ID_ with AV_
The old names have been deprecated a while ago, but were needed for
supporting older ffmpeg/libav versions. The deprecated identifiers
have been removed from recent Libav and FFmpeg git.

This change breaks compatibility with Libav 0.8.x and equivalent
FFmpeg releases.
2013-03-13 23:51:30 +01:00
wm4 ba5fc1d5e6 image_writer: switch to avcodec_encode_video2()
avcodec_encode_video() was deprecated, and was finally removed from
Libav and FFmpeg git.

This change breaks compatibility with Libav 0.8.x. Thank the Libav
developers, not me.
2013-03-13 23:51:29 +01:00
wm4 fd8750c25b af_lavcac3enc: switch to avcodec_encode_audio2()
avcodec_encode_audio() was deprecated, and was finally removed from
Libav and FFmpeg git.

This appears to work. I get heavy A/V desync with -ao alsa and -ao pcm,
but this was already so before this change.
2013-03-13 23:51:29 +01:00
Alexander Preisinger f7ad81737b wayland: remove asserts from egl_create_context
Instead of assert return false on most check.
Removes the redundant second inclusion of the assert header.
2013-03-13 20:01:12 +01:00
Alexander Preisinger db6325853a wayland: simplify egl_create_window
Removes the local ret because it was only in an assert statement and also
removes the window size assignments, because they are already done in
config_wnidow_wayland.
2013-03-13 19:47:11 +01:00
Alexander Preisinger ba43d98ac2 wayland: use the cursor_autohide_delay option
In the previous implemention the backend always assumed 1 second
instead of honoring the cursor_autohide_delay option
2013-03-11 18:31:09 +01:00
Alexander Preisinger f2debeca66 wayland: move window by grabing it
Because the are no server-side-decorations in the available wayland compositors
use grabbing the surface to move it.
2013-03-11 18:24:12 +01:00
wm4 b52f3800c2 configure: add _GNU_SOURCE to CFLAGS by default
In theory, projects have to define feature test macros to enable various
system functionality in system headers. (This is done so to ensure new
identifiers can be added to system headers, without breaking old
programs by causing name conflicts.) This includes macros like
_GNU_SOURCE, _BSD_SOURCE, _POSIX_C_SOURCE etc.

Traditionally, gcc as well as glibc headers implicitly assumed
_GNU_SOURCE if no feature test macros were defined by the user.
clang did this too to ensure compatibility with gcc centric programs
(which in practice includes most Linux programs).

However, it appears recent clang versions started to prefer BSD
traditional function over the POSIX, which switches the definition
of a function used by mp_msg.c:

       pid_t getpgrp(void);                 /* POSIX.1 version */
       pid_t getpgrp(pid_t pid);            /* BSD version */

mp_msg.c expects the POSIX version, while clang gives us the BSD
version, resulting in a compilation failure.

Solve this by defining _GNU_SOURCE. This requests most features from
system headers, and explicitly prefers POSIX definitions over BSD,
which should fix the compilation issue.
2013-03-11 01:06:02 +01:00
wm4 28de5a7891 configure: remove -fomit-frame-pointer and -ffast-math from CFLAGS
-fomit-frame-pointer is enabled by default with recent gcc and clang
compilers if -O2 is used. It also breaks debugging when optimization is
disabled, so it makes absolutely no sense to have -fomit-frame-pointer
explicitly in the CFLAGS.

Get rid of -ffast-math too. It's little more than cargo-culting, and
might actually break NaN handling and such things.
2013-03-11 00:50:01 +01:00
wm4 b1be668b9d vo_opengl: insert a magical glFlush call
Helps a little bit with stuttering with pans and "heavy" subtitles
covering the screen.
2013-03-11 00:44:27 +01:00
Stefano Pigozzi 89aae59e89 cocoa_common: fix window position when bigger than display
Fix a regression introduced in commit 979ce46c64 causing a window to take up
more space than what the display allows.

Add keepCentered:YES, so that the video area is always clipped to the current
visible frame (even when using scale).

Fixes #38.
2013-03-10 17:27:43 +01:00
wm4 bc20f2cb00 core: remove a number of global variables
Move them into per-instance structs. This should get rid of all global
variables in mplayer.c (not counting those referenced by cfg-mplayer.h).

In core/input/ar.c, just remove checking the slave_mode variable. I'm
not sure what this code was supposed to achieve, but slave mode is
broken, slave mode is actually infeasible on OSX (ar.c is completely OSX
specific), and the correct way of doing this would be to disable this
input device per command line switch.
2013-03-08 02:12:53 +01:00
wm4 14427ae2ee core: make more robust against missing libavcodec AVCodecDescriptor entries
Missing entries cause avcodec_descriptor_get() to return NULL, and in
turn mp_codec_from_av_codec_id() will return NULL. This shouldn't
happen, and avcodec_descriptor_get() returning NULL for a valid codec is
clearly a bug.

But make it more robust anyway, and use the decoder's name if this
happens, because I doubt maintainance of the AVCodecDescriptor table
in ffmpeg/Libav will always be perfect and reliable.
2013-03-07 23:42:58 +01:00
Rudolf Polzer fe4213b164 vo_sdl: we don't want to minize the window when losing focus
Because: this makes multi-monitor use entirely useless (as soon as
pointer leaves left screen, mpv gets auto minimized).
2013-03-06 18:10:20 +01:00
wm4 c6e1061161 options: fix panscan controls
The value range was set to 1-99 instead of 0-1. This broke panscan
control with the 'w' and 'e' keybindings.

Broken by commit 1198c03.
2013-03-06 17:29:54 +01:00
wm4 a1a9dc9c85 options: remove --no-vsync
Latest nvidia drivers ignore the application setting, so this switch
makes even less sense than before. It's still possible to control this
with VO specific suboptions.
2013-03-06 00:24:34 +01:00
wm4 3a0d647e0f w32_common: fix compilation
Broken by commit 1198c03.
2013-03-05 17:46:17 +01:00
Alexander Preisinger 1198c031e4 vo: Separate vo options from MPOpts
Separate the video output options from the big MPOpts structure and also only
pass the new mp_vo_opts structure to the vo backend.

Move video_driver_list into mp_vo_opts
2013-03-04 23:32:47 +01:00
wm4 4949992264 Fix missing ctype.h includes
libavutil/common.h stopped including ctype.h, and some source files were
relying on recursive inclusion of this header.
2013-03-04 23:25:45 +01:00
Stefano Pigozzi 39824c071e cocoa_common: fix crash 2013-03-04 23:23:12 +01:00
Stefano Pigozzi a453a0a57b cocoa_common: fix compilation
7686cd7f broke some stuff
2013-03-04 22:51:43 +01:00
wm4 7889e38f21 Remove vo_fps global variable
This is needed by the encode stuff for some reason, so we have to
explicitly pass it. Functionality shouldn't change.
2013-03-04 22:21:57 +01:00
wm4 6ef1a1cddd manpage: fix --no-dts typo 2013-03-04 22:20:54 +01:00