Commit Graph

39581 Commits

Author SHA1 Message Date
wm4 e36f4b6bc1 sub: load .mks files as external subtitles 2014-11-06 00:18:58 +01:00
wm4 b77ac78fed demux_mkv: fix indentation
Meh.
2014-11-05 23:17:55 +01:00
wm4 24e52f6643 demux_mkv: for subtitle preroll, consider all clusters
This considered only index entries that were for the same track ID as
the track used for seeking. This doesn't make much sense for preroll;
it'll just possibly skip clusters, and select an earlier cluster.

One possible negative side-effect is that the preroll might be too tight
now, and miss subtitle packets more often.
2014-11-05 21:54:28 +01:00
wm4 6ab364df4b demux_mkv: apply subtitle preroll only if needed, based on cue index
The demuxer has a hack to seek to the cluster before the target cluster
in order to "catch" subtitle lines that start before the seek target,
but overlap with the video after the seek target.

Avoid this hack if the cue index indicates that there are no overlapping
subtitle packets that can be caught by seeking to the previous cluster.
2014-11-05 21:52:20 +01:00
wm4 805e952d82 demux_mkv: read CueRelativePosition/CueDuration elements
Nothing is done with them yet. This is preparation for the following
commit.

CueRelativePosition isn't even saved anywhere, because I don't intend to
use it. (Too messy for no gain.)
2014-11-05 21:52:07 +01:00
wm4 8f992515cd demux_mkv: index all packets
Instead of indexing only 1 packet per cluster (which is enough for
working seeking), add every packet to the index.

Since on seek, we go through every single index entry, this probably
makes seeking slower. On the other hand, this code is used for files
without index only (e.g. incomplete files), so it probably doesn't
matter much.

Preparation for the following commits.
2014-11-05 21:51:43 +01:00
wm4 ea613c2592 command: use playback time as reference for sub_seek
update_subtitle() already uees playback_pts to make subtitles work
better in no-audio mode. Using get_current_time() usually gets
playback_pts, but also has the advantage that it will use the seek
target time during seeks. This will result in multiple sub_seek commands
doing the right thing (at least as long as they're far enough apart so
that seeking is actually initiated when the second command is run).
2014-11-05 18:47:12 +01:00
wm4 a821e72b81 demux: report 0s readahead time as fallback in some situations
If no packets are queued, the readahead time is obviously 0.

If the end time is smaller than the start time, the problem is probably
that audio and video start at slightly different times - report 0 in
this case too.

Do this because seeing "???" as readahead time is a bit annoying.
2014-11-05 03:03:27 +01:00
wm4 a7686e86ff video: remove swapped-endian image format aliases
Like the previous commit, this removes names only, not actual support
for these formats.
2014-11-05 01:52:20 +01:00
wm4 fce77c05f5 vo_wayland: don't use endian-specific defines
Instead, use the native-endian alias, and switch the wayland format
depending on the target platform's endian.

This drops support for swapped-endian formats, but I think that is ok.
Not only are the affected formats rather ancient and backwards, but
using swapped formats probably does not make any sense for performance
either.

Untested.
2014-11-05 01:52:20 +01:00
wm4 91471deecc video: remove aliases for some rarely referenced image formats
These formats are still supported; you just can't reference them via a
defined constants directly. They are now handled via the generic
passthrough.

(If you want to use such a format, you either have to add the entry
back, or use AV_PIX_FMT_* directly.)
2014-11-05 01:52:19 +01:00
wm4 5fc29e459f video: add image format test program 2014-11-05 01:52:19 +01:00
wm4 7333bc6536 video: passthrough unknown AVPixelFormats
This is a rather radical change: instead of maintaining a whitelist of
FFmpeg formats we support, we automatically support all formats.

In general, a format which doesn't have an explicit IMGFMT_* name will
be converted to a known format through libswscale, or will be handled
by code which can treat pixel formats in a generic way using the pixel
format description, like vo_opengl.

AV_PIX_FMT_UYYVYY411 is a special-case. It's packed YUV with chroma
subsampling by 4 in both directions. Its component order is documented
as "Cb Y0 Y1 Cr Y2 Y3", meaning there's one UV sample for 4 Y samples.
This means each pixel uses 1.5 bytes (4 pixels have 1 UV sample, so
4 bytes + 2 bytes). FFmpeg can actually handle this format with its
generic mechanism in an extremely awkward way, but it doesn't work for
us. Blacklist it, and hope no similar formats will be added in the
future.

Currently, the AV_PIX_FMT_*s allowed are limited to a numeric value of
500. More is not allowed, and there are some fixed size arrays that need
to contain any possible format (look for IMGFMT_END dependencies).

We could have this simpler by replacing IMGFMT_* with AV_PIX_FMT_*
through the whole codebase. But for now, this is better, because we
can compensate for formats missing in Libav or older FFmpeg versions,
like AV_PIX_FMT_RGB0 and others.
2014-11-05 01:52:19 +01:00
wm4 9548f63943 video: handle endian detection in a more generic way
FFmpeg has only a AV_PIX_FMT_FLAG_BE flag, not a LE one, which causes
problems for us: we want to have the LE flag too, so code can actually
detect whether a format is non-native endian. Basically, we want to
reconstruct the LE/BE suffix all AV_PIX_FMT_*s have.

Doing this is hard due to the (messed up) way AVPixFmtDescriptor works.
The worst is AV_PIX_FMT_RGB444: this group of formats describe an
endian-independent access (since no component actually spans 2 bytes,
you only need byte accesses with a fixed offset), so we have to go
through some pain.
2014-11-05 01:41:35 +01:00
wm4 3a50bbf563 video: refuse to allocate image data for hwaccel formats
Makes no sense.
2014-11-05 01:41:35 +01:00
wm4 ffe9c03502 video: get hwaccel flag from pixdesc 2014-11-05 01:41:34 +01:00
wm4 5e9dfe932f player: fix --secondary-sid
Use the "default" selection for the ff-index, not the "no" selection.

Broken by commit f0f83ff.
Fixes #1243.
2014-11-04 18:53:36 +01:00
wm4 bebfaae666 vo_opengl: minimal EGL on X11 support
Pretty useless and only good for testing.

Does not include any form of GLES support.
2014-11-04 01:41:37 +01:00
wm4 dc1d851c92 x11: rely on the Atom cache
XInternAtom() has a 64 entry hash table to avoid network accesses. Rely
on this cache, instead of caching these manually.
2014-11-03 23:01:27 +01:00
wm4 c54f0adacd demux: unbreak build with Libav
....
2014-11-03 22:30:07 +01:00
wm4 5438a8b32e demux: don't account known range for streams that are EOF
This influences the demuxer readahead display. If a stream has reached
EOF, we want to ignore it for the purpose of this calculation.

Note that if a stream contains no packets, it still should cause the
value 0s to be displayed (unless it's EOF), because that's just the
actual situation.
2014-11-03 21:59:20 +01:00
wm4 7c2c1dbe80 demux: fix PTS comparison
This was relying on the fact that timestamps will always be numerically
larger than MP_NOPTS_VALUE, but the trick didn't actually work for
MP_PTS_MIN. Be a bit more sincere, and don't rely on this anymore. This
fixes the comparison, and avoids the readahead amount displaying as
"???" in some situations (since one of the values was NOPTS).
2014-11-03 21:54:49 +01:00
wm4 71d5dd0916 demux: don't consider stream EOF an underrun
In this case, we didn't find any new packets for this stream, even
though we've read ahead as much as possible. (If reading ahead in this
case, the "Too many packets in the demuxer packet queues" error is
normally printed.)

If we do consider this an underrun, handle_pause_on_low_cache() will
pause and show the "buffering" state, which is not useful.

Could also happen on very bad interleaving.
2014-11-03 21:22:12 +01:00
wm4 458a766dc9 demux_mkv: remove minor code duplication 2014-11-03 20:25:21 +01:00
wm4 4e87ac8231 demux_mkv: implement audio skipping/trimming
This mechanism was introduced for Opus, and allows correct skipping of
"preroll" data, as well as discarding trailing audio if the file's
length isn't a multiple of the audio frame size.

Not sure how to handle seeking. I don't understand the purpose of the
SeekPreRoll element.

This was tested with correctness_trimming_nobeeps.opus, remuxed to mka
with mkvmerge v7.2.0. It seems to be correct, although the reported file
duration is incorrect (maybe a mkvmerge issue).
2014-11-03 20:20:28 +01:00
wm4 93e1db0bff ad_lavc: allow skip samples amount to be larger than 1 packet
Apparently we actually need this. At least the following commit would
break without this.
2014-11-03 19:56:38 +01:00
wm4 416c86f3cb command: add window-minimized property (X11 only)
More or less requested by #1237.

Should be simple to extend this to other backends.
2014-11-02 20:55:07 +01:00
wm4 4e2574f025 command: make window-scale property observable
Add a generic mechanism to the VO to relay "extra" events from VO to
player. Use it to notify the core of window resizes, which in turn will
be used to mark all affected properties ("window-scale" in this case) as
changed.

(I refrained from hacking this as internal command into input_ctx, or to
poll the state change, etc. - but in the end, maybe it would be best to
actually pass the client API context directly to the places where events
can happen.)
2014-11-02 20:53:56 +01:00
wm4 61b06f3756 client API: nothing uses the result parameter of mpv_command_node()
Add a comment about this to avoid confusing users of this function. The
parameter is essentially unused, but exists so that we don't need to
add extra APIs if the need for it arises.
2014-11-02 17:46:53 +01:00
wm4 3a95a0887c command: expose mpv version as property
A client API user has no other way to know the version.
2014-11-02 17:44:24 +01:00
wm4 12212a1685 common: fix version variable declarations
This was stupid.
2014-11-02 17:38:07 +01:00
wm4 975e98b3fe player: print anamorphic size only if video is anamorphic
Has been annoying me since forever.
2014-11-02 17:34:02 +01:00
wm4 969757baa0 player: always use demux_chapter
Instead of defining a separate data structure in the core.

For some odd reason, demux_chapter exported the chapter time in
nano-seconds. Change that to the usual timestamps (rename the field
to make any code relying on this to fail compilation), and also remove
the unused chapter end time.
2014-11-02 17:29:41 +01:00
wm4 1cebd16350 player: add --chapters-file option
Note that you can't pass .cue or .edl files to it, at least not yet.

Requested in context of allowing to specify custom chapters. For that
to work well, we probably need to add some sort of chapter metadata
pseudo-demuxer.
2014-11-02 17:23:04 +01:00
wm4 95a5624946 manpage: update --playlist comments
Using the --playlist option is no longer recommended.

A while ago, mpv rewrote all playlist parsers and added some minimal
security mechanisms (like not allowing local file access or unsafe
protocols in remote playlists). Further, mpv can load playlists by
passing them as normal file arguments, without the option.

Now, --playlist is needed only in these situations:
1) loading plaintext files
2) disabling additional security mechanisms
   (e.g. using a remote playlist to play local files)
2014-11-02 16:05:58 +01:00
wm4 0c3df23335 osd: properly wakeup when the OSD function disappears
Fixes #1236.
2014-11-01 17:32:34 +01:00
Stefano Pigozzi 98b1f861cb cocoa: fix fullscreen delay when paused
NSDisableScreenUpdates came to hunt me in the end and when mpv was paused, it
did wait for a frame that never came (because of interaction with the live
resizing code)!
2014-11-01 17:29:10 +01:00
Stefano Pigozzi fccd08f43b build: remove bundle support from waf
Use TOOLS/osxbundle.py instead. It's just better and less hacky.
2014-11-01 17:29:10 +01:00
wm4 dbc41ea3bb ipc: make it possible to receive log messages
The receiving part was implemented, but since no messages are enabled
by default, it couldn't be used.
2014-11-01 15:45:41 +01:00
wm4 de59b87609 ipc: add a command to retrieve API version 2014-11-01 15:45:41 +01:00
wm4 a1e7daf942 ipc: verify resume/suspend commands
Calling mpv_resume() too often is considered an API usage violation,
and will trigger an internal assertion somewhere.
2014-11-01 15:45:40 +01:00
wm4 d915ef7f0f manpage: ipc: fix command name for observe_property 2014-11-01 15:45:40 +01:00
Stefano Pigozzi fba8fedf66 build: remove bundle support from waf
Use TOOLS/osxbundle.py instead. It's just better and less hacky.
2014-11-01 11:00:03 +01:00
wm4 dab6cbca16 player: update meaning of drop_frame_cnt
Rename the variable, update comments, and update the documentation of
the property which returns its value.
2014-11-01 01:07:21 +01:00
wm4 0e97808fc5 player: show AV-desync message in all framedrop modes
This was shown only if decoder-framedropping was enabled, and only if at
least 50 frames were dropped by it. Since drop_frame_cnt used to mean
"number of late frames", this code made sense, but this is not the case
anymore: drop_frame_cnt can be even 0, all while video gets hopelessly
behind audio.

One problem with this is that short desync spikes (which usually can
probably dealt with) will also cause this message to be shown. If it
gets triggered too often, the code will need to be adjusted.
2014-11-01 01:06:22 +01:00
wm4 b66669ef2c build: fix 'ar' invocation when cross-compiling
This shouldn't use the host's 'ar' when building static libs. It only
worked until now because Linux 'ar' is usually built with PE support.

Couldn't confirm whether it works, because this dumb crap is just
broken when cross-compiling to mingw.
2014-11-01 00:28:19 +01:00
wm4 650b57cd6e cache: don't relay STREAM_CTRL_AVSEEK if it's unsupported
Thanks to STREAM_CTRL_HAS_AVSEEK, we actually know whether CTRL_AVSEEK
is implemented at all, and we can avoid a blocking wait on the cache if
demux_lavf sends CTRL_AVSEEK even if it won't wait. I'm hoping this
can't currently happen, but why hope if we can explicitly prevent it.
It'll make us more robust against future changes in libavformat.
2014-11-01 00:05:24 +01:00
wm4 3f3a6b13bd sub: remove osd_get_sub()
Trades one strange thing against another, but seems slightly less
strange.
2014-11-01 00:02:01 +01:00
wm4 75afef6463 command: don't require whitespace before ';' or '#'
This change is probably too simplistic, but most things appear to work,
so I don't care about that now.

Fixes #1232.
2014-10-31 23:56:17 +01:00
wm4 13d408fe8d sub: be more flexible about changes to how subtitles are rendered
For example, if --force-window is used, and video is switched off during
playback, then you need to redecide the rendering method to get subs
displayed correctly.

Do this by moving the state setup code into a function, and call it on
every frame.
2014-10-31 23:43:22 +01:00