Commit Graph

36826 Commits

Author SHA1 Message Date
Stefano Pigozzi 54948f1b62 build: remove pointless exception handling in oss check 2013-11-26 21:35:37 +01:00
Stefano Pigozzi 803ff1a283 build: unbreak __get_osslibdir__ on python3
Fixes #370
2013-11-26 21:35:37 +01:00
Stefano Pigozzi 6ead6aa005 cocoa: unlock on uninit
NSLock should be unlocked before dealloc is called on it.
2013-11-26 20:50:35 +01:00
Stefano Pigozzi 4c634762b4 build: check for pthreads with and without additional cflags 2013-11-26 14:16:29 +01:00
Stefano Pigozzi ac245f96e4 av_common: fix typo in comment 2013-11-26 09:06:08 +01:00
Martin Herkt 7d152965ce ao_alsa: do not forcibly disable ALSA resampling
Resampling with non-ancient ALSA setups works fine, so there is no
need to keep this around. Furthermore, as of writing, the default
builtin resampler used by many ALSA setups (taken from libspeex)
actually has higher quality than the default resampling modes of
avresample and swresample.
2013-11-26 02:48:00 +01:00
wm4 8846a2f95c ad_lavc: increase number of packets for initial decode
Apparently just 5 packets is not enough for the initial audio decode
(which is needed to find the format). The old code (before the recent
refactor) appeared to use 5 packets, but there were apparently other
code paths which in the end amounted to more than 5 packets being read.

The sample that failed (see github issue #368) needed 9 packets.

Fixes #368.
2013-11-26 01:49:17 +01:00
wm4 bdd00d8b65 player: don't use a loop when no loop is needed
This used a really weird idiom: a loop that iterates only once, so you
can use break; to jump out of the block.
2013-11-26 01:11:33 +01:00
wm4 fe73b14eb1 player: move code for skipping 0-sized video packets to demuxer
These packets have to be explicitly dropped, because usually libavcodec
uses 0-sized packets to flush delayed frames, meaning just passing
through these packets would have bad consequences.

Normally, libavformat doesn't output 0-sized packets anyway. But I don't
want to take any chances, so don't delete it, and just move it out of
the way to demux.c.
2013-11-26 01:07:32 +01:00
Stefano Pigozzi 49f076d86d build: make cygwin use *nix timers 2013-11-26 00:33:40 +01:00
Stefano Pigozzi 58bf7fd1f3 build: add -mwin32 on cygwin 2013-11-26 00:33:40 +01:00
Stefano Pigozzi 88099c8617 build: add a gdi check for windows
Incidentally this seems wrong in the configure as well because only gl-win32
depends on it instead of also making direct3d depend on this (as I did here).
2013-11-26 00:33:39 +01:00
wm4 ce4d1f461a sub: respect detected language for fuzzy-matched external subtitles
Solve this by passing through the language to the player, which then
uses the generic subtitle selection code to make a choice.

Fixes #367.
2013-11-25 23:41:02 +01:00
wm4 78fa766fcc player: only pause for waiting on cache if it makes sense
If the value for --cache-on-pause is larger than --cache-min, and the
cache runs below --cache-on-pause, but above --cache-min, the logic
would demand to pause the player and then unpause immediately again.
This doesn't make much sense, and alternating the pause state in each
playloop iteration has negative consequences. Add an explicit check to
avoid this situation.
2013-11-25 23:24:50 +01:00
wm4 56d3ff33f1 video: move timestamp determination code to dec_video
This means the code that tries to figure out the timestamp from
demuxer and decoder output is now all in dec_video.c. We set the
final timestamp on the returned image (mp_image.pts), as well as
the d_video->pts field.

The way the player uses d_video->pts field is still a bit messy. Maybe
this could be cleaned up later.
2013-11-25 23:16:22 +01:00
wm4 b5b1692593 video: disable PTS sorting fallback by default
It appears PTS sorting was useful only for avi files (and VfW-muxed
mkv). Maybe it was historically also important for decoders with broken
or non-existent PTS reordering (win32 codecs?). But now that we handle
demuxers which outputs DTS only correctly, it just seems dead weight.

Disable it by default. The --pts-association-mode option is now forced
to always use the decoder's PTS value. You can still enable the old
default (auto) or force sorting. But we will probably remove this option
entirely at some point.

Make demux_mkv export timestamps at DTS when it's in VfW mode. This is
needed to get correct timestamps with the new default mode. demux_lavf
already does that.
2013-11-25 23:14:54 +01:00
wm4 8743d3fbfa demux_lavf: disable genpts by default, remove the builtin genpts hack
This was needed to determine PTS from DTS, but the previous commits
make it unnecessary.

The builtin genpts hack was used for DVD, because libavformat's genpts
essentially went amok on DVD timestamp resets. See commit 65d87091 for
details.
2013-11-25 23:13:46 +01:00
wm4 9f72a9753e demux: export dts from demux_lavf, use it for avi
Having the DTS directly can be useful for restoring PTS values.

The avi file format doesn't actually store PTS values, just DTS. An
older hack explicitly exported the DTS as PTS (ignoring the [I assume]
genpts generated non-sense PTS), which is not necessary anymore due to
this change.
2013-11-25 23:13:01 +01:00
wm4 d8b59aa17f player: merge no-correct-pts with correct-pts code
Now the --no-correct-pts mode is like the normal mode, just with
different timestamp calculations. The semantics should be about the
same as before this commit.
2013-11-25 23:12:18 +01:00
wm4 88fa420b20 player: change semantics of --no-correct-pts
Before this commit, this mode estimated the frame time by subtracting
successive packet PTS values. This is complete non-sense for video
codecs which use reordering. The code compensated frame times for these
non-sense using the FPS value, but confused the rest of the player with
non-sense jumping around timestamps. So, all in all this mode is not
very useful.

Repurpose this mode for fixed frame rate playback. This gives almost the
same behavior as the old mode with forced framerate (--fps option). The
result is simpler and often more robust.
2013-11-25 23:10:18 +01:00
wm4 83dc3a81f1 dec_video: fix function signature
Just why...? And why did this take 7 years?
2013-11-25 23:09:40 +01:00
wm4 4205bbf243 video: pass PTS as part of demux_packet/AVPacket and mp_image/AVFrame
Instead of passing the PTS as separate field, pass it as part of the
usual data structures. Basically, this removes strange artifacts from
the API. (It's not finished, though: the final decoded PTS goes through
strange paths, and filter_video() finally overwrites the decoded
mp_image's pts field with it.)

We also stop using libavcodec's reordered_opaque fields, and use
AVPacket.pts and AVFrame.pkt_pts. This is slightly unorthodox, because
these pts fields are not "really" opaque anymore, yet we treat them as
such. But the end result should be the same, and reordered_opaque is
marked as partially deprecated (it's not clear whether it's really
deprecated).
2013-11-25 23:08:29 +01:00
wm4 51bce52d57 player: warn if PTS association mode switches
This normally shouldn't happen. It does happen with VfW-muxed mkv files,
and would normally happen with avi files (except that we force the
correct association mode using an explicit hack for avi).

This is usually prepended by warnings like:

 Decreasing video pts: 0.125000 < 0.167000

and after the switch, there should be no warnings anymore.

Background: avi likes to use DTS for timestamps instead of PTS.
Basically, there are no proper timestamps in the file, only frame
numbers. And Matroska is insane and stores the made-up DTS instead
of a proper PTS. This will be handled properly later.
2013-11-25 23:07:22 +01:00
Stefano Pigozzi ded99df98a build: don't abort if our OSS implementation isn't from 4Front
Original commit was implemented differently by @bugmen0t. The problem here was
that the waf API was called directly, instead of using our own check_cc (which
defaults, among other things, to non mandatory checks).
2013-11-25 22:26:39 +01:00
Stefano Pigozzi ccb50bfdae build: run oss_audio.c check with oss cflags as well 2013-11-25 22:18:45 +01:00
bugmen0t defbe48dee build: unbreak __get_osslibdir__()
- without Utils.* always returns empty string
- subprocess doesn't need extra quoting for sh -c
- "source" is a bash'ism, not in POSIX sh
- most shell commands embed newline at the end
2013-11-25 22:16:57 +01:00
bugmen0t f26fb0098f build: only check 4Front OSS after passing its CFLAGS 2013-11-25 22:16:11 +01:00
Stefano Pigozzi 2aeeb28dd1 input: discard precise scrolling commands with no value
Apparently Cocoa precise scrolling generates a lot of spurious events with
a delta that is equal to 0.0. Make sure that they are discarded and not added
to the input queue.

Even though this only known to happen with Cocoa, I implemented this at core
level since it makes sense in general.

Fixes: #310
2013-11-25 19:35:52 +01:00
Natanael Copa 98fca35318 build: fix construction of args to pkg-config
This makes it work with pkgconf (https://github.com/pkgconf/pkgconf)

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-11-25 11:00:43 +01:00
Stefano Pigozzi 4aab1d23e6 build: work around bug in waf's bundle installation
waf wrongly installs resources to BundleRoot/Resources instead of
BundleRoot/Contents/Resources. Will post a patch to them later. Either way,
this must worked around until the next waf patch release.
2013-11-25 08:58:31 +01:00
Stefano Pigozzi 8b6e05adff build: add install_files call after the mpv target was defined
This makes it work on cold compiles when there is no `build/` directory and
one does ./waf configure && ./waf install (i.e.: no ./waf build).
2013-11-24 22:23:45 +01:00
eng 9d603e9985 bootstrap.py: check version if waf already exists 2013-11-24 22:14:39 +01:00
Stefano Pigozzi 92779408d3 build: also install mpv CLI binary when building OS X bundle 2013-11-24 22:10:04 +01:00
Stefano Pigozzi cda0222064 gitignore: add generated files by old build system 2013-11-24 18:53:18 +01:00
wm4 dc87c5e452 bootstrap.py: skip download if waf already exists
It seems like a good idea not to generate any additional network traffic
and wait times if we don't have to.

Also print the URL it's downloading from.

Note that if we require a newer waf release, there will be a problem.
Running ./bootstrap.py won't get the newest waf version anymore in case
the old version is in the source dir. Not sure how to handle this.
2013-11-24 17:00:26 +01:00
Stefano Pigozzi efa7f8f376 build: make waf append pkgconfig flags as-is [2]
fixup commit... removes a redundant `return`
2013-11-24 16:01:38 +01:00
Stefano Pigozzi d8f1a57876 build: make waf append pkgconfig flags as-is
waf apparently only appends a pkgconfig flag if it doesn't already exist in
the lib storage. Since our configure often checks for multiple libraries in
one call we want to keep the flags as is. This is especially important to
always keep stuff like -lm in the right place.
2013-11-24 15:57:49 +01:00
Stefano Pigozzi 2231d5e398 travis: remove --disable-doc from libav/ffmpeg configure 2013-11-24 14:47:33 +01:00
wm4 ae709b5c03 player: close demuxer before stream
Demuxer might access stream even when closing. For now, this is not
a real problem (because it didn't actually happen), but it's cleaner.
2013-11-24 14:44:58 +01:00
wm4 4012c4a96e osd: remove mp_osd_res.video_par field
This is not needed anymore, because we decided that the PAR of the
decoded video matters, and not the PAR of the filtered video that
arrives at the VO.
2013-11-24 14:44:58 +01:00
wm4 e5311586ab Rename sub.c/.h to osd.c/.h
This was way too misleading. osd.c merely calls the subtitle renderers,
instead of actually dealing with subtitles.
2013-11-24 14:44:58 +01:00
wm4 df8d00cc1f vd_lavc: improve a comment 2013-11-24 14:44:58 +01:00
Stefano Pigozzi 38b7eede1e build: store dependencies as lists
In Python sets are unordered, so iterating them after converting to a list
always leads to different results. The code iterated on them to collect all
the flags to pass to the compiler, and since the order of the flags changed,
waf would rebuild all of the C files. Seems like in Python 2 this worked as
expected by pure chance.

This commit stores the sets as lists, and converts them to sets when the set
operations are needed.

Fixes #363
2013-11-24 14:31:14 +01:00
Stefano Pigozzi 806b410c6a build: cache compiler defines on the configure context directly 2013-11-24 14:10:35 +01:00
Stefano Pigozzi aaa1b6f683 travis: disable e-mail notifications 2013-11-23 22:31:44 +01:00
wm4 5a3e01fa80 vd_lavc: when falling back to software, revert filter error status
When mpv is started with some video filters set (--vf is used), and
hardware decoding is requested, and hardware decoding would be possible,
but is prevented due to video filters that accept software formats only,
the fallback didn't work properly sometimes.

This fallback works rather violently: it tries to initialize the filter
chain, and if it fails it throws away the frame decoded using the
hardware, and retries with software. The case that didn't work was when
decoding the current packet didn't immediately lead to a new frame. Then
the filter chain wouldn't be reinitialized, and the playloop would stop
playback as soon as it encounters the error flag.

Fix this by resetting the filter error flag (back to "uninitialized"),
which is a rather violent, but somewhat working solution.

The fallback in general should perhaps be cleaned up later.
2013-11-23 22:28:39 +01:00
wm4 f99aff1b31 Reduce stheader.h includes, move stream types to mp_common.h 2013-11-23 22:08:42 +01:00
wm4 36744a30fb Attempt to fix build on older libavcodec versions 2013-11-23 22:08:18 +01:00
wm4 e901bb7c99 audio: respect --end/--length with spdif passthrough
In theory, we can't really do this, because we don't know when a spdif
frame ends. Spdif transports compressed audio through audio setups that
were originally designed for PCM only (which includes the audio filter
chain, the AO API, most audio output APIs, etc.), and to reach this
goal, spdif pretends to be PCM. Compressed data frames are padded with
zeros, until a certain data rate is reached, which corresponds to a
pseudo-PCM format with 2 bytes per sample and 2 channels at 48000 Hz.
Of course an actual spdif frame is significantly larger than a frame
of the PCM format it pretends to be, so cutting audio data on frame
boundaries (as according to the pseudo-PCM format) merely yields an
incomplete and broken frame, not audio that plays for the desired
duration.

However, sending an incomplete frame might still be much better than the
current behavior, which simply ignores --end/--length (but still lets
the video end at the exact end time).

Should this result in trouble with real spdif receivers, this commit
probably has to be reverted.
2013-11-23 21:42:31 +01:00
wm4 f90e7ef7ea video: don't overwrite demuxer FPS value
If the --fps option was given (MPOpts->force_fps), the demuxer FPS value
was overwritten with the forced value. This was fine, since the demuxer
value wasn't needed anymore. But with the recent changes not to write to
the demuxer stream headers, we don't want to do this anymore. So
maintain the (forced/updated) FPS value in dec_video->fps.

The removed code in loadfile.c is probably redundant, and an artifact
from past refactorings.

Note that sub.c will now always use the demuxer FPS value, instead of
the user override value. I think this is fine, because it used the
demuxer's video size values too. (And it's rare that these values are
used at all.)
2013-11-23 21:41:40 +01:00