Commit Graph

34922 Commits

Author SHA1 Message Date
wm4 5148f9f5cc demux: remove retrieval of chapter end time
The frontend doesn't use this.

Also use double for returning the chapter times. Everything uses double
for times, and there's no reason to use float here.
2013-05-06 23:11:11 +02:00
wm4 885c6a2610 Fix some cppcheck / scan-build warnings
These were found by the cppcheck and scan-build static analyzers. Most
of these aren't interesting (the 2 previous commits fix some interesting
cases found by these analyzers), and they don't nearly fix all warnings.
(Most of the unfixed warnings are spam, things MPlayer never cared
about, or false positives.)
2013-05-06 23:11:11 +02:00
wm4 ab776adece vf_yadif: actually set PTS for output frames
The original frame PTS was used instead. Oops...
2013-05-06 23:11:11 +02:00
wm4 b34338ac6f img_format: fix broken condition
This caused all formats with fewer than 8 bits per component marked as
little endian. (Normally, only some messed up packed RGB formats are
endian-specific in this case.)
2013-05-06 23:11:10 +02:00
Uoti Urpala 2cd1a8286b subreader: fix one more unsafe sscanf call with "%["
"%[,.:]" conversion was used with a buffer that could be shorter than
the matched string. Suppress assignment of the conversion since the
value wasn't used anyway, and also limit match length to 1 as it
doesn't look like the intent was to match longer runs of the
characters.

Merged from mplayer2 commit 5cb9aac. Note that the other half of the
mplayer2 commit is already part of the mpv commit d98e61e. (I'm not
sure why. The mplayer2 commit date precedes mpv's, but was pushed long
after the mpv change was pushed; either one of the dates is wrong, or
we did the same work twice - in that case, thanks a lot...)
2013-05-06 23:11:08 +02:00
wm4 5e727c314e stream: fix bad cache behavior introduced by recent commit
Commit 4d14a42, a seemingly harmless change, introduced very bad cache
behavior when the cache isn't forked, such as on Windows, where it uses
threads. Apparently the cache code was designed for forking, and an
unknown obscure condition causes severe performance degradation if a
STREAM_CTRL is sent to the cache on every frame.

Since the cache code is literally insane (uses shared memory + fork(),
and has hacks to make it work with threads, is messed into the stream
code in extra-hacky ways), we just fix it by caching the STREAM_CTRL in
question.

This is also done for some other STREAM_CTRLs that are called on each
frame, such as playback duration. This indicates that the cache code has
some inherent problem with answering such requests in a timely matter,
and that there's no easy way around this.

(Even if the cache is eventually rewritten, these things will probably
have to be cached, otherwise you'd have to forcibly block until the
stream implementation is done with a blocking read. The real question
is why it worked fine with the forked cache, though.)
2013-05-05 21:50:43 +02:00
wm4 ce9a854d54 core: add playback resume feature (manual/opt-in)
A "watch later" command is now mapped to Shift+Q. This quits the player
and stores the playback state in a config file in ~/.mpv/watch_later/.
When calling the player with the same file again, playback is resumed
at that time position.

It's also possible to make mpv save playback state always on quit with
the --save-position-on-quit option. Likewise, resuming can be disabled
with the --no-resume-playback option.

This also attempts to save some playback parameters, like fullscreen
state or track selection. This will unconditionally override config
settings and command line options (which is probably not what you would
expect, but in general nobody will really care about this). Some things
are not backed up, because that would cause various problems. Additional
subtitle files, video filters, etc. are not stored because that would be
too hard and fragile. Volume/mute state are not stored because it would
mess up if the system mixer is used, or if the system mixer was
readjusted in the meantime.

Basically, the tradeoff between perfect state restoration and
complexity/fragility makes it not worth to attempt to implement
it perfectly, even if the result is a little bit inconsistent.
2013-05-05 20:08:11 +02:00
wm4 38ce911704 command: alias video/audio/sub properties to -vid/-aid/-sid
Now vid/aid/sid can be used as properties. video/audio/sub still work,
but they are aliases for the "real" properties.

This guarantees that options/properties use the same value range. One
consequence is that the video/audio/sub properties return "no" as value
if no track is selected instead of -1.
2013-05-05 20:07:05 +02:00
wm4 497ec230bf mplayer: factor config dir creation
Move it into its own function.
2013-05-05 19:35:04 +02:00
wm4 5165e19a23 demux: use talloc for packets
No functional change.
2013-05-05 18:44:24 +02:00
wm4 e4837b2d42 core: ignore backstep command if demuxer is not capable
Also, mark demuxer as not capable if DVD playback is done. The problem
with DVD is that playback time (stream_pts) is not reported frame-exact,
and the time is a "guess" at best.
2013-05-05 18:44:24 +02:00
wm4 e5f18eb825 options: correctly handle things like: dvd://1-2/filename
The "/filename" part was silently dropped when a range of titles is
specified.
2013-05-05 18:44:24 +02:00
wm4 6a0421295e demux_lavf: use demuxer ID for transport streams
Might help mapping tracks correctly to stream_bluray, fixing the
issue with the track language not being reported.
2013-05-05 18:44:24 +02:00
wm4 b8fce1217c demux: use demux_lavf instead of demux_mpg for DVD playback
With the commit "demux_lavf: fix DEMUXER_CTRL_RESYNC", DVD playback
seems to work nicely with demux_lavf, and maybe works even better than
with demux_mpg.

The old demuxer can be forced with: --demuxer=mpegps

If no regressions surface, demux_mpg.c will be deleted later.
2013-05-05 18:44:24 +02:00
wm4 18c383f51b demux_lavf: fix DEMUXER_CTRL_RESYNC
This used the libavformat current position, instead of the mp stream
(which reflects current DVD/Bluray read position). This was broken,
because libavformat won't update its position by calling the user's
stream callbacks, negating the whole point of DEMUXER_CTRL_RESYNC.

Now DVD playback with libavformat seems to work relatively well.
2013-05-05 18:44:24 +02:00
wm4 4ed22795bb demux_lavf: set stream_pts
demux_mpg did the same, and doing this in demux_lavf fixes DVD playback
when using this demuxer.

Additionally this might make bluray work better in the future (but for
now, bluray playback doesn't change as it doesn't report stream PTS yet).
2013-05-05 18:44:24 +02:00
wm4 4ba4d6ef3f demux: report stream time info instead of demuxer info if possible
Needed for bluray and dvd. demux_mpg (used for dvd playback) did this
manually for the time length.
2013-05-05 18:44:24 +02:00
wm4 4d14a42997 stream: add start time reporting
Will be needed to override the demuxer's start time reporting. We could
be lazy and special-case it since the result is always 0 for the streams
that care, but doing it properly is better.
2013-05-05 18:44:24 +02:00
wm4 3644433224 core: move demuxer time reporting to demuxer 2013-05-05 18:44:24 +02:00
wm4 acad31c2d3 core: don't report byte-based playback position with dvd
DVD playback uses a demuxer that signals to the frontend that timestamp
resets are possible. This made the frontend calculate the OSD playback
position based on the byte position and the total size of the stream.
This actually broke DVD playback position display. Since DVD reports a
a linear playback position, we don't have to rely on the demuxer
reported position, so disable this functionality in case of DVD
playback. This reverts the OSD behavior with DVD to the old behavior.
2013-05-05 18:44:23 +02:00
wm4 977dc4c63d csputils: use AVCOL_SPC_YCOCG instead of AVCOL_SPC_YCGCO (fixes Libav build)
This one should probably be blamed on ffmpeg. Its headers contain:

     #define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG

Uh, ok...
2013-05-05 18:44:23 +02:00
wm4 81a1d07b81 manpage: fix option description 2013-05-05 18:44:21 +02:00
wm4 012d297bb1 video: add --hwdec-codecs option to whitelist codecs for hw decoding 2013-05-04 01:38:27 +02:00
wm4 844249317b vd_lavc: allow explicitly selecting vdpau hw decoders
This allows using the vdpau decoders with -vd without having to use
the -hwdec switch (basically like in mplayer).

Note that this way of selecting the hardware decoder is still
deprecated. libavcodec went away from adding special decoder entries
for hardware decoding, and instead makes use of the "hwaccel"
architecture, where hardware decoders use the same decoder names as
the software decoders. The old vdpau special decoders will probably
be deprecated and removed in the future.
2013-05-04 01:36:15 +02:00
wm4 2cb147a2f4 video: support YCgCo colorspace
YCgCo can be manually selected, but will also be used if the decoder
reports YCgCo. To make things more fun, files are sometimes marked
incorrectly, which will display such broken files incorrectly starting
with this commit.
2013-05-04 01:34:29 +02:00
wm4 872aefaa15 vo_opengl: XYZ input support
Useful for the j2k decoder.

Matrix taken from http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
(XYZ to sRGB, whitepoint D65)

Gamma conversion follows what libswscale does (2.6 in, 2.2 out).

If linear RGB is used internally for scaling, the gamma conversion
will be undone by setting the exponent to 1. Unfortunately, the two
gamma values don't compensate each others exactly (2.2 vs. 1/0.45=2.22...),
so output is a little bit incorrect in sRGB or color-managed mode. But
for now try hard to match libswscale output, which may or may not be
correct.
2013-05-04 01:32:50 +02:00
wm4 16d40828ae video: fix setting XYZ flag
Commit 9e0b68a didn't really do this correctly, failure at basic logic.
2013-05-04 01:32:23 +02:00
wm4 767cbb77ed gl_video: use GL_SRGB only if it's really RGB
Use the proper RGB flag instead of !YUV. Currently, this doesn't change
anything, because only RGB and YUV formats are supported.
2013-05-04 01:31:46 +02:00
wm4 35568f84f3 stream: remove unused new_ds_stream() 2013-05-03 21:08:35 +02:00
wm4 71cc8c1581 vf_rotate: fix for some obscure pixel formats
Repurpose the 3 byte case for any unhandled pixel width. Fixes rotation
with e.g. rgb48. Very inefficient, but works.
2013-05-03 21:08:26 +02:00
Alexander Preisinger f8c13d6b66 wayland: fix wrong poll comment, check for errors
We only print an error message when POLLERR or POLLHUP occurrs, as the
something did go horribly wrong and the server will either deal with it or
crash.

Also add POLLOUT to the events.
2013-05-02 23:24:14 +02:00
Alexander Preisinger 68d4cc4536 wayland: avoid iterating over all outputs
If we use the output itself as user data we don't have to iterate over all
outputs when the handle_mode event comes.
2013-05-02 21:01:19 +02:00
Alexander Preisinger 57e0a84715 wayland: remove unused stuff 2013-05-02 21:01:19 +02:00
Alexander Preisinger c0b8c35e3b wayland: use new function xkb_keymap_from_buffer
Bump xkbcommon version and use the new xkb_keymap_from_buffer. This is more
secure, because the from_string expects a 0 terminated string, but this cannot
be guaranteed with mmap.
2013-05-02 21:01:19 +02:00
wm4 0d1cd116d7 Fix compilation with Libav 2013-05-01 17:02:06 +02:00
wm4 9e0b68a385 video: add XYZ support
Needed for the ffmpeg j2k decoder.
2013-05-01 16:26:45 +02:00
Alexander Preisinger 3899e594ea wayland: remove input modifier variable
This variable was never used anywhere.
2013-05-01 15:46:01 +02:00
Alexander Preisinger db0c3d79f8 wayland: use GetTimerMS for hiding mouse cursor
This commit remove a lot of linux specific code, like epoll. It also reduces
the complexity of the code. Instead of epoll we use poll which makes the
wayland backend more portable to other platforms.
2013-05-01 15:41:33 +02:00
Alexander Preisinger 048c68e5c2 wayland: use mpv internal key auto-repeat handling
This removes a good chunk of code trying to recreate key repeat.
Because the wayland protocol and xkbcommon don't have an interface for
auto-repeating pressed keys.
2013-05-01 13:41:07 +02:00
wm4 d98e61ea43 subreader: fix out of bound write access when parsing .srt
This broke .srt subtitles on gcc-4.8. The breakage was relatively
subtle: it set all hour components to 0, while everything else was
parsed successfully.

But the problem is really that sscanf wrote 1 byte past the sep
variable (or more, for invalid/specially prepared input). The %[..]
format specifier is unbounded. Fix that by letting sscanf drop the
parsed contents with "*", and also make it skip only one input
character by adding "1" (=> "%*1[...").

The out of bound write could easily lead to security issues.

Also, this change makes .srt subtitle parsing slightly more strict.
Strictly speaking this is an unrelated change, but do it anyway. It's
more correct.
2013-04-30 00:14:26 +02:00
wm4 1c96f51e36 demux: simplify stream ID business, fix issue with cover art
The stream ID handling as it was changed in commit 654c34f was still
a little bit insane, and caused a regression with the cover art hack
(the stream set in demux->video->sh was incorrect for demux_lavf).

Simplify by always using stream_index for demux_stream->id, and getting
rid of that tid thing. It turns out that the id for subtitles isn't
special either (maybe demux_ts.c was the only thing left that required
this).
2013-04-29 22:59:15 +02:00
Rudolf Polzer 2d8783075f encoding: fix final audio frame sync
When --ocopyts was used, the final audio frame got improper pts. Fixed
by now using the play() logic to play the final frame too.
2013-04-28 11:39:38 +02:00
Stefano Pigozzi 7a42df8712 cocoa_common: fix window sizing
The code was attempting to get the ceiling of the double. Too bad NSSize has
floats inside of it and the int cast is nowhere to be seen. This caused
rounding errors by one pixel in the window size.
2013-04-28 09:55:06 +02:00
Stefano Pigozzi d500297377 subassconverter: silence clang warning 2013-04-28 09:41:39 +02:00
wm4 4982083b2b osd: convert OSD font to OpenType
The old OSD font was a PostScript Type 1 font. Convert it to OpenType
to work around a fontconfig bug [1]. OpenType is a more modern format,
and the font file is quite a bit smaller, so this is actually a nice
change.

The conversion was done by opening the font with fontforge and saving
it as OpenType (CFF). fontforge showed a warning when doing this:

    The font contains errors.
      Self Intersecting
      Bad Private Dictionary

These seem to be harmless.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=63922
2013-04-27 18:03:19 +02:00
reimar daee1a04e7 stream_bluray: remove the broken -bluray-chapter option
Remove the broken -bluray-chapter option.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36175 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	DOCS/man/en/mplayer.1
	cfg-common.h
2013-04-27 15:28:57 +02:00
reimar 2f004875d3 stream_bluray: fix querying current chapter
br://: Fix querying current chapter.

This also fixes specifying an end chapter via -chapter.
Based on patch by Olivier Rolland [billl users.sourceforge.net]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36173 b3059339-0415-0410-9bf9-f77b7e298cf2
2013-04-27 15:28:34 +02:00
wm4 4a9410880c mplayer: put space before encoding part of status line
Also, the trailing space isn't needed.
2013-04-27 13:45:20 +02:00
Bin Jin eec9b8a012 demux_mkv: fix segfault issue playing back VC1 in a mkv
This bug was introduced in commit 06eee1b.
2013-04-27 13:42:08 +02:00
wm4 bf48f1ecce vd_lavc: fix decoder init failure path
libavcodec decoder initialization failure caused a segfault, because it
wasn't properly reported back in init().

Also remove the return value from init_avctx(), which actually makes
things simpler. Instead, ctx->avctx can be checked to see whether
initialization was ok.
2013-04-27 13:40:55 +02:00