Commit Graph

40452 Commits

Author SHA1 Message Date
wm4 59dc351772 player: move timeline specific handling to timeline loaders
In particular, gets rid of the Matroska specifics from the common code.
2015-02-04 23:04:21 +01:00
wm4 f8dc5db315 manpage: document hook API
This shouldn't exist and for the most part is meant to be used by the
ytdl Lua script, but let's document it anyway. Since the Lua API handles
all the details, it's considered much more "stable" than the raw API,
which is why the raw API wasn't documented.
2015-02-04 23:04:21 +01:00
wm4 e163284b68 command: add on_unload hook
Fixes #1552.
2015-02-04 23:04:01 +01:00
wm4 5bce4664be stream_cdda: fix bugs in chapter time retrieval
Looks like a bunch of off-by-one errors.

The track number was mistakenly offset by 1 - this shifted all chapters
by one, and make the first chapter start on the second track (so the
"chapter" property returned -1 in the first track since it was before
the first chapter).

Also, the calculation of the sector destination was messed up. This
comes from commit 32d818f0, where I apparently attempted to calculate
the position to one byte before the section, but unfortunately math
doesn't work this way and it was nonsense. Just drop this idea; while it
may help with seeking (probably...), it also returns slightly different
times. The user shall use hr-seeks if accurate seeking is required.

Hopefully fixes #1560.
2015-02-04 15:17:49 +01:00
wm4 b715fb6df1 demux_raw: output smaller audio packets
Currently, audio packets are always filtered as a whole. Since demux_raw
output a 1 second long packet, this could lead to large delays when
applying softvol volume. It could be fixed by splitting the frames the
decoder outputs before filtering them (like the old filter code used
to), but since this didn't cause any other problems yet, I'm going with
the simpler fix.

Fixes #1558.
2015-02-04 10:42:23 +01:00
Kevin Mitchell a501e2a6d1 osdep/subprocess-posix: remove __GLIBC__ guard
It's the wrong thing to check. For example it doesn't work on cygwin.
Just live with the warning.
2015-02-03 14:34:52 -08:00
wm4 acc5e8f574 player: make --force-window create the window immediately on start
Before this change, window creation was delayed until the video was
initialized. This guaranteed that the first window size was that of the
video, so the WM would place it correctly.

Some time ago, it was requested on the IRC channel that --force-window
should not do this. Sometimes, it can take a while until video is
initialized, e.g. when youtube-dl is used (which incurs lots of network
delay). In this case, it's awkward that it takes so long until a window
(any window) is shown.

On the other hand, this can cause incorrect window placement with some
WMs. We simply hope that this won't happen with modern WMs. (Although it
does with the WM I use, crappy old IceWM.)
2015-02-03 23:19:38 +01:00
wm4 c3c714b059 player: remove --fixed-vo
In ancient times, this was needed because it was not default, and many
VOs had problems with it. But it was always default in mpv, and all VOs
are required to deal with it. Also, running --fixed-vo=no is not useful
and just creates weird corner cases. Get rid of it.
2015-02-03 23:11:08 +01:00
wm4 de81cb07f4 options: allow more options to be changed at runtime
This allows setting these options directly (without going through
properties, or with going through the "options/" property). The
documented restrictions apply to all of these: changes do not get
immediately applied, unlike with corresponding properties.

This is in reaction to #1548.
2015-02-03 23:11:08 +01:00
Stefano Pigozzi eacf22e42a cocoa: improve refresh rate fallback code
Apparently CoreGraphics reports the actual refresh rate. DisplayLink can also
query the nominal refresh rate of the display so we use that as fallback
instead of the fugly 60fps hardcode added in aeb1fca0d.

Props to people on https://github.com/glfw/glfw/issues/137
2015-02-03 22:59:54 +01:00
Stefano Pigozzi aeb1fca0d4 cocoa: automatically fetch display-fps from the monitor
Comment explains why I have been so doubtful at adding this. The Apple docs
say CGDisplayModeGetRefreshRate is supposed to work only for CRTs, but it
doesn't, and actually works for LCD TVs connected over HDMI and external
displays (at least that's what I'm told, I don't have the hardware to test).
Maybe Apple docs are incorrect.

Since AFAIK Apple doesn't want to give us a better API – maybe in the fear we
might be able to actually write some useful software instead of "apps" –
I decided not to care as well and commit this.
2015-02-03 22:07:37 +01:00
wm4 a33b46194c vo_opengl: disable alpha by default
This reverts the default behavior introduced in commit 93feffad. Way too
often libavcodec will return RGB data that has an alpha channel as per
pixel format, but actually contains garbage.

On the other hand, this will actually render garbage color values in
e.g. PNG files (for pixels with alpha==0, the color value should be
essentially ignored, which is what the old alpha blend mode did).

This "fixes" #1528, which is probably a decoder bug (or far less likely,
a broken file).
2015-02-03 21:00:21 +01:00
wm4 e6664e94a1 demux_disc: fix CDDA seekability
The only reason why cdda:// goes through this wrapper-demuxer is so that
we add chapters to it. Most things related to seeking apply only to
DVD/BD, and in fact broke CDDA sekkability.

Fixes #1555.
2015-02-03 19:32:30 +01:00
wm4 fd78d77586 vo_opengl: avoid unnecessary shader reinit on fullscreen toggle
Makes it unnecessarily slow. It's still needed if the sigmoid crap is
actually used.
2015-02-03 17:39:30 +01:00
wm4 98828886d4 vo_opengl: change initialization of gamma option
Make the lazy gamma initialization less weird, and make the default
value of the "gamma" sub-option 1.0. This means --vo=opengl:help will
list the actual default value.

Also change the lower bound to 0.1 - avoids a division by zero (I don't
know how shaders handle NaN, but it's probably not a good idea to give
them this value).
2015-02-03 17:19:34 +01:00
wm4 f296dcb248 csputils, vo_opengl: remove per-component gamma
There was some code accounting for different gamma values for R/G/B.
It's inherited from an old, undocumented MPlayer feature, which was at
some point disabled for convenience by myself (meaning you couldn't
actually set separate gamma because it was removed from the property
interface - mp_csp_copy_equalizer_values() just set them to the same
value). Get rid of these meaningless leftovers.
2015-02-03 16:52:44 +01:00
wm4 0f560bbf8a csputils: remove some unused functions, make some private
mp_gen_gamma_map() and mp_gen_yuv2rgb_map() were used by vo_opengl_old
only. The other functions removed from csputils.h are used by csputils.c
only.
2015-02-03 16:38:38 +01:00
xylosper 95fd83a269 command: new commands audio_add/audio_remove/audio_reload
These commands are counterparts of sub_add/sub_remove/sub_reload which
work for external audio file.

Signed-off-by: wm4 <wm4@nowhere>
(minor simplification)
2015-02-03 13:53:39 +01:00
wm4 2c22fcd350 options: fix parsing for options/af and options/vf
Basically, the declared option name and the name passed to the
parse_obj_settings_list() must be the same.

Fixes the issue addressed in #1550, but differently.
2015-02-03 13:40:55 +01:00
Niklas Haas 9d62482cdc
vo_opengl: change upper bound of :gamma to 2.0
This allows a spread of 1.0 in either direction, which is already close
to absurd. Anything higher than that is pretty pointless.
2015-02-03 12:29:19 +01:00
Niklas Haas a51045bddd
manpage: add recommended values to :gamma suboption
These were derived from dividing our assumed video gamut (1.961) by some
typical screen values (2.2 for dimly lit and 2.4 for pitch black):

1.961/2.4 = 0.8170833333333334 ~= 0.8
1.961/2.2 = 0.8913636363636364 ~= 0.9
2015-02-03 08:48:54 +01:00
Niklas Haas fa1698cb9a vo_opengl: always clamp the video to range 0-1
Before this, enabling :gamma in combination with :sigmoid and probably a few
other things results in ugly artifacts because the video isn't clamped until
after the :gamma was applied (or at all, if the cms_matrix is unused).
2015-02-03 08:47:48 +01:00
Stefano Pigozzi 5de7f1c5ac ao_coreaudio: fix small memory leak 2015-02-03 00:40:02 +01:00
Stefano Pigozzi de4f997752 ao_coreaudio: use device UID instead of ID for selection
Previously we let the user use the audio device ID, but this is not persistent
and can change when plugging in new devices. That of course made it quite
worthless for storing it as a user setting for GUIs, or for user scripts.

In theory getting the kAudioDevicePropertyDeviceUID can fail but it doesn't
on any of my devices, so I'm leaving the error reporting quite high and see if
someone complains.
2015-02-03 00:40:02 +01:00
Stefano Pigozzi a3be14683a command: add property returning detected audio device
This can be useful to adjust some other audio related properties
at runtime depending on the audio device being used.
2015-02-03 00:40:02 +01:00
wm4 dd287a3276 win32: don't resize when window is minimized
At least the opengl-hq VO allocates additional resources when
downscaling a lot, which is just a waste.

Also see #1547 (although I doubt that this is the cause; if it is,
a real fix will be required).
2015-02-02 22:52:13 +01:00
wm4 2a9534871d command: add property returning detected hwdec API
This is somewhat imperfect, because detection of hw decoding APIs is
mostly done on demand, and often avoided if not necessary. (For example,
we know very well that there are no hw decoders for certain codecs.)

This also requires every hwdec backend to identify itself (see hwdec.h
changes).
2015-02-02 22:43:13 +01:00
wm4 c07e046bfa player: add external audio file auto-loading
Apparently some people want this. Not enabled by default.

Fixes #967.
2015-02-02 21:23:12 +01:00
wm4 cf8fa2bdd4 options: slightly improve help output for choice and flag options 2015-02-02 18:07:37 +01:00
wm4 c8631b3b06 command: add properties returning the current VO and AO driver
This wasn't possible before.
2015-02-02 18:07:37 +01:00
wm4 ef827af06c client API: add mpv_wait_async_requests()
This does what it's documented to do.

The implementation reuses the code in mpv_detach_destroy(). Due to the
way async requests currently work, just sending a synchronous dummy
request (like a "ignore" command) would be enough to ensure
synchronization, but this code will continue to work even if this
changes.

The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed.
(If a client is somehow very slow to terminate, this could silence an
annoying queue overflow message, but all in all it does nothing.)

Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is
in theory allowed, so change pthread_cond_signal() to
pthread_cond_broadcast() to avoid missed wakeups.

As requested in issue #1542.
2015-02-02 18:07:37 +01:00
wm4 9d8b00f1d6 command: add dummy get implementation for tv-channel property
A small cosmetic change with the effect that pressing 'k' shows
"unavailable" instead of "error" (even if no  TV code is active).
2015-02-02 18:07:37 +01:00
wm4 c45f2fe0ee vo_opengl: fix breakage with rotated video on initial display
Resizing was happening before reconfig, so src_rect_rot was outdated and
didn't include the rotation. This resulted in corrupted rendering on
initial display, which fixed itself after the first time the window was
somehow resized.
2015-02-02 18:07:37 +01:00
Stefano Pigozzi 568a0157ff osxbundle: don't try to package Python
This fixes usage when the bundle is used on the same machine that Python/Cython
was compiled on. It doesn't fix the harder problem of packaging a full Python
installation in the mpv app bundle (and I'm not sure we actually want that).

Fixes #1549
2015-02-02 16:11:11 +01:00
wm4 1ba03f6813 build: disable pdf build by default
rst2pdf keeps having sporadic layouting failures, causing build
failures.
2015-02-02 12:06:06 +01:00
wm4 44429544f5 demux_mkv: use unique IDs for cover art pseudo-tracks
Might fix behavior with mkv files that use ordered chapters and have
cover art tags. In my opinion, this should actually have worked (because
cover art pseudo-tracks are strictly appended), but I don't have a
sample file to test at hand.
2015-02-01 18:34:49 +01:00
wm4 5af4c81e5b player: dump audio jitter to stats file
This allows us to plot the difference between video timestamps, and the
adjusted video timestamps due to syncing video to audio speed.
2015-02-01 18:32:26 +01:00
wm4 12dbbcbb15 TOOLS/stats-conv: change unit of X-axis to seconds
...instead of milliseconds.
2015-02-01 18:26:24 +01:00
wm4 720eb187fd command: send additional property change events in-between loading
Opening the stream and opening the demuxer are both done asynchronously,
meaning the player reacts to client API requests. They also can
potentially take a while. Thus it's better to process outstanding
property changes, so that change events are sent for properties that
were changed during opening.
2015-02-01 18:25:12 +01:00
wm4 77664895a1 command: improve observability of some audio properties
In particular, this would fix the sending the initial change event. It
was easily missed because MPV_EVENT_FILE_LOADED usually triggered it,
but the actual property could change only later, because audio
initialization really is kind of asynchronous to it.

This probably fixes #1544.
2015-02-01 18:21:48 +01:00
wm4 6f1357d876 build: fix v4l2 support on NetBSD
It was accidentally broken. Tested by a NetBSD user. May help with other
BSDs.
2015-01-31 16:14:14 +01:00
wm4 a169a2fb79 player: don't treat audio playback restart while paused special
I guess this was supposed to be some sort of optimization, but even
though it probably works, it's pretty meaningless and I couldn't measure
a difference. One special case killed.
2015-01-30 23:54:43 +01:00
wm4 48f96f43ec player: minor simplification in A/V-sync related code
Just minor things.
2015-01-30 23:49:30 +01:00
wm4 3813c3804f Revert "player: allow seeking audio between video frames"
This reverts commit 7b3feecbc2.

It's broken, hr-seek never ends at a video position before seek pts.
Not sure what I was thinking, although it did work anyway when
artificially forcing a video frame to display before seek pts.
2015-01-30 23:42:01 +01:00
wm4 12d822ce44 ao_null: add emulation for certain broken behavior
I'm not sure how common this behavior possibly is; well whatever. This
option will allow reproducing such behavior, and help debugging it.
2015-01-30 21:30:54 +01:00
wm4 a7c43babb7 player: print desync message on negative A/V-sync too
At least there is _some_ problem if this happens. It would mean that
audio is playing slower than video. Normally, video is synced to audio,
so if audio stops playback completely, video will not advance at all.
But using things like --autosync, it's well possible that this kind of
desync happens.
2015-01-30 21:26:29 +01:00
wm4 e123c1dfcd player: rearrange some A/V-sync related code
Move the update_avsync_before_frame() call further down. Moving it
closer to where the time_frame value is used (and which the function
updates) should make the code more readable. With this change, there's
no need anymore to reset the time_frame value on the video reconfig
path.

Move the update_avsync_after_frame() up. Now no meaningful amount of
time passes since the previous get_relative_time() call anymore, and the
second one can be removed.
2015-01-30 21:18:30 +01:00
wm4 9d57e7d23c player: use correct type for some relative times
We use double for these things everywhere, just this code didn't. It
likely doesn't matter much, and this code is for an optional feature
too.
2015-01-30 21:10:39 +01:00
wm4 5f7de39942 av_common: add comment about using now-deprecated libavcodec field
FFmpeg and Libav have the stupid practice of replacing and deprecating
API symbols on the same day. So with FFmpeg git, this is useless and
will print a compile time warning, while it's required with all stable
releases, and might lead to decoding errors with xvid/avi (apparently).

Add a comment before someone writes a patch and I have to explain it all
over again.
2015-01-30 15:57:40 +01:00
wm4 697309fc48 vo_opengl: use triangle strip for video
A small simplification. Couldn't be done before, because it was also
used by the OSD code, which required disjoint quads in a single draw
call.

Also mess with the unrelated code in gl_osd.c to simplify it a little
as well.
2015-01-30 15:57:40 +01:00