Commit Graph

36613 Commits

Author SHA1 Message Date
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
wm4 de68b8f23c video: move handling of container vs. stream AR out of vd_lavc.c
Now the actual decoder doesn't need to care about this anymore, and it's
handled in generic code instead. This simplifies vd_lavc.c, and in
particular we don't need to detect format changes in the old way
anymore.
2013-11-23 21:40:51 +01:00
wm4 215b3cedda ao_rsound: fix option types
These are option values, and the option code expects char*.

Not actually tested.
2013-11-23 21:40:33 +01:00
wm4 4c2fb8f3a2 dec_video: make vf_input and hwdec_info statically allocated
The only reason why these structs were dynamically allocated was to
avoid recursive includes in stheader.h, which is (or was) a very central
file included by almost all other files. (If a struct is referenced via
a pointer type only, it can be forward referenced, and the definition of
the struct is not needed.) Now that they're out of stheader.h, this
difference doesn't matter anymore, and the code can be simplified.

Also sneak in some sanity checks.
2013-11-23 21:39:07 +01:00
wm4 02f96efc50 dec_video: remove "initialized" field
It's redundant.
2013-11-23 21:38:39 +01:00
wm4 904c73d2d2 demux: remove gsh field from sh_audio/sh_video/sh_sub
This used to be needed to access the generic stream header from the
specific headers, which in turn was needed because the decoders had
access only to the specific headers. This is not the case anymore, so
this can finally be removed again.

Also move the "format" field from the specific headers to sh_stream.
2013-11-23 21:37:56 +01:00
wm4 639e672bd1 player: rearrange how subtitle context and stream headers are used
Use sh_stream over sh_sub. Use dec_sub (and mpctx->d_sub) instead of the
stream header. This aligns the subtitle code with the recent audio and
video refactoring.

sh_sub still has the decoder context, though. This is because we want to
avoid reinit when switching segments with ordered chapters. (Reinit is
fast, except for creating the ASS_Renderer, which in turn triggers
fontconfig.) Not sure how much this matters, though, because the initial
segment switch will lazily initialize the decoder anyway.
2013-11-23 21:37:15 +01:00
wm4 3486302514 video: move decoder context from sh_video into new struct
This is similar to the sh_audio commit.

This is mostly cosmetic in nature, except that it also adds automatical
freeing of the decoder driver's state struct (which was in
sh_video->context, now in dec_video->priv).

Also remove all the stheader.h fields that are not needed anymore.
2013-11-23 21:36:20 +01:00
wm4 057af4697c options: print lavfi filter list with --vf=lavfi=help 2013-11-23 21:35:52 +01:00
wm4 e99ae17a80 options: don't prefix sub-options with "--" in help output
Commit 0cb9227a added this to the option list help output, but it looks
strange with sub-options.
2013-11-23 21:35:03 +01:00
wm4 b5ed614839 options: implement --pphelp differently
Make it work via --vf=pp:help instead.
2013-11-23 21:34:24 +01:00
wm4 25855059af video: remove vf_pp auto-insertion
This drops the --pp option, which was probably broken for a while. The
option automatically inserted the "pp" filter. The value passed to it
was ignored (which is probably broken, it always selected maximal
quality).

Inserting this filter can be done simply with --vf=pp, so this is not
needed anymore.
2013-11-23 21:30:56 +01:00
wm4 8260590346 options: provide a way for --vf to print custom help
Useful in rather special situations. See following commits.
2013-11-23 21:29:05 +01:00
wm4 acfeb869a3 video: merge vd.c into dec_video.c
I don't feel like the separation ever made sense, and it was hard to
tell which file a function you were looking for was in.
2013-11-23 21:28:28 +01:00