Compare commits

..
430 Commits
Author SHA1 Message Date
wm4 93ce083bd8 Release 0.2.1 2013-10-20 14:12:33 +02:00
wm4 97c93918fe input: fix --input-ar-rate=0
Crashed, instead of disabling auto-repeat.
2013-10-20 14:11:28 +02:00
Alexander Preisinger 7078df4f5e wayland: use mp_input_test_dragging
Instead of removing dragging we now test if it we should drag the window or
not. Because if the OSC shows up we can not drag the window because that would
cause mouse events that makes the OSC disappear.
2013-10-20 14:11:25 +02:00
Alexander Preisinger 8e642809bf Revert "wayland: remove moving window by grabbing"
This reverts commit 3308bc2bc9.
2013-10-20 14:11:21 +02:00
Alexander Preisinger 8c4cf5ce84 Revert "wayland: remove outdated comment"
This reverts commit d75cfef49c.
2013-10-20 14:11:18 +02:00
wm4 16cbc4a014 vdpau_old: restore hardware decoding with old API
--hwdec=vdpau did nothing with older ffmpeg/libav versions. Oops.
2013-10-20 14:11:11 +02:00
wm4 2aff8b7523 af_lavrresample: actually free resampler
Fixes #304.
2013-10-20 14:11:04 +02:00
Nikoli 5d9353f0d5 mpv.desktop: add russian translation, sort 2013-10-20 14:11:00 +02:00
wm4 6f139ad981 sws_utils: work around libswscale crash with --contrast=-100 2013-10-20 14:10:49 +02:00
wm4 0052445e86 vf_scale: fix get/set confusion
This caused the equalizer controls to appear stuck.
2013-10-20 14:10:46 +02:00
Alessandro Ghedini 2cf8d4ffdb spelling fixes 2013-10-20 14:10:43 +02:00
wm4 e6236e22db Release 0.2.0 2013-10-16 00:11:28 +02:00
ChrisK2 f572d22863 docs: osc: add short info about lua and how to disable it 2013-10-15 23:46:12 +02:00
wm4 0554379f84 changes.rst: add some replaced options, follow conventions better 2013-10-15 23:41:52 +02:00
ChrisK2 a0e4455616 docs: osc: fix table and other errors 2013-10-15 23:22:52 +02:00
ChrisK2 935ca52d81 docs: Add osc.rst to mpv.rst
Also moved OPTIONS headline into options.rst
2013-10-15 22:42:00 +02:00
ChrisK2 71b0c2b88c osc: fix borked options 2013-10-15 22:41:19 +02:00
ChrisK2 a54ca2da31 osc docs: Add documentation for OSC and rename some options
camelCase from some of the option names removed. If you were using those, you'll have to update them in your config.
2013-10-15 22:30:33 +02:00
wm4 a0485221c7 x11_common: don't handle mouse enter events
This could cause the OSC to be displayed without mouse interaction: for
example, starting mpv with --fs, and putting the mouse to where the OSC
area is beforehand, would cause the OSC to appear and stay visible. We
don't want that. The simplest solution is not generating artificial
mouse move events from mouse enter events, because they make the OSC
think the mouse was actually moved.

Also see commit 0c7978c, where handling of mouse enter events was added.
This was supposed to fix certain corner cases, but they're not relevant
anymore due to changes in OSC behavior.

Commit 9777047 fixed this as well (by resetting the mouse state on
MOUSE_LEAVE), but all the behavior reverted with this commit as perhaps
a bad idea. It wasn't very robust, made it hard to distinguish real
events from artificial ones, and finally made the mouse cursor more
often visible than needed. (Now switching between workspaces doesn't
make the cursor visible again when switching to a fullscreened mpv.)
2013-10-15 21:53:33 +02:00
wm4 1b8eeeb8cc tech-overview.txt: reflect talloc/TA changes 2013-10-15 21:53:13 +02:00
ChrisK2 97770473d0 osc: reset mouse position when leaving window
and store it freshly on first mouse_move event when entering again
2013-10-15 21:49:06 +02:00
ChrisK2 dd3e52fe68 osc: Don't create a config if none exists.
A documentation explaing where and how to create one instead will follow.
2013-10-15 01:17:34 +02:00
wm4 f0a5ff39a1 osc: use "info" instead of "warn" for config file creation message
When the main mpv config file, "info" is used, so this makes things
consistent.
2013-10-14 23:48:18 +02:00
wm4 7cbb7b680c example.conf: add example for disabling the OSC 2013-10-14 23:42:53 +02:00
wm4 cf02e515d4 parser-cfg: allow putting options with leading "--"
Now you can pretend the config file is quite literally command line
values dumped into a file, e.g.

--option1=value
--option2=value
...

although the underlying mechanisms are quite different.
2013-10-14 23:41:26 +02:00
wm4 c7dee24c8c parser-cfg: use bstr everywhere after parsing stage
Until now it used both char[] and bstr variants in the same code, which
was nasty. For example, the next commit would have additionally required
using memmove() to remove the prefix from the char[] string.
2013-10-14 23:37:58 +02:00
wm4 8c234045fa options: enable OSC by default
Can can disable it with --osc=no.
2013-10-14 21:09:54 +02:00
wm4 24fffa0f6b mplayer: escape strings if needed when writing watch_later config
This fixes handling of e.g. "--vf=lavfi=[ noise ]" when used with
playback resume functionality. The spaces made it bug out, and there are
more cases where it could potentially break.

We could always escape for simplicity, but for now make old and new mpv
builds somewhat interoperable and use this new escaping only if needed.
2013-10-14 21:05:58 +02:00
wm4 5106edfd5e parser-cfg: parse % escapes
This parses "%len%string" escapes, where string can contain any
characters. This method of escaping has also been used in other parts
of mplayer and mpv, so it's not a new idea.

(Also, don't confuse with URL encoding.)

Needed by the following commit.
2013-10-14 21:04:58 +02:00
wm4 5a1b60c567 version.sh: don't use git tags for version output (again)
With the way I've been doing releases in the release/0.1 branch, this
proved completely useless. You need to write the VERSION file anyway,
and since we use github's automatically generated tarballs (via its
release system), the VERSION file needs to be in the git revision of
a release anyway. git master on the other hand displayed the v0.1.0
tag, because the tag is within the master branch.

This essentially reverts commit b27f65a. Now just print the contents
of the VERSION file if it exists, and likewise, we append the git
revision if it exists. (Do that even if VERSION exists, because this
way we can tell if someone is using the release branch at an in-between
point where no new release has been made yet.)
2013-10-14 20:14:17 +02:00
wm4 0f1764195a mplayer: print ffmpeg library versions along with mpv version info
Also change what the FFmpeg version info looks like, and additionally
dump lavfi/lavr/lswr versions. (Don't bother with libavdevice and
libpostproc, they're not important enough.)

Unfortunately, there's no "single" FFmpeg/Libav version due to fatal
braindeath on the FFmpeg/Libav side. We can't map the versions to
releases either (it simply isn't accessible anywhere).
2013-10-14 20:14:17 +02:00
ChrisK2 683da7411e osc: raise minmousemove default setting to 3 and disable input mouse area when OSC not visible
The mouse area that covers the OSC is now only activated when the OSC is actually visible, to make sure the mouse still hides if it happens to be parked in the OSC area without making the OSC show up.
2013-10-14 19:51:16 +02:00
wm4 94e71b7cc0 mplayer, vo_image: simplify OSD redrawing, fix vo_image crash
vo_image didn't handle OSD redrawing correctly anymore after OSD
redrawing behavior was changed in commit ed9295c (or maybe it has been a
problem for a longer time, and only showed up now). Basically, flip_page
was called unexpectedly and when no image was stored, which made it
crash trying to access the image. This could happen when for example
provoking OSD redrawing by pausing while using --vo=image, or by using
this command line: mpv --vo=image '-vf=lavfi="select=not(mod(n\,3))"'

Fix by removing the code that pretends vo_image can redraw OSD, and by
removing the framestepping fallback, which could make bad things happen
if the VO didn't support OSD redrawing. By now, there aren't any real
VOs that can't redraw the OSD properly, so this code is not needed and
just complicates things like vo_image.

This change likely will also be useful for vo_lavc (encoding).
2013-10-13 23:40:23 +02:00
wm4 eeac26410f mplayer: print a warning if libass is not compiled
Libass is technically an optional dependency, but in practice users
tend to disable libass accidentally or for the hell of it to get
something "minimal", without being aware of the consequences.
2013-10-13 22:25:33 +02:00
ChrisK2 1560d6ce60 osc: fix mouse hiding 2013-10-13 05:38:13 +02:00
ChrisK2 9b20c681fd osc: Once again new Show/Hide handling
The deadzone-size is now by default zero, so movement on the entire window will make the OSC show up. To avoid it showing up by randomly moving mice, the option 'minmousemove' controls how many pixels movement (default: 1) between ticks (frames) are necessary to make the OSC show up.
The deadzone can be reenabeled by setting the option 'deadzonesize' (default: 0 = no deadzone, 1 = entire area between OSC and opposite window border), to restore the old behavior, set it to ~0.92.

The OSC will hide immediately when leaving the window or entering the deadzone (if existing) or after the time specified with 'hidetimeout' (default: 500ms) passed without any new movement. Set to negative value to disabling auto-hide (thus restoring old behavior). The OSC will never hide if hovered by the mouse.
2013-10-13 03:51:25 +02:00
wm4 a550731209 Copyright, LICENSE: switch to GPL version 2 or later
Now that talloc has been removed, the license can be switched back to
GPLv2+. Actually, there never was a GPLv2+ licensed MPlayer (fork or
not) until now, but removal of some GPLv2-only code makes this possible
now. Rewrite the Copyright file to explain the reasons for the licenses
MPlayer and forks use. The old Copyright file didn't contain anything
interesting anymore, and all information it contained is available at
other places in the source tree.

The reason for the license change itself is that it should improve
interoperability with differently licensed code in general.

This essentially reverts commit 1752808.
2013-10-13 01:36:10 +02:00
wm4 0933f12d28 Replace talloc
There are multiple reasons to do this. One big reason is the license:
talloc is LGPLv3+, which forces mpv to be licensed as GPLv3+.

Another one is that our talloc copy contains modifications, which makes
it essentially incompatible with upstream talloc (in particular, our
version aborts on out of memory conditions - well, it wasn't my idea).
Updating from upstream is also a bit involved - the talloc source is
not really organized in a way to allow copying it into projects (and
this isn't an intended use-case).

Finally, talloc is kind of big and bloated. The replacement halves the
amount of code - mainly because we didn't use all talloc features. It's
even more extreme if you compare upstream talloc (~4700 lines) and the
new allocator without talloc compat (~900 lines).

The replacement provides all features we need. It also doesn't clash
with talloc. (The talloc compatibility wrapper uses macros to avoid
introducing linker-level symbols which could clash with libtalloc.)

It also tries to lower the overhead (only 4 words opposed to 10 words
in talloc for leaf nodes in release mode). Debugging features like leak
reporting can be enabled at compile time and add somewhat more overhead.
Though I'm not sure whether the overhead reduction was actually
successful: allocations with children need an "extra" header, which adds
plenty of overhead, and it turns out that almost half of all allocations
have children. Maybe the implementation could be simplified and the
extra header removed - even then, overhead would be lower than talloc's.

Currently, debugging features can be entirely deactivated by defining
NDEBUG - I'm not sure if anything defines this directly yet, though.

Unlike in talloc, the leak reporting stuff is thread-safe. (That's also
why it's far less elegant, and requires extra list pointers.)

Comes with a compatibility layer, so no changes to mpv source code
are needed. The idea is that we will pretend to be using talloc for
a while, so that we can revert to our old talloc implementation at
any time for debugging purposes.

Some inspiration was taken from Mesa's ralloc:

    http://cgit.freedesktop.org/mesa/mesa/tree/src/glsl/ralloc.h

This is another talloc replacement, but lacks some features we need
(getting size of an allocation, debugging features, being able to
access children in the dtor).

There's some information in ta/README what will happen next and how the
transition is expected to progress.
2013-10-13 01:36:09 +02:00
wm4 c613d802bc talloc: change talloc destructor signature
Change talloc destructor so that they can never signal failure, and
don't return a status code. This makes our talloc copy even more
incompatible to upstream talloc, but on the other hand this is
preparation for getting rid of talloc entirely.

(The talloc replacement in the next commit won't allow the talloc_free
equivalent to fail, and the destructor return value would be useless.
But I don't want to change any mpv code either; the idea is that the
talloc replacement commit can be reverted for some time in order to
test whether the talloc replacement introduced a regression.)
2013-10-13 01:16:30 +02:00
Stefano Pigozzi 8d5f800567 cocoa: make --ontop also cover dock+menubar
This only shows any differences when mpv isn't frontmost and is in fullscreen.
Cmd+Tab overlay is still at a higher level as to avoid complete usability fail.
2013-10-12 21:02:46 +02:00
wm4 f312528ebc command: preferably show "add"/"cycle"/"set" command errors on OSD
Before this, they were shown on terminal only. Now they use the OSD
mechanism, which shows them on the video window or the terminal,
depending on settings and what's available.
2013-10-12 18:57:02 +02:00
wm4 20988ee607 command: don't allow changing volume if no audio initialized
Changing volume when audio is disabled was a feature request (github
issue #215), and was introduced with commit 327a779.

But trying to fix github issue #280 (volume is not correct in no-audio
mode, and if audio is re-enabled, the volume set in no-audio mode isn't
set), I concluded that it's not worth the trouble and the current
implementation is questionable all around. (For example, you can't
change the real volume in no-audio mode, even if the AO is open - this
could happen with gapless audio.) It's hard to get right, and the
current mixer code is already hilariously overcomplicated. (Virtually
all of mixer.c is an amalgamation of various obscure corner cases.)

So just remove this feature again.

Note that "options/volume" and "options/mute" still can be used in
idle mode to adjust the volume used next time, though these properties
can't be used during playback and thus not in audio-only mode.

Querying the volume still "works" in audio-only mode, though it can
return bogus values.
2013-10-12 18:57:02 +02:00
wm4 38874b2f2e playlist: check for NULL on caller site
Letting some playlist functions randomly accept NULL, while others do
not isn't such a good idea.
2013-10-12 18:57:02 +02:00
Philip Sequeira 7ce464bef9 options: --loop=N means playback N times, not N+1 times
The argument or this change is that --loop should set how often the
file is played, not the number of additional repeats.

Based on pull request 277, with additions to the manpage and removal
of "--loop=0".

Signed-off-by: wm4 <wm4@nowhere>
2013-10-12 18:57:02 +02:00
wm4 d1c473bc25 libquvi9: work around insane interaction between libquvi and libkdecore
The primary effect of this commit is that it fixes playback resume if
libquvi 0.9 and German locale are used, and libkdecore is on the system.
(See github issue #279.)

libquvi uses libproxy to determine system-wide proxy settings. libproxy
in turn loads libkdecore (if present) to determine KDE proxy settings.
libkdecore has a global constructor, which calls setlocale(LC_ALL, ""),
switching the current locale from "C" to what the user's settings. This
breaks some basic C string processing functions. Note that the locale
won't be set on program start, but only when libproxy calls dlopen() on
its config_kde module, which actually causes libkdecore to be loaded and
initialized.

In particular, with German locale, snprintf() would use "," instead of
"." when formatting float values, which in combination with playback
resume, would lead to parse errors the next time mpv was started, which
is how this issue was found.

I'd consider this a bug with libkdecore or at least libproxy. No library
should ever even touch locale: it might break basic expectations on C
string handling functions, might override program settings, and it's not
thread-safe. But this is so nasty and severe, that a quick hack to fix
it hurts less.

See github issue #279 and KDE bug #325902.
2013-10-12 18:56:03 +02:00
Stefano Pigozzi 57c3fca7a8 cocoa: refactor precise scrolling to a separate method 2013-10-12 16:26:53 +02:00
Mad Fish 42189ada97 cocoa: fix mouse wheel scrolling 2013-10-12 16:26:24 +02:00
Mohammad Alsaleh 65a3977282 mpvcore/playlist.c: Avoid NULL reference in playlist_add_base_path()
Before this patch, those will cause a crash:

  mpv -playlist /dev/null
  mpv -playlist <(bla) # if the result of bla is empty

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2013-10-11 18:01:47 +02:00
Stefano Pigozzi 177c89d948 cocoa_common: check if the screen has a menubar in a more generic way
Fixes #274
2013-10-09 09:27:41 +02:00
William Light 16450fab3f mp_ring: fix mp_ring_read_cb() when read wraps around
previously, mp_ring_read_cb() would allow reading past the end of the
ringbuffer when buffered > available. mp_ring_read() had logic for
splitting the read into two, which I duplicated into mp_ring_read_cb().
2013-10-08 20:03:57 +02:00
wm4 5c3abb9082 demux_raw: set a default video size 2013-10-07 17:21:53 +02:00
wm4 de6eace6e9 command: sub_seek: avoid getting stuck
First, don't try to seek if the result is 0 (i.e. nothing found, or
subtitle event happens to be exactly on spot).

Second, since we never can make sure that we actually seek to the exact
subtitle PTS (seeking "snaps" to video PTS), offset the seek by 10ms.
Since most subtitle events are longer than 10ms, this should work fine.
2013-10-07 17:21:53 +02:00
ChrisK2 ccdaecfc5c osc: Okay, don't multiply the cache value
As expected, this is not liked.
2013-10-07 00:56:11 +02:00
ChrisK2 f3556356b7 osc: Display cache fill status
The OSC will now display cache fill status between the timecodes, but only if it's below 48% to not clutter the interface with erratically changing values.

By default, the displayed value is multiplied by 2 to not confuse users who are unfamillar with the inner workings of the caching system. This can be disabled using the iAmAProgrammer=true setting.
2013-10-07 00:04:35 +02:00
ChrisK2 99adbe1e7c osc: Add another scale option for forced windows.
If the OSC is rendered on a forced window (by --force-window), the scale can be configured with scaleForcedWindow.
2013-10-06 23:44:46 +02:00
Thomas Orgis 55883943c5 ad_mpeg123: support in-stream format changes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36461 b3059339-0415-0410-9bf9-f77b7e298cf2

Fixes playback of http://mpg123.org/test/44and22.mp3

Cherry-picked from MPlayer SVN rev. #36461, a patch by
Thomas Orgis, committed by by Reimar Döffinger.
2013-10-06 23:41:18 +02:00
wm4 8304046180 vo_x11, vo_xv: fix OSD redrawing with --force-window
The window wasn't cleared in this mode before doing the redrawing.
2013-10-06 23:03:30 +02:00
wm4 2d638347c1 mplayer: don't resume playlist if --no-resume-playback is used 2013-10-06 21:54:00 +02:00
Christian Neukirchen 2119bcbeac ao_sndio: add documentation 2013-10-05 22:47:20 +02:00
wm4 ae9a3e33aa command: add commands for displaying overlays
Requested by github issue #255.

Does not work where mmap is not available (i.e. Windows).
2013-10-05 22:46:55 +02:00
wm4 fd49edccf8 command: add properties for retrieving OSD dimensions 2013-10-05 22:46:55 +02:00
wm4 1be863afdb mplayer: fix some issues with playlist_prev command
You couldn't jump to the first entry in the playlist, if that entry was
marked as "too short". But this is usually fine, because it doesn't get
into the way of the user. (This feature is meant to allow being able to
jump backwards through the playlist even if a file immediately stops
playback right after initialization, not to prevent playing these files
at all.)

Also, apply the skip logic when wrapping around the playlist when going
backwards. This happens with --loop, because looping pretends the
playlist is infinitely repeated forwards and backwards (as long as the
playlist_prev/next commands are concerned).

Also add some comments.
2013-10-05 22:46:55 +02:00
wm4 c3ea08a2d7 mplayer: fix cleanup if VO initialization fails
Just specifying a VO that doesn't exist would make it crash.
Regression caused by commit 6a0408b.
2013-10-05 22:46:14 +02:00
Stefano Pigozzi 89fced63b8 cocoa_common: add OS X 10.7 compatibility hacks includes
I forgot these when I split the code. They will hopefully fix compilation on
10.7.
2013-10-05 14:40:48 +02:00
wm4 6a0408be68 mplayer: don't keep previous video frame with --force-window
When for example switching off the video stream, and --force-window is
used, forcefully reconfigure the VO. This will reset the size, and will
clear the window with black.

Needed some effort, because you don't always want to clear the window
on "discontinuity" points like going to a next file: this would
introduce some flicker.
2013-10-04 00:27:54 +02:00
wm4 76f32e3881 gl_x11: fail gracefully if selected FBconfig has no X visual
glXGetVisualFromFBConfig() specifies specifies that it can return NULL
if there is no associated X visual. Instead of crashing, let
initialization fail. I'm not sure if this is actually supposed to work
with a fallback visual (passing a NULL visual to vo_x11_config_vo_window
would just do this), but let's play safe for now.

Apparently this can happen when trying to use vo_opengl over a remote
X display.
2013-10-03 23:50:48 +02:00
Stefano Pigozzi 683e212a77 ao_coreaudio: clear output buffer on buffer underrun
Output silence to the output buffer during underruns. This removes small
occasional glitches that happen before the AUHAL is actually paused from the
`audio_pause` call.

Fixes #269
2013-10-03 23:43:07 +02:00
Christian Neukirchen 3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +02:00
wm4 bdc56771eb vo_opengl_old: mp_msg conversion
This was the only thing in video/out/ left with major mp_msg() use.
2013-10-02 21:41:46 +02:00
wm4 ef9c5300ef cosmetics: replace "CTRL" defines by enums
Because why not.
2013-10-02 21:19:16 +02:00
wm4 93b712fa8a command: add sub_seek input command
Essentially reuses the sub_step command, and is subject to the same
restrictions.

Seems to behave a bit strange sometimes, but generally works.
2013-10-02 21:05:04 +02:00
wm4 df5706f156 input: remove strange offset from commands enum
A leftover from 10 years of refactoring.
2013-10-02 20:48:50 +02:00
wm4 a4998e08ef command: don't let "avsync" property print NOPTS value
Can happen when seeking in audio files with attached picture.
MP_NOPTS_VALUE doesn't really make sense outside of mpv internals, so
don't return it.
2013-10-02 20:43:13 +02:00
wm4 a8240c1b58 vo: mark frame lost after seek reset
Reverts a small change made in commit ed9295c. This is needed, because
otherwise mplayer.c/update_video_attached_pic() thinks it never has to
update the picture after initialization. (Maybe there would be more
elegant ways to handle this, but not without adding extra state.)
2013-10-02 20:41:11 +02:00
wm4 4da7630824 mplayer: osd bar depends on VO, not video decoding
The OSD bar wasn't displayed, and instead a fallback message was shown.
2013-10-02 20:39:26 +02:00
wm4 d24bf6e349 mplayer: make VO interaction work in --idle mode
Didn't handle VO events, didn't handle OSD message management.

There is probably still some strangeness left. --idle mode was never
made for direct interaction.
2013-10-02 20:38:10 +02:00
wm4 ca2b05c0fb mplayer: change default window size for --force-window
Closer to the ubiquitous 16:9 screen aspect ratio. Requested by ChrisK3.
2013-10-02 20:34:41 +02:00
wm4 fde99da5c6 mpv.desktop: add --force-window
Seems appropriate.
2013-10-02 01:40:06 +02:00
wm4 886c3ef999 command: subtitle support depends on VO, not video decoding
We can render subtitles if a VO is open. Whether we're decoding video
(i.e. if mpctx->sh_video is set) doesn't really matter.

Subtitle display with --force-window still doesn't quite work yet,
because there's nothing to actually force redrawing of subtitles in this
mode.
2013-10-02 01:39:28 +02:00
wm4 f01744ac4e core: add --force-window
This commit adds the --force-window option, which will cause mpv always
to create a window when started. This can be useful when pretending that
mpv is a GUI application (which it isn't, but users pretend anyway), and
playing audio files would run mpv in the background without giving a
window to control it.

This doesn't actually create the window immediately: it only does so
only after initializing playback and when it is clear that there won't
be any actual video. This could be a problem when starting slow or
completely stuck network streams (mpv would remain frozen in the
background), or if video initialization somehow is stuck forever in
an in-between state (like when the decoder doesn't output a video
frame, but doesn't return an error either). Well, we can pretend only
so much that mpv is a GUI application.
2013-10-02 01:39:28 +02:00
wm4 3c0333978e core: don't require "refresh" seek for --keep-open
Seeking normally resets the VO and throws away the currently displayed
frame, so if you seek outside the video with --keep-open enabled, the
window would normally be "stuck" and not redraw properly, because there
is no source video frame that could be redrawn. To deal with this, a
precise seek to the position of the last displayed video frame was
issued.

This usually worked, but it can fail for formats where seeking is broken
or not possible (consider reading from a pipe).

Fix this by changing the semantics for vo_seek_reset(): now the video
frame is remembered even after seeking.

Note that this changes behavior a little when trying to seek outside of
a file with --keep-open enabled. Since no actual seek is done anymore,
the video will remain "frozen" on the previous position, and you can't
unpause or framestep to see the video between current position and
actual end of the video. If users complain, I might revert this commit.
2013-10-02 00:42:18 +02:00
wm4 7be13b4690 vo_vdpau: don't blank screen on VOCTRL_RESET
vo_vdpau is the only VO which implements VOCTRL_RESET. Redrawing the
last output frame is hard, because the output could consist of several
source video frames with certain types of post-processing
(deinterlacing). Implement redrawing as special case by keeping the
previous video frames aside until at least one new frame is decoded.

This improves the previous commit, but is separate, because it's rather
complicated.
2013-10-02 00:38:23 +02:00
wm4 ed9295c250 video/out: always support redrawing VO window at any point
Before, a VO could easily refuse to respond to VOCTRL_REDRAW_FRAME,
which means the VO wouldn't redraw OSD and window contents, and the
player would appear frozen to the user. This was a bit stupid, and makes
dealing with some corner cases much harder (think of --keep-open, which
was hard to implement, because the VO gets into this state if there are
no new video frames after a seek reset).

Change this, and require VOs to always react to VOCTRL_REDRAW_FRAME.
There are two aspects of this: First, behavior after a (successful)
vo_reconfig() call, but before any video frame has been displayed.
Second, behavior after a vo_seek_reset().

For the first issue, we define that sending VOCTRL_REDRAW_FRAME after
vo_reconfig() should clear the window with black. This requires minor
changes to some VOs. In particular vaapi makes this horribly
complicated, because OSD rendering is bound to a video surface. We
create a black dummy surface for this purpose.

The second issue is much simpler and works already with most VOs: they
simply redraw whatever has been uploaded previously. The exception is
vdpau, which has a complicated mechanism to track and filter video
frames. The state associated with this mechanism is completely cleared
with vo_seek_reset(), so implementing this to work as expected is not
trivial. For now, we just clear the window with black.
2013-10-02 00:36:26 +02:00
Stefano Pigozzi 94d6babb95 ao_coreaudio: fetch device name only for verbose log level
The previous code fetched the device name regardless of log level and then
only printed it if log level was verbose.
2013-10-01 11:00:43 +02:00
Martin Herkt f210244a1c ao_jack: don’t force exact client name
Trying to connect multiple mpv clients to JACK with the
JackUseExactName option would fail unless the user manually
specifies a unique client name. This changes the behavior
to automatically generate a unique name if the requested
one is already in use.
2013-09-30 14:42:55 +02:00
wm4 c000a08de2 x11: remove colormap code, always request TrueColor visuals
vo_x11 had a clever trick to implement a video equalizer: it requested a
DirectColor visual. This is a X11 mechanism which allows you to specify
a lookup table for each color channel. Effectively, this is a safe
override for the graphic card's gamma ramp. If X thinks the window
deserves priority over other windows in the system, X would temporarily
switch the gamma ramp so that DirectColor visuals can be displayed as
the application intends. (I'm not sure what the exact policy is, but in
practice, this meant the equalizer worked when the mouse button was
inside the window.)

But all in all, this is just lots of useless code for a feature that is
rarely ever useful. Remove it and use the libswscale equalizer instead.
(This comes without a cost, since vo_x11 already uses libswscale.)

One worry was that using DirectColor could have made it work better in
8-bit paletted mode. But this is not the case: there's no difference,
and in both cases, the video looks equally bad.
2013-09-30 00:47:24 +02:00
wm4 00d41cc5b0 vf_scale: factor out libswscale equalizer control
Will be used by vo_x11.
2013-09-30 00:45:58 +02:00
wm4 9488d312c1 Remove completely outdated AUTHORS file
Considering that we use version control, maintaining an AUTHORS file
doesn't make much sense, and indeed it was barely touched since the time
mplayer2 forked from MPlayer. None of the contributors to mplayer2 or
mpv are listed in this file (even uau's work is not appropriately
reflected, despite having an entry in this file).

I'm removing this file because it's obviously pointless to keep around,
and moreover it's misleading.

In theory removing this file might be questionable: the git log reaches
back into CVS and SVN times, which don't have separate committer and
author fields for each comment. The commit messages could be incomplete
and not mention the original author, while the AUTHORS file somehow
could. I doubt this is a real concern, since you can always reconstruct
the original AUTHORS file from git.

Another concern is that this could be interpreted as disrespectful to
the people mentioned in this file; but it isn't meant to be
disrespectful.

Also point out a slight irregularity in the Copyright file.
2013-09-30 00:30:30 +02:00
wm4 2c6a3cb1f2 mplayer: fix looping of very short files
Commit 884c179 attempted to make it possible to skip backwards through
the playlist, even for files which fail to intitialize, or play for a
very short time. This was also used to prevent mpv from looping forever
and doing nothing if --loop=inf is used, and no file in the playlist is
playable.

This broke looping of very short files, because mpv was assuming that
this case happened. But there are legitimate use cases.

Fix this by making the looping case special. Instead of checking whether
playback was "very short", check whether something could be decoded and
displayed/played. If yes, allow looping.
2013-09-29 21:10:45 +02:00
wm4 5b3ae5aaac vaapi: remove non-VLD entrypoints
These probably don't work. libavcodec doesn't seem to support them,
and neither did the original mplayer-vaapi patch.
2013-09-29 13:52:09 +02:00
wm4 60e7926248 vaapi: fix non-sense condition
Attempting signed comparison on unsigned value.
2013-09-29 13:45:49 +02:00
wm4 4e1d65983a vaapi: fix inverted condition
How embarrassing. This could make --hwdec=vaapi-copy as well as
screenshots with vo_vaapi randomly fail. Regression since
commit b8382aa.
2013-09-29 13:45:15 +02:00
Stefano Pigozzi 9d3943840c cocoa_common: call gl_clear indirectly
glClear needs GL headers and we don't want those in `cocoa_common`. Create
a callback in `gl_cocoa` and register it `cocoa_common`.

Fixes #264
2013-09-28 15:08:40 +02:00
Stefano Pigozzi 73808cd8f0 cocoa_common: fix deadlock
After rebasing my dev branch it turned out that  the code deadlocked on
recursive calls of `vo_control`. Make the locking code a little bit smarter
by making always skip locking/unlocking if we are executing a chunck of
code that is already synchronized with `dispatch_sync`.
2013-09-28 15:08:26 +02:00
Stefano Pigozzi 67d87d36d5 cocoa_common: report pixels instead of points during mouse movement
This fixes the position reporting on retina displays. Doesn't make any
difference on normal displays where 1px = 1pt.

Fixes: #260
2013-09-28 11:20:00 +02:00
Stefano Pigozzi 0ab9634eb3 cocoa_common: split the code, refactoring and cleanups
Split the code to several files. The GUI elements now each have they own files
and private state. The original code was a mess to respect the retarded mplayer
convention of having everything in a single file.

This commit also seems to fix the long running bug of artifacts showing
randomly when going fullscreen using nVidia GPUs.
2013-09-28 11:20:00 +02:00
ChrisK2 0e68ff4fad osc: add options to show OSC only when FS/windowed
The boolean-options showWindowed and showFullscreen can now be set in plugin_osc.conf to control the behaviour.

enhancement for #262
2013-09-27 20:12:13 +02:00
wm4 1b3fbfc183 osx: fix build
Or at least I hope it fixes it, since I can't test.

Broken by commit 0d90dd0.
2013-09-27 19:21:30 +02:00
wm4 b7f01957ec network: add options to control TLS verification 2013-09-27 18:09:30 +02:00
wm4 b8382aabb3 vaapi: make vaDeriveImage() less verbose
This can just be not supported, so making it look like a real error
doesn't make much sense.
2013-09-27 18:00:03 +02:00
wm4 0901fc8e0e vaapi: check image format in va_surface_upload()
Just for robustness. Also print a warning in vo_vaapi if this happens.
2013-09-27 18:00:03 +02:00
wm4 4d2f354da6 vaapi: potentially make reading surfaces back to system RAM faster
Don't allocate a VAImage and a mp_image every time. VAImage are cached
in the surfaces themselves, and for mp_image an explicit pool is
created. The retry loop runs only once for each surface now.

This also makes use of vaDeriveImage() if possible.
2013-09-27 17:59:44 +02:00
wm4 ede652774e input: translate mouse position to OSD space early
Until now, mouse positions were just passed to the core as-is, even if
the mouse coordinates didn't map to any useful coordinate space, like
OSD coordinates. Lua scripting (used by the OSC, the only current user
of mouse input) had to translate mouse coordinates manually to OSD space
using mp_get_osd_mouse_pos(). This actually didn't work correctly in
cases mouse coordinates didn't map to OSD (like vo_xv): the mouse
coordinates the OSC got were correct, but input.c was still expecting
"real" mosue coordinates for mouse areas.

Fix this by converting to OSD coordinates before passing the mouse
position to the core.
2013-09-27 15:39:28 +02:00
wm4 3871024ec3 input: handle MOUSE_LEAVE specially
Do this so that MOUSE_LEAVE can't be combined with other keys. (E.g.
keep 'w' pressed, then move the mouse outside of the mpv window; it will
print a warning what w-MOUSE_LEAVE is not mapped.)
2013-09-27 15:33:47 +02:00
wm4 0d90dd07ff input: more mp_msg conversion
It appears the last run missed all mp_tmsg().

Since the command parser also prints messages, it needs a new parameter
to pass a log context. We go the easy way and just require the input_ctx
to be passed, and use its mp_log.
2013-09-27 15:30:59 +02:00
Ben Boeckel 9f149717a6 matroska: prevent uids from being dereferenced when NULL
The old code prevented it since uids being NULL makes a 0 talloc length.
Now that we're iterating over a specific length, NULL can be
dereferenced.
2013-09-27 08:45:02 +02:00
ChrisK2 2970352b25 osc: Prevent OSD style options from messing with the OSC styles
Should fix #259
2013-09-26 18:29:14 +02:00
Ben Boeckel 828a952c9a matroska: fix uninitialized memory accesses with ordered chapters
There is uninitialized memory access if the actual size isn't passed
along. In the worst case, this can cause a source to be loaded against
the uninitialized memory, causing a false count of found versus required
sources, preventing the "Failed to find ordered chapter part" message.
2013-09-26 18:20:32 +02:00
wm4 696a8c5609 osd_libass: add "Default" dummy style
This is pretty much a hack for the OSC. It will allow it to rely on a
somewhat predictable style, instead of having to overwrite all user
OSD settings manually with override tags.
2013-09-26 17:49:54 +02:00
wm4 5a837ced0b video: let sh_video->disp_w/h always be container size
Nothing really accesses it. Subtitle initialization actually does in a
somewhat meaningful way, but there container size is probably fine, as
subtitles were always initialized before the first video frame was
decoded.
2013-09-26 17:33:57 +02:00
wm4 9a55c4e70c video: let sh_video->aspect always be container aspect ratio
Now writing -1 to the 'aspect' property resets the video to the auto
aspect ratio. Returning the aspect from the property becomes a bit more
complicated, because we still try to return the container aspect ratio
if no frame has been decoded yet.
2013-09-26 17:29:14 +02:00
wm4 f5bf6c0fb3 vd: move aspect calculation to a function
This function would probably be useful in other places too.

I'm not sure why vd.c doesn't apply the aspect if it changes size by
less than 4 pixels. Maybe it's supposed to avoid ugly results with bad
scalers if the difference is too small to be noticed normally.
2013-09-26 16:09:08 +02:00
wm4 7eb13c4028 vd: remove some dead code
As of now, this function is called only after decoding a full, valid
video frame, so the image parameters should be reliable.
2013-09-26 15:54:58 +02:00
ChrisK2 0a0d7f43a5 Add the on-screen-controller
Signed-off-by: wm4 <wm4@nowhere>
2013-09-26 01:29:15 +02:00
wm4 6048f87e3c Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).

This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.

One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-26 01:28:58 +02:00
wm4 b0cc3c2cf4 Fix previous commit
This time it broke because I didn't actually test compiling vo_vaapi.c,
and it was using a macro from mp_image.h, which implicitly assumed
FFALIGN was available. Screw that too, and copy the definition of
ffmpeg's FFALIGN to MP_ALIGN_UP, and move these macros to mp_comnon.h.
2013-09-25 22:44:12 +02:00
wm4 200fb7eceb vaapi: fix compilation with Libav
The code using FFSWAP was moved from vo_vaapi.c to vaapi.c, which didn't
include libavutil/common.h anymore, just libavutil/avutil.h. The header
avutil.h doesn't include common.h recursively in Libav, so it broke
there.

Add FFSWAP as MPSWAP in mp_common.h (copy pasted from ffmpeg) to make
sure this doesn't happen again. (This kind of stuff happens all too
often, so screw libavutil.)
2013-09-25 22:22:02 +02:00
wm4 72fbd846db options: allow selecting the libass shaper
I'm using the word "languages" instead of "scripts" in the manpage, but
I think that's easier to understand with a smaller amount of
descriptions.
2013-09-25 21:42:29 +02:00
wm4 1e4f08c50c options: make --ass-hinting a choice, instead of using magic numbers
options.c still doesn't use the constants defined by the libass headers,
but it's still better than exposing those to the user directly.
2013-09-25 21:40:35 +02:00
Martin Herkt 4e6751609e configure: make the pdflatex check use the tempdir 2013-09-25 16:04:41 +02:00
Martin Herkt cc12f05a52 configure: improve pdflatex check 2013-09-25 15:57:20 +02:00
wm4 641e94cd27 vaapi: allow GPU read-back with --hwdec=vaapi-copy
This code is actually quite inefficient: it reuses the (slow, simple)
screenshot code. It uses an inefficient method to read the image
(vaGetImage() instead of vaDeriveImage()), allocates new memory for
each frame that is read, and it tries all image formats again each
time.

Also, in my tests it always picked NV12 as image format, which is not
ideal if you actually want to filter the video, and vo_xv can't handle
this format without conversion either.

However, a user confirmed that it worked for him, so everything is fine.
2013-09-25 13:53:42 +02:00
wm4 7c3f1ffc44 vd_lavc: allow process_image to change image format
This will allow GPU read-back with process_image.

We have to restructure how init_vo() works. Instead of initializing the
VO before process_image is called, rename init_vo() to
update_image_params(), and let it update the params only. Then we really
initialize the VO after process_image.

As a consequence of these changes, already decoded hw frames are
correctly unreferenced if creation of the filter chain fails. This
could trigger assertions on VO uninitialization, because it's not
allowed to reference hw frames past VO lifetime.
2013-09-25 13:53:42 +02:00
xylosper 39d1ab82e5 vaapi: add vf_vavpp and use it for deinterlacing
Merged from pull request #246 by xylosper. Minor cosmetic changes, some
adjustments (compatibility with older libva versions), and manpage
additions by wm4.

Signed-off-by: wm4 <wm4@nowhere>
2013-09-25 13:53:42 +02:00
wm4 1ee8d0210d sd_ass: minor simplification
There shouldn't be any functional changes. Just reduce the amount of
pointless temporary variables.
2013-09-24 23:18:11 +02:00
wm4 1dbb73e0fb sd_ass: remove dead code
This code was made inactive some months ago. At this time it wasn't
entirely clear whether this code was still needed, but now I'm pretty
sure it isn't. Even if it is, it didn't work anymore.
2013-09-24 23:14:38 +02:00
wm4 fdd5140f43 command: fix short buffer when handling of long property names
This wasn't enough and could lead to a cut off message shown on OSD.
Just make it dynamic, since we already use dynamic memory allocation
at this point anyway.
2013-09-24 21:26:05 +02:00
Alexander Preisinger d75cfef49c wayland: remove outdated comment 2013-09-24 18:34:50 +02:00
Alexander Preisinger 3308bc2bc9 wayland: remove moving window by grabbing
Moving the window was convenient but generates a MOUSE_LEAVE event
which it shouldn't. Now we remove it, because it is still possible
to move the window in weston with MOD+BTN0.
2013-09-24 18:30:44 +02:00
Martin Herkt d4bdcdfe09 .gitignore: add pdflatex output files 2013-09-23 19:07:22 +02:00
Martin Herkt 8764f4cf96 sub/ass_mp: remove superfluous message prefixes 2013-09-23 19:02:23 +02:00
Martin Herkt 3807038193 install: don’t force append /mpv to docdir 2013-09-23 14:09:15 +02:00
wm4 ee57f7fdae win32: edit resource files, in particular set CompanyName
Setting CompanyName (probably) helps with issue #256.

Update some other fields as well, because why not. (They're full of
MPlayer remnants.)
2013-09-23 01:44:09 +02:00
wm4 ddca41bd54 demux: don't print "Clip info:" line if there are no tags 2013-09-23 01:22:48 +02:00
Paul B Mahol 20b2d7cb6f ao_oss: add support for SNDCTL_DSP_RESET and use it when pausing
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2013-09-23 01:21:37 +02:00
wm4 cc7f8ee620 mplayer: attempt to make playback resume work with DVD/BD
The problem with DVD/BD and playback resume is that most often, the
filename is just "dvd://", while the actual path to the DVD disk image
is given with --dvd-device. But playback resume works on the filename
only.

Add a pretty bad hack that includes the path to the disk image if the
filename starts with dvd://, and the same for BD respectively. (It's a
bad hack, but I want to go to bed, so here we go. I might revert or
improve it later, depending on user feedback.)

We have to cleanup the global variable mess around the dvd_device.
Ideally, this should go into MPOpts, but it isn't yet. Make the code
paths in mplayer.c take MPOpts anyway.
2013-09-22 03:31:25 +02:00
wm4 b0f7a26f1a network: fix rtsp playback
By default, libavformat uses UDP for rtsp playback. This doesn't work
very well. Apparently the reason is that the buffer sizes libavformat
chooses for UDP are way too small, and switching to TCP gets rid of this
issue entirely (thanks go to Reimar Döffinger for figuring this out).

In theory, you can set buffer sizes as libavformat options, but that
doesn't seem to help.

Add an option to select the rtsp transport, and make TCP the default.

Also remove an outdated comment from stream.c.
2013-09-22 02:40:29 +02:00
wm4 ce861c9f33 stream_lavf: print lavf options that could not be set
Mainly for debugging. Usually, we just set options for all possible
protocols, and we can't really know whether a certain protocol is used
beforehand. That's also the reason why avio_open2() takes a dictionary,
instead of letting the user set options directly with av_opt_set(). Or
in other words, we don't know whether an option that could be set is an
error or not, thus we print the messages only at verbose level.
2013-09-22 02:20:18 +02:00
wm4 eda596a3f9 command: when changing volume while muted, show an extra message on OSD
So nobody has to wonder why everything is silent, even if they raise the
volume.
2013-09-21 00:08:38 +02:00
wm4 897d4b58a1 command: when changing a property, allow showing an extra OSD message
This is for properties that normally show a bar, and thus do not show an
OSD message (as per classic mplayer behavior). Setting an extra_msg
allows showing an OSD message anyway, except if OSD messages are
explicitly suppressed.

This refactors the whole show_property_osd() function a bit, and
replaces the weird sep field with a more general method.
2013-09-21 00:07:42 +02:00
wm4 f988c63003 m_property: add a way to switch on property values in property expansion
Allows for example: --status-msg='${?pause==yes:(Paused) } ...' to
emulate the normal terminal status line. It's useful in other situations
too.

I'm a bit worried about extending this mini-DSL, and sure hope nobody
will implement a generic formula evaluator at some point in the future.
But for now we're probably safe.
2013-09-20 23:09:43 +02:00
wm4 ab706f9969 m_property: rearrange code 2013-09-20 22:26:08 +02:00
wm4 99576ac483 command: don't append, but prepend deinterlace filter by default
In most cases, it's better if deinterlacing happens before any other
filtering, so prepend the filter to the user's filter list, instead
of appending it.
2013-09-20 16:48:08 +02:00
wm4 d5a3739105 vo_lavc: mp_msg conversion
Also restores consistent log message prefixes with ao_lavc.
2013-09-20 16:32:36 +02:00
wm4 0611c43b97 command: use a list of potential deinterlacer filters
Instead of hardcoding a single filter. This might be helpful for
modeling the vaapi deinterlacer as a video filter. The idea is that a
software deinterlacer would be tried first, and if that fails (because
vaapi hardware decoding uses HW surfaces, which a software deinterlacer
does not accept), the vaapi filter would be tried.
2013-09-20 15:09:29 +02:00
wm4 2694b5f378 vo/x11_common: don't require a working input method
Normally, we need this for Xutf8LookupString(). But we can just fall
back to XLookupString(). In fact, the code for this was already there,
the code was just never tested and was actually crashing when active
(see commit 2115c4a).
2013-09-20 14:45:49 +02:00
wm4 6c28524e0f vf: fix filter initialization error check
vf_open returns 0 on error, 1 on success. Oops. Accidentally broken
with 6629a95.
2013-09-20 14:01:00 +02:00
Johan Kiviniemi 912f609403 ao_pulse: bug fix: goto the correct error handler 2013-09-20 13:50:45 +02:00
Johan Kiviniemi e5710ccc5d ao_pulse: set the property media.role=video 2013-09-20 13:50:13 +02:00
wm4 3e5b632559 Merge branch 'volume_restore' 2013-09-20 13:48:36 +02:00
wm4 542086dd45 af: merge af_reinit() and fix_output_format()
Calling them separately doesn't really make sense, and all existing
calls to them usually combined them. One subtitle difference was that
af_init() didn't wipe the filter chain if initialization of the chain
itself failed, but that didn't really make sense anyway.

Also remove af_init() from the code for setting balance in mixer.c. The
mixer should be in the initialized state only if audio is fully
initialized, so the af_init() call made no sense.

Note that the filter "editing" code in command.c doesn't really do a
nice job of handling errors in case recreating an _old_ (known to work)
filter chain unexpectedly fails, and this obscure/rare case might be
differently handled after this change.
2013-09-20 13:43:00 +02:00
wm4 0162271725 mixer: make struct opaque
Also remove stray include statements from ao_alsa and ao_oss.
2013-09-20 13:23:25 +02:00
wm4 327a779a81 mixer: allow accessing volume and mute property on disabled audio
The volume is set as soon as the audio chain is created again. This
works only in softvol mode. For system wide volume or otherwise
externally user controllable volume, this code is intentionally
disabled. It would be extremely weird if changing volume (while audio is
not initialized) would do nothing, and then suddenly change it when the
audio chain is created.

There's another odd corner case: the user-set volume will be thrown away
if it's set before the _first_ audio chain initialization. This is
because the volume restore logic recognizes a change from nothing to
softvol or an AO, and circumventing that would require additional code.
Also, we don't even know the start volume before that point.

Forcing the volume with --volume will can override the volume set during
no-audio mode, depending on the situation.
2013-09-20 13:23:25 +02:00
wm4 7623c94ddc manpage: af_volnorm was renamed 2013-09-20 13:23:25 +02:00
wm4 b8e42ae13c mixer: restore volume with playback resume
Note that this is intentionally never done if the AO or softvolume is
different, or if the current volume control method is thought to control
system wide volume (such as ALSA) or otherwise user controllable (such
as PulseAudio). The intention is to keep things robust and to avoid
messing with the user's audio settings as far as possible, while still
providing the ability to resume volume if it makes sense.
2013-09-20 13:23:25 +02:00
Martin Herkt ed2d67b6d7 vo/x11_common: remove superfluous msg prefixes 2013-09-20 00:04:39 +02:00
Stefano Pigozzi 061b6ab3aa macosx_application: fix regression causing crash
95a2151d1 introduced a crash on systems lower than 10.9 when opening files
with a single argument.
2013-09-19 22:03:49 +02:00
Stefano Pigozzi 00d8e85373 Revert "osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts"
Commit broke text subtitles without embedded fonts. Will look for a better
solution later. Revert it for now, since I'm starting to get bug reports.

This reverts commit 4a9f618d9f.
2013-09-19 21:39:16 +02:00
Martin Herkt 2115c4a3ad vo/x11_common: Fail init with no valid XIM
XOpenIM can fail to find a valid input method, in which case it
returns NULL. Passing a NULL pointer to XCreateIC would cause a
crash, so fail VO init before that happens.
2013-09-19 20:08:34 +02:00
Alexander Preisinger 858dcee5f1 wayland/common: exit properly on fd errors
Before this commit there was just an error message, but the file descriptor was
still open. Now we close the file descriptor and prevent it from calling
endlessly. Also a CLOSE_WIN event is sent which closes the window eventually if
the action of CLOSE_WIN is set to quit or quit_watch_later.
2013-09-19 17:45:49 +02:00
wm4 6599677b98 mplayer: rename a somewhat misnamed function 2013-09-19 17:28:27 +02:00
wm4 93feffad15 vo_opengl: blend alpha components by default
Improves display of images and video with alpha channel, especially if
the transparent regions contain (supposed to be invisible) garbage
color values.
2013-09-19 17:03:03 +02:00
wm4 234d967bed mixer: don't unmute audio when raising volume
This is rather strange behavior, away with it.
2013-09-19 14:32:25 +02:00
wm4 38b2c97fd6 mixer: refactor, fix some aspects of --volume handling
Refactor how mixer.c does volume/mute restoration and initialization.
Move to handling of --volume and --mute to mixer.c. Simplify the
implementation of these and hopefully fix bugs/strange behavior related
to using them as file-local options (this uses a somewhat dirty trick:
the option values are reverted to "auto" after initialization). Put most
code related to initialization and volume restoring in probe_softvol()
and restore_volume(). Having this code all in one place is less
confusing.

Instead of trying to detect whether to use softvol at runtime, detect it
at initialization time using AOCONTROL_GET_VOLUME (same with mute,
AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work
if the GET variants work. Hopefully this is always the case.

This is also preparation for being able to change volume/mute settings
if audio is disabled, and for allowing restoring value with playback
resume.
2013-09-19 14:32:09 +02:00
wm4 4ba52a9e82 mixer, af_volume: use linear values instead of dB
Softvol always used a linear multiplier for volume control. This was
converted to dB, and then back to linear in af_volume. Remove this non-
sense. We still try to keep the command line argument to af_volume in
dB, though.
2013-09-19 14:31:55 +02:00
wm4 296531ad00 mixer: minor refactoring
Let struct mixer access access MPOpts to simplify some things. Rename
some variables and functions. There should be no functional changes.
2013-09-19 14:31:43 +02:00
wm4 69e272dad7 af_export: fix compilation warning
Blargh.
2013-09-19 14:30:53 +02:00
Stefano Pigozzi 4a9f618d9f osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts
This is to avoid the 30s hang while mpv caches fonts. In practice all the
fonts an average user is going to use are embedded in mkv files so there is
no reason to build fontconfig's cache on all of OS X system directories.

I might add something similar for terminal usage, but I am highly undecided.
2013-09-18 22:18:33 +02:00
wm4 5249cccfcf Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
2013-09-18 19:56:15 +02:00
wm4 1298dbdf01 osdep/path: remove ifdefs
They're not really needed, so kill them.
2013-09-18 19:42:19 +02:00
Stefano Pigozzi af018f7e4f macosx: move bundle path stuff to path-macosx.m
This makes the code uniform to how stuff was handled for Windows in 1cb55ceb.
2013-09-18 19:30:11 +02:00
wm4 1cb55cebf9 path, win32: redo user configfile path handling
Remove the ifdef hell from mp_find_user_config_file(). Move the win32
specific code (for MinGW and Cygwin) to path-win.c. The behavior should
be about the same, but I can't be sure due to lack of testing and
because the old path.c code was hard to follow. (I expect those who care
about windows will fix things, should issues pop up - sorry.)

One difference is that the new code will always force MPV_HOME. It looks
like the old code preferred the mpv config dir in the exe dir if it
exists.

Also, make sure MP_PATH_MAX has enough space, even if the equivalent
wchar_t string is not 0-terminated with PATH_MAX (because apparently the
winapi doesn't require this). (Actually, maybe we should just kill all
uses of PATH_MAX/MP_PATH_MAX.)
2013-09-18 19:08:51 +02:00
wm4 12372298a2 win32: add getenv() UTF-8 variant
This is a bit "hard", because getenv() returns a static string, and we
can't just return an allocated string. We also want getenv() to be
thread-safe if possible. (If the mpv core is going to be more threaded,
we sure do want the lower layers to be thread-safe as well.)
2013-09-18 19:08:51 +02:00
wm4 b97d10a839 path: fix undefined behavior
The homepath variable was static, and its value was set to a stack
buffer. This means a second invocation of the function would trigger
undefined behavior. Moreover the stack buffer always went out of scope
before homepath was used.
2013-09-18 19:08:51 +02:00
Stefano Pigozzi bb4ea8bb3e cocoa_common: signal a mouse movement when changing window size
This is mainly to avoid spurious cursor states due to the mouse moving inside
or outside the window as a result of the window resize (with cmd-0/1/2).

This avoids complex logic and triggers a mouse move so that the player
recomputes the correct cursor state based on the autohide configuration of
the user.
2013-09-18 19:05:00 +02:00
Stefano Pigozzi a08802016d cocoa_common: override core's cursor visibility state
This keeps the state in sync with the current state in cocoa_common. Infact the
cocoa code in mpv can decide wether it really wants to hide the cursor based on
the result of the `canHideCursor` method (this is so that the cursor is only
hidden when hovering on the video window).
2013-09-18 19:05:00 +02:00
Stefano Pigozzi fc74574df0 HIDRemote: remove OS X version checks
Turns out that these checks were for versions of OS X that mpv doesn't even
support anymore. So just remove the checks since they cause a deprecation
warning.
2013-09-17 20:44:54 +02:00
wm4 82de39b7d5 find_subfiles: fix really dumb bug causing segfaults
NULL pointer deref when a .sub file with the same filename as the video
file was present.

I was probably half asleep when writing this code.
2013-09-17 15:41:23 +02:00
Nyx0uf 95a2151d19 macosx_application: remove deprecation warning on OS X 10.9
GetCurrentProcess() is deprecated on 10.9. Make a universal solution by
checking OS version number.

get_system_version() function is the recommended Apple way of getting the
OS version, since Gestalt is also deprecated (and does pretty much the same
thing anyway)

Updating HIDRemote.m to use a similar function would allow to get rid of the
2 other warnings.
2013-09-16 21:51:08 +02:00
Andreas Sinz 44b6696279 gl_common: add wayland backend before x11 backend 2013-09-16 13:45:47 +02:00
wm4 2f165ee12b gl_common: signal to GL backend whether we are probing
This is supposed to reduce the amount of useless error messages shown
during initialization of vo_opengl. If multiple backends are compiled,
usually only one of them will work. For example, on Linux both X and
Wayland backends can be compiled, but usually either Wayland or X is
running. Then, if Wayland is not running, but X is, trying to initialize
the Wayland backend should not spam the terminal with error messages.

Signed-off-by: Andreas Sinz <andreas.sinz@aon.at>
2013-09-16 13:45:33 +02:00
wm4 6da11789ae mplayer: read subtitle packets as soon as possible
Call update_subtitles() on every iteration of the playloop, so that
subtitle packets are read as soon as possible, instead of every time a
video frame is displayed. This helps in case the packet queue is swamped
with subtitle packets, which can happen with certain insane mkv files.
The change will simply cause the subtitle queue to be emptied on each
playloop iteration.

The timestamps update_subtitles() uses for display are the same before
and after this commit. (Important for files which have subtitle packets
with timestamps or duration not set.)
2013-09-16 00:46:14 +02:00
wm4 4a3ceac2b5 demux_mkv: don't add too many subtitle packets during seeking
In insane files with a very huge number of subtitle events, and if the
--demuxer-mkv-subtitle-preroll option is given, seeking can still
overflow the packet queue. Normally, the subtitle_preroll variable
specifies the maximum number of packets that can be added. But once this
number is reached, the normal seeking behavior is enabled, which will
add all subtitle packets with the right timestamps to the packet queue.
At this point the next video keyframe can still be quite far away, with
enough subtitle packets on the way to overflow the packet queue.

Fix this by always setting an upper limit of subtitle packets read
during seeking. This should provide additional robustness even if the
preroll option is not used.

This means that even with normal seeking, at most 500 subtitle packets
are demuxed. Packets after that are discarded.

One slightly questionable aspect of this commit is that subtitle_preroll
is never reset in audio-only mode, but that is probably ok.
2013-09-16 00:46:14 +02:00
wm4 4f400d2b85 command: force video refresh when changing aspect
Pausing the player and changing the aspect would leave the VO without a
frame to display.
2013-09-15 22:03:29 +02:00
wm4 471d6f0013 manpage: remove bogus space in example usage 2013-09-15 21:32:26 +02:00
wm4 d6884defa7 Add mpv.desktop, let Makefile install the desktop file and the icons
The mpv.desktop file is taken from the Arch package [1]. It appears to
be based on the mplayer2 git mplayer.desktop file (e.g. very similar
MimeType field), with minor modifications applied by Arch package
maintainers.

Note that for now, this doesn't show a terminal (Terminal=false), which
might not always be ideal. For example, if the file is audio only, or
if VO initialization fails for some reason, mpv will run in the
background and play audio without showing a window. But users prefer
running it without terminal, and don't want to play audio files with
it.

Maybe a --force-window option will be added in the future, which would
always create a VO window, and compensate for these issues.

[1] https://aur.archlinux.org/packages/mpv-git/
2013-09-15 21:22:30 +02:00
wm4 132c7f1cf5 manpage: remove version and date fields
These would have to be updated manually all the time. Replacing them
automatically would be possible, but additional work, and would force
regeneration of the manpage way too often.

We decided that we don't need these fields.
2013-09-15 20:44:07 +02:00
wm4 9aa206a90e screenshot: change %w format to be more like %t
Instead of containing a format string within %w{...}, simply allow %w
to specify one item of a time format string. This is simpler, more like
other format specifiers (%t),  and probably easier to use too.
2013-09-15 19:07:35 +02:00
wm4 884c179177 mplayer: attempt to skip playlist entries which can't be played
This is for situations when repeated attempts at playing a playlist
entry failed, and playlist navigation becomes impossible due to that.
For example, it wasn't possible to skip backwards past an unplayable
playlist entry:

    mpv file1.mkv doesntexist.mkv file3.mkv

You couldn't skip back to file1.mkv from file3.mkv. When running a
single "playlist_prev" command, doesntexist.mkv would be played, which
would fail to load. As reaction to the failure to load it, the next file
would be played, which is file3.mkv.

To make this even worse, the file could successfully load, but run only
for a split second. So just loading successfully isn't good enough.

Attempt to solve this by marking problematic playlist entries as failed,
and by having playlist_prev skip past such playlist entries. We define
failure as not being able to play more than 3 seconds (or failing to
initialize to begin with). (The 3 seconds are in real time, not file
duration.)

"playlist_prev force" still exhibits the old behavior.

Additionally, use the same mechanism to prevent pointless infinite
reloading if none of the files on the playlist exist. (See github issue

All in all, this is a heuristic, and later adjustments might be
necessary.

Note: forward skips (playlist_next) are not affected at all. (Except for
the interaction with --loop.)
2013-09-15 05:03:55 +02:00
wm4 aa43405020 screenshot: make it possible to format playback time in various ways 2013-09-15 02:51:19 +02:00
wm4 58cff195e7 mp_common: add function which accepts a format string to format playback time 2013-09-15 02:51:17 +02:00
wm4 a87298e501 mplayer: don't run heartbeat command while paused
This is commonly used to disable the screensaver with broken/non-
standard X screensavers. During pause, the screensaver should not be
disabled, so not calling this command while paused seems sensible.

See github issue #236.
2013-09-15 02:13:54 +02:00
wm4 534842b694 av_log: show ffmpeg "info" messages with -v only
They are rarely useful in my opinion.

This commit was mainly motivated by this message:

    Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using a tool like VirtualDub or avidemux to fix it.

It's what's left over from the "Invalid and inefficient vfw-avi..."
warning that used to be printed when playing avi/divx files. Although
the new message is much better, it's still rather useless and poses
more questions than it answers. Besides, nobody wants to remux a file
when playing it, especially not if playback appears to be completely
fine. (There are some claims that these files raise CPU usage, but even
my old crappy CPU can decode low res avi/divx files at real time at
about x35 playback speed.)
2013-09-15 00:43:43 +02:00
Stefano Pigozzi 47715fd1f7 mplayer: m_option: fix clang -Wformat compiler warning
Code was using %d format instead %zd to print size_t data.
2013-09-14 20:49:55 +02:00
Stefano Pigozzi 855b705980 stream_dvd: prevent segmentation fault with some broken files
I have a sample where some final chapters are missing. This was causing a
segmentation fault when trying to fetch chapter times for them.

This makes the code ignore those chapters.
2013-09-14 20:49:55 +02:00
Bilal Syed Hussain 29edc86721 macosx: add webm the filetypes handled by the bundle 2013-09-14 20:49:55 +02:00
Benjamin Franzke 15dccc3746 demux_playlist: add mov RTSPtext tag parser
The quicktime html scripting guide suggests to wrap urls not
necesarly associated with quicktime in a .mov file.
(so that when <embed>ing videos quicktime would be forced.)
These mov files may contain several "Text Hacks".
One of these is RTSPtext.

The suggested/allowed format (as regex) is like:
  RTSPtext[ \r]RTSP://url
See also p.51 of:
https://developer.apple.com/library/mac/documentation/QuickTime/Conceptual/QTScripting_HTML/QTScripting_HTML.pdf
In reality there are also files like (e.g. zdfmediathek.de):
RTSPtext\nrtsp://url\n\n

Lets handle these files as a playlist with one element.
2013-09-14 15:58:10 +02:00
Stefano Pigozzi 61790c98e8 README: add clarification about --enable 2013-09-14 10:00:59 +02:00
Stefano Pigozzi 438f9e585d README: update Contact info with Mailing Lists 2013-09-14 10:00:59 +02:00
wm4 a0cdb1ea45 mplayer: print a message when writing watch_later config for resume 2013-09-13 21:36:19 +02:00
wm4 728816e87b mplayer: change "Playing" message printed before playback start
Change it from "Playing file." to "Playing: file". The idea is that it
looks nicer without that trailing dot. (See github issue #229.)
2013-09-13 21:32:29 +02:00
xylosper 1a1504914a vd_lavc: reset last_sample_aspect_ratio in uninit_avctx()
In init_vo(), if sh->aspect is 0 or last_sample_aspect_ratio is set,
sh->aspect is overwritten. With software decoding fallback behaviour,
this makes the aspect ratio from container ignored since
last_sample_aspect_ratio is already set in first try with hardware
decoding.
2013-09-13 21:32:29 +02:00
wm4 ea1200111d core: restore user-set video and audio filters with resume functionality
This requires adding a function that converts the filter list back to a
string.
2013-09-13 21:32:28 +02:00
wm4 6cec60a454 core: add --deinterlace option, restore it with resume functionality
The --deinterlace option does on playback start what the "deinterlace"
property normally does at runtime. You could do this before by using the
--vf option or by messing with the vo_vdpau default options, but this
new option is supposed to be a "foolproof" way.

The main motivation for adding this is so that the deinterlace property
can be restored when using the video resume functionality
(quit_watch_later command).

Implementation-wise, this is a bit messy. The video chain is rebuilt in
mpcodecs_reconfig_vo(), where we don't have access to MPContext, so the
usual mechanism for enabling deinterlacing can't be used. Further,
mpcodecs_reconfig_vo() is called by the video decoder, which doesn't
have access to MPContext either. Moving this call to mplayer.c isn't
currently possible either (see below). So we just do this before frames
are filtered, which potentially means setting the deinterlacing every
frame. Fortunately, setting deinterlacing is stable and idempotent, so
this is hopefully not a problem. We also add a counter that is
incremented on each reconfig to reduce the amount of additional work per
frame to nearly zero.

The reason we can't move mpcodecs_reconfig_vo() to mplayer.c is because
of hardware decoding: we need to check whether the video chain works
before we decide that we can use hardware decoding. Changing it so that
this can be decided in advance without building a filter chain sounds
like a good idea and should be done, but we aren't there yet.
2013-09-13 21:32:28 +02:00
Stefano Pigozzi ddd3ade023 macosx_application: fix file opening on 10.9 (for real this time)
I did commit 86c05655d by thinking `mpv` already removed the `mpv` from
argc/argv. It actually is still there, so the argc must be 1 to check for no
arguments.

Thanks to @Nyx0uf for pointing out the bug and for testing on 10.9!
2013-09-13 19:55:15 +02:00
Stefano Pigozzi fe7fed590a macosx: always active bundle path lookup if cocoa is active
This is not really something you want to disable anyway. If there is no bundle
the code already does it's falbacks anyway.
2013-09-12 18:45:40 +02:00
Stefano Pigozzi 86c05655d4 macosx_application: fix file opening on OS X 10.9 (hopefully)
File opening through Finder, apparently drops `--psn` arguments on Mavericks
and just uses no args. Modify the code to account for that case.

This wasn't tested on 10.9 itself (I don't have a paid dev account), but it
*should* work if I understood the problem correctly.
2013-09-12 18:42:59 +02:00
Martin Herkt be96a25dad mpvcore/path: Fix non-MinGW builds
Well that was dumb.
2013-09-12 18:26:14 +02:00
Alexander Preisinger 71f287c9c0 wayland/shm: fix resizing for good (finally)
Problem: I own the buffer and I destroyed while still being displayed.
Solution: Add a temporary buffer and destroy it when the next buffer is
attached.
2013-09-12 18:15:35 +02:00
Martin Herkt 63c61500b8 mpvcore/path: Fix config path handling on Windows
Previously, mpv incorrectly used the %HOME% environment variable on
MinGW to determine the current user’s home directory. This is wrong;
the correct variable to use would be %HOMEPATH%, which would however
still be wrong since application data goes into the application data
directory, not the user’s home. This patch makes it use the local
AppData path instead of reading an environment variable.

This however exposed another problem (which also affected users who
actually had the %HOME% variable set):
b2c2fe7a37 (discussed in issue #95) introduced some changes that
make mpv load user config files from the executable path on Windows.
The problem with this change is that config_dir was still declared
static, so once a config file had been found in the executable path,
it would set config_dir to an empty string, so mpv would dump e.g.
watch_later data straight into the user’s home. This commit also
fixes that.

One side effect of this is that mpv no longer considers the “mpv”
subdirectory in the executable path (that behavior resulted from
the homedir variable always being empty), unless it is somehow
unable to determine the local AppData path.
2013-09-12 18:02:57 +02:00
Alexander Preisinger 195b8bfe93 wayland: change fs messages to dbg
These messages are only helpful when debugging.
2013-09-12 16:38:44 +02:00
Alexander Preisinger 6bd911d7db wayland/egl: use wayland log 2013-09-12 16:36:52 +02:00
Alexander Preisinger cb3d200f58 wayland/shm: use wayland log 2013-09-12 16:31:48 +02:00
Alexander Preisinger aa5f8ba542 Revert "wayland: don't create our own log context"
This reverts commit beab54506e.

Conflicts:
	video/out/wayland_common.c
2013-09-12 16:29:13 +02:00
wm4 1061f43a2f gl_osd: mp_msg conversion 2013-09-12 01:34:42 +02:00
wm4 3a9c5ef687 aspect: mp_msg conversion 2013-09-12 01:34:42 +02:00
wm4 75e63ebb24 gl_lcms: mp_msg conversion
Have to deal with some dumb stuff in LittleCMS2's API: its error handler
is global.
2013-09-12 01:34:42 +02:00
wm4 beb1aa5988 gl_common: complete mp_msg conversion
Hopefully this works on Wayland and Cocoa, which I didn't test.
2013-09-12 01:34:42 +02:00
wm4 057407a39f x11_common: mp_msg conversion
Doesn't touch some parts, like the X11 error handler (which doesn't
allow setting a context pointer).
2013-09-12 01:34:41 +02:00
Alexander Preisinger a84fd1c44a gl_32: mp_msg conversion 2013-09-11 22:41:14 +02:00
Alexander Preisinger b789ef5e8e w32_common: mp_msg conversion 2013-09-11 22:41:14 +02:00
Alexander Preisinger df5606afe0 gl_x11: mp_msg conversion 2013-09-11 22:41:13 +02:00
Stefano Pigozzi 9549746453 Makefile: update DIRS to fix cleaning
Commits 40624100 and 72f2942df didn't update the variable accordingly.
2013-09-11 19:24:40 +02:00
wm4 739cd61024 input: fix accidental NULL pointer dereference
This could happen if the input queue was full, and an unmapped key was
used, or something like this.

Possibly fixes github issue #224.
2013-09-11 18:32:36 +02:00
Stefano Pigozzi 763f33424e input: convert to new msg API 2013-09-10 21:31:02 +02:00
Stefano Pigozzi 49849190dd cocoa_common: remove most of the special handling for cursor autohide
This is mostly related to the fullscreen behaviour. cecbd8864 introduces an
option to make mpv behave like a OSX user would expect. This commit changes
the Cocoa parts of the code to be consistent with the behaviour on X11. Old
behaviour is still available through the option mentioned in cecbd8864.

There is still custom logic in the cocoa backend and it can probably be moved
to core:

  * Don't perform autohide if the mouse is down
  * Don't perform autohide outside of the video window

Fixes #218 (by accident)
2013-09-10 21:24:37 +02:00
Stefano Pigozzi 9f01797eac mplayer: remove duplicated mouse autohide check 2013-09-10 21:24:22 +02:00
Alexander Preisinger 6de1cb2d59 wayland/common: improved error messages
The previous error message were not very usefull.
Also include a hint where to look for solutions.
2013-09-10 17:53:43 +02:00
wm4 fc18c1ba6e mplayer: print libquvi results in verbose mode
Helpful for debugging.
2013-09-10 17:21:59 +02:00
wm4 6a850b0264 quvi: restore playback position when switching formats
This simply issues a seek after reloading.
2013-09-10 16:50:19 +02:00
wm4 cf0e852fcd quvi: coerce libquvi 0.4 support into allowing format switching
libquvi 0.4 doesn't allow us listing the formats supported by a
streaming site without doing additional network accesses, so switching
formats was not supported with it. (It's different with libquvi 0.9.)

But the most important case is switching between SD and HD. Usually,
--quvi-format=default will get SD, while --quvi-format=best gives HD.
Use this, and pretend that an URL supported by libquvi 0.4 supports both
of these. "cycle quvi-format" will switch between these. If the user
specifies something else via --quvi-format, this is included in the list
of switchable formats additionally to "default" and "best".
2013-09-10 16:38:34 +02:00
wm4 c9a740fccd stream_bluray: return number of titles
So that the "titles" property returns the number of titles.
2013-09-10 15:39:48 +02:00
wm4 328b951019 command: make title property unavailable if there's no support
Instead of returning 0 if the stream doesn't have title info, make the
property unavailable.
2013-09-10 15:39:05 +02:00
wm4 316dfb93d7 stream: force demuxer of cached stream, fixes cdda:// + cache 2013-09-10 15:23:27 +02:00
wm4 bf71e28d6b mplayer: mentioned --list-options in --help output
It's annoying for users if you can't get a list of options with --help,
but on the other hand, printing all options would be overkill. So just
mentioned --list-options.
2013-09-10 15:19:37 +02:00
wm4 12efec7a48 Makefile: restore manpage dependency rules
Broken by commit 0054073.

Also add them to the pdf target.
2013-09-10 15:16:20 +02:00
wm4 12770d5407 manpage: various improvements
Took a superficial look at the manpage, and fixed whatever I spotted.
2013-09-10 15:12:25 +02:00
Alexander Preisinger 683e58066e wayland: update license headers 2013-09-09 18:37:33 +02:00
Alexander Preisinger b30ad057a5 wayland/shm: version detection that also works
The previous method would break on the next release. Because I am stupid.
2013-09-09 18:21:48 +02:00
Martin Herkt 005407338d Add PDF manual target
This builds a PDF version of the manpage using rst2latex
and pdflatex, and installs it to PREFIX/share/doc/mpv by
default.
2013-09-09 04:34:56 +02:00
wm4 1b4d9b26cb demux: keep title chapter tag in uppercase
This is generally more uniform.

Do the same for the file global title in demux_mkv.c, although that is
not strictly related to chapters.
2013-09-08 23:07:02 +02:00
wm4 f5195cc4e7 demux_mkv: support V_PRORES
Why not...

Code for demangling Matroska-style prores video packets inspired by
libavformat's Matroska demuxer.
2013-09-08 23:05:18 +02:00
Martin Herkt 3992e5dfca DOCS/crosscompile-mingw.txt: Update 2013-09-08 12:25:20 +02:00
Martin Herkt c9873ea06c Manpage: Fix formatting (mostly for PDF output) 2013-09-08 12:02:30 +02:00
Gabriel Peixoto 856c58aa9c find_subfiles: fix off-by-1 error
This could lead to a segfault, fixes #219

Signed-off-by: Gabriel Peixoto <gabrielrcp@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2013-09-08 07:44:08 +02:00
wm4 35fd083828 demux: retrieve per-chapter metadata
Retrieve per-chapter metadata, but don't do much with it. We just make
the metadata of the _current_ chapter available as chapter-metadata
property. Returning the full chapter list with metadata would be no
problem, except that the property interface isn't really good with
structured data, so it's not available for now.

Not sure if it's worth it, but it was requested via github issue #201.
2013-09-08 07:43:23 +02:00
wm4 ba07000b88 demux: refactor tag handling
Make the code somewhat reuseable, instead of bound to a single demuxer
instance. The plan is to add support for per-chapter tags later.
2013-09-08 06:32:48 +02:00
wm4 1aae5981a7 core: remove a minor memory leak 2013-09-08 05:17:05 +02:00
wm4 222b8c6e02 demux_mkv: don't overflow packet queue when doing sub-preroll
Consider the cluster used for prerolling contains an insane amount of
subtitle packets. Then the demuxer packet queue would be full of
subtitle packets, and demux.c would refuse to read any further packets -
including video and audio packets, resulting in EOF. Since everything
involving Matroska and subtitles is 100% insane, this can actually
happen.

Fix this by putting a limit on the number of subtitle packets read by
preroll, and throw away any further packets if the limit is exceeded. If
this happens, the preroll mechanism will stop working, but the player's
operation is unaffected otherwise.
2013-09-08 05:09:16 +02:00
ChrisK2 7f398f833e osc: rename osd_font, add some glyphs
Cherry picked from various commits in lua_experiment by ChrisK2.

The metrics of the OSD symbols change slightly, possibly due to the
font editor that was used, and the metrics were not correct to begin
with. (But the real reason seems unknown.) Remove the rescaling of
the OSD font in ASS_USE_OSD_FONT, because the height more or less fits
now. (This change wasn't in the lua_experiment branch.)
2013-09-08 03:35:04 +02:00
wm4 9a1978b2ee osd_libass: make sure Z-order is well defined for multiple events
Otherwise, events may overlap in arbitrary ways.
2013-09-08 03:20:38 +02:00
wm4 9ec9bff4c1 mplayer: cosmetics: split some code off of run_playloop()
run_playloop() is already stuffed enough. This function is still quite
big, but all the other code shares various variables, so it's not as
easy to split.
2013-09-08 03:04:21 +02:00
wm4 cecbd8864e mplayer: add --cursor-autohide-fs-only option
This option makes the cursor always visible in windowed mode.
Apparently, this is what (some?) Windows and OSX users expect. It's
disabled by default for now.

Restructure the cursor hide logic a bit for this purpose.
2013-09-08 03:03:58 +02:00
wm4 68e331851a options: remove --(no-)mouseinput option
I have no idea why it exists, as it's redundant to --(no-)mouse-movements.
2013-09-08 03:03:58 +02:00
wm4 0509532d70 options: cosmetics: move cursor_autohide_delay definition
No functional changes.
2013-09-08 03:03:58 +02:00
wm4 f1b5198b35 input: rearrange code
Let all key events go through mp_input_feed_key() internally, and also
do double click and MP_INPUT_RELEASE_ALL handling there. Move
check_autorepeat() to where it's actually used.
2013-09-08 01:50:14 +02:00
wm4 ac927e39bf input: don't deliver mouse events if mouse area is not set
This caused the OSC to be always visible at startup on X11:
- EnterNotify event send a mouse event to input.c
- OSC has not completely initialized yet, and no mouse area is set
- mouse event is dispatched to "showhide" OSC section
- OSC becomes visible, regardless of mouse position

Fix this by treating the mouse area as empty if it's not set, instead of
infinite as it was before this commit. This means an input section must
set a mouse area to receive mouse events at all. We also have to change
the default section to receive mouse events with the new behavior.

Also, if MOUSE_MOVE is unmapped (or mapped to something that doesn't
parse), and produces no command, the mouse position wouldn't be updated
(because the mouse position is bound to input commands), so we have to
generate a dummy command in this case.

(This matters only for the OSC, On Screen Controller, which isn't merged
yet, so these changes shouldn't have much effect right now.)
2013-09-08 01:50:14 +02:00
wm4 0a9919fa2e input: merge consecutive mouse move events
Might give better behavior on load.
2013-09-08 01:49:59 +02:00
wm4 681e829793 input: split queue_add() function
Split it into queue_add_head() and queue_add_tail(). Gets rid of the
weird, rarely used boolean parameter.
2013-09-08 01:49:59 +02:00
wm4 6c19067362 input: redo what input events can be dropped
Until now, any command was dropped as soon as the input queue was full,
and the command was not an abort command (i.e. a command that exits the
player or goes to the next file).

This could cause issues with key down events (especially mouse buttons)
not being released.

Change it so that key up events can never be dropped. This is a bit
involved, because we know whether a key maps to an abort command only
after interpreting it, and interpreting it changes global state, which
in turn requires undoing the event if the input is dropped. Refactor
the code a bit to move more functionality into interpret_key() to make
this easier.
2013-09-08 01:49:59 +02:00
wm4 5f00c3cf20 input: remove separation between key and control queue
This is actually quite useless. It also allows the control queue to
starve the key queue, because the control queue is always checked first.
2013-09-08 01:49:57 +02:00
wm4 dd67b32acd example.conf: some modifications
Remove options which are too obscure and most likely not very useful in
general, or update them to something more modern. Add some comments
about how configuration files work in general.
2013-09-07 22:43:31 +02:00
wm4 c7ab8ea513 mplayer: don't auto-load explicitly loaded subtitle files
Even if a subtitle was explicitly loaded with -sub, it was still auto-
loaded (if auto-loading applied to that file). Fix this by explicitly
checking whether a file is already loaded.

The check is maximal naive and just compares the filenames as strings.
The change in find_subfiles.c is so that "-sub something.ass" happens to
work (auto-loading prepended a "./" to it, so the naive filename
comparison check didn't work).
2013-09-07 20:34:49 +02:00
wm4 dc475728e0 find_subfiles: don't auto-load .sub file if .idx file exists
External vobsubs usually come as .idx/.sub pairs. Loading the .idx file
implicitly loads the .sub file, whereas loading the .sub file will kind
of work, but miss important information such as subtitle resolution. Or
in other words, if the .idx file exists, adding the .sub file as track
is useless and confusing.

Explicitly remove .sub file from the auto-load suntitle list in these
cases. Standalone .sub files are still loaded.

We also drop that weird logic that excluded .utf8 files from being
loaded if -subcp was in use. I hope the associated use case didn't make
much sense to begin with. If not, we could still implement it properly,
instead of this weird hack.
2013-09-07 20:34:49 +02:00
wm4 580e925011 find_subfiles: some cleanups
Remove a crap assert() (what... either it can't happen, or it should
error or at least abort() if it can't be handled).

Remove some dead definitions.
2013-09-07 20:34:49 +02:00
wm4 fde0f40e87 find_subfiles: use stat() instead of opening the file to check existence
Use mp_path_exists() to check for existence of a file (which in turn
uses stat()), instead of opening and closing it. The difference is that
if we don't have sufficient permissions to read the subtitle files, we
will loudly complain. Personally, I prefer this behavior.
2013-09-07 20:34:49 +02:00
wm4 9d0d2443fb find_subfiles: don't try to open URLs as directories
Did things like opendir("http://..."). Makes no sense, and just
generates noise.
2013-09-07 20:34:49 +02:00
wm4 082ea0de12 mp_core: fix a comment
track.demuxer is never NULL (anymore).
2013-09-07 20:34:49 +02:00
wm4 c4b935adf7 mplayer: remove unused mp_add_subtitles() parameter 2013-09-07 20:34:49 +02:00
wm4 8894a4b0d2 command: make options writeable in idle mode
Until now, options could be accessed as properties via "options/name",
but the access was read-only. Change it so that write access is possible
in --idle mode. (All options have to support setting options at that
time, simply because of the way MPlayer designed per-file options.
During playback, normal properties take care of changing things,
including things backed by options.)

This is work in progress. There are some issues: at least setting the
"vf" and "af" options won't work for strange reasons.
2013-09-07 20:34:49 +02:00
wm4 d77a924434 command: remove some unneeded code
chapter_display_name() always returns something.

The "chapter < -1" check is not needed, because this is done at the
start of the function.
2013-09-07 20:34:49 +02:00
Stefano Pigozzi 494d408583 macosx_application: handle mpv:// links
Pretty useful for people writing userscripts for web browsers. Links starting
with 'mpv://' are forwarded to the mpv OSX bundle. The leading 'mpv://' is
stripped from the recived url and the rest of the string is inserted as is in
the playlist.
2013-09-07 15:37:02 +02:00
Stefano Pigozzi b0797e8fe9 macosx_application: handle URL events as fileopen events
This allows to open URLs directly with mpv. This is useful for streaming and
libquvi supported sites.
2013-09-07 12:10:29 +02:00
wm4 ae64f29930 options: fix --volume option range, add some explanations to manpage
The --volume option accepted values up to 10000, but internally, the
value is always clipped to 0-100 range. What makes this even worse is
that --softvol-max suggests that it extends the range of --volume, which
is not the case. (And passing a volume larger than 100 to --volume
didn't even print a warning.)
2013-09-07 08:54:12 +02:00
wm4 c8f49be919 demux_lavf: workaround for broken libavformat subtitle seeking
The really funny thing about this commit is that this code is added on
top of another work around. Basically, subtitle seeking in libavformat
is completely broken. To make it useful, we have to add yet another
workaround.

The basic problem is that libavformat's subtitle seeking code always
uses the stream time base, instead of AV_TIME_BASE if stream index -1 is
passed to the avformat_seek_file() function.

Fixes github issue #216. Hopefully this will be fixed in ffmpeg too at
some point.
2013-09-07 02:56:28 +02:00
wm4 db79db8444 input: don't print warning if certain internal keys are not bound
This affects MOUSE_MOVE and MOUSE_LEAVE. Both are needed internally
(such as for the OSC), but not really useful for input.conf. Since the
warning has the purpose of notifying the user that a key is unmapped and
what key name to use for setting up a binding in input.conf, the warning
is rather useless in this case. It's also annoying in combination with
the
--no-input-default-bindings option, since that removes the default
bindings to "ignore" for these keys.
2013-09-06 00:45:03 +02:00
wm4 af83cac9b8 etc: delete mplayer.xpm
I don't think we need this anymore.
2013-09-05 21:05:04 +02:00
wm4 2d369a39dd mplayer: try to resume playback only if a resume file actually exists
Well, this was dumb. The resume message was printed for every file,
whether a resume config file existed or not.
2013-09-05 18:00:30 +02:00
Martin Herkt 5de277e423 mpvcore/input: Fix build without pthreads 2013-09-05 13:04:40 +02:00
Stefano Pigozzi 00a08af9f6 macosx_events: fix modifiers handling with media keys
This was caused by a typo. Regression from add7c2955d.

Fixes #213
2013-09-05 07:38:37 +02:00
wm4 88503a12c2 mplayer: print informative message when resuming playback
In particular, this informs the user how to disable this.
2013-09-04 18:16:47 +02:00
wm4 62ab8441a6 mplayer: make --save-position-on-quit save only on quit
When enabling --save-position-on-quit, playback position stored not only
on quit, but in any case playback of a file was stopped. This includes
going to the next file with playlist navigation commands.

After some discussion on IRC, it turned out that nobody thought this was
good behavior. Disable it, and really make it save only on quit.

Maybe the option is useless now, as the user could remap the CLOSE_WIN
key binding. On the other hand, CLOSE_WIN sounds and _is_ a bit obscure.
2013-09-04 18:12:11 +02:00
wm4 b8d498da15 mplayer: always write playback resume info, even at start/end of file
Before this commit, the player didn't write resume info if the playback
position was within the first or last percent of the file.

This was sometimes annoying, and with playlist resume can lead to
unintuitive behavior. (It wouldn't resume the playlist if the currently
played file was at 0-1% or 99-100%, even if you were in the middle of a
playlist.)

Moreover, the "percent > 99" check is a bit bogus anyway, because 100
(in integer) is rarely reached.

Drop the check, and make sure using --save-position-on-quit won't write
resume info when reaching EOF. The latter check is needed to make sure
playback of the file starts at beginning when playing it again after
EOF.
2013-09-04 17:08:52 +02:00
wm4 191ac00af2 path: better check for mp_is_url()
The previous check just searched for a "://" substring. This was quite
bad, because "://" can be a valid part of a path. Later, I added
special handling for filenames starting with "." and "/", so that you
could reliably pass arbitrary filenames to mpv, no matter how messed
up they were.

Even though it doesn't really matter in practise anymore, this is still
crap, so add a more reliable check instead.
2013-09-04 16:28:02 +02:00
wm4 3bb217d5e9 mplayer: allow resuming from playlist
This includes the case of passing multiple files to command line
(internally this is the same as loading a playlist).

Resuming works by finding the first playlist entry that can be resumed.

Alternative implementations would be possible, such as hashing the
playlist contents. But this implementation is simpler, and doesn't have
the disadvantage that changes to the playlist (like appending entries)
will throw away the resume point.

This makes loading large playlists a bit slower, because it has to look
into ~/.mpv/watch_later/ for every entry. Loading a 15000 entries
playlist now increases from 150ms to 400ms. Considering you rarely load
playlists this big with mpv (because it's impractical considering the
terminal and non-GUI nature of the player), this is probably ok.
2013-09-04 16:15:09 +02:00
wm4 b0f8e03f17 command: unescape URLs for ${filename} and ${media-title}
Undo URL percent encoding if the filename appears to be an URL. This
will fix display of the actual filename in some cases.

We don't put any effort into checking whether the URL is really percent
encoded, because we don't really know how the protocol handler is going
to interpret the URL. For stream_lavf, we probably can't know. Still,
from the perspective of this commit, it seems to make sense to assume
they are percent encoded.
2013-09-04 16:15:09 +02:00
wm4 efc5ac17bf path: add a common mp_is_url() function
Remove the duplicated code.
2013-09-04 16:15:08 +02:00
wm4 dbff29c81d x11_common: don't allocate more than needed for icon
icon_size is the number of array items of type long, not bytes. Change
the type of icon_size to int, because size_t makes you think of byte
quantities too quickly.

As an unrelated change, change the (char *) cast to (unsigned char *),
because it matches the common XChangeProperty idiom better.
2013-09-04 13:37:38 +02:00
wm4 266ce242c3 tv: attempt to support mjpeg streams
MPlayer handles this correctly, because MPlayer still has the FourCC
codec dispatch (codecs.conf). We need to handle this case specially,
because the libavformat rawvideo decoder will of course not eat mjpeg.

mjpeg is the only supported format, though. (Even MPlayer needs to
convert between V4L2 formats and MPlayer FourCCs, and mjpeg is the only
non-raw format.)
2013-09-04 00:46:23 +02:00
wm4 ed3187b41a mplayer: handle --reset-on-next-file=""
The option list contains an empty string member with this option value,
so ignore that. I'm not sure whether the option list should maybe be
empty in this case, but it could be the wrong thing in case of other
options.
2013-09-04 00:43:14 +02:00
wm4 7af15f2d6e mplayer: don't let playback resume force options that are file local
This happens by default with pausing: if a file was paused when doing
quit_watch_later, then resume and unpause, then the file played after
that would start in paused mode. This is because the pause option is
backed up at thr wrong place, so it backs up the state from resuming,
instead of whatever it was set to before that.
2013-09-04 00:31:14 +02:00
Alexander Preisinger 353686e636 configure: build with wayland 1.2.0
For the time being there will be a check if someone uses wayland from git,
because I really really like to have the others formats too.
2013-09-03 20:12:44 +02:00
Alexander Preisinger 13f3b55881 configure: improve wayland check 2013-09-03 19:31:10 +02:00
Stefano Pigozzi d57e1aa599 macosx_events: send a release all after key up events
This prevents keys to become stuck due to changing keyboard modifiers during
the key down. Not the prettiest approach but event `x11_common` does it like
this.

Fixes #210
2013-09-02 21:13:56 +02:00
Stefano Pigozzi add7c2955d macosx_events: remove duplication
refactoring: extract method `handleMPKey:withMask:`
2013-09-02 21:11:05 +02:00
Stefano Pigozzi 39a69aeb89 cocoa_common: remove unlocking from fullscreen function
This was added in the past to prevent a deadlock, but is not needed
anymore.
2013-09-02 08:35:21 +02:00
Stefano Pigozzi 694654e383 cocoa_common: avoid the opengl view to leak it's state
Just because everything is in a single file it doesn't excuse us to have high
coupling between C and ObjC code.
2013-09-02 08:21:03 +02:00
Stefano Pigozzi 04caddb7c8 cocoa: enqueue events only if input context is present 2013-09-01 23:51:36 +02:00
wm4 a5183a761c x11: add window icon
The png file added to etc/ are taken from the link mentioned in commit
303096b, except that they have been converted to 16 bit, sRGB (with
color profile info dropped, if there was one), and transparent pixels
reset for better compression.

The file x11_icon.bin is generated by gen-x11-icon.sh. I'm adding it to
the git repo directly, because the script requires ImageMagick, and we
don't want to make building even more complicated.

The way how this is done is basically a compromise between effort
required in x11_common.c and in gen-x11-icon.sh. Ideally, x11_icon.bin
would be directly in the format as required by _NET_WM_ICON, but trying
to write the binary width/height values from shell would probably be a
nightmare, so here we go.

The zlib code in x11_common.c is lifted from demux_mkv.c, with some
modifications (like accepting a gzip header, because I don't know how to
make gzip write raw compressed data).
2013-09-01 23:27:33 +02:00
Stefano Pigozzi 71335183ec mplayer: fix race condition on uninit with Cocoa
NULL out Cocoa's reference to mplayer's input context before deallocating it
2013-09-01 23:03:51 +02:00
Stefano Pigozzi 3e1115569e input: unlock playloop thread during select
This allows other threads to use mp_input_put_key without blocking if the
playloop is doing the 500ms select call (i.e.: during pause).
Makes Cocoa GUI responsive again (regression since 2d363c3).
2013-09-01 22:48:09 +02:00
Stefano Pigozzi 134c3e148c osx: use MP_KEY_* instead of MK_* for media keys
In 213ad5d6c I added `MK_*` key bindings overlooking the fact that mpv already
has `MP_KEY_*` for media keys.
2013-09-01 20:57:40 +02:00
wm4 6a55fa6793 input: allow window dragging even if mouse is in a mouse area
If the input section is enabled with MP_INPUT_ALLOW_VO_DRAGGING, then
the  VO will be allowed to drag the window with mouse button down +
mouse move even if the mouse is inside the section's mouse area.
2013-09-01 20:17:51 +02:00
wm4 0c7978cf9c input: deal with spurious X11 LeaveNotify events
If the mpv window is unfocus, clicking on the OSC should focus the
window (done by the window manager) and allow interaction with the OSC.
But somehow X sends a spurious LeaveNotify event, immediately followed
by an EnterNotify event. This happens at least with IceWM. The result is
that the OSC will disappear (due to receiving MOUSE_LEAVE). The OSC will
stay invisible, because EnterNotify isn't handled, and there's nothing
that could make the OSC appear again.

Solve this by handling EnterNotify. We cause a redundant MOUSE_MOVE
event to be sent, which triggers the code to make the OSC visible. We
have to remove the code from input.c, which ignores redundant mouse move
events.

Since the code ignoring redundant mouse move events is still needed on
Windows, move that code to w32_common.c. The need for this is documented
in the code, also see commit 03fd2fe. (The original idea was to save
some code by having this code in the core, but now it turns out that
this didn't quite work out.)
2013-09-01 20:17:51 +02:00
wm4 11d2f723d5 input: print more debug infos, raise loglevel 2013-09-01 20:17:51 +02:00
wm4 42fa7cbbf9 input: stay in current input section if mouse button is down
Normally, moving the mouse outside of the mouse area of an input section
will send mouse events somewhere else (because input section mouse areas
are similar to windows/widgets in real GUI toolkits). This was done even
if a mouse button was held down. This is quite different from how GUI
toolkits behave.

Change the code so that if a mouse button is down, the mouse area of the
current input section can't be left. Releasing the mouse button (while
the mouse pointer is outside of the mouse area) will actually leave the
mouse area.

As a side-effect, this commit also tests more often whether the current
mouse input section is valid. This is needed to make releasing a mouse
button trigger the mouse input section change.
2013-09-01 20:17:51 +02:00
wm4 61ba810752 input: add some more X11 multimedia/internet keys
These keys can be found on various "multimedia" and "internet" keyboard.
X defines many keycodes, so I'm not adding all, just what I found on my
own keyboard.

Other key codes can be added on request.
2013-09-01 20:17:51 +02:00
wm4 e366c1a9c6 keycodes: cosmetics: align indentation 2013-09-01 20:17:51 +02:00
wm4 570826448a audio: fix playback of Musepack SV8 files
This is basically a libavcodec API oddity: it can happen that
avcodec_decode_audio4() returns 0 (meaning 0 bytes were consumed). It
requires you to feed the complete packet again to decode the full
packet, and to successfully decode the following packets.

We ignored this case with the argument that there's the danger of an
endless decode loop (because nothing of that packet is apparently
decoded, so it would retry forever), but change it in order to decode
mpc8 files correctly.

Also add some comments to explain the mess.
2013-09-01 20:17:50 +02:00
wm4 ead525e17a input: comment all default bindings in input.conf
I suspect most users will just copy etc/input.conf when they want to
remap some default bindings. But usually this means the user even copies
bindings he doesn't care about, and it's better if the user maps only
the bindings in his input.conf the user intends to remap.

Comment all bindings in etc/input.conf. Since this file also defines the
builtin defaults and is baked into the mpv binary, we have to do
something to get them anyway, even though they are commented. Do this by
having input.c "uncomment" the bindings in the baked in input.conf. (Of
course this is done only for the builtin config, not configs loaded from
disk.)
2013-09-01 20:17:50 +02:00
Stefano Pigozzi 3ad7b9419e travis: don't generate docs for ffmpeg/libav
Fixes some breakage with ffmpeg-git
2013-09-01 19:52:17 +02:00
Stefano Pigozzi 2d363c39b9 input: lock for accessing struct input_ctx
The previous code was locking only the input queue. That was too weak since it
didn't protect the input_ctx data structure. So remove the locking on the queue
and lock all the public functions that interact with the input_ctx.

The private functions and public functions that do not act on the input_ctx
(there are quite some functions doing mp_cmd manipulations for instance) are
not locked.

Some changes by wm4. Use a recursive mutex, and restructure some code to be
less annoying with locks, such as converting code to single return, or
making use of the recursive mutex.
2013-09-01 18:02:45 +02:00
Stefano Pigozzi ddd873902a cocoa_common: enable click-through on the video view
Generate a mouse down event on the first click so that one can interact
with the OSC directly as opposed to wasting the first click in order to focus
the window.
2013-09-01 16:10:57 +02:00
Stefano Pigozzi c686e270a1 cocoa_common: track mouse move events when not focused
This is really only important with the OSC and makes the tracking code behave
more consistently with the X11 one.
2013-09-01 16:10:37 +02:00
Stefano Pigozzi 303096bcb2 change application icon
I would like to thank Chris Ward (@tenzerothree, http://tenzerothree.com/) for
working on the art for these icons and bringing some eye candy to the project.

The PSDs made by Chris are available on our Dropbox [1], along with the exports
I made to create OSX and Windows icons. The PSDs are almost completly vector
and all the resolutions look really similar, except the 16px favicon which was
handcrafted to look better and more recognizeable on the smaller pixel budget.

For Mac OS X the icons were created using iconutils on the PNGs iconsets
exported from the PSDs. These even support retina resolutions (except 512@2x).

For Windows the .ico file was created with imagemagick. The included images
are 16px, 24px, 32px, 48px 64px, 256px. These are the resolutions listed on
MSDN for supporting Windows XP [2] and Windows versions based on Aero [3].
Only 32bit PNGs were used since it is 2013.

For Linux nothing changed yet, even though @wm4 talked about using the PNGs
directly there. This will probably be dealt with in a later commit.

  [1]: https://www.dropbox.com/sh/yelfoj9tbft7o06/A8vOT6JKaG
  [2]: http://msdn.microsoft.com/en-us/library/ms997636.aspx
  [3]: http://msdn.microsoft.com/en-us/library/aa511280.aspx
2013-09-01 12:24:53 +02:00
wm4 4d62b90f88 video: add unscaled mode with --video-unscaled 2013-09-01 03:46:28 +02:00
wm4 f5144077ac configure: fix some descriptions in the help output 2013-09-01 03:03:25 +02:00
Stefano Pigozzi 462e6f281a cocoa: let the core handle key repeats
Report key down and key up modifiers to the core so that it can issue it's
own key repeats (instead of relying on Cocoa's ones).
2013-08-30 19:49:30 +02:00
wm4 c89b162462 input: fix --no-input-default-bindings
The option did nothing. This was probably broken with 5b38a52.
2013-08-29 19:07:20 +02:00
wm4 fd2ead5080 gl_video: don't crash if no FBOs are available
This probably has been broken since bbc865a: a test was added that uses
a FBO, but it's always run, even if FBOs were not detected. On the other
hand, fbotex_init() just runs into an assert. Fix the test that
triggered this condition, and make fbotex_init() "nicer" by just failing
if FBOs are not available.
2013-08-28 23:08:28 +02:00
wm4 33c03c4d0a demux_playlist: port ini reference playlist parser
Port it from playlist_parser.c to demux_playlist.c. Also, change the m3u
parser to drop whitespace from the trailing part of the line (will make
it work properly with windows line endings).

(I hoped that this would make MMS URIs with http instead of mmsh
prefixes work, but it doesn't. Instead, it leads to a playlist loop. So
solving this issue would require a change in ffmpeg, probably.)
2013-08-28 23:08:10 +02:00
wm4 792844f873 stream: read at least a full buffer with stream_peek()
Until now, stream_peek() read only the bare minimum it had to read from
the stream. But this could cause problems, such as being very
inefficient when peeking a lot, or conflicting with ability to seek
back. (The latter issue can be caused by peeking a few bytes, and then
doing a stream_read() with a size that is 1 byte longer: this would read
the peeked data, then call stream_fill_buffer(), which throws away the
previously peeked bytes - so you can't seek back anymore. This is
mitigated by a hack in demux_open(): it peeks a full buffer, to avoid
that peeking/reading during demuxer probing [or before that, in a stream
filter] can cause the buffer to be dropped.)
2013-08-28 23:08:08 +02:00
Alexander Preisinger c181ae87ce configure: fix build with stable wayland releases 2013-08-28 21:48:21 +02:00
Alexander Preisinger 65321f081d wayland/shm: rework format handling
Use a linked list for all supported formats and make the format table const.
2013-08-26 20:34:06 +02:00
Alexander Preisinger 56644b8abc wayland: fix memory leaks 2013-08-26 20:34:06 +02:00
Stefano Pigozzi d3c4ba3ab8 cocoa_common: autohide dock when autohiding menubar
A cocoa bug doesn't allow to do otherwise. Will open a radar later.
2013-08-26 20:01:20 +02:00
Stefano Pigozzi 75791f4dd9 configure: fix VDA autodetection based on FFmpeg support
The original condition was too weak, requiring only the header. The header is
installed is FFmpeg regardless of the presence of VDA on the system, so just
perform a check on the `ff_vda_create_decoder` function.
2013-08-26 20:00:41 +02:00
Alexander Preisinger 445f8bd29a configure: move wayland-egl check
This makes it possible to build the shm backend when no EGL platform is
available.
2013-08-26 17:20:44 +02:00
Alexander Preisinger beab54506e wayland: don't create our own log context
This was more problematic than useful ([vo/wayland/wayland])
2013-08-26 16:39:05 +02:00
Alexander Preisinger 5895d6c24f wayland/shm: use opaque regions
Make use of opaque regions on non-alpha formats. This allows the compositor to
improve the drawing of the surface, because he can discard everything behind
the window when drawing.
2013-08-26 16:29:03 +02:00
wm4 df9639d755 gl_video: fix odd video sizes with PBOs
Odd video sizes if pixel formats with chroma subsampling and PBOs were
used, garbage was rendered. This was because the PBO path created
buffers with an unpadded size, and then tried to upload a padded
image to it. Fix it by explicitly setting the padded size. (As with
the non-PBO path, we rely that image allocations are somehow padded,
which is normally the case.)
2013-08-26 10:09:46 +02:00
wm4 3fc3bf70f9 stream: add uncompressed rar support
Apparently, it is popular to store large files in uncompressed rar
archives. Extracting files is not practical, and some media players
suport playing directly from uncompressed rar (at least VLC and some
DirectShow components).

Storing or accessing files this way is completely idiotic, but it is
a common practice, and the ones subjected to this practice can't do
much to change this (at least that's what I assume/hope). Also, it's
a feature request, so we say yes.

This code is mostly taken from VLC (commit f6e7240 from their git tree).
We also copy the way this is done: opening a rar file by itself yields
a playlist, which contains URLs to the actual entries in the rar file.
Compressed entries are simply skipped.
2013-08-26 10:09:46 +02:00
wm4 74b846e2f7 stream: change open code, add stream filter concept
Add a stream filter concept, in which streams can be opened on top of
an underlying "source" stream. Change the open code to make this
easier, and also to account for some mechanisms that will be needed
for this.

The following commit will add stream_rar, which contains such a stream
filter.
2013-08-26 10:09:45 +02:00
wm4 f3a7849ba6 stream: don't drop buffer when creating the cache
This is really not needed. While we really can't take a loaded buffer
over to the cache, there's no reason why the cache couldn't read this
buffer normally.

On the other hand, this code could cause trouble when probing from a
stream before the cache has been enabled.
2013-08-26 10:09:45 +02:00
wm4 971e8456fc stream: fix url_options field, make protocols field not fixed length
The way the url_options field was handled was not entirely sane: it's
actually a flexible array member, so it points to garbage for streams
which do not initialize this member (it just points to the data right
after the struct, which is garbage in theory and practice). This was
not actually a problem, since the field is only used if priv_size is
set (due to how this stuff is used). But it doesn't allow setting
priv_size only, which might be useful in some cases.

Also, make the protocols array not a fixed size array. Most stream
implementations have only 1 protocol prefix, but stream_lavf.c has
over 10 (whitelists ffmpeg protocols). The high size of the fixed
size protocol array wastes space, and it is _still_ annoying to
add new prefixes to stream_lavf (have to bump the maximum length),
so make it arbitrary length.

The two changes (plus some more cosmetic changes) arte conflated into
one, because it was annoying going over all the stream implementations.
2013-08-26 10:09:45 +02:00
wm4 8be9c49fcd core: add a playlist demuxer
Modeled after the old playlist_parser.c, but actually new code, and it
works a bit differently.

Demuxers (and sometimes streams) are the component that should be used
to open files and to determine the file format. This was already done
for subtitles, but playlists still use a separate code path.
2013-08-26 10:09:45 +02:00
wm4 ddc9733446 audio: don't allow setting unknown formats from command line
af_str2fmt_short(), which is used by the command line option parser,
allowed passing a hex number. The user could set arbitrary integers as
internal audio formats, even formats which don't exist or make no sense.
This is not very useful, so get rid of it.
2013-08-26 10:09:44 +02:00
wm4 53b5227270 audio: make internal audio format 0 an invalid format
Having to use -1 for that is generally quite annoying.

Audio formats are created from bitmasks, and it can't be excluded that
0 is not a valid format. Fix this by adjusting AF_FORMAT_I so that it
is never 0. Along with AF_FORMAT_F and the special formats, all valid
formats are covered and guaranteed to be non-0.

It's possible that this commit will cause some regressions, as the
check for invalid audio formats changes a bit.
2013-08-26 10:09:41 +02:00
Alexander Preisinger 58e826e6f2 wayland: shm based software rendering
A wayland output based on shared memory. This video output is useful for x11
free systems, because the current libGL in mesa provides GLX symbols. It is also
useful for embedded systems where the wayland backend for EGL is not
implemented like the raspberry pi.

At the moment only rgb formats are supported, because there is still no
compositor which supports planar formats like yuv420p. The most used compositor
at the moment, weston, supports only BGR0, BGRA and BGR16 (565).

The BGR16 format is the fastest to convert and render without any noticeable
differences to the BGR32 formats. For this reason the current (very basic)
auto-detection code will prefer the BGR16 format. Also the weston source code
indicates that the preferred format is BGR16 (RGB565).

There are 2 options:
    * default-format (yes|no)  Which uses the BGR32 format
    * alpha (yes|no)    For outputting images and videos with transparencies
2013-08-25 22:46:26 +02:00
Alexander Preisinger 9af505a796 wayland: remove shm listener for the backend
The obtained information from the shm listener isn't used by anything and is
also wrong now in wayland git master branch because of new shm formats which
need a different way of saving the supported formats.
2013-08-25 22:46:26 +02:00
Alexander Preisinger 8fd274ea3b wayland/egl: rework resizing (again)
Moves a good chunk of the resizing code to wayland_common.c. This makes it
possible to share it with future video drivers.

It doesn't resizit it immediatly, it calcutlates the new position and size and
then shedules a resizing event. This removes the ugly callback and void pointer
from the wayland data structure.
2013-08-25 22:46:26 +02:00
Stefano Pigozzi c2cb85851f vo_corevideo: use dwidth/dheight for window dimensions
In the previous commit I wrongly used params->d_h/d_w which happened to work
by chance.
2013-08-25 21:14:59 +02:00
Stefano Pigozzi dc2ebae8cf vo_corevideo: convert to use reconfig instead of config 2013-08-25 20:47:46 +02:00
Stefano Pigozzi e66049c31b vo_corevideo: don't set colormatrix on direct rendering path
The current code uses GL_YCBCR_422_APPLE texture format. This allows to handle
transparently the conversion to RGB but always use BT.601 colormatrix [1].

Hopefully I can adapt gl_video to take CVPixelBuffers soon so that `vo=opengl`
can be used instead of `vo=corevideo` with `hwdec=vda`

 [1]: http://www.opengl.org/registry/specs/APPLE/ycbcr_422.txt
      http://www.opengl.org/registry/specs/APPLE/rgb_422.txt
2013-08-25 20:41:43 +02:00
Stefano Pigozzi cf2d0b882a configure: fix help for macosx-bundle from autodetected to disabled
The help and configure result wrongly showed this feature was autodetected,
while it is infact disabled by default.
2013-08-25 12:21:34 +02:00
Stefano Pigozzi d4a874f726 vo_corevideo: fix regression in colormatrix handling
Regression since 18b6c01d92. That commit changed the colorspace handling to
always reinit the video output. Since the CVPixelBuffers are lazily created,
VOCTRL_SET_YUV_COLORSPACE was always called when the CVPixelBufferRef was NULL.

Since CoreVideo functions do not complain when called on NULL, no one noticed
that CVBufferSetAttachment, which stored the color matrix meta data was called
on NULL.
2013-08-25 12:13:46 +02:00
wm4 554cd7c490 sd_lavc_conv: fix build with older ffmpeg/libav
Sigh...
2013-08-24 20:07:05 +02:00
wm4 20e2d74440 configure: fix VDA warning on systems other than OSX
CONFIG_VDA is supposed to be defined to 0 or 1. But on non-OSX systems,
the configure test isn't run at all, so CONFIG_VDA ends up undefined.
2013-08-24 19:45:30 +02:00
wm4 47e92b2f88 video: handle video output levels with mp_image_params
Until now, video output levels (obscure feature, like using TV screens
that require RGB output in limited range, similar to YUY) still required
handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new
mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE
is not needed at all anymore in VOs that use the reconfig callback. The
result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the
colormatrix related properties (basically, for display on OSD).  For
other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config
instead of twice.
2013-08-24 19:40:18 +02:00
wm4 ba4654b729 vo_image: simplify 2013-08-24 17:11:59 +02:00
wm4 c3a0721d09 video/out: don't require VOs to handle screenshot aspect specially
This affects VOs which just reuse the mp_image from draw_image() to
return screenshots. The aspect of these images is never different
from the aspect the screenshots should be, so there's no reason to
adjust the aspect in these cases.

Other VOs still need it in order to restore the original image
attributes.

This requires some changes to the video filter code to make sure that
the aspect in the passed mp_images is consistent.

The changes in mplayer.c and vd_lavc.c are (probably) not strictly
needed for this commit, but contribute to consistency.
2013-08-24 17:03:06 +02:00
wm4 086b37a830 vo_vaapi: potentially fix screenshot colorspace issues
mp_image_set_params() doesn't check whether the colorspace parameters
are  consistent (e.g. setting YUV colorspaces with RGB formats), and
shouldn't need to.
2013-08-24 16:32:48 +02:00
wm4 402f85f7f2 sub: add webvtt-in-webm support
The way this was added to FFmpeg is less than ideal, because it requires
text parsing in the Matroska demuxer. But in order to use the FFmpeg
webvtt-to-ass converter, we still have to mimic this in some way. We do
this by putting the parsing into sd_lavc_conv.c, before the subtitle
packet is passed to libavcodec. At least this keeps the ugliness out of
unrelated code.

There is some change that FFmpeg will fix their design eventually.

Instead of rewriting the parsing code, we simply borrow it from FFmpeg's
Matroska demuxer.
2013-08-24 15:17:37 +02:00
wm4 0d8a62c08d Some more mp_msg conversions
Also add a note to mp_msg.h, since it might be not clear which of the
two mechanisms is preferred.
2013-08-23 23:30:09 +02:00
Alexander Preisinger 11a7a8b30b x11/out: mp_msg conversion 2013-08-23 20:06:08 +02:00
Stefano Pigozzi fcde6207a1 cocoa_common: avoid locking calls when not needed
cocoa_common contains some locking calls to support video outputs that support
live resizing (at this moment only vo=opengl).

These should not be used unless the VO declares it is multithreaded by
registering the resize_redraw callback used for live resizing.

Fixes #200
2013-08-23 13:58:38 +02:00
wm4 edd36a3afc audio/out: do some mp_msg conversions
Use the new MP_ macros for some AOs instead of mp_msg.

Not all AOs are converted, and some only partially. In some cases, some
additional cosmetic changes are made.
2013-08-22 23:12:35 +02:00
wm4 cb54c2dda8 ao: remove some leftovers 2013-08-22 22:45:24 +02:00
wm4 1e649f353b demux: remove unused audio_delay parameter from demux_seek()
Used to be needed by demux_avi.
2013-08-22 19:14:26 +02:00
wm4 bc0abebe8e demux: check whether stream is selected in demux_get_next_pts()
Otherwise, this would just try to demux a good chunk of the file, even
though the operation can't succeed anyway.

This caused some pretty strange issues, where perfectly valid use cases
would print a "Too many packets in the demuxer packet queue..." message.
2013-08-22 19:14:26 +02:00
wm4 6f86affef5 demux_raw: read multiple frames per packet
The rawaudio demuxer read one frame per packet, basically a few bytes,
which caused insane overhead. (I found this when I couldn't play raw
audio without dropouts when using -v, which printed a line per packet
read.)

Fix this and read 1 second of audio per packet. This is a regression
since cfa5712 (merging of demux_rawaudio and demux_rawvideo).
2013-08-22 19:14:26 +02:00
wm4 cd7ec016e7 stream: allow potentially faster skipping
Instead of always skipping in STREAM_BUFFER_SIZE blocks, allow an
arbitrary size. This allows - in theory - faster forward seeking in
pipes.

(Maybe not a very significant change, but it reduces the number of
things that depend on STREAM_BUFFER_SIZE for no good reason. Though
we still use that value as minimum read size.)
2013-08-22 19:14:26 +02:00
wm4 f806e268c6 stream: don't require streams to set s->pos in seek callback
Instead, set s->pos depending on the success of the seek callback.
2013-08-22 19:14:26 +02:00
wm4 a790f2133b stream: move file forward skipping to common stream implementation
stream_file.c contains some code meant for forward seeking with pipes.
This simply reads data until the seek position is reached. Move this
code to stream.c. This stops stream_file from doing strange things
(messing with stream internals), and removes the code duplication too.

We also make stream_seek_long() use the new skip code. This is shorter
and much easier to follow than the old code, which basically did strange
things.
2013-08-22 18:33:19 +02:00
wm4 28eac7dfb3 stream_avdevice: remove redundant dummy callback 2013-08-22 18:20:49 +02:00
wm4 974250b60c stream_file: uncrustify 2013-08-22 18:20:49 +02:00
Stefano Pigozzi a9cb2dc1b8 video: add vda decode support (with hwaccel) and direct rendering
Decoding H264 using Video Decode Acceleration used the custom 'vda_h264_dec'
decoder in FFmpeg.

The Good: This new implementation has some advantages over the previous one:

 - It works with Libav: vda_h264_dec never got into Libav since they prefer
   client applications to use the hwaccel API.

 - It is way more efficient: in my tests this implementation yields a
   reduction of CPU usage of roughly ~50% compared to using `vda_h264_dec` and
   ~65-75% compared to h264 software decoding. This is mainly because
   `vo_corevideo` was adapted to perform direct rendering of the
   `CVPixelBufferRefs` created by the Video Decode Acceleration API Framework.

The Bad:
  - `vo_corevideo` is required to use VDA decoding acceleration.
  - only works with versions of ffmpeg/libav new enough (needs reference
    refcounting). That is FFmpeg 2.0+ and Libav's git master currently.

The Ugly: VDA was hardcoded to use UYVY (2vuy) for the uploaded video texture.
One one end this makes the code simple since Apple's OpenGL implementation
actually supports this out of the box. It would be nice to support other
output image formats and choose the best format depending on the input, or at
least making it configurable. My tests indicate that CPU usage actually
increases with a 420p IMGFMT output which is not what I would have expected.

NOTE: There is a small memory leak with old versions of FFmpeg and with Libav
since the CVPixelBufferRef is not automatically released when the AVFrame is
deallocated. This can cause leaks inside libavcodec for decoded frames that
are discarded before mpv wraps them inside a refcounted mp_image (this only
happens on seeks).
For frames that enter mpv's refcounting facilities, this is not a problem
since we rewrap the CVPixelBufferRef in our mp_image that properly forwards
CVPixelBufferRetain/CvPixelBufferRelease calls to the underying
CVPixelBufferRef.

So, for FFmpeg use something more recent than `b3d63995` for Libav the patch
was posted to the dev ML in July and in review since, apparently, the proposed
fix is rather hacky.
2013-08-22 12:13:30 +02:00
Stefano Pigozzi 94b4a80d45 mp_msg: fix typo in message level for new msg API macros 2013-08-22 11:54:28 +02:00
Stefano Pigozzi acbf5e826a cocoa_common: fix window positioning with --geometry
Regression since ff3b98d11c. The window positioning code relied on the
visibleFrame's height without taking into account the dock's presence.

Also moved the constraining code to the proper method that overrides the
original NSWindow behaviour. This avoids having to check for border since the
constraining is performed by Cocoa only for titled windows.

Fixes #190
2013-08-22 11:54:28 +02:00
wm4 45365ad99f mplayer: replace "D:" in status line with "Late:"
Too many people thought "D:" really meant number of dropped frames. But
it's actually the number of frames where the playloop thought it'd be
a good idea to drop them. Of course this does nothing if frame dropping
is disabled, but even with normal frame dropping, this doesn't indicate
whether a frame was _really_ dropped. (Looks like libavcodec doesn't
even give us this information reliably? The decode function can return
no frame in case of codec delay due to threading and such.)
2013-08-21 18:42:18 +02:00
wm4 74e3a29606 options: replace --edition=-1 with --edition=auto
Originally, the objective of this commit was changing --edition to be
1-based, but this was cancelled. I'm still leaving the change to
demux_mkv.c though, which is now only of cosmetic nature.
2013-08-21 18:41:59 +02:00
wm4 c8a7140c73 mplayer: start track IDs from 1 rather than 0
Completely pointless, but makes ChrisK happy for some reason.

Track ID 0 is now rejected by the option parser itself.
2013-08-21 18:32:42 +02:00
Cheng Sun 92658864ae manpage: fix (again) incorrect ao_alsa example
One example in ao.rst used the old syntax with misspelling of "no-block".
2013-08-20 23:15:06 +01:00
wm4 e49abd2fa2 command: simplify video brightness/gamma/etc. handling a bit
We don't need to store the offsets of the options corresponding to the
properties, because the option-property bridge knows about this already.

The check against 1000 was for the case if e.g. the --brightness option
is not used. Always overwrite the option value instead, both when
querying and setting the property. (This is needed to make the settings
persistent even if vf_eq is used and the video chain is reinitialized.)

This commit assumes that VFCTRL_SET_EQUALIZER is always paired with
VFCTRL_GET_EQUALIZER (likewise for VOCTRL), which is the case.
2013-08-20 16:23:44 +02:00
wm4 d69b39512d vf_eq: fix behavior when changing parameters
Using -vf eq and changing brightness, contrast, etc. using key bindings
with e.g. "add brightness 1" didn't work well: with step width 1, the
property gets easily "stuck". This is a rounding problem: e.g. setting
gamma to 3 would actually make it report that gamma is set to 2, so
the "add" command will obviously never reach 3 with a step width of 1.
Fix this by storing the parameters as integers.

This was broken in cac7702. This commit effectively changed these
properties to use the value as reported by vf_eq, instead of the
previously set value for the "add" command. This was more robust,
but not very correct either, so we keep the new behavior and make
vf_eq report its parameters more accurately.
2013-08-20 16:11:07 +02:00
wm4 f05206f899 m_option: make "add speed 0.1" command work
Was broken since the speed property was switched from float to double.
2013-08-19 22:32:25 +02:00
wm4 fb022db423 mp_core: declare seek_type enum outside of nested struct
cosmetic change. See previous commit.
2013-08-19 22:32:25 +02:00
Alexander Preisinger 7cec294d08 wayland: separate shm and cursor context
The display, window, keyboard and cursor structures are now cleanly and
logically separated. Also could prevent a future bug where no shm format is set
when the cursor image is loaded (Never happened until now).
2013-08-19 14:12:39 +02:00
wm4 c5e66dde33 m_option: rename struct member named "new"
Cosmetic change to allow C++ code to include this header.

See github issue #195.
2013-08-19 13:03:08 +02:00
wm4 216e8320b0 video: make it possible to scale/pan the video by arbitrary amounts
Add --video-align-x/y, --video-pan-x/y, --video-scale options and
properties. See the additions to the manpage for description and
semantics.

These transformations are intentionally done on top of panscan. Unlike
the (now removed) --panscanrange option, this doesn't affect the default
panscan behavior. (Although panscan itself becomes kind of useless if
the new options are used.)
2013-08-19 13:03:08 +02:00
wm4 67704e2977 options: remove --panscanrange option
This option allowed you to extend the range of the panscan controls, so
that you could essentially use it to scale the video. This will be
replaced by a separate option to set the zoom factor directly.
2013-08-19 12:55:53 +02:00
wm4 4579cce768 mplayer: reshuffle on every loop if --loop and --shuffle are used
See github issue #194.

Unfortunately, this breaks the property that going back in the playlist
always works as expected. This changes, because the playlist_prev
command will work on the reshuffled playlist, instead of loading the
previously played files in order. If this ever becomes an issue, I
might revert this commit.
2013-08-19 01:05:49 +02:00
wm4 2508f38a92 vaapi: use highest available profile, instead of mapping it exactly
Now the code does the same as the original MPlayer VAAPI patch, instead
of trying to map the profiles exactly.

See previous commit for justification and discussion.
2013-08-19 01:05:48 +02:00
wm4 adfb71b79e vdpau: don't try to match codec profiles
Instead, do what MPlayer did all these years. It worked for them, so
there's probably no reason to change this.

Apparently fixes playback with some files, where the VDPAU decoder does
not formally support a profile, but decoding works with a more powerful
profile anyway.

Though note that MPlayer did this because it couldn't do it in a better
way (no decoder reported profiles available when creating the VDPAU
decoder), so it's not entirely clear whether this is a good idea. An
alterbative implementation might try to map the profiles exactly, and
do some fall backs if the exact profile is not available. But this
hack-solution works too.
2013-08-19 01:05:48 +02:00
wm4 062d39fad2 changes: add some things for completeness 2013-08-19 01:05:37 +02:00
wm4 4b506525da vo_vdpau: add RGB support
Apparently this was dropped some years ago, but judging from MPlayer's
handling of this, the original code wasn't so great anyway. The new
code handling clearing of panscan borders correctly, and integrates
better with the YUV path. (Although the VDPAU API sure makes this
annoying with its separate surface types for RGB.)

Note that we create 5 surfaces for some reason - I don't think this
makes too much sense (because we can't use the deinterlacer with RGB
surfaces), but at least it reduces the amount of differences with
the YUV code path.

Clearing the borders is done by drawing a single black pixel over the
window. This sounds pretty dumb, but it appears to work well, and
there is no other API for that. (One could try to use the video mixer
for this purpose, since it has all kinds of features, including
compositing multiple RGBA surfaces and clearing the window background.
But it would require an invisible dummy video surface to make the
video mixer happy, and that's getting too messy.)
2013-08-18 05:46:02 +02:00
wm4 31ce3fcf9d vo_vdpau: fix screenshots if panscan is used
When panscan was used, i.e. the video is cropped to make the video fill
the screen if video and screen aspects don't match, screenshots
contained only the visible region of the source video, stretched to
original video size.
2013-08-18 05:06:46 +02:00
wm4 8f75588615 vo_vdpau: remove unused variable
It was used to manage video surface in the software decoding path, but
now surface management shares the code with hardware decoding.
2013-08-18 01:48:58 +02:00
wm4 6bbcb861fa mplayer: don't make restored options from quit_watch_later per-file local
Consider:

    mpv file1.mkv file2.mkv

and file1.mkv is restored from an earlier session when quit_watch_later
was used. Then all restored options were reset when file2.mkv is played,
even if the user changed them during playback. This affects for example
the fullscreen setting.

Make it so that after finishing a resumed file, the previously restored
settings are not reset again. (Which means only resuming will forcefully
overwrite the settings.)
2013-08-17 21:56:39 +02:00
Philip Sequeira b018c7d936 command: more intuitive chapter seek behavior
If close to chapter start, skipping back goes to previous chapter (no change).
If more than <threshold> seconds in, skipping back will now go to the beginning
of the current chapter instead.

The threshold is set by the new option --chapter-seek-threshold and defaults to
5 seconds.  A negative value disables the new functionality.
2013-08-17 21:32:52 +02:00
Philip Sequeira 8cebec6262 command: allow seek to "chapter -1"
This will seek to the start of the file regardless of whether the first real
chapter starts there or not.
2013-08-17 21:32:41 +02:00
wm4 ab81af477c vo_vdpau: use color close to black as default colorkey (instead of green)
The VDPAU default colorkey, although it seems to be driver specific, is
usually green. This is a pretty annoying color, and you usually see it
briefly (as flashes) if the VDPAU window resizes.

Change it to some shade of black. The new default color is close to what
MPlayer picks as colorkey (and apparently it worked well for them):

    VdpColor vdp_bg = {0.01, 0.02, 0.03, 0};

Since our OPT_COLOR can set 8 bit colors only, we use '#020507' instead,
which should be the same assuming 8 bit colors.

Obviously, you can't use black, because black is a way too common color,
and would make it too easy to observe the colorkey effect when e.g.
moving a terminal with black background over the video window.
2013-08-17 20:06:21 +02:00
wm4 75298d9f0a vo_vdpau: allow setting colorkey
Formally, this sets the "background color" of the presentation queue.
But in practice, this color is also used as colorkey.

This commit doesn't change the VDPAU default yet.
2013-08-17 20:06:20 +02:00
wm4 76963781df m_option: add missing copy callback for some option types
One reaosn for this is that this broke proper handling of .defval, since
m_option_copy did nothing for these option types.
2013-08-17 19:52:33 +02:00
wm4 c890b8942d m_option: make defval const
There's really no reason why it shouldn't.
2013-08-17 19:50:45 +02:00
wm4 8b245c4d4b sd_lavc_conv: don't check AV_CODEC_PROP_TEXT_SUB flag
Not actually useful. This would break whenever a new text subtitle
format would be added, which requires a binary->text transformation.
(mov_text is one such format; disable it.) In general, we would have
to know which packet formats are binary, which we don't, so the only
reasonable way to handle this is a white list.
2013-08-15 23:40:04 +02:00
wm4 3e6ed76935 sub: don't print detected charset if it's UTF-8
Too noisy. This also fixes that iconv() was called if "utf8" was used
as codepage.
2013-08-15 23:40:04 +02:00
wm4 4246b5fbf0 vdpau_old: add forgotten probe callback
Could make it crash if the VO didn't support vdpau decoding.
2013-08-15 23:40:04 +02:00
wm4 a82be4348e manpage: fix incorrect ao_alsa example, extend changes.rst
One example in ao.rst used the old syntax with mangled device names.
Fix it. Mention some shell related caveats. Explicitly mention the
change of device name syntax in changes.rst, because it seems to be
a common issue.
2013-08-15 23:40:03 +02:00
wm4 f9271c2ca2 sub: make --subcp=enca the default. 2013-08-15 23:40:03 +02:00
wm4 fe3c445112 sub: allow specifying a fallback codepage if input is not UTF-8
Normally, --subcp always forces conversion. This really always forces
conversion, even if the UTF-8 check on the input succeeds.

Extend the --subcp to allow codepages as fallback if UTF-8 doesn't
work. So, for example --subcp=utf8:cp1250 will use UTF-8 if the input
looks like UTF-8, and will fall back to use cp1250 if the UTF-8 check
fails.

I think this should actually be the default, but on the other hand,
this changes the semantics of the option, and a user would actually
expect --subcp to force conversion, rather than silently using UTF-8
if that happens to work.
2013-08-15 23:40:03 +02:00
wm4 00f735d5cb bstr: make UTF-8 check stricter
Don't accept overlong sequences. Don't accept codepoints past the
maximum unicode codepoint. Don't accept the UTF-16 surrogate codepoints.

I'm not sure if there are more codepoints that are defined to be
invalid, but we just want to make libavcodec happy, so this is enough.

(libavcodec's subtitle converter checks for valid UTF-8 and throws up
and dies if it's not - now we want to use bstr_sanitize_utf8_latin1() to
force valid UTF-8, so the strictness of our UTF-8 parser has to match at
least that of the libavcodec's check.)

I'm not sure whether the min test is actually 100% correct.

Note that libavcodec also treats BOM codepoints as invalid. This is
definitely a bug: the BOM is really just "zero-width non-breaking space"
redefined by Microsoft, but it is perfectly valid to appear in the
middle of a string. Official Unicode has merely deprecated the old
usage of the BOM codepoint, and didn't make it illegal. Besides, the
string could be from the start of a file, so even this check doesn't
make sense even with libavcodec's insane logic. We don't copy this bug.
2013-08-15 23:40:03 +02:00
wm4 acb51c9243 sub: if charset detection fails, treat it as broken UTF-8
Broken UTF-8 in this context means we treat it as UTF-8, but we also
interpret broken UTF-8 sequences as Latin1.

Also, run our own UTF-8 check function before the charset detectors.
This prevents from ENCA's UTF-8 check possibly messing up (like
detecting 7-bit clean UTF-8 as ASCII, or other things). It also takes
care of UTF-8 detection if no charset detector (ENCA, libguess) is
compiled in, and it lets us deal better with cut-off UTF-8 sequences.
2013-08-15 23:40:02 +02:00
wm4 380fa71fc7 bstr: add UTF-8 validation and sanitation functions 2013-08-15 23:40:02 +02:00
wm4 04bc16f6ea vdpau: fix compilation on Libav
Libav's <libavcodec/vdpau.h> header uses some libavocdec symbols without
forward-declaring them and without including the headers declaring them.
FFmpeg's header for this is fine.
2013-08-15 23:40:02 +02:00
wm4 006c2f66e1 video/decode: change fix_image callback
This might make it slightly easier when trying to implement surface
read-back for hardware decoding.
2013-08-15 23:40:02 +02:00
wm4 be2f2ff033 vd_lavc: fix comment, document hwdec video frame size trickiness
About this issue, it would be better if the surfaces could be allocated
with the real size, and the vdpau video mixer could be created with that
size as well. That would be a bit hard, because the real surface size
had to be communicated to vdpau. So I'm going with this solution. vaapi
seems to be fine with either surface size, so there's hopefully no
problem.
2013-08-15 23:40:02 +02:00
wm4 0da9638576 video/decode: pass parameters directly to hwdec allocate_image callback
Instead of passing AVFrame. This also moves the mysterious logic about
the size of the allocated image to common code, instead of duplicating
it everywhere.
2013-08-15 23:40:02 +02:00
Stefano Pigozzi 30f2db5930 vo_corevideo: add uyvy422 pixel format support
Looks like the vda_h264_dec in ffmpeg likes to output this format and it
inserted swscale to do pixfmt conversion to yuyv422.
2013-08-15 11:22:40 +02:00
Giuliano Schneider e437ecf729 input: fix build if HAVE_PTHREADS is undefined 2013-08-15 11:22:30 +02:00
wm4 cd85379423 sub: fix accidental subtitle overlaps
The fix_overlaps_and_gaps() function in dec_sub.c fixes small gaps or
overlaps between subtitle events. However, sometimes it could happen
that the corrected subtitle events could overlap by 1ms due to bad
rounding, making libass shift subtitles to reduce collisions. (The
second subtitle will be shown above the previous one, even if both
subtitles are visible only for 1ms.)

sd_ass.c rounds the timestamps when converting to integers for unknown
reasons. I think it would work fine without that rounding, but since
I have no clue why it rounds, and since it could be needed to ensure
correct timestamps with ASS subtitles demuxed from Matroska, I'd rather
not touch it. So the solution is to use already rounded timestamps to
calculate the new subtitle duration in fix_overlaps_and_gaps().

See github issue #182.
2013-08-14 15:23:13 +02:00
wm4 3ffabe26af x11: fix --ontop
Apply it after mapping.
2013-08-14 00:36:33 +02:00
wm4 6704e39fcb vaapi: fix typo 2013-08-14 00:36:33 +02:00
Stefano Pigozzi 68b189351c changes.rst: document some OSX and windows changes 2013-08-13 23:20:27 +02:00
Stefano Pigozzi cd973fd30f input.conf: bind AXIS_(LEFT|RIGHT) to seek 5
Binding them to volume was a bad default, so change it.
2013-08-13 23:07:49 +02:00
Stefano Pigozzi 04cdc205bc cocoa_common: add precise scrolling support
This adds precise scrolling support. I ran some tests and it seems a little
bit smoother and well.. precise. The defaults are rebindable using: AXIS_UP,
AXIS_DOWN, AXIS_LEFT and AXIS_RIGHT.
2013-08-13 23:05:46 +02:00
Stefano Pigozzi 11dad6d44b macosx: remove platform specific input queue
Since last commit the input queue in the core is thread safe, so there is no
need for all this platform specific stuff anymore.
2013-08-13 23:02:43 +02:00
Stefano Pigozzi 36586dd7b7 input: make input queue thread safe
If pthreads are enabled the input queue accesses are regulated by acquiring
a mutex. This is useful for platforms like OS X, where the events are created
in the cocoa thread and added to the queue to then be dequeued in the playloop
thread.
2013-08-13 23:02:16 +02:00
Martin Herkt 87ce0c3b8d mpvcore/options: Update default user agent string
Uh… about time, I guess?
2013-08-13 03:43:22 +02:00
wm4 d5f1b1638c demux: move demux_mf before demux_subreader
demux_subreader is quite aggressive, and sometimes detects random
strings in EXIF as subtitle text.
2013-08-12 20:40:39 +02:00
wm4 b644fe3da6 demux_subreader: report what subtitle format has been found 2013-08-12 20:39:43 +02:00
Noble Huang 1ef239a499 stream_bluray: fix bd:// url segfault introduced by commit bc1d61 2013-08-12 19:00:39 +02:00
wm4 92720fcc0e Revert "sub: support straight alpha additionally to premultiplied alpha"
This reverts commit 689a25003f, with some
adjustments to code that was added after that commit.

I just messed up big time. We don't need this, and in fact the commit
confused straight and premultiplied alpha at one point (just a simple
inverted condition due to an oversight), which is why it looked like
it was working.

In commit 2827295 I wrote:

   Also, libva can't decide whether it accepts straight or premultiplied
   alpha for OSD sub-pictures [...]

That was just me messing up and being severely confused by my own bugs.
VA API  uses premultiplied alpha, which by the way is nice and
thoughtful of the VA API devs.

Well, this was stupid. But in the end, I'm glad that I could actually
reduce codesize by a good amount again.
2013-08-12 02:49:22 +02:00
wm4 19a7534573 manpage: actually document --hwdec=auto 2013-08-12 02:16:20 +02:00
wm4 12a6f73a2f configure: fix typo 2013-08-12 02:14:00 +02:00
wm4 7df6539a87 vo: fix build with #ifdef -> #if
Whoever had the idea of introducing mixed conventions for these
preprocessor symbols should be shot.
2013-08-12 01:38:38 +02:00
wm4 2827295703 video: add vaapi decode and output support
This is based on the MPlayer VA API patches. To be exact it's based on
a very stripped down version of commit f1ad459a263f8537f6c from
git://gitorious.org/vaapi/mplayer.git.

This doesn't contain useless things like benchmarking hacks and the
demo code for GLX interop. Also, unlike in the original patch, decoding
and video output are split into separate source files (the separation
between decoding and display also makes pixel format hacks unnecessary).

On the other hand, some features not present in the original patch were
added, like screenshot support.

VA API is rather bad for actual video output. Dealing with older libva
versions or the completely broken vdpau backend doesn't help. OSD is
low quality and should be rather slow. In some cases, only either OSD
or subtitles can be shown at the same time (because OSD is drawn first,
OSD is prefered).

Also, libva can't decide whether it accepts straight or premultiplied
alpha for OSD sub-pictures: the vdpau backend seems to assume
premultiplied, while a native vaapi driver uses straight. So I picked
straight alpha. It doesn't matter much, because the blending code for
straight alpha I added to img_convert.c is probably buggy, and ASS
subtitles might be blended incorrectly.

Really good video output with VA API would probably use OpenGL and the
GL interop features, but at this point you might just use vo_opengl.
(Patches for making HW decoding with vo_opengl have a chance of being
accepted.)

Despite these issues, decoding seems to work ok. I still got tearing
on the Intel system I tested (Intel(R) Core(TM) i3-2350M). It was also
tested with the vdpau vaapi wrapper on a nvidia system; however this
was rather broken. (Fortunately, there is no reason to use mpv's VAAPI
support over native VDPAU.)
2013-08-12 01:12:02 +02:00
wm4 c7da4ba744 img_convert: add function to scale RGBA OSD images 2013-08-12 00:51:31 +02:00
wm4 689a25003f sub: support straight alpha additionally to premultiplied alpha
This is for VAAPI support. VAAPI does not support premultiplied alpha
for OSD. (Normally, we prefer premultiplied, because it has better
behavior on scaling.)

I'm not sure whether blending in the ASS->RGBA part is correct and I
didn't test it extensively.
2013-08-12 00:50:28 +02:00
wm4 8fe4790ec8 video: redo hw decoding initialization, add --hwdec=auto
Change how the HW decoding stuff is organized, the way it's initialized
in particular. Instead of duplicating the list of supported codecs for
hwaccel decoders, add a probe function which allows each decoder to
report whether it supports a given codec.

Add an "auto" choice to the --hwdec option, which automatically enables
hardware decoding if libavcodec and/or the VO supports it.

What mpv prints on the terminal changes a bit. Now it will just print
a single line whether hw decoding is used or not (and nothing at all if
no hw decoding at all was requested). The pretty violent fallback from
hw decoding to software decoding is still quite verbose and evil-looking
though.
2013-08-11 23:59:18 +02:00
255 changed files with 16468 additions and 9467 deletions

No files matched your search

+7 -2
View File
@@ -14,9 +14,14 @@
/tags
/TAGS
/video/out/gl_video_shaders.h
/video/out/vdpau_template.c
/video/out/x11_icon.inc
/demux/ebml_defs.c
/demux/ebml_types.h
/sub/osd_font.h
/mpvcore/lua/*.inc
/DOCS/man/*/mpv.1
/DOCS/man/*/mpv.aux
/DOCS/man/*/mpv.log
/DOCS/man/*/mpv.out
/DOCS/man/*/mpv.pdf
/DOCS/man/*/mpv.toc
-1117
View File
File diff suppressed because it is too large. Load diff
+14 -30
View File
@@ -1,35 +1,19 @@
mpv is a fork of mplayer2, which is a fork of MPlayer.
Original MPlayer Copyright file follows below.
MPlayer was originally written by Árpád Gereöffy and has been extended and
worked on by many more since then, see the AUTHORS file for an (incomplete)
list. MPlayer as a whole is copyrighted by the MPlayer team. Individual
copyright notices can be found in file headers.
mpv as a whole is licensed as GPL version 2 or later (see LICENSE). Most source
files are GPLv2+, but some files are available under a more liberal license,
such as LGPLv2+, BSD, MIT, ISC, and possibly others. Look at the copyright
header of each source file, and grep the sources for "Copyright" if you need
to know details. Files without Copyright notice are licensed as LGPLv2+.
Most files in MPlayer are licensed under the GNU General Public License,
version 2 with an explicit "or later" clause or a compatible license
(LGPL 2.1+, MIT/BSD). An exception are the files talloc.c and talloc.h,
which are LGPL 3+.
Thus MPlayer as a whole can be redistributed under terms compatible with
the GNU General Public License, version 3; see the LICENSE file for details.
For information about authors and contributors, consult the git log, which
contains the complete SVN and CVS history as well.
MPlayer includes code from several external sources. General information and
license details are listed below:
Note that mplayer2 as a whole is licensed under GPLv3+. This is because it uses
a copy of talloc (part of Samba), which is LGPLv3+, and the next compatible
license for this mix is GPLv3+.
Name: a couple of files copied from FFmpeg
Version: updated to different versions
URL: http://www.ffmpeg.org
Directory: compat/x86_cpu.h
Copyright: Many, see individual files for copyright notices.
License: GNU Lesser General Public License
Name: dvbstream
Version: 0.4.3-pre3 (CVS checkout)
URL: http://sourceforge.net/projects/dvbtools/
Directory: stream/dvbin.h stream/stream_dvb.c
Copyright: 2001-2002 Dave Chapman <dave@dchapman.com>
License: GNU General Public License
This is not a complete list. grep the sources for "Copyright".
MPlayer as a whole is licensed under GPLv2 (incompatible to GPLv3!), because
some files are licensed to GPLv2 (and _not_ any later version of the license).
In particular, this affects the file libmpdemux/demux_ty_osd.c. It is disabled
under mplayer2, and has been removed from mpv.
+9 -17
View File
@@ -5,9 +5,10 @@ http://mingw-w64.sourceforge.net.
You have to run mpv's configure with these arguments:
./configure --enable-cross-compile --target=i686-w64-mingw32
Using MXE to setup a MinGW-w64 environment is recommended: http://mxe.cc
Currently, using an experimental branch of MXE is required:
https://github.com/tonytheodore/mxe.git
Using mingw-w64-cmake to setup a MinGW-w64 environment is recommended (this will
also build mpv and its dependencies): https://github.com/lachs0r/mingw-w64-cmake
Alternatively, use MXE: http://mxe.cc
Warning: the original MinGW (http://www.mingw.org) is unsupported.
@@ -18,11 +19,10 @@ Example with MXE
================
# Download MXE. Note that compiling the required packages requires about 1 GB
# or more! We are using an experimental repository, which supports MinGW-w64.
# The official MXE supports classic MinGW only, which doesn't work with mpv.
# or more!
cd /opt
git clone https://github.com/tonytheodore/mxe.git mingw
git clone https://github.com/mxe/mxe
cd mingw
# Edit the MXE target, so that MinGW-w64 for 32 bit targets is built.
@@ -38,11 +38,6 @@ make libass
make jpeg
make pthreads
# Older MXE and MinGW-w64 snapshots don't provide up-to-date OpenGL headers.
wget http://www.opengl.org/registry/api/glext.h
mv glext.h usr/i686-w64-mingw32/include/GL/
# Build mpv. The target will be used to automatically select the name of the
# build tools involved (e.g. it will use i686-w64-mingw32-gcc).
@@ -52,9 +47,6 @@ export PATH=/opt/mingw/usr/bin/:$PATH
./configure --enable-cross-compile --target=i686-w64-mingw32
make
# This should work. For some reason, the resulting .exe will depend on the DLL
# /opt/mingw/usr/i686-w64-mingw32/bin/libwinpthread-1.dll because pthreads-w32
# folks don't like static linking. How to enable static linking is left as
# exercise to the reader. Passsing --disable-pthreads to mpv's configure will
# get rid of the dependency, but may disable some features (such as the stream
# cache).
# This should work. Note however that MXE’s ffmpeg package might be very old
# in order to avoid breaking e.g. xine-lib, so you might want to update that
# or build it manually as well.
+20
View File
@@ -0,0 +1,20 @@
[latex2e writer]
use-latex-docinfo: yes
use-latex-toc: yes
hyperlink-color: Blue!30!RoyalPurple!70!Black
latex-preamble: \usepackage[usenames,dvipsnames]{xcolor}
\usepackage{fullpage}
\usepackage{graphicx}
\renewcommand{\familydefault}{\sfdefault}
\makeatletter
\renewcommand{\maketitle}{
\begin{center}
\includegraphics{etc/mpv-icon-8bit-64x64.png}\\
\vspace*{-1.5em}
\begin{Huge}
\@title
\end{Huge}
\end{center}
}
\makeatother
+6 -6
View File
@@ -313,12 +313,12 @@ Available filters are:
channels 0 and 1 into output channel 2 (which could be sent to a
subwoofer for example).
.. note::
.. note::
If you just want to force remixing to a certain output channel
layout, it is easier to use the ``force`` filter. For example,
``mpv '--af=force=channels=5.1' '--channels=5.1'`` would always
force remixing audio to 5.1 and output it like this.
If you just want to force remixing to a certain output channel layout,
it is easier to use the ``force`` filter. For example,
``mpv '--af=force=channels=5.1' '--channels=5.1'`` would always force
remixing audio to 5.1 and output it like this.
``sub[=fc:ch]``
Adds a subwoofer channel to the audio stream. The audio data used for
@@ -438,7 +438,7 @@ Available filters are:
``drc[=method:target]``
Applies dynamic range compression. This maximizes the volume by compressing
the audio signal's dynamic range.
the audio signal's dynamic range. (Formerly called ``volnorm``.)
``<method>``
Sets the used method.
+16 -3
View File
@@ -17,8 +17,8 @@ in the list. Suboptions are optional and can mostly be omitted.
.. admonition:: Examples
- ``--ao=alsa,oss,`` Try the ALSA driver, then the OSS driver, then others.
- ``--ao=alsa:noblock:device=hw=0.3`` Sets noblock-mode and the device-name
as first card, fourth device.
- ``--ao=alsa:no-block:device=[hw:0,3]`` Sets noblock-mode and the
device-name as first card, fourth device.
Available audio output drivers are:
@@ -36,7 +36,7 @@ Available audio output drivers are:
Set the name of the mixer element (default: ``Master``). This is for
example ``PCM`` or ``Master``.
``mixer-index=<number>``
Set the index of the mixer channel (default: 0). Consider the output
Set the index of the mixer channel (default: 0). Consider the output of
"``amixer scontrols``", then the index is the number that follows the
name of the element.
@@ -48,6 +48,10 @@ Available audio output drivers are:
``--ao=alsa:device=[plug:surround50]``
Note that the ``[`` and ``]`` simply quote the device name. With some
shells (like zsh), you have to quote the option string to prevent the
shell from interpreting the brackets instead of passing them to mpv.
``oss``
OSS audio output driver
@@ -170,6 +174,15 @@ Available audio output drivers are:
Set the TCP port used for connecting to the server (default: 12345).
Not used if connecting to a Unix domain socket.
``sndio``
Audio output to the OpenBSD sndio sound system
(Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel
layouts.)
``device=<device>``
sndio device to use (default: ``$AUDIODEVICE``, resp. ``snd0``).
``wasapi``
Audio output to the Windows Audio Session API.
+48 -8
View File
@@ -27,7 +27,8 @@ General Changes for MPlayer to mplayer2
* Use libass for subtitle rendering by default (better quality)
* Generally preferring ffmpeg/libav over internal demuxers and decoders
* Improvements when playing multiple files (``--fixed-vo``)
* Screenshot improvements (instant screenshots without 1-frame delay)
* Screenshot improvements (instant screenshots without 1-frame delay, allow
taking screenshots even with hardware decoding)
* Improved support for PulseAudio
* General code cleanups
* Many more changes
@@ -35,6 +36,7 @@ General Changes for MPlayer to mplayer2
General Changes for mplayer2 to mpv
-----------------------------------
* Switch back to GPLv2+.
* Removal of lots of unneeded code to encourage developer activity (less
obscure scary zombie code that kills any desire for hacking the codebase)
* Removal of dust and dead bodies (code-wise), such as kernel drivers for
@@ -55,6 +57,9 @@ General Changes for mplayer2 to mpv
``screenshot`` video filter is not needed anymore, and should not be put
into the mpv config file)
* Removal of teletext support
* Removal of most builtin demuxers, using libavformat instead
* Removal of builtin network support, using libavformat instead (also,
support https via libavformat)
* Replace image VOs (``--vo=jpeg`` etc.) with ``--vo=image``
* Do not lose settings when playing a new file in the same player instance
* New location for config files, new name for the binary.
@@ -68,7 +73,38 @@ General Changes for mplayer2 to mpv
* Wayland support
* Support for precise scrolling which scales the parameter of commands. If the
input doesn't support precise scrolling the scale factor stays 1.
* General code cleanups
* OSX: Cocoa event loop is independent from mplayer's event loop, so user
actions like accessing menus and live resizing do not block the playback.
* OSX: Apple Remote support.
* OSX: Media Keys support.
* Windows: Added WASAPI audio output.
* New OSD bar with chapter marks and not positioned in the middle of the video
(though this can be customized with the ``--osd-bar-align-y`` option).
* Allow customizing whether a key binding for seeking shows the video time, the
OSD bar, or nothing (see section `Input Command Prefixes`_).
* Display list of chapters and audio/subtitle tracks on OSD (see section
`Properties`_).
* ``--keep-open`` option to stop the player from closing the window and
exiting after playback ends.
* Re-enable screensaver while the player is paused.
* Matroska edition switching at runtime.
* Support for libavfilter (for video->video and audio->audio). This allows
using most of FFmpeg's filters, which improve greatly on the old MPlayer
filters in features, performance, and correctness.
* Improved downmixing and output of surround audio. Instead of using hardcoded
pan filters to do remixing, use libavresample. Channel maps are used to
identify the channel layout, so e.g. ``3.0`` and ``2.1`` audio can be
distinguished.
* Allow resuming playback at a later point with ``Shift+q``, also see
``quit_watch_later`` input command.
* Support mapping multiple commands to one key.
* Allow changing/adjusting video filters at runtime. (This is also used to make
the ``D`` key insert vf_yadif if deinterlacing is not supported otherwise.)
* Native VAAPI support
* OSX: VDA support using libavcodec hwaccel API insted of FFmpeg's decoder. Up
to 2-2.5x reduction in CPU usage.
* General bug fixes and removal of long-standing issues
* General code cleanups (including refactoring or rewrites of many parts)
* Many more changes
Detailed Listing of User-visible Changes
@@ -111,7 +147,7 @@ Command Line Switches
``-xineramascreen`` ``--screen`` (different values)
``-ss`` ``--start``
``-endpos`` ``--length``
``--cursor-autohide-delay`` ``--cursor-autohide``
``-cursor-autohide-delay`` ``--cursor-autohide``
``-sub-fuzziness`` ``--autosub-match``
``-subfont`` ``--sub-text-font``
``-font`` ``--osd-font``
@@ -134,8 +170,12 @@ Command Line Switches
``-lavfdopts`` ``--demuxer-lavf-...``
``-rawaudio ...`` ``--demuxer-rawaudio-...``
``-rawvideo ...`` ``--demuxer-rawvideo-...``
``--mixer`` AO suboptions (``alsa``, ``oss``)
``--mixer-channel`` AO suboptions (``alsa``, ``oss``)
``-mixer`` AO suboptions (``alsa``, ``oss``)
``-mixer-channel`` AO suboptions (``alsa``, ``oss``)
``-ao alsa:device=hw=0.3`` ``--ao=alsa:device=[hw:0,3]``
``-af volnorm`` ``--af=drc`` (renamed)
``-zoom`` Inverse available as ``--video-unscaled``
``-panscanrange`` ``--video-zoom``, ``--video-pan-x/y``
=========================== ========================================
.. note::
@@ -149,8 +189,8 @@ input.conf and Slave Commands
This lists only commands that are not always gracefully handled by the
internal legacy translation layer. If an input.conf contains any legacy
commands, they will be displayed with ``-v`` when it is loaded, and show
and the replacement commands.
commands, a warning will be printed when starting the player. The warnings
also show the replacement commands.
Properties containing ``_`` to separate words use ``-`` instead.
@@ -189,7 +229,7 @@ input.conf and Slave Commands
+--------------------------------+----------------------------------------+
| ``show_chapters`` | ``show_text ${chapter-list}`` |
+--------------------------------+----------------------------------------+
| ``af_switch``, ``af_add``, ... | ``af [set|add|...]`` |
| ``af_switch``, ``af_add``, ... | ``af set|add|...`` |
+--------------------------------+----------------------------------------+
Other
+112 -8
View File
@@ -35,7 +35,7 @@ Newlines always start a new binding. ``#`` starts a comment (outside of quoted
string arguments). To bind commands to the ``#`` key, ``SHARP`` can be used.
``<key>`` is either the literal character the key produces (ASCII or Unicode
character), or a symbol name.
character), or a symbolic name (as printed by ``--input-keylist``).
``<section>`` (braced with ``{`` and ``}``) is the input section for this
command.
@@ -226,6 +226,15 @@ List of Input Commands
``<skip>`` subtitle events is displayed. ``<skip>`` can be negative to step
backwards.
``sub_seek <skip>``
Seek to the next (skip set to 1) or the previous (skip set to -1) subtitle.
This is similar to ``sub_step``, except that it seeks video and audio
instead of adjusting the subtitle delay.
Like with ``sub_step``, this works with external text subtitles only. For
embedded text subtitles (like with Matroska), this works only with subtitle
events that have already been displayed.
``osd [<level>]``
Toggle OSD level. If ``<level>`` is specified, set the OSD mode
(see ``--osd-level`` for valid values).
@@ -316,6 +325,77 @@ Input Commands that are Possibly Subject to Change
``disable_section "<section>"``
Disable the named input section. Undoes ``enable_section``.
``overlay_add <id> <x> <y> "<file>" <offset> "<fmt>" <w> <h> <stride>``
Add an OSD overlay sourced from raw data. This might be useful for scripts
and applications controlling mpv, and which want to display things on top
of the video window.
Overlays are usually displayed in screen resolution, but with some VOs,
the resolution is reduced to that of the video's. You can read the
``osd-width`` and ``osd-height`` properties. At least with ``--vo-xv`` and
anamorphic video (such as DVD), ``osd-par`` should be read as well, and the
overlay should be aspect-compensated. (Future directions: maybe mpv should
take care of some of these things automatically, but it's hard to tell
where to draw the line.)
``id`` is an integer between 0 and 63 identifying the overlay element. The
ID can be used to add multiple overlay parts, update a part by using this
command with an already existing ID, or to remove a part with
``overlay_remove``. Using a previously unused ID will add a new overlay,
while reusing an ID will update it. (Future directions: there should be
something to ensure different programs wanting to create overlays don't
conflict with each others, should that ever be needed.)
``x`` and ``y`` specify the position where the OSD should be displayed.
``file`` specifies the file the raw image data is read from. It can be
either a numeric UNIX file descriptor prefixed with ``@`` (e.g. ``@4``),
or a filename. The file will be mapped into memory with ``mmap()``. Some VOs
will pass the mapped pointer directly to display APIs (e.g. opengl or
vdpau), so no actual copying is involved. Truncating the source file while
the overlay is active will crash the player. You shouldn't change the data
while the overlay is active, because the data is essentially accessed at
random points. Instead, call ``overlay_add`` again (preferably with a
different memory region to prevent tearing).
``offset`` is the offset of the first pixel in the source file. It is
passed directly to ``mmap`` and is subject to certain restrictions
(see ``man mmap`` for details). In particular, this value has to be a
multiple of the system's page size.
``fmt`` is a string identifying the image format. Currently, only ``bgra``
is defined. This format has 4 bytes per pixels, with 8 bits per component.
The least significant 8 bits are blue, and the most significant 8 bits
are alpha (in little endian, the components are B-G-R-A, with B as first
byte). This uses premultiplied alpha: every color component is already
multiplied with the alpha component. This means the numeric value of each
component is equal to or smaller than the alpha component. (Violating this
rule will lead to different results with different VOs: numeric overflows
resulting from blending broken alpha values is considered something that
shouldn't happen, and consequently implementations don't ensure that you
get predictable behavior in this case.)
``w``, ``h``, and ``stride`` specify the size of the overlay. ``w`` is the
visible width of the overlay, while ``stride`` gives the width in bytes in
memory. In the simple case, and with the ``bgra`` format, ``stride==4*w``.
In general, the total amount of memory accessed is ``stride * h``.
(Technically, the minimum size would be ``stride * (h - 1) + w * 4``, but
for simplicity, the player will access all ``stride * h`` bytes.)
.. admonition:: Warning
When updating the overlay, you should prepare a second shared memory
region (e.g. make use of the offset parameter) and add this as overlay,
instead of reusing the same memory every time. Otherwise, you might
get the equivalent of tearing, when your application and mpv write/read
the buffer at the same time. Also, keep in mind that mpv might access
an overlay's memory at random times whenever it feels the need to do
so, for example when redrawing the screen.
``overlay_remove <id>``
Remove an overlay added with ``overlay_add`` and the same ID. Does nothing
if no overlay with this ID exists.
Undocumented commands: ``tv_start_scan``, ``tv_step_channel``, ``tv_step_norm``,
``tv_step_chanlist``, ``tv_set_channel``, ``tv_last_channel``, ``tv_set_freq``,
``tv_step_freq``, ``tv_set_norm``, ``dvb_set_channel``, ``radio_step_channel``,
@@ -326,6 +406,9 @@ should be replaced by properties), ``stop`` (questionable use), ``get_property``
Input Command Prefixes
----------------------
These prefixes are placed between key name and the actual command. Multiple
prefixes can be specified. They are separated by whitespace.
``osd-auto`` (default)
Use the default behavior for this command.
``no-osd``
@@ -390,7 +473,7 @@ Name W Comment
``speed`` x see ``--speed``
``filename`` currently played file (path stripped)
``path`` currently played file (full path)
``media-title`` filename or libquvi ``QUVIPROP_PAGETITLE``
``media-title`` filename, title tag, or libquvi ``QUVIPROP_PAGETITLE``
``demuxer``
``stream-path`` filename (full path) of stream layer filename
``stream-pos`` x byte position in source stream
@@ -412,6 +495,7 @@ Name W Comment
``angle`` x current DVD angle
``metadata`` metadata key/value pairs
``metadata/<key>`` value of metadata entry ``<key>``
``chapter-metadata`` metadata of current chapter (works similar)
``pause`` x pause status (bool)
``cache`` network cache fill state (0-100)
``pts-association-mode`` x see ``--pts-association-mode``
@@ -428,7 +512,7 @@ Name W Comment
``audio`` x alias for ``aid``
``balance`` x audio channel balance
``fullscreen`` x see ``--fullscreen``
``deinterlace`` x deinterlacing, if available (bool)
``deinterlace`` x similar to ``--deinterlace``
``colormatrix`` x see ``--colormatrix``
``colormatrix-input-range`` x see ``--colormatrix-input-range``
``colormatrix-output-range`` x see ``--colormatrix-output-range``
@@ -450,14 +534,22 @@ Name W Comment
``dwidth`` video width (after filters and aspect scaling)
``dheight`` video height
``aspect`` x video aspect
``osd-width`` last known OSD width (can be 0)
``osd-height`` last known OSD height (can be 0)
``osd-par`` last known OSD display pixel aspect (can be 0)
``vid`` x current video track (similar to ``--vid``)
``video`` x alias for ``vid``
``video-align-x`` x see ``--video-align-x``
``video-align-y`` x see ``--video-align-y``
``video-pan-x`` x see ``--video-pan-x``
``video-pan-y`` x see ``--video-pan-y``
``video-zoom`` x see ``--video-zoom``
``program`` x switch TS program (write-only)
``sid`` x current subtitle track (similar to ``--sid``)
``sub`` x alias for ``sid``
``sub-delay`` x see ``--sub-delay``
``sub-pos`` x see ``--sub-pos``
``sub-visibility`` x whether current subtitle is rendered
``sub-visibility`` x see ``--sub-visibility``
``sub-forced-only`` x see ``--sub-forced-only``
``sub-scale`` x subtitle font size multiplicator
``ass-use-margins`` x see ``--ass-use-margins``
@@ -471,7 +563,7 @@ Name W Comment
``playlist-pos`` current position on playlist
``playlist-count`` number of total playlist entries
``playlist`` playlist, current entry marked
``track-list`` list of audio/video/sub tracks, cur. entr. marked
``track-list`` list of audio/video/sub tracks, current entry marked
``chapter-list`` list of chapters, current entry marked
``quvi-format`` x see ``--quvi-format``
``af`` x see ``--af``
@@ -500,15 +592,27 @@ The following expansions are supported:
fails, expand to an error string. (Use ``${NAME:}`` with a trailing
``:`` to expand to an empty string instead.)
If ``NAME`` is prefixed with ``=``, expand to the raw value of the property
(see below).
(see section below).
``${NAME:STR}``
Expands to the value of the property ``NAME``, or ``STR`` if the
property cannot be retrieved. ``STR`` is expanded recursively.
``${?NAME:STR}``
Expands to ``STR`` (recursively) if the property ``NAME`` is available.
``${!NAME:STR}``
Expands to ``STR`` (recursively) if the property ``NAME`` cannot be
retrieved.
``${?NAME:STR}``
Expands to ``STR`` (recursively) if the property ``NAME`` is available.
``${?NAME==VALUE:STR}``
Expands to ``STR`` (recursively) if the property ``NAME`` expands to a
string equal to ``VALUE``. You can prefix ``NAME`` with ``=`` in order to
compare the raw value of a property (see section below). If the property
is unavailable, or other errors happen when retrieving it, the value is
never considered equal.
Note that ``VALUE`` can't contain any of the characters ``:`` or ``}``.
Also, it is possible that escaping with ``"`` or ``%`` might be added in
the future, should the need arise.
``${!NAME==VALUE:STR}``
Same as with the ``?`` variant, but ``STR`` is expanded if the value is
not equal. (Using the same semantics as with ``?``.)
``$$``
Expands to ``$``.
``$}``
+18
View File
@@ -0,0 +1,18 @@
LUA SCRIPTING
=============
mpv can load Lua scripts. These scripts can be used to control mpv in a similar
way to slave mode. mpv provides the builtin module ``mp`` (can be loaded
with ``require 'mpv'``), which provides functions to send commands to the
mpv core and to retrieve information about playback state, user settings,
file information, and so on.
.. admonition:: Warning
Lua scripting is work in progress, and it's in a very early stage. When
writing scripts, rely only on the features and functions documented here.
Everything else is subject to change.
.. admonition:: Warning
Nothing is finished and documented yet.
+22 -42
View File
@@ -1,9 +1,3 @@
..
Hint: To generate a nicely formatted XeLaTeX document from this file, use
rst2xetex --use-latex-docinfo --use-latex-toc --hyperlink-color=MidnightBlue --latex-preamble="\usepackage[usenames,dvipsnames]{xcolor}\usepackage{fullpage}\setmainfont{Droid Sans}\setsansfont{Linux Biolinum O}\setmonofont[HyphenChar=None]{DejaVu Sans Mono}" mpv.rst
You might want to put the .. contents:: directive below to generate a TOC.
mpv
###
@@ -12,12 +6,15 @@ a movie player
##############
:Author: wm4
:Date: 2013-07-08
:Copyright: GPLv3
:Version: git
:Copyright: GPLv2+
:Manual section: 1
:Manual group: multimedia
.. raw:: latex
\tableofcontents
\pagebreak
SYNOPSIS
========
@@ -34,7 +31,7 @@ SYNOPSIS
| **mpv** \dvb://[card\_number@]channel [options]
| **mpv** \mf://[filemask|\@listfile] [-mf options] [options]
| **mpv** cdda://track[-endtrack][:speed][/device] [options]
| **mpv** [file|mms[t]|http|httpproxy|rt[s]p|ftp|udp|smb]:// [user:pass\@]URL[:port] [options]
| **mpv** [file|mms[t]|http|httpproxy|rt[s]p|ftp|udp|smb]://[user:pass\@]URL[:port] [options]
DESCRIPTION
@@ -176,7 +173,9 @@ P
Show progression bar, elapsed time and total duration on the OSD.
! and @
Seek to the beginning of the previous/next chapter.
Seek to the beginning of the previous/next chapter. In most cases,
"previous" will actually go to the beginning of the current chapter; see
``--chapter-seek-threshold``.
D (``--vo=vdpau``, ``--vf=yadif`` only)
Activate/deactivate deinterlacer.
@@ -202,8 +201,7 @@ corresponding adjustment, or the software equalizer (``--vf=eq``).)
7 and 8
Adjust saturation.
(The following keys are valid only when using the corevideo video output
driver.)
(The following keys are valid only on OSX.)
command + 0
Resize movie window to half its original size.
@@ -232,7 +230,7 @@ PREVIOUS and NEXT
Seek backward/forward 1 minute.
(The following keys are only valid if you compiled with TV or DVB input
support and will take precedence over the keys defined above.)
support.)
h and k
Select previous/next channel.
@@ -252,24 +250,6 @@ button 3 and button 4
button 5 and button 6
Decrease/increase volume.
Joystick Control
----------------
left and right
Seek backward/forward 10 seconds.
up and down
Seek forward/backward 1 minute.
button 1
Pause.
button 2
Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
button 3 and button 4
Decrease/increase volume.
USAGE
=====
@@ -314,6 +294,8 @@ file1.mkv ``--a --b --c``
file2.mkv ``--a --b --c``
=============== ===========================
(This is different from MPlayer and mplayer2.)
Also, if any option is changed at runtime (via input commands), they are not
reset when a new file is played.
@@ -408,7 +390,7 @@ profile name ``default`` to continue with normal options.
::
[vo.vdpau]
# Use hardware decoding (this might break playback of some h264 files)
# Use hardware decoding (might break playback of some h264 files)
hwdec=vdpau
[protocol.dvd]
@@ -442,9 +424,6 @@ taking screenshots is handled by the VOs, and adding the screenshot filter will
break hardware decoding. (The filter may still be useful for taking screenshots
at a certain point within the video chain when using multiple video filters.)
OPTIONS
=======
.. include:: options.rst
.. include:: ao.rst
@@ -459,6 +438,10 @@ OPTIONS
.. include:: input.rst
.. include:: osc.rst
.. include:: lua.rst
.. include:: changes.rst
ENVIRONMENT VARIABLES
@@ -498,7 +481,7 @@ behavior of mpv.
FFmpeg/Libav:
This library accesses various environment variables. However, they are not
centrally documented, and documenting them is not our job. Therefore, the
centrally documented, and documenting them is not our job. Therefore, this
list is incomplete.
Notable environment variables:
@@ -601,13 +584,10 @@ FILES
EXAMPLES OF MPV USAGE
=====================
Quickstart Blu-ray playing:
Blu-ray playback:
- ``mpv bd:////path/to/disc``
- ``mpv bd:// --bluray-device=/path/to/disc``
Quickstart DVD playing:
``mpv dvd://1``
Play in Japanese with English subtitles:
``mpv dvd://1 --alang=ja --slang=en``
@@ -643,6 +623,6 @@ mpv is a MPlayer fork based on mplayer2, which in turn is a fork of MPlayer.
MPlayer was initially written by Arpad Gereoffy. See the ``AUTHORS`` file for
a list of some of the many other contributors.
MPlayer is (C) 2000-2012 The MPlayer Team
MPlayer is (C) 2000-2013 The MPlayer Team
This man page was written mainly by Gabucino, Jonas Jermann and Diego Biurrun.
+300 -93
View File
@@ -1,3 +1,6 @@
OPTIONS
=======
``--ad=<[+|-]family1:(*|decoder1),[+|-]family2:(*|decoder2),...[-]>``
Specify a priority list of audio decoders to be used, according to their
family and decoder name. Entries like ``family:*`` prioritize all decoders
@@ -69,8 +72,7 @@
Specify a priority list of audio languages to use. Different container
formats employ different language codes. DVDs use ISO 639-1 two-letter
language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three-letter
language codes, while OGM uses a free-form identifier. mpv prints the
available languages when run in verbose (``-v``) mode. See also ``--aid``.
language codes, while OGM uses a free-form identifier. See also ``--aid``.
.. admonition:: Examples
@@ -123,19 +125,33 @@
Using this option may lead to incorrect subtitle rendering.
``--ass-hinting=<type>``
``--ass-hinting=none|light|normal|native``
Set font hinting type. <type> can be:
:0: no hinting
:1: FreeType autohinter, light mode
:2: FreeType autohinter, normal mode
:3: font native hinter
:none: no hinting (default)
:light: FreeType autohinter, light mode
:normal: FreeType autohinter, normal mode
:native: font native hinter
The default value is 0 (no hinting).
.. admonition:: Warning
Enabling hinting can lead to mispositioned text (in situations it's
supposed to match up with video background), or reduce the smoothness
of animations with some badly authored ASS scripts. It is recommended
to not use this option, unless really needed.
``--ass-line-spacing=<value>``
Set line spacing value for SSA/ASS renderer.
``--ass-shaper=simple|complex``
Set the text layout engine used by libass.
:simple: uses Fribidi only, fast, doesn't render some languages correctly
:complex: uses HarfBuzz, slower, wider language support
``complex`` is the default. If libass hasn't been compiled against HarfBuzz,
libass silently reverts to ``simple``.
``--ass-styles=<filename>``
Load all SSA/ASS styles found in the specified file and use them for
rendering text subtitles. The syntax of the file is exactly like the ``[V4
@@ -183,7 +199,7 @@
offset scale factor, not what the video filter chain or the video output
use.
``--ass-vsfilter-color-compat=<basic|full|force-601|no``
``--ass-vsfilter-color-compat=<basic|full|force-601|no>``
Mangle colors like (xy-)vsfilter do (default: basic). Historically, VSFilter
was not colorspace aware. This was no problem as long as the colorspace
used for SD video (BT.601) was used. But when everything switched to HD
@@ -249,8 +265,8 @@
See ``--geometry`` for details how this is handled with multi-monitor
setups.
Use ``--autofit-larger`` instead if you do not want the window to get
larger.
Use ``--autofit-larger`` instead if you just want to limit the maximum size
of the window, rather than always forcing a window size.
Use ``--geometry`` if you want to force both window width and height to a
specific size.
@@ -307,17 +323,6 @@
out. This delay in reaction time to sudden A/V offsets should be the only
side-effect of turning this option on, for all sound drivers.
``--bandwidth=<bytes>``
Specify the maximum bandwidth for network streaming (for servers that are
able to send content in different bitrates). Useful if you want to watch
live streamed media behind a slow connection. With Real RTSP streaming, it
is also used to set the maximum delivery bandwidth allowing faster cache
filling and stream dumping.
.. note::
Probably broken/useless.
``--untimed``
Do not sleep when outputting video frames. Useful for benchmarks when used
with ``--no-audio.``
@@ -331,6 +336,10 @@
Specify the Blu-ray disc location. Must be a directory with Blu-ray
structure.
.. admonition:: Example
``mpv bd:// --bluray-device=/path/to/bd/``
``--border``, ``--no-border``
Play movie with window border and decorations. Since this is on by
default, use ``--no-border`` to disable the standard window decorations.
@@ -357,7 +366,7 @@
``--cache-default=<kBytes|no>``
Set the size of the cache in kilobytes (default: 320 KB). Using ``no``
will not automatically enable the cache e.h. when playing from a network
will not automatically enable the cache e.g. when playing from a network
stream. Note that using ``--cache`` will always override this option.
``--cache-pause=<no|percentage>``
@@ -433,11 +442,6 @@
libavcodec downmixes the audio into the requested number of channels if
possible.
.. note::
This option is honored by codecs (AC-3 only), filters (surround) and
audio output drivers (OSS at least).
The ``--channels`` option either takes a channel number or an explicit
channel layout. Channel numbers refer to default layouts, e.g. 2 channels
refer to stereo, 6 refers to 5.1.
@@ -446,6 +450,13 @@
lists speaker names, which can be used to express arbitrary channel
layouts (e.g. ``fl-fr-lfe`` is 2.1).
.. note::
Currently, this option is not very useful. The main effect of this
option is that automatic stereo downmixing is disabled. It depends
mainly on the selected audio output and the associated audio subsystem
how playback of files with surround audio will behave.
``--chapter=<start[-end]>``
Specify which chapter to start playing at. Optionally specify which
chapter to end playing at. Also see ``--start``.
@@ -459,6 +470,13 @@
the start of the next one then keep playing video normally over the
chapter change instead of doing a seek.
``--chapter-seek-threshold=<seconds>``
Distance in seconds from the beginning of a chapter within which a backward
chapter seek will go to the previous chapter (default: 5.0). Past this
threshold, a backward chapter seek will go to the beginning of the current
chapter instead. A negative value means always go back to the previous
chapter.
``--colormatrix=<colorspace>``
Controls the YUV to RGB color space conversion when playing video. There
are various standards. Normally, BT.601 should be used for SD video, and
@@ -559,10 +577,30 @@
``no`` will disable cursor autohide. ``always`` means the cursor will stay
hidden.
``--cursor-autohide-fs-only``
If this option is given, the cursor is always visible in windowed mode. In
fullscreen mode, the cursor is shown or hidden according to
``--cursor-autohide``.
``--audio-delay=<sec>``
Audio delay in seconds (positive or negative float value). Negative values
delay the audio, and positive values delay the video.
``--deinterlace=<yes|no|auto>``
Enable or disable interlacing (default: auto, which usually means no).
Interlaced video shows ugly comb-like artifacts, which are visible on
fast movement. Enabling this typically inserts the yadif video filter in
order to deinterlace the video, or lets the video output apply deinterlacing
if supported.
This behaves exactly like the ``deinterlace`` input property (usually
mapped to ``Shift+D``).
``auto`` is a technicality. Strictly speaking, the default for this option
is deinterlacing disabled, but the ``auto`` case is needed if ``yadif`` was
added to the filter chain manually with ``--vf``. Then the core shouldn't
disable deinterlacing just because the ``--deinterlace`` was not set.
``--demuxer=<[+]name>``
Force demuxer type. Use a '+' before the name to force it; this will skip
some checks. Give the demuxer name as printed by ``--demuxer=help``.
@@ -584,7 +622,7 @@
This is default in order to reduce latency when opening HTTP streams.
``--demuxer-lavf-format=<value>``
``--demuxer-lavf-format=<name>``
Force a specific libavformat demuxer.
``--demuxer-lavf-genpts-mode=<auto|lavf|builtin|no>``
@@ -667,12 +705,14 @@
.. admonition:: Example
- ``mpv sample-720x576.yuv --demuxer=rawvideo --demuxer-rawvideo=w=720:h=576``
Play a raw YUV sample.
Play a raw YUV sample::
mpv sample-720x576.yuv --demuxer=rawvideo \
--demuxer-rawvideo=w=720:h=576
``--demuxer-rawvideo-format=<value>``
Colorspace (fourcc) in hex or string for ``--demuxer=rawvideo``
(default: YV12).
(default: ``YV12``).
``--demuxer-rawvideo-mp-format=<value>``
Colorspace by internal video format for ``--demuxer=rawvideo``. Use
@@ -708,6 +748,10 @@
also specify a directory that contains files previously copied directly
from a DVD (with e.g. vobcopy).
.. admonition:: Example
``mpv dvd:// --dvd-device=/path/to/dvd/``
``--dvd-speed=<speed>``
Try to limit DVD speed (default: 0, no change). DVD base speed is 1385
kB/s, so an 8x drive can read at speeds up to 11080 kB/s. Slower speeds
@@ -724,10 +768,10 @@
Some DVDs contain scenes that can be viewed from multiple angles.
This option tells mpv which angle to use (default: 1).
``--edition=<ID>``
``--edition=<ID|auto>``
(Matroska files only)
Specify the edition (set of chapters) to use, where 0 is the first. If set
to -1 (the default), mpv will choose the first edition declared as a
to ``auto`` (the default), mpv will choose the first edition declared as a
default, or if there is no default, the first edition defined.
``--embeddedfonts``, ``--no-embeddedfonts``
@@ -750,7 +794,7 @@
``--no-fixed-vo``, ``--fixed-vo``
``--no-fixed-vo`` enforces closing and reopening the video window for
multiple files (one (un)initialization for all files).
multiple files (one (un)initialization for each file).
``--flip``
Flip image upside-down.
@@ -763,6 +807,20 @@
depending on GPU drivers and hardware. For other VOs, this just makes
rendering slower.
``--force-window``
Create a video output window even if there is no video. This can be useful
when pretending that mpv is a GUI application. Currently, the window
always has the size 640x480, and is subject to ``--geometry``,
``--autofit``, and similar options.
.. warning::
The window is created only after initialization (to make sure default
window placement still works if the video size is different from the
``--force-window`` default window size). This can be a problem if
initialization doesn't work perfectly, such as when opening URLs with
bad network connection, or opening broken video files.
``--force-window-position``
Forcefully move mpv's video output window to default location whenever
there is a change in video parameters, video stream or file. This used to
@@ -959,14 +1017,11 @@
See also ``--autofit`` and ``--autofit-larger`` for fitting the window into
a given size without changing aspect ratio.
``--grabpointer``, ``--no-grabpointer``
``--no-grabpointer`` tells the player to not grab the mouse pointer after a
video mode change (``--vm``). Useful for multihead setups.
``--heartbeat-cmd``
``--heartbeat-cmd=<command>``
Command that is executed every 30 seconds during playback via *system()* -
i.e. using the shell. The time between the commands can be customized with
the ``--heartbeat-interval`` option.
the ``--heartbeat-interval`` option. The command is not run while playback
is paused.
.. note::
@@ -979,7 +1034,8 @@
This can be "misused" to disable screensavers that do not support the
proper X API (see also ``--stop-screensaver``). If you think this is too
complicated, ask the author of the screensaver program to support the
proper X APIs.
proper X APIs. Note that the ``--stop-screensaver`` does not influence the
heartbeat code at all.
.. admonition:: Example for xscreensaver
@@ -1027,7 +1083,10 @@
.. admonition:: Example
``mpv --http-header-fields='Field1: value1','Field2: value2' http://localhost:1234``
::
mpv --http-header-fields='Field1: value1','Field2: value2' \
http://localhost:1234
Will generate HTTP request::
@@ -1052,10 +1111,22 @@
``<api>`` can be one of the following:
:no: always use software decoding (default)
:vdpau: works with nvidia drivers only, requires ``--vo=vdpau``
:vda: OSX
:auto: see below
:vdpau: requires ``--vo=vdpau`` (Linux only)
:vaapi: requires ``--vo=vaapi`` (Linux with Intel GPUs only)
:vaapi-copy: copies video back into system RAM (Linux with Intel GPUs only)
:vda: requires ``--vo=corevideo`` (OSX only)
:crystalhd: Broadcom Crystal HD
``auto`` tries to automatically enable hardware decoding using the first
available method. This still depends what VO you are using. For example,
if you are not using ``--vo=vdpau``, vdpau decoding will never be enabled.
Also note that if the first found method doesn't actually work, it will
always fall back to software decoding, instead of trying the next method.
The ``vaapi-copy`` function allows you to use vaapi with any VO. Because
this copies the decoded video back to system RAM, it's quite inefficient.
``--hwdec-codecs=<codec1,codec2,...|all>``
Allow hardware decoding for a given list of codecs only. The default is the
special value ``all``, which always allows all codecs.
@@ -1183,10 +1254,31 @@
``--list-properties``
Print a list of the available properties.
``--loop=<number|inf|no>``
Loops playback ``<number>`` times. ``inf`` means forever and ``no`` disables
looping. If several files are specified on command line, the entire playlist
is looped.
``--load-unsafe-playlists``
Normally, something like ``mpv playlist.m3u`` won't load the playlist. This
is because the playlist code is unsafe. (This is the same in all other
variations of MPlayer.)
See ``--playlist`` for details.
Note: this option will allow opening playlists using the ``playlist``
special demuxer. The ``--playlist`` uses different code, and supports more
playlist formats than the playlist demuxer. This means that for now, the
``--playlist`` option should always be used if you intend to open playlists.
Background: the special demuxer contains newly written code, while the
``--playlist`` option uses the old MPlayer code. Adding support for more
playlist formats to the special demuxer is work in progress, and eventually
the old code should disappear.
``--loop=<N|inf|no>``
Loops playback ``N`` times. A value of ``1`` plays it one time (default),
``2`` two times, etc. ``inf`` means forever. ``no`` is the same as ``1`` and
disables looping. If several files are specified on command line, the
entire playlist is looped.
``--lua=<filename>``
Load a Lua script. You can load multiple scripts by separating them with
commas (``,``).
``--mc=<seconds/frame>``
Maximum A-V sync correction per frame (in seconds)
@@ -1219,14 +1311,11 @@
1). A value of 1 means square pixels (correct for (almost?) all LCDs). See
also ``--monitoraspect`` and ``--aspect``.
``--mouse-movements``
``--mouse-movements``, ``--no-mouse-movements``
Permit mpv to receive pointer events reported by the video output
driver. Necessary to select the buttons in DVD menus. Supported for
X11-based VOs (x11, xv, etc) and the gl, direct3d and corevideo VOs.
``--mouseinput``, ``--no-mouseinput``
``--no-mouseinput`` disables mouse button press/release input.
``--no-msgcolor``
Disable colorful console output on terminals.
@@ -1307,8 +1396,9 @@
``--no-sub``
Do not select any subtitle when the file is loaded.
``--no-sub-visibility``
Disable display of subtitles, but still select and decode them.
``--sub-visibility``, ``--no-sub-visibility``
Can be used to disable display of subtitles, but still select and decode
them.
``--no-video``
Do not play video. With some demuxers this may not work. In those cases
@@ -1324,6 +1414,9 @@
search for video segments from other files, and will also ignore any
chapter order specified for the main file.
``--osc``, ``--no-osc``
Whether to load the on-screen-controller (default: no).
``--no-osd-bar``, ``--osd-bar``
Disable display of the OSD bar. This will make some things (like seeking)
use OSD text messages instead of the bar.
@@ -1334,13 +1427,15 @@
``--osd-bar-align-x=<-1-1>``
Position of the OSD bar. -1 is far left, 0 is centered, 1 is far right.
Fractional values (like 0.5) are allowed.
``--osd-bar-align-y=<-1-1>``
Position of the OSD bar. -1 is top, 0 is centered, 1 is bottom.
Fractional values (like 0.5) are allowed.
``--osd-bar-w=<1-100>``
Width of the OSD bar, in percentage of the screen width (default: 75).
A value of 0.5 means the bar is half the screen wide.
A value of 50 means the bar is half the screen wide.
``--osd-bar-h=<0.1-50>``
Height of the OSD bar, in percentage of the screen height (default: 3.125).
@@ -1374,8 +1469,8 @@
For example, ``#FF0000`` is red. This is similar to web colors.
You can specify transparency by specifying an alpha value in the form
``#AARRGGBB``. 0 is fully transparent, while ``FF`` is opaque (opaque is
default with the shorter color specification).
``#AARRGGBB``. ``00`` is fully transparent, while ``FF`` is opaque (opaque
is default with the shorter color specification).
.. admonition:: Examples
@@ -1470,17 +1565,9 @@
controls how much of the image is cropped. May not work with all video
output drivers.
``--panscanrange=<-19.0-99.0>``
(experimental)
Change the range of the pan-and-scan functionality (default: 1). Positive
values mean multiples of the default range. Negative numbers mean you can
zoom in up to a factor of ``--panscanrange=+1``. E.g. ``--panscanrange=-3``
allows a zoom factor of up to 4. This feature is experimental. Do not
report bugs unless you are using ``--vo=opengl``.
``--playing-msg=<string>``
Print out a string after starting playback. The string is expanded for
properties, e.g. ``--playing-msg=file: ${filename}`` will print the string
properties, e.g. ``--playing-msg='file: ${filename}'`` will print the string
``file:`` followed by a space and the currently played filename.
See `Property Expansion`_.
@@ -1611,6 +1698,8 @@
Particularly useful on slow terminals or broken ones which do not properly
handle carriage return (i.e. ``\r``).
Also see ``--really-quiet`` and ``--msglevel``.
``--quvi-format=<best|default|...>``
Video format/quality that is directly passed to libquvi (default: ``best``).
This is used when opening links to streaming sites like YouTube. The
@@ -1631,9 +1720,10 @@
The following explanations are relevant:
`<http://quvi.sourceforge.net/doc/0.9/glossary_termino.html#m_stream_id>`_
With 0.9.x, the ``quvi-format`` property can be used at runtime to cycle
through the list of formats. Unfortunately, this resets the playback
position and is slow too.
The ``quvi-format`` property can be used at runtime to cycle through the
list of formats. Unfortunately, this is slow. On libquvi 0.4.x, this
functionality is limited to switching between ``best`` and ``default`` if
the ``cycle`` input command is used.
``--radio=<option1:option2:...>``
These options set various parameters of the radio capture module. For
@@ -1725,9 +1815,10 @@
- ``--reset-on-next-file=""``
Do not reset pause mode.
``--reuse-socket``
(udp:// only)
Allows a socket to be reused by other processes as soon as it is closed.
``--rtsp-transport=<lavf|udp|tcp|http>``
Select RTSP transport method (default: tcp). This selects the underlying
network transport when playing ``rtsp://...`` URLs. The value ``lavf``
leaves the decision to libavformat.
``--saturation=<-100-100>``
Adjust the saturation of the video signal (default: 0). You can get
@@ -1737,8 +1828,10 @@
``--save-position-on-quit``
Always save the current playback position on quit. When this file is
played again later, the player will seek to the old playback position on
start. This affects any form of stopping playback (quitting, going to the
next file).
start. This does not happen if playback of a file is stopped in any other
way than quitting. For example, going to the next file in the playlist
will not save the position, and start playback at beginning the next time
the file is played.
This behavior is disabled by default, but is always available when quitting
the player with Shift+Q.
@@ -1752,12 +1845,12 @@
multiple displays), this option tells mpv which screen to display the
movie on.
This option does not always work. In these cases, try to use ``--geometry``
to position the window explicitly.
.. admonition:: Note (X11)
This option does not work properly with all window managers.
This option does not work properly with all window managers. In these
cases, you can try to use ``--geometry`` to position the window
explicitly. It's also possible that the window manager provides native
features to control which screens application windows should use.
See also ``--fs-screen``.
@@ -1835,6 +1928,28 @@
numbers would be more intuitive, but are not easily implementable
because container formats usually use time stamps for identifying
frames.)
``%wX``
Specify the current playback time using the format string ``X``.
``%p`` is like ``%wH:%wM:%wS``, and ``%P`` is like ``%wH:%wM:%wS.%wT``.
Valid format specifiers:
``%wH``
hour (padded with 0 to two digits)
``%wh``
hour (not padded)
``%wM``
minutes (00-59)
``%wm``
total minutes (includes hours, unlike ``%wM``)
``%wS``
seconds (00-59)
``%ws``
total seconds (includes hours and minutes)
``%wf``
like ``%ws``, but as float
``%wT``
milliseconds (000-999)
``%tX``
Specify the current local date/time using the format ``X``. This format
specifier uses the UNIX ``strftime()`` function internally, and inserts
@@ -1863,7 +1978,7 @@
Play files in random order.
``--sid=<ID|auto|no>``
Display the subtitle stream specified by ``<ID>`` (0-31). ``auto`` selects
Display the subtitle stream specified by ``<ID>``. ``auto`` selects
the default, ``no`` disables subtitles.
See also ``--slang``, ``--no-sub``.
@@ -1872,8 +1987,7 @@
Specify a priority list of subtitle languages to use. Different container
formats employ different language codes. DVDs use ISO 639-1 two letter
language codes, Matroska uses ISO 639-2 three letter language codes while
OGM uses a free-form identifier. mpv prints the available languages
when run in verbose (``-v``) mode. See also ``--sid``.
OGM uses a free-form identifier. See also ``--sid``.
.. admonition:: Examples
@@ -1927,6 +2041,14 @@
current level. With values below 100 the initial volume (which is 100%)
will be above the maximum, which e.g. the OSD cannot display correctly.
.. admonition:: Note
The maximum value of ``--volume`` as well as the ``volume`` property
is always 100. Likewise, the volume OSD bar always goes from 0 to 100.
This means that with ``--softvol-max=200``, ``--volume=100`` sets
maximum amplification, i.e. amplify by 200%. The default volume (no
change in volume) will be ``50`` in this case.
``--speed=<0.01-100>``
Slow down or speed up playback by the factor given as parameter.
@@ -1985,7 +2107,8 @@
``--stop-screensaver``, ``--no-stop-screensaver``
Turns off the screensaver (or screen blanker and similar mechanisms) at
startup and turns it on again on exit (default: yes).
startup and turns it on again on exit (default: yes). The screensaver is
always re-enabled when the player is paused.
This is not supported on all video outputs or platforms. Sometimes it is
implemented, but does not work (happens often on GNOME). You might be able
@@ -2025,22 +2148,39 @@
``--subcp=<codepage>``
If your system supports ``iconv(3)``, you can use this option to specify
the subtitle codepage.
the subtitle codepage. By default, ENCA will be used to guess the charset.
If mpv is not compiled with ENCA, ``UTF-8:UTF-8-BROKEN`` is the default,
which means it will try to use UTF-8, otherwise the ``UTF-8-BROKEN``
pseudo codepage (see below).
.. admonition:: Warning
If you force the charset, even subtitles that are known to be
UTF-8 will be recoded, which is perhaps not what you expect. Prefix
codepages with ``utf8:`` if you want the codepage to be used only if the
input is not valid UTF-8.
.. admonition:: Examples
- ``--subcp=latin2``
- ``--subcp=cp1250``
- ``--subcp=utf8:latin2`` Use Latin 2 if input is not UTF-8.
- ``--subcp=utf8:cp1250`` Use CP1250 if input is not UTF-8.
- ``--subcp=cp1250`` Always force recoding to cp1250.
If the player was compiled with ENCA support, you can use special syntax
to use that::
The pseudo codepage ``UTF-8-BROKEN`` is used internally. If this is used
as codepage, the subtitle will be interpreted as UTF-8, but with "Latin 1"
as fallback for bytes which are not valid UTF-8 sequences. iconv is never
involved in this mode.
--subcp=enca:<language>:<fallback codepage>
If the player was compiled with ENCA support, you can control it with the
following syntax::
``--subcp=enca:<language>:<fallback codepage>``
You can specify your language using a two letter language code to make
ENCA detect the codepage automatically. If unsure, enter anything (if the
language is invalid, mpv will complain and list valid languages).
Fallback codepage specifies the codepage to use if autodetection fails.
If no fallback is specified, ``UTF-8-BROKEN`` is used.
.. admonition:: Examples
@@ -2112,10 +2252,10 @@
to fix the playback speed for frame-based subtitle formats. Works for
external text subtitles only.
.. admonition:: Examples
.. admonition:: Example
- ``--sub-speed=25/23.976`` plays frame based subtitles which have been
loaded assuming a framerate of 23.976 at 25 FPS.
`--sub-speed=25/23.976`` plays frame based subtitles which have been
loaded assuming a framerate of 23.976 at 25 FPS.
``--sws=<n>``
Specify the software scaler algorithm to be used with ``--vf=scale``. This
@@ -2157,7 +2297,17 @@
.. warning::
There is a danger of this causing significant CPU usage, depending on
the properties used and the window manager.
the properties used and the window manager. Changing the window title
is often a slow operation, and if the title changes every frame,
playback can be ruined.
``--tls-ca-file=<filename>``
Certificate authority database file for use with TLS. (Silently fails with
older ffmpeg or libav versions.)
``--tls-verify``
Verify peer certificates when using TLS (e.g. with ``https://...``).
(Silently fails with older ffmpeg or libav versions.)
``--tv=<option1:option2:...>``
This option tunes various properties of the TV capture module. For
@@ -2436,6 +2586,51 @@
``--vid=<ID|auto|no>``
Select video channel. ``auto`` selects the default, ``no`` disables video.
``--video-align-x=<-1-1>``, ``--video-align-y=<-1-1>``
Moves the video rectangle within the black borders, which are usually added
to pad the video to screen if video and screen aspect ratios are different.
``--video-align-y=-1`` would move the video to the top of the screen
(leaving a border only on the bottom), a value of ``0`` centers it
(default), and a value of ``-1`` would put the video at the bottom of the
screen.
If video and screen aspect match perfectly, these options do nothing.
This option is disabled if the ``--no-keepaspect`` option is used.
``--video-pan-x=<value>``, ``--video-pan-y=<value>``
Moves the displayed video rectangle by the given value in the X or Y
direction. The unit is in fractions of the size of the scaled video (the
full size, even if parts of the video are not visible due to panscan or
other options).
For example, displaying a 1280x720 video fullscreen on a 1680x1050 screen
with ``--video-pan-x=-0.1`` would move the video 168 pixels to the left
(making 128 pixels of the source video invisible).
This option is disabled if the ``--no-keepaspect`` option is used.
``--video-unscaled``
Disable scaling of the video. If the window is larger than the video,
black bars are added. Otherwise, the video is cropped. The video still
can be influenced by the other ``--video-...`` options. (If the
``--video-zoom`` option is set to a value other than ``1``, scaling is
enabled, but the video isn't automatically scaled to the window size.)
Note that the scaler algorithm may still be used, even if the video isn't
scaled. For example, this can influence chroma conversion.
This option is disabled if the ``--no-keepaspect`` option is used.
``--video-zoom=<value>``
Adjust the video display scale factor by the given value. The unit is in
fractions of original video size.
For example, given a 1280x720 video, ``--video-zoom=-0.1`` would make the
video by 128 pixels smaller in X direction, and 72 pixels in Y direction.
This option is disabled if the ``--no-keepaspect`` option is used.
``--vo=<driver1[:suboption1[=value]:...],driver2,...[,]>``
Specify a priority list of video output drivers to be used. For
interactive use, one would normally specify a single one to use, but in
@@ -2450,6 +2645,18 @@
Set the startup volume. A value of -1 (the default) will not change the
volume. See also ``--softvol``.
``--volume-restore-data=<string>``
Used internally for use by playback resume (e.g. with ``quit_watch_later``).
Restoring value has to be done carefully, because different AOs as well as
softvol can have different value ranges, and we don't want to restore
volume if setting the volume changes it system wide. The normal options
(like ``--volume``) would always set the volume. This option was added for
restoring volume in a safer way (by storing the method used to set the
volume), and is not generally useful. Its semantics are considered private
to mpv.
Do not use.
``--wid=<ID>``
(X11 and Windows only)
This tells mpv to attach to an existing window. The ID is interpreted as
+198
View File
@@ -0,0 +1,198 @@
ON SCREEN CONTROLLER
====================
The On Screen Controller (short: OSC) is a minimal GUI integrated with mpv to
offer basic mouse-controllability. It is intended to make interaction easier
for new users and to enable precise and direct seeking.
The OSC is enabled by default if mpv was compiled with lua support. It can be
disabled using ``--osc=no``.
Using the OSC
-------------
By default, the OSC will show up whenever the mouse is moved inside the
player window and will hide if the mouse is not moved outside the OSC for
0.5 seconds or if the mouse leaves the window.
The Interface
~~~~~~~~~~~~~
::
+------------------+-----------+--------------------+
| playlist prev | title | playlist next |
+-------+------+---+--+------+-+----+------+--------+
| audio | skip | seek | | seek | skip | full |
+-------+ back | back | play | frwd | frwd | screen |
| sub | | | | | | |
+-------+------+------+------+------+------+--------+
| seekbar |
+----------------+--------------+-------------------+
| time passed | cache status | time remaining |
+----------------+--------------+-------------------+
playlist prev
============= ================================================
left-click play previous file in playlist
shift+L-click show playlist
============= ================================================
title
| Displays current media-title or filename
============= ================================================
left-click show playlist position and length and full title
right-click show filename
============= ================================================
playlist next
============= ================================================
left-click play next file in playlist
shift+L-click show playlist
============= ================================================
audio and sub
| Displays selected track and amount of available tracks
============= ================================================
left-click cycle audio/sub tracks forward
right-click cycle audio/sub tracks backwards
shift+L-click show available audio/sub tracks
============= ================================================
skip back
============= ================================================
left-click go to beginning of chapter / previous chapter
shift+L-click show chapters
============= ================================================
seek back
============= ================================================
left-click skip back 5 seconds
right-click skip back 30 seconds
shift-L-click skip back 1 frame
============= ================================================
play
============= ================================================
left-click toggle play/pause
============= ================================================
seek frwd
============= ================================================
left-click skip forward 10 seconds
right-click skip forward 60 seconds
shift-L-click skip forward 1 frame
============= ================================================
skip frwd
============= ================================================
left-click go to next chapter
shift+L-click show chapters
============= ================================================
fullscreen
============= ================================================
left-click toggle fullscreen
============= ================================================
seekbar
| Indicates current playback position and position of chapters
============= ================================================
left-click seek to position
============= ================================================
time passed
| Shows current playback position timestamp
============= ================================================
left-click toggle displaying timecodes with milliseconds
============= ================================================
cache status
| Shows current cache fill status (only visible when below 48%)
time remaining
| Shows remaining playback time timestamp
============= ================================================
left-click toggle between total and remaining time
============= ================================================
Configuration
-------------
The OSC offers limited configuration through a config file ``plugin_osc.conf``
placed in mpv's user dir.
Config Syntax
~~~~~~~~~~~~~
The config file must exactly follow the following syntax::
# this is a comment
parameter1=value1
parameter2=value2
``#`` can only be used at the beginning of a line and there may be no
spaces around the ``=`` or anywhere else.
Configurable parameters
~~~~~~~~~~~~~~~~~~~~~~~
``showwindowed``
| Default: yes
| Show OSC when windowed?
``showfullscreen``
| Default: yes
| Show OSC when fullscreen?
``scalewindowed``
| Default: 1
| Scaling of the controller when windowed
``scalefullscreen``
| Default: 1
| Scaling of the controller when fullscreen
``scaleforcedwindow``
| Default: 2
| Scaling of the controller when rendered on a forced (dummy) window
``vidscale``
| Default: yes
| Scale the controller with the video?
``valign``
| Default: 0.8
| Vertical alignment, -1 (top) to 1 (bottom)
``halign``
| Default: 0
| Horizontal alignment, -1 (left) to 1 (right)
``hidetimeout``
| Default: 500
| Duration in ms until the OSC hides if no mouse movement, negative value
disables auto-hide
``fadeduration``
| Default: 200
| Duration of fade out in ms, 0 = no fade
``deadzonesize``
| Default: 0
| Size of the deadzone. The deadzone is an area that makes the mouse act
like leaving the window. Movement there won't make the OSC show up and
it will hide immediately if the mouse enters it.
``minmousemove``
| Default: 3
| Minimum amount of pixels the mouse has to move between ticks to make
the OSC show up
+17
View File
@@ -861,3 +861,20 @@ Available filters are:
``a3=<string>``
Specify the fourth parameter to pass to the library.
``vavpp``
VA-API video post processing. Works with ``--vo=vaapi`` only. Currently
deinterlaces. This filter is automatically inserted if deinterlacing is
requested (either using the ``D`` key, by default mapped to the command
``cycle deinterlace``, or the ``--deinterlace`` option).
``deint=<method>``
Select the deinterlacing algorithm.
no
Don't perform deinterlacing.
first-field
Show only first field (going by ``--field-dominance``).
bob
bob deinterlacing (default).
+79 -14
View File
@@ -22,12 +22,9 @@ in the list. Suboptions are optional and can mostly be omitted.
Available video output drivers are:
``xv`` (X11 only)
Uses the XVideo extension to enable hardware-accelerated playback. This is
Uses the XVideo extension to enable hardware-accelerated display. This is
the most compatible VO on X, but may be low-quality, and has issues with
OSD and subtitle display.
For information about what colorkey is used and how it is drawn, run
mpv with the ``-v`` option and look out for the lines tagged with ``[xv
common]`` at the beginning.
``adaptor=<number>``
Select a specific XVideo adaptor (check xvinfo results).
@@ -133,6 +130,16 @@ Available video output drivers are:
``output_surfaces=<2-15>``
Allocate this many output surfaces to display video frames (default:
3). See below for additional information.
``colorkey=<#RRGGBB|#AARRGGBB>``
Set the VDPAU presentation queue background color, which in practice
is the colorkey used if VDPAU operates in overlay mode (default:
``#020507``, some shade of black). If the alpha component of this value
is 0, the default VDPAU colorkey will be used instead (which is usually
green).
``force-yuv``
Never accept RGBA input. This means mpv will insert a filter to convert
to a YUV format before the VO. Sometimes useful to force availability
of certain YUV-only features, like video equalizer or deinterlacing.
Using the VDPAU frame queueing functionality controlled by the queuetime
options makes mpv's frame flip timing less sensitive to system CPU load and
@@ -265,7 +272,9 @@ Available video output drivers are:
There are some more filters. For a complete list, pass ``help`` as
value, e.g.: ``mpv --vo=opengl:lscale=help``
value, e.g.::
mpv --vo=opengl:lscale=help
``lparam1=<value>``
Set filter parameters. Ignored if the filter is not tunable. These are
@@ -445,13 +454,20 @@ Available video output drivers are:
Default is 128x256x64.
Sizes must be a power of two, and 256 at most.
``alpha``
Try to create a framebuffer with alpha component. This only makes sense
if the video contains alpha information (which is extremely rare). May
not be supported on all platforms. If alpha framebuffers are
unavailable, it silently falls back on a normal framebuffer. Note
that when using FBO indirections (such as with ``opengl-hq``), an FBO
format with alpha must be specified with the ``fbo-format`` option.
``alpha=<blend|yes|no>``
Decides what to do if the input has an alpha component (default: blend).
blend
Blend the frame against a black background.
yes
Try to create a framebuffer with alpha component. This only makes sense
if the video contains alpha information (which is extremely rare). May
not be supported on all platforms. If alpha framebuffers are
unavailable, it silently falls back on a normal framebuffer. Note
that when using FBO indirections (such as with ``opengl-hq``), an FBO
format with alpha must be specified with the ``fbo-format`` option.
no
Ignore alpha component.
``chroma-location=<auto|center|left>``
Set the YUV chroma sample location. auto means use the bitstream
@@ -609,8 +625,7 @@ Available video output drivers are:
The following options are only useful if writing your own fragment programs.
``customprog=<filename>``
Load a custom fragment program from ``<filename>``. See
``TOOLS/edgedect.fp`` for an example.
Load a custom fragment program from ``<filename>``.
``customtex=<filename>``
Load a custom "gamma ramp" texture from ``<filename>``. This can be used
in combination with ``yuv=4`` or with the ``customprog`` option.
@@ -665,6 +680,46 @@ Available video output drivers are:
``switch-mode``
Instruct SDL to switch the monitor video mode when going fullscreen.
``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
that there is absolutely no reason to use this, other than wanting to use
hardware decoding to save power on laptops, or possibly preventing video
tearing with some setups.
``scaling=<algorithm>``
default
Driver default (mpv default as well).
fast
Fast, but low quality.
hq
Unspecified driver dependent high-quality scaling, slow.
nla
``non-linear anamorphic scaling``
``deint-mode=<mode>``
Select deinterlacing algorithm. Note that by default deinterlacing is
initially always off, and needs to be enabled with the ``D`` key
(default key binding for ``cycle deinterlace``).
This option doesn't apply if libva supports video post processing (vpp).
In this case, the default for ``deint-mode`` is ``no``, and enabling
deinterlacing via user interaction using the methods mentioned above
actually inserts the ``vavpp`` video filter. If vpp is not actually
supported with the libva backend in use, you can use this option to
forcibly enable VO based deinterlacing.
no
Don't allow deinterlacing (default for newer libva).
first-field
Show only first field (going by ``--field-dominance``).
bob
bob deinterlacing (default for older libva).
``scaled-osd=<yes|no>``
If enabled, then the OSD is rendered at video resolution and scaled to
display resolution. By default, this is disabled, and the OSD is
rendered at display resolution if the driver supports it.
``null``
Produces no video output. Useful for benchmarking.
@@ -712,3 +767,13 @@ Available video output drivers are:
JPEG DPI (default: 72)
``outdir=<dirname>``
Specify the directory to save the image files to (default: ``./``).
``wayland`` (Wayland only)
Wayland shared memory video output as fallback for ``opengl``.
``default-format``
Use the default RGB32 format instead of an auto-detected one.
``alpha``
Use a buffer format that supports videos and images with alpha
information
+6
View File
@@ -76,6 +76,12 @@ talloc.h & talloc.c:
replacement. It works on top of system malloc and provides additional
features that are supposed to make memory management easier.
Warning: actually, we're not using talloc anymore. talloc in mpv has been
replaced by a custom re-implementation (TA in ta/). It provides
some talloc emulation (just the parts needed by mpv). We will get
rid of the talloc emulation later and use TA natively.
(See ta/README for details.)
mpvcore/mp_core.h:
Data structures for mplayer.c and command.c. They are usually not accessed
by other parts of mpv for the sake of modularization.
+271 -605
View File
@@ -1,625 +1,284 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Version 2, June 1991
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
13. Use with the GNU Affero General Public License.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
14. Revised Versions of this License.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
NO WARRANTY
15. Disclaimer of Warranty.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
@@ -628,15 +287,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -645,30 +304,37 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+101 -21
View File
@@ -25,6 +25,7 @@ include config.mak
SOURCES_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c
SOURCES_AUDIO_INPUT-$(OSS) += stream/ai_oss.c
SOURCES_AUDIO_INPUT-$(SNDIO) += stream/ai_sndio.c
SOURCES-$(AUDIO_INPUT) += $(SOURCES_AUDIO_INPUT-yes)
SOURCES-$(CDDA) += stream/stream_cdda.c \
stream/cdinfo.c
@@ -44,16 +45,21 @@ SOURCES-$(LIBBS2B) += audio/filter/af_bs2b.c
SOURCES-$(LIBPOSTPROC) += video/filter/vf_pp.c
SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c
SOURCES-$(MACOSX_BUNDLE) += osdep/macosx_bundle.m
SOURCES-$(COCOA) += video/out/cocoa_common.m \
SOURCES-$(COCOA) += video/out/cocoa/view.m \
video/out/cocoa/window.m \
video/out/cocoa/additions.m \
video/out/cocoa_common.m \
osdep/macosx_application.m \
osdep/macosx_events.m \
osdep/ar/HIDRemote.m
osdep/ar/HIDRemote.m \
osdep/path-macosx.m
SOURCES-$(MNG) += demux/demux_mng.c
SOURCES-$(MPG123) += audio/decode/ad_mpg123.c
SOURCES-$(NEED_GETTIMEOFDAY) += osdep/gettimeofday.c
SOURCES-$(NEED_GLOB) += osdep/glob-win.c
SOURCES-$(WIN32) += osdep/path-win.c
SOURCES-$(PRIORITY) += osdep/priority.c
SOURCES-$(PVR) += stream/stream_pvr.c
@@ -106,24 +112,32 @@ SOURCES-$(OSS) += audio/out/ao_oss.c
SOURCES-$(PULSE) += audio/out/ao_pulse.c
SOURCES-$(PORTAUDIO) += audio/out/ao_portaudio.c
SOURCES-$(RSOUND) += audio/out/ao_rsound.c
SOURCES-$(SNDIO) += audio/out/ao_sndio.c
SOURCES-$(VDPAU) += video/vdpau.c video/out/vo_vdpau.c
SOURCES-$(VDA) += video/decode/vda.c
SOURCES-$(VDPAU_DEC) += video/decode/vdpau.c
SOURCES-$(VDPAU_DEC_OLD) += video/decode/vdpau_old.c
SOURCES-$(VAAPI) += video/out/vo_vaapi.c \
video/decode/vaapi.c \
video/vaapi.c
SOURCES-$(VAAPI_VPP) += video/filter/vf_vavpp.c
SOURCES-$(X11) += video/out/vo_x11.c video/out/x11_common.c
SOURCES-$(XV) += video/out/vo_xv.c
SOURCES-$(WAYLAND) += video/out/vo_wayland.c video/out/wayland_common.c
SOURCES-$(VF_LAVFI) += video/filter/vf_lavfi.c
SOURCES-$(AF_LAVFI) += audio/filter/af_lavfi.c
SOURCES-$(LUA) += mpvcore/mp_lua.c
ifeq ($(HAVE_AVUTIL_REFCOUNTING),no)
SOURCES-yes += video/decode/lavc_dr1.c
endif
SOURCES-$(DLOPEN) += video/filter/vf_dlopen.c
SOURCES = talloc.c \
audio/audio.c \
SOURCES = audio/audio.c \
audio/chmap.c \
audio/chmap_sel.c \
audio/fmt-conversion.c \
@@ -167,8 +181,9 @@ SOURCES = talloc.c \
demux/demux_lavf.c \
demux/demux_mf.c \
demux/demux_mkv.c \
demux/demux_subreader.c \
demux/demux_playlist.c \
demux/demux_raw.c \
demux/demux_subreader.c \
demux/ebml.c \
demux/mf.c \
mpvcore/asxparser.c \
@@ -203,6 +218,7 @@ SOURCES = talloc.c \
osdep/numcores.c \
osdep/timer.c \
stream/cookies.c \
stream/rar.c \
stream/stream.c \
stream/stream_avdevice.c \
stream/stream_file.c \
@@ -210,6 +226,7 @@ SOURCES = talloc.c \
stream/stream_memory.c \
stream/stream_mf.c \
stream/stream_null.c \
stream/stream_rar.c \
sub/dec_sub.c \
sub/draw_bmp.c \
sub/find_subfiles.c \
@@ -223,6 +240,9 @@ SOURCES = talloc.c \
sub/sd_srt.c \
sub/spudec.c \
sub/sub.c \
ta/ta.c \
ta/ta_utils.c \
ta/ta_talloc.c \
video/csputils.c \
video/fmt-conversion.c \
video/image_writer.c \
@@ -283,22 +303,29 @@ ALL_TARGETS += mpv$(EXESUF)
INSTALL_BIN += install-mpv
INSTALL_BIN_STRIP += install-mpv-strip
INSTALL_MAN =
INSTALL_PDF =
ifeq ($(BUILD_MAN),yes)
INSTALL_MAN += install-mpv-man
ALL_TARGETS += DOCS/man/en/mpv.1
endif
ifeq ($(BUILD_PDF),yes)
INSTALL_PDF += install-mpv-pdf
ALL_TARGETS += DOCS/man/en/mpv.pdf
endif
DIRS = . \
audio \
audio/decode \
audio/filter \
audio/out \
core \
mpvcore \
mpvcore/input \
mpvcore/timeline \
demux \
osdep \
osdep/ar \
stream \
sub \
video \
@@ -322,6 +349,12 @@ endif
all: $(ALL_TARGETS)
%.tex: %.rst
$(RST2LATEX) --config=DOCS/man/docutils.conf $< $@
%.pdf: %.tex
pdflatex -interaction=batchmode -jobname=$(basename $@) $<; pdflatex -interaction=batchmode -jobname=$(basename $@) $<
%.1: %.rst
$(RST2MAN) $< $@
@@ -366,10 +399,26 @@ video/out/gl_video.c: video/out/gl_video_shaders.h
video/out/gl_video_shaders.h: TOOLS/file2string.pl video/out/gl_video_shaders.glsl
./$^ >$@
video/out/x11_common.c: video/out/x11_icon.inc
video/out/x11_icon.inc: TOOLS/file2string.pl video/out/x11_icon.bin
./$^ >$@
sub/osd_libass.c: sub/osd_font.h
sub/osd_font.h: TOOLS/file2string.pl sub/osd_font.otf
./$^ >$@
mpvcore/mp_lua.c: mpvcore/lua/defaults.inc
mpvcore/lua/defaults.inc: TOOLS/file2string.pl mpvcore/lua/defaults.lua
./$^ >$@
mpvcore/mp_lua.c: mpvcore/lua/assdraw.inc
mpvcore/lua/assdraw.inc: TOOLS/file2string.pl mpvcore/lua/assdraw.lua
./$^ >$@
mpvcore/mp_lua.c: mpvcore/lua/osc.inc
mpvcore/lua/osc.inc: TOOLS/file2string.pl mpvcore/lua/osc.lua
./$^ >$@
# ./configure must be rerun if it changed
config.mak: configure
@echo "############################################################"
@@ -392,22 +441,21 @@ mpvcore/version.c osdep/mpv-rc.o: version.h
osdep/mpv-rc.o: osdep/mpv.exe.manifest etc/mpv-icon.ico
DOCS/man/en/mpv.1: DOCS/man/en/af.rst \
DOCS/man/en/ao.rst \
DOCS/man/en/changes.rst \
DOCS/man/en/encode.rst \
DOCS/man/en/input.rst \
DOCS/man/en/options.rst \
DOCS/man/en/vf.rst \
DOCS/man/en/vo.rst
DOCS/man/en/mpv.1 DOCS/man/en/mpv.pdf: DOCS/man/en/af.rst \
DOCS/man/en/ao.rst \
DOCS/man/en/changes.rst \
DOCS/man/en/encode.rst \
DOCS/man/en/input.rst \
DOCS/man/en/options.rst \
DOCS/man/en/vf.rst \
DOCS/man/en/vo.rst
###### installation / clean / generic rules #######
install: $(INSTALL_BIN) $(INSTALL_MAN)
install-no-man: $(INSTALL_BIN)
install-strip: $(INSTALL_BIN_STRIP) $(INSTALL_MAN)
install-strip-no-man: $(INSTALL_BIN_STRIP)
install: $(INSTALL_BIN) install-data $(INSTALL_MAN) $(INSTALL_PDF)
install-no-man: $(INSTALL_BIN) install-data
install-strip: $(INSTALL_BIN_STRIP) install-data $(INSTALL_MAN) $(INSTALL_PDF)
install-strip-no-man: $(INSTALL_BIN_STRIP) install-data
install-dirs:
if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
@@ -424,22 +472,54 @@ install-mpv-man-en: DOCS/man/en/mpv.1
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/
install-mpv-pdf: install-mpv-pdf-en
install-mpv-pdf-en: DOCS/man/en/mpv.pdf
if test ! -d $(DOCDIR) ; then $(INSTALL) -d $(DOCDIR) ; fi
$(INSTALL) -m 644 DOCS/man/en/mpv.pdf $(DOCDIR)/
ICONSIZES = 16x16 32x32 64x64
define ICON_INSTALL_RULE
install-mpv-icon-$(size): etc/mpv-icon-8bit-$(size).png
$(INSTALL) -d $(prefix)/share/icons/hicolor/$(size)/apps
$(INSTALL) -m 644 etc/mpv-icon-8bit-$(size).png $(prefix)/share/icons/hicolor/$(size)/apps/mpv.png
endef
$(foreach size,$(ICONSIZES),$(eval $(ICON_INSTALL_RULE)))
install-mpv-icons: $(foreach size,$(ICONSIZES),install-mpv-icon-$(size))
install-mpv-desktop: etc/mpv.desktop
$(INSTALL) -d $(prefix)/share/applications
$(INSTALL) -m 644 etc/mpv.desktop $(prefix)/share/applications/
install-data: install-mpv-icons install-mpv-desktop
uninstall:
$(RM) $(BINDIR)/mpv$(EXESUF)
$(RM) $(MANDIR)/man1/mpv.1
$(RM) $(MANDIR)/en/man1/mpv.1
$(RM) $(DOCDIR)/mpv.pdf
$(RM) $(prefix)/share/applications/mpv.desktop
$(RM) $(foreach size,$(ICONSIZES),$(prefix)/share/icons/hicolor/$(size)/apps/mpv.png)
clean:
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_EXESUFS,mpv)
-$(RM) DOCS/man/en/mpv.1
-$(RM) $(call ADDSUFFIXES,.pdf .tex .log .aux .out .toc,DOCS/man/*/mpv)
-$(RM) DOCS/man/*/mpv.1
-$(RM) version.h
-$(RM) mpvcore/input/input_conf.h
-$(RM) video/out/vdpau_template.c
-$(RM) demux/ebml_types.h demux/ebml_defs.c
-$(RM) video/out/gl_video_shaders.h
-$(RM) video/out/x11_icon.inc
-$(RM) sub/osd_font.h
-$(RM) mpvcore/lua/defaults.inc
-$(RM) mpvcore/lua/assdraw.inc
-$(RM) mpvcore/lua/osc.inc
distclean: clean
-$(RM) config.log config.mak config.h TAGS tags
+22 -6
View File
@@ -47,22 +47,26 @@ If you are running Mac OSX and using homebrew we provide [homebrew-mpv][homebrew
to date formula that compiles mpv with sensible dependencies and defaults for
OSX.
configure --enable-* parameters
-------------------------------
### configure `--enable-*` parameters
The --enable-* parameters unconditionally force options on, completely
The `--enable-*` parameters unconditionally force options on, completely
skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
If you used one of these options and experience a compilation or
linking failure, make sure you have passed the necessary compiler/linker flags
to configure.
mpv's configure script is greedy and automatically enables features as a result
of autodetection. The cases where you may want to use `--enable-*` are very
limited.
Bug reports
-----------
Please use the [issue tracker][issue tracker] provided by GitHub to send us bug
Please use the [issue tracker][issue-tracker] provided by GitHub to send us bug
reports or feature requests.
Contributing
@@ -75,9 +79,21 @@ make code review easier for both parties later on.
Contacts
--------
You can find us on IRC in `#mpv-player` on `irc.freenode.net`
These forms of contact are meant to ask questions about mpv usage, give
feedback on mpv and discuss it's development.
If possible, please avoid posting bugs here and use the [issue tracker][issue-tracker]
instead.
- **Users IRC Channel**: `#mpv-player` on `irc.freenode.net`
- **Users Mailing List**: `mpv-users@googlegroups.com` ([Archive / Subscribe][mpv-users]).
- **Devel Mailing List**: `mpv-devel@googlegroups.com` ([Archive / Subscribe][mpv-devel])
To contact the `mpv` team in private write to `mpv-team@googlegroups.com`.
[changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/man/en/changes.rst
[mpv-build]: https://github.com/mpv-player/mpv-build
[homebrew-mpv]: https://github.com/mpv-player/homebrew-mpv
[issue tracker]: https://github.com/mpv-player/mpv/issues
[issue-tracker]: https://github.com/mpv-player/mpv/issues
[mpv-users]: https://groups.google.com/forum/?hl=en#!forum/mpv-users
[mpv-devel]: https://groups.google.com/forum/?hl=en#!forum/mpv-devel
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
# This script is expected to be called as TOOLS/gen-x11-icon.sh (it will access
# etc/mpv-icon...), and it will write video/out/x11_icon.bin.
conv() {
echo
identify -format "icon: %w %h" $1
convert $1 -depth 8 rgba:-
}
(echo "# File generated by gen-x11-icon.sh" ;
conv etc/mpv-icon-8bit-16x16.png ;
conv etc/mpv-icon-8bit-32x32.png ;
conv etc/mpv-icon-8bit-64x64.png) | gzip -c > video/out/x11_icon.bin
+19 -33
View File
@@ -35,7 +35,7 @@
<string>wma</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>audio.icns</string>
<string>document.icns</string>
<key>CFBundleTypeName</key>
<string>Audio file</string>
<key>CFBundleTypeRole</key>
@@ -86,6 +86,7 @@
<string>VCD</string>
<string>VFW</string>
<string>VOB</string>
<string>WEBM</string>
<string>WMV</string>
<string>asf</string>
<string>avi</string>
@@ -119,10 +120,11 @@
<string>vcd</string>
<string>vfw</string>
<string>vob</string>
<string>webm</string>
<string>wmv</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>movie.icns</string>
<string>document.icns</string>
<key>CFBundleTypeName</key>
<string>Movie file</string>
<key>CFBundleTypeRole</key>
@@ -157,7 +159,7 @@
<string>utf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>subtitles.icns</string>
<string>document.icns</string>
<key>CFBundleTypeName</key>
<string>Subtitles file</string>
<key>CFBundleTypeRole</key>
@@ -190,57 +192,41 @@
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>Real Time (Streaming) Protocol</string>
<string>mpv Custom Protocol</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rtp</string>
<string>rtsp</string>
<string>mpv</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>File over HTTP/FTP/UDP</string>
<key>CFBundleURLSchemes</key>
<array>
<string>icyx</string>
<string>udp</string>
<string>ftp</string>
<string>http_proxy</string>
<string>http</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>Microsoft Media Services</string>
<string>Streaming Protocol</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mms</string>
<string>mmst</string>
<string>http</string>
<string>httpproxy</string>
<string>rtp</string>
<string>rtsp</string>
<string>ftp</string>
<string>udp</string>
<string>smb</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>Cuesheet</string>
<string>CD/DVD/Bluray Media</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cue</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>CD/DVD Media</string>
<key>CFBundleURLSchemes</key>
<array>
<string>dvdnav</string>
<string>cdda</string>
<string>dvd</string>
<string>vcd</string>
<string>bd</string>
</array>
</dict>
</array>
Binary file not shown.
-64
View File
@@ -1,64 +0,0 @@
#!/bin/sh
set -e
if [ $# -ne 2 ]; then
echo >&2 "Usage: $0 input.svg output.ico"
exit 1
fi
# For smooth rendering on high-DPI displays, the standard three app icon sizes
# (16x16, 32x32 and 48x48) have to be scaled to the four Windows DPI settings
# as in the table below:
# Small Regular Tiles
# 96 DPI (100%) 16x16 32x32 48x48
# 120 DPI (125%) 20x20 40x40 60x60
# 144 DPI (150%) 24x24 48x48 72x72
# 196 DPI (200%) 32x32 64x64 96x96
# Also, there should also be an extra large 256x256 icon and some low colour
# 8-bit and 4-bit variants, which are still used in Remote Desktop.
# Note: Windows Vista has a bug in its icon scaling that makes no sense.
# Instead of following the DPI setting, small icons are always a bit larger
# than they should be at 22x22, 26x26 and 36x36 for 120, 144 and 196 DPI. This
# script doesn't generate icons with those sizes, since computers with Vista
# and a high-DPI display are probably fairly rare these days.
temppng=".$(basename "$1" .svg)-temp.png"
inkscape --without-gui --export-png="$temppng" --export-dpi=72 \
--export-background-opacity=0 --export-width=512 --export-height=512 \
"$1" >/dev/null 2>&1
# Old versions of ImageMagick (like the one in Cygwin) use the wrong gamma when
# exporting icon files. To fix, add -gamma 2.2 after the input file.
convert png:"$temppng" -filter lanczos2 \
\( -clone 0 -resize 96x96 \) \
\( -clone 0 -resize 72x72 \) \
\( -clone 0 -resize 64x64 \) \
\( -clone 0 -resize 60x60 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 40x40 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 24x24 \) \
\( -clone 0 -resize 20x20 \) \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 256x256 \) \
\( -clone 0 -resize 32x32 \( -clone 0 -alpha opaque -colors 255 \) \
\( -clone 0 -channel A -threshold 50% \) \
-delete 0 -compose CopyOpacity -composite -colors 256 \) \
\( -clone 0 -resize 16x16 \( -clone 0 -alpha opaque -colors 255 \) \
\( -clone 0 -channel A -threshold 50% \) \
-delete 0 -compose CopyOpacity -composite -colors 256 \) \
\( -clone 0 -resize 32x32 \( -clone 0 -alpha opaque -colors 15 \) \
\( -clone 0 -channel A -threshold 50% \) \
-delete 0 -compose CopyOpacity -composite -colors 16 \) \
\( -clone 0 -resize 16x16 \( -clone 0 -alpha opaque -colors 15 \) \
\( -clone 0 -channel A -threshold 50% \) \
-delete 0 -compose CopyOpacity -composite -colors 16 \) \
-delete 0 \
-define png:compression-level=9 -define png:include-chunk=none ico:"$2"
rm "$temppng"
+1 -1
View File
@@ -1 +1 @@
0.1.1
0.2.1
+3 -1
View File
@@ -39,6 +39,8 @@ struct ad_functions {
int maxlen);
};
#define ADCTRL_RESYNC_STREAM 1 // resync, called after seeking
enum ad_ctrl {
ADCTRL_RESYNC_STREAM = 1, // resync, called after seeking
};
#endif /* MPLAYER_AD_H */
+4 -2
View File
@@ -389,13 +389,15 @@ static int decode_new_packet(struct sh_audio *sh)
}
int got_frame = 0;
int ret = avcodec_decode_audio4(avctx, priv->avframe, &got_frame, &pkt);
if (ret > 0) {
// At least "shorten" decodes sub-frames, instead of the whole packet.
// At least "mpc8" can return 0 and wants the packet again next time.
if (ret >= 0) {
ret = FFMIN(ret, mpkt->len); // sanity check against decoder overreads
mpkt->buffer += ret;
mpkt->len -= ret;
mpkt->pts = MP_NOPTS_VALUE; // don't reset PTS next time
}
if (mpkt->len == 0 || ret <= 0) {
if (mpkt->len == 0 || ret < 0) {
talloc_free(mpkt);
priv->packet = NULL;
}
+88 -61
View File
@@ -1,7 +1,7 @@
/*
* MPEG 1.0/2.0/2.5 audio layer I, II, III decoding with libmpg123
*
* Copyright (C) 2010-2012 Thomas Orgis <thomas@orgis.org>
* Copyright (C) 2010-2013 Thomas Orgis <thomas@orgis.org>
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@
struct ad_mpg123_context {
mpg123_handle *handle;
char new_format;
#ifdef AD_MPG123_MEAN_BITRATE
/* Running mean for bit rate, stream length estimation. */
float mean_rate;
@@ -95,7 +96,9 @@ static int preinit(sh_audio_t *sh)
* Let's try to run with the default for now. */
/* That would produce floating point output.
* You can get 32 and 24 bit ints, even 8 bit via format matrix. */
* You can get 32 and 24 bit ints, even 8 bit via format matrix.
* If wanting a specific encoding here, configure format matrix and
* make sure it is in set_format(). */
/* mpg123_param(con->handle, MPG123_ADD_FLAGS, MPG123_FORCE_FLOAT, 0.); */
/* Example for RVA choice (available since libmpg123 1.0.0):
@@ -184,6 +187,59 @@ static void print_header_compact(struct mpg123_frameinfo *i)
smodes[i->mode]);
}
/* libmpg123 has a new format ready; query and store, return return value
of mpg123_getformat() */
static int set_format(sh_audio_t *sh, struct ad_mpg123_context *con)
{
int ret;
long rate;
int channels;
int encoding;
ret = mpg123_getformat(con->handle, &rate, &channels, &encoding);
if(ret == MPG123_OK) {
mp_chmap_from_channels(&sh->channels, channels);
sh->samplerate = rate;
/* Without external force, mpg123 will always choose signed encoding,
* and non-16-bit only on builds that don't support it.
* Be reminded that it doesn't matter to the MPEG file what encoding
* is produced from it. */
switch (encoding) {
case MPG123_ENC_SIGNED_8:
sh->sample_format = AF_FORMAT_S8;
sh->samplesize = 1;
break;
case MPG123_ENC_SIGNED_16:
sh->sample_format = AF_FORMAT_S16_NE;
sh->samplesize = 2;
break;
/* To stay compatible with the oldest libmpg123 headers, do not rely
* on float and 32 bit encoding symbols being defined.
* Those formats came later */
case 0x1180: /* MPG123_ENC_SIGNED_32 */
sh->sample_format = AF_FORMAT_S32_NE;
sh->samplesize = 4;
break;
case 0x200: /* MPG123_ENC_FLOAT_32 */
sh->sample_format = AF_FORMAT_FLOAT_NE;
sh->samplesize = 4;
break;
default:
/* This means we got a funny custom build of libmpg123 that only supports an unknown format. */
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"Bad encoding from mpg123: %i.\n", encoding);
return MPG123_ERR;
}
#ifdef AD_MPG123_FRAMEWISE
/* Going to decode directly to MPlayer's memory. It is important
* to have MPG123_AUTO_RESAMPLE disabled for the buffer size
* being an all-time limit. */
sh->audio_out_minsize = 1152 * 2 * sh->samplesize;
#endif
con->new_format = 0;
}
return ret;
}
/* This tries to extract a requested amount of decoded data.
* Even when you request 0 bytes, it will feed enough input so that
* the decoder _could_ have delivered something.
@@ -213,6 +269,9 @@ static int decode_a_bit(sh_audio_t *sh, unsigned char *buf, int count)
* This will be handled in init(). */
do {
size_t got_now = 0;
/* Fetch new format now, after old data has been used. */
if(con->new_format)
ret = set_format(sh, con);
/* Feed the decoder. This will only fire from the second round on. */
if (ret == MPG123_NEED_MORE) {
@@ -237,6 +296,15 @@ static int decode_a_bit(sh_audio_t *sh, unsigned char *buf, int count)
talloc_free(pkt);
if (ret == MPG123_ERR)
break;
/* Indication of format change is possible here (from mpg123_decode()). */
if(ret == MPG123_NEW_FORMAT) {
con->new_format = 1;
if(got)
break; /* Do not switch format during a chunk. */
ret = set_format(sh, con);
}
}
/* Theoretically, mpg123 could return MPG123_DONE, so be prepared.
* Should not happen in our usage, but it is a valid return code. */
@@ -247,7 +315,7 @@ static int decode_a_bit(sh_audio_t *sh, unsigned char *buf, int count)
* for the loop condition. */
#ifdef AD_MPG123_FRAMEWISE
if (!buf) { /* fake call just for feeding to get format */
ret = mpg123_getformat(con->handle, NULL, NULL, NULL);
ret = set_format(sh, con);
} else { /* This is the decoding. One frame at a time. */
ret = mpg123_replace_buffer(con->handle, buf, count);
if (ret == MPG123_OK)
@@ -261,6 +329,15 @@ static int decode_a_bit(sh_audio_t *sh, unsigned char *buf, int count)
got += got_now;
sh->pts_bytes += got_now;
/* Indication of format change should happen here. */
if(ret == MPG123_NEW_FORMAT) {
con->new_format = 1;
if(got)
break; /* Do not switch format during a chunk. */
ret = set_format(sh, con);
}
#ifdef AD_MPG123_FRAMEWISE
} while (ret == MPG123_NEED_MORE || (got == 0 && count != 0));
#else
@@ -270,8 +347,6 @@ static int decode_a_bit(sh_audio_t *sh, unsigned char *buf, int count)
if (ret == MPG123_ERR) {
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 decoding failed: %s\n",
mpg123_strerror(con->handle));
mpg123_close(con->handle);
return -1;
}
return got;
@@ -290,39 +365,29 @@ static int reopen_stream(sh_audio_t *sh)
/* Open and make sure we have fed enough data to get stream properties. */
if (MPG123_OK == mpg123_open_feed(con->handle) &&
/* Feed data until mpg123 is ready (has found stream beginning). */
!decode_a_bit(sh, NULL, 0)) {
!decode_a_bit(sh, NULL, 0) &&
set_format(sh, con) == MPG123_OK) { /* format setting again just for return value */
return 1;
} else {
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"mpg123 failed to reopen stream: %s\n",
mpg123_strerror(con->handle));
mpg123_close(con->handle);
return 0;
}
}
/* Now we really start accessing some data and determining file format.
* Paranoia note: The mpg123_close() on errors is not really necessary,
* But it ensures that we don't accidentally continue decoding with a
* bad state (possibly interpreting the format badly or whatnot). */
* Format now is allowed to change on-the-fly. Here is the only point
* that has MPlayer react to errors. We have to pray that exceptional
* erros in other places simply cannot occur. */
static int init(sh_audio_t *sh, const char *decoder)
{
long rate = 0;
int channels = 0;
int encoding = 0;
mpg123_id3v2 *v2;
struct mpg123_frameinfo finfo;
struct ad_mpg123_context *con = sh->context;
/* We're open about any output format that libmpg123 will suggest.
* Note that a standard build will always default to 16 bit signed and
* the native sample rate of the file. */
if (MPG123_OK == mpg123_format_all(con->handle) &&
reopen_stream(sh) &&
MPG123_OK == mpg123_getformat(con->handle, &rate, &channels, &encoding) &&
/* Forbid the format to change later on. */
MPG123_OK == mpg123_format_none(con->handle) &&
MPG123_OK == mpg123_format(con->handle, rate, channels, encoding) &&
con->new_format = 0;
if (reopen_stream(sh) &&
/* Get MPEG header info. */
MPG123_OK == mpg123_info(con->handle, &finfo) &&
/* Since we queried format, mpg123 should have read past ID3v2 tags.
@@ -344,50 +409,11 @@ static int init(sh_audio_t *sh, const char *decoder)
con->mean_count = 0;
#endif
con->vbr = (finfo.vbr != MPG123_CBR);
mp_chmap_from_channels(&sh->channels, channels);
sh->samplerate = rate;
/* Without external force, mpg123 will always choose signed encoding,
* and non-16-bit only on builds that don't support it.
* Be reminded that it doesn't matter to the MPEG file what encoding
* is produced from it. */
switch (encoding) {
case MPG123_ENC_SIGNED_8:
sh->sample_format = AF_FORMAT_S8;
sh->samplesize = 1;
break;
case MPG123_ENC_SIGNED_16:
sh->sample_format = AF_FORMAT_S16_NE;
sh->samplesize = 2;
break;
/* To stay compatible with the oldest libmpg123 headers, do not rely
* on float and 32 bit encoding symbols being defined.
* Those formats came later */
case 0x1180: /* MPG123_ENC_SIGNED_32 */
sh->sample_format = AF_FORMAT_S32_NE;
sh->samplesize = 4;
break;
case 0x200: /* MPG123_ENC_FLOAT_32 */
sh->sample_format = AF_FORMAT_FLOAT_NE;
sh->samplesize = 4;
break;
default:
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"Bad encoding from mpg123: %i.\n", encoding);
mpg123_close(con->handle);
return 0;
}
#ifdef AD_MPG123_FRAMEWISE
/* Going to decode directly to MPlayer's memory. It is important
* to have MPG123_AUTO_RESAMPLE disabled for the buffer size
* being an all-time limit. */
sh->audio_out_minsize = 1152 * 2 * sh->samplesize;
#endif
return 1;
} else {
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 init error: %s\n",
mpg123_strerror(con->handle));
mpg123_close(con->handle);
return 0;
}
}
@@ -432,6 +458,7 @@ static int decode_audio(sh_audio_t *sh, unsigned char *buf, int minlen,
int bytes;
bytes = decode_a_bit(sh, buf, maxlen);
/* This EOF is ignored, apparently, until input data is exhausted. */
if (bytes == 0)
return -1; /* EOF */
+12 -29
View File
@@ -437,8 +437,6 @@ static int af_fix_rate(struct af_stream *s, struct af_instance **p_af,
// state (for example, format filters that were tentatively inserted stay
// inserted).
// In that case, you should always rebuild the filter chain, or abort.
// Also, note that for complete reinit, fixup_output_format() may have to be
// called after this function.
static int af_reinit(struct af_stream *s)
{
// Start with the second filter, as the first filter is the special input
@@ -496,7 +494,12 @@ static int af_reinit(struct af_stream *s)
af_print_filter_chain(s, NULL, MSGL_V);
return AF_OK;
/* Set previously unset fields in s->output to those of the filter chain
* output. This is used to make the output format fixed, and even if you
* insert new filters or change the input format, the output format won't
* change. (Audio outputs generally can't change format at runtime.) */
af_copy_unset_fields(&s->output, &s->filter_output);
return af_config_equals(&s->output, &s->filter_output) ? AF_OK : AF_ERROR;
negotiate_error:
mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to correct audio format. "
@@ -547,21 +550,6 @@ void af_destroy(struct af_stream *s)
talloc_free(s);
}
/*
* Set previously unset fields in s->output to those of the filter chain
* output. This is used to make the output format fixed, and even if you insert
* new filters or change the input format, the output format won't change.
* \return AF_ERROR on error, AF_OK if successful.
*/
static int fixup_output_format(struct af_stream *s)
{
if (AF_OK != af_reinit(s))
return AF_ERROR;
af_copy_unset_fields(&s->output, &s->filter_output);
return af_config_equals(&s->output, &s->filter_output) ? AF_OK : AF_ERROR;
}
/* Initialize the stream "s". This function creates a new filter list
if necessary according to the values set in input and output. Input
and output should contain the format of the current movie and the
@@ -586,23 +574,18 @@ int af_init(struct af_stream *s)
// Add all filters in the list (if there are any)
struct m_obj_settings *list = s->opts->af_settings;
for (int i = 0; list && list[i].name; i++) {
if (!af_prepend(s, s->last, list[i].name, list[i].attribs))
if (!af_prepend(s, s->last, list[i].name, list[i].attribs)) {
af_uninit(s);
return -1;
}
}
}
remove_auto_inserted_filters(s);
// Init filters
if (AF_OK != af_reinit(s))
return -1;
if (AF_OK != fixup_output_format(s)) {
if (af_reinit(s) != AF_OK) {
// Something is stuffed audio out will not work
mp_msg(
MSGT_AFILTER, MSGL_ERR,
"[libaf] Unable to setup filter system can not"
" meet sound-card demands, please send a bug report. \n");
mp_msg(MSGT_AFILTER, MSGL_ERR, "Could not create audio filter chain.\n");
af_uninit(s);
return -1;
}
@@ -628,7 +611,7 @@ struct af_instance *af_add(struct af_stream *s, char *name, char **args)
return NULL;
// Reinitalize the filter list
if (af_reinit(s) != AF_OK || fixup_output_format(s) != AF_OK) {
if (af_reinit(s) != AF_OK) {
af_uninit(s);
af_init(s);
return NULL;
+5
View File
@@ -99,6 +99,11 @@ static int control(struct af_instance* af, int cmd, void* arg)
for(i = 1; i < af->data->nch; i++)
s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
if (!s->filename) {
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] No filename set.\n");
return AF_ERROR;
}
// Init memory mapping
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
+1 -1
View File
@@ -150,7 +150,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
}
case AF_CONTROL_COMMAND_LINE:{
int format = af_str2fmt_short(bstr0(arg));
if (format == -1) {
if (!format) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] %s is not a valid format\n", (char *)arg);
return AF_ERROR;
}
+3
View File
@@ -41,6 +41,7 @@
#define avresample_alloc_context swr_alloc
#define avresample_open swr_init
#define avresample_close(x) do { } while(0)
#define avresample_free swr_free
#define avresample_available(x) 0
#define avresample_convert(ctx, out, out_planesize, out_samples, in, in_planesize, in_samples) \
swr_convert(ctx, out, out_samples, (const uint8_t**)(in), in_samples)
@@ -275,8 +276,10 @@ static void uninit(struct af_instance *af)
struct af_resample *s = af->priv;
if (s->avrctx)
avresample_close(s->avrctx);
avresample_free(&s->avrctx);
if (s->avrctx_out)
avresample_close(s->avrctx_out);
avresample_free(&s->avrctx_out);
}
static bool needs_reorder(int *reorder, int num_ch)
+9 -4
View File
@@ -81,17 +81,22 @@ static int control(struct af_instance* af, int cmd, void* arg)
}
return af_test_output(af,(struct mp_audio*)arg);
case AF_CONTROL_COMMAND_LINE:{
float v=0.0;
float v=1000.0;
float vol[AF_NCH];
int i;
sscanf((char*)arg,"%f:%i:%i", &v, &s->soft, &s->fast);
for(i=0;i<AF_NCH;i++) vol[i]=v;
float dest = 0.0;
if (v < 1000)
af_from_dB(1,&v,&dest,20.0,-200.0,60.0);
for(i=0;i<AF_NCH;i++) vol[i]=dest;
return control(af,AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, vol);
}
case AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET:
return af_from_dB(AF_NCH,(float*)arg,s->level,20.0,-200.0,60.0);
memcpy(s->level, arg, sizeof(float) * AF_NCH);
return AF_OK;
case AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET:
return af_to_dB(AF_NCH,s->level,(float*)arg,20.0);
memcpy(arg, s->level, sizeof(float) * AF_NCH);
return AF_OK;
case AF_CONTROL_PRE_DESTROY:{
float m = 0.0;
int i;
+2 -18
View File
@@ -47,11 +47,7 @@ int af_fmt2bits(int format)
char* af_fmt2str(int format, char* str, int size)
{
const char *name = af_fmt2str_short(format);
if (name) {
snprintf(str, size, "%s", name);
} else {
snprintf(str, size, "%#x", format);
}
snprintf(str, size, "%s", name);
return str;
}
@@ -105,11 +101,6 @@ const char *af_fmt2str_short(int format)
return "??";
}
static bool af_fmt_valid(int format)
{
return (format & AF_FORMAT_MASK) == format;
}
int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int samplerate)
{
int bps = (af_fmt2bits(format) / 8);
@@ -122,16 +113,9 @@ int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int sampler
int af_str2fmt_short(bstr str)
{
if (bstr_startswith0(str, "0x")) {
bstr rest;
int fmt = bstrtoll(str, &rest, 16);
if (rest.len == 0 && af_fmt_valid(fmt))
return fmt;
}
for (int i = 0; af_fmtstr_table[i].name; i++)
if (!bstrcasecmp0(str, af_fmtstr_table[i].name))
return af_fmtstr_table[i].format;
return -1;
return 0;
}
+7 -7
View File
@@ -43,11 +43,6 @@
#define AF_FORMAT_US (1<<1) // Unsigned
#define AF_FORMAT_SIGN_MASK (1<<1)
// Fixed or floating point
#define AF_FORMAT_I (0<<2) // Int
#define AF_FORMAT_F (1<<2) // Foating point
#define AF_FORMAT_POINT_MASK (1<<2)
// Bits used
#define AF_FORMAT_8BIT (0<<3)
#define AF_FORMAT_16BIT (1<<3)
@@ -62,7 +57,12 @@
#define AF_FORMAT_IEC61937 (6<<6)
#define AF_FORMAT_SPECIAL_MASK (7<<6)
#define AF_FORMAT_MASK ((1<<9)-1)
// Fixed or floating point
#define AF_FORMAT_I (1<<9) // Int
#define AF_FORMAT_F (2<<9) // Foating point
#define AF_FORMAT_POINT_MASK (3<<9)
#define AF_FORMAT_MASK ((1<<11)-1)
// PREDEFINED formats
@@ -117,7 +117,7 @@
#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_LE
#endif
#define AF_FORMAT_UNKNOWN (-1)
#define AF_FORMAT_UNKNOWN 0
#define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)
#define AF_FORMAT_IS_IEC61937(fmt) (AF_FORMAT_IS_AC3(fmt) || ((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_IEC61937)
+209 -106
View File
@@ -17,6 +17,7 @@
*/
#include <string.h>
#include <stdio.h>
#include <libavutil/common.h>
@@ -24,38 +25,66 @@
#include "audio/out/ao.h"
#include "audio/filter/af.h"
#include "mpvcore/mp_msg.h"
#include "talloc.h"
#include "mixer.h"
struct mixer {
struct MPOpts *opts;
struct ao *ao;
struct af_stream *af;
// Static, dependent on ao/softvol settings
bool softvol; // use AO (true) or af_volume (false)
bool emulate_mute; // if true, emulate mute with volume=0
// Last known values (possibly out of sync with reality)
float vol_l, vol_r;
bool muted;
// Used to decide whether we should unmute on uninit
bool muted_by_us;
/* Contains ao driver name or "softvol" if volume is not persistent
* and needs to be restored after the driver is reinitialized. */
const char *driver;
// Other stuff
float balance;
};
struct mixer *mixer_init(void *talloc_ctx, struct MPOpts *opts)
{
struct mixer *mixer = talloc_ptrtype(talloc_ctx, mixer);
*mixer = (struct mixer) {
.opts = opts,
.vol_l = 100,
.vol_r = 100,
.driver = "",
};
return mixer;
}
bool mixer_audio_initialized(struct mixer *mixer)
{
return !!mixer->ao;
}
static void checkvolume(struct mixer *mixer)
{
if (!mixer->ao)
return;
if (mixer->softvol == SOFTVOL_AUTO) {
mixer->softvol = mixer->ao->per_application_mixer
|| mixer->ao->no_persistent_volume
? SOFTVOL_NO : SOFTVOL_YES;
}
ao_control_vol_t vol;
if (mixer->softvol || CONTROL_OK != ao_control(mixer->ao,
AOCONTROL_GET_VOLUME, &vol)) {
mixer->softvol = SOFTVOL_YES;
if (!mixer->afilter)
return;
float db_vals[AF_NCH];
if (!af_control_any_rev(mixer->afilter,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET, db_vals))
db_vals[0] = db_vals[1] = 1.0;
else
af_from_dB(2, db_vals, db_vals, 20.0, -200.0, 60.0);
vol.left = (db_vals[0] / (mixer->softvol_max / 100.0)) * 100.0;
vol.right = (db_vals[1] / (mixer->softvol_max / 100.0)) * 100.0;
ao_control_vol_t vol = {mixer->vol_l, mixer->vol_r};
if (mixer->softvol) {
float vals[AF_NCH];
if (!af_control_any_rev(mixer->af,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET, vals))
vals[0] = vals[1] = 1.0;
vol.left = (vals[0] / (mixer->opts->softvol_max / 100.0)) * 100.0;
vol.right = (vals[1] / (mixer->opts->softvol_max / 100.0)) * 100.0;
} else {
// Rely on the values not changing if the query is not supported
ao_control(mixer->ao, AOCONTROL_GET_VOLUME, &vol);
ao_control(mixer->ao, AOCONTROL_GET_MUTE, &mixer->muted);
}
float l = mixer->vol_l;
float r = mixer->vol_r;
if (mixer->muted_using_volume)
if (mixer->emulate_mute && mixer->muted)
l = r = 0;
/* Try to detect cases where the volume has been changed by some external
* action (such as something else changing a shared system-wide volume).
@@ -67,73 +96,59 @@ static void checkvolume(struct mixer *mixer)
if (FFABS(vol.left - l) >= 3 || FFABS(vol.right - r) >= 3) {
mixer->vol_l = vol.left;
mixer->vol_r = vol.right;
if (mixer->muted_using_volume)
if (mixer->emulate_mute)
mixer->muted = false;
}
if (!mixer->softvol)
// Rely on the value not changing if the query is not supported
ao_control(mixer->ao, AOCONTROL_GET_MUTE, &mixer->muted);
mixer->muted_by_us &= mixer->muted;
mixer->muted_using_volume &= mixer->muted;
}
void mixer_getvolume(mixer_t *mixer, float *l, float *r)
void mixer_getvolume(struct mixer *mixer, float *l, float *r)
{
checkvolume(mixer);
*l = mixer->vol_l;
*r = mixer->vol_r;
}
static void setvolume_internal(mixer_t *mixer, float l, float r)
static void setvolume_internal(struct mixer *mixer, float l, float r)
{
struct ao_control_vol vol = {.left = l, .right = r};
if (!mixer->softvol) {
// relies on the driver data being permanent (so ptr stays valid)
mixer->restore_volume = mixer->ao->no_persistent_volume ?
mixer->ao->driver->info->short_name : NULL;
if (ao_control(mixer->ao, AOCONTROL_SET_VOLUME, &vol) != CONTROL_OK)
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
"[Mixer] Failed to change audio output volume.\n");
return;
}
mixer->restore_volume = "softvol";
if (!mixer->afilter)
return;
// af_volume uses values in dB
float db_vals[AF_NCH];
int i;
db_vals[0] = (l / 100.0) * (mixer->softvol_max / 100.0);
db_vals[1] = (r / 100.0) * (mixer->softvol_max / 100.0);
for (i = 2; i < AF_NCH; i++)
db_vals[i] = ((l + r) / 100.0) * (mixer->softvol_max / 100.0) / 2.0;
af_to_dB(AF_NCH, db_vals, db_vals, 20.0);
if (!af_control_any_rev(mixer->afilter,
float vals[AF_NCH];
vals[0] = l / 100.0 * mixer->opts->softvol_max / 100.0;
vals[1] = r / 100.0 * mixer->opts->softvol_max / 100.0;
for (int i = 2; i < AF_NCH; i++)
vals[i] = (vals[0] + vals[1]) / 2.0;
if (!af_control_any_rev(mixer->af,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET,
db_vals))
vals))
{
mp_tmsg(MSGT_GLOBAL, mixer->softvol ? MSGL_V : MSGL_WARN,
"[Mixer] No hardware mixing, inserting volume filter.\n");
if (!(af_add(mixer->afilter, "volume", NULL)
&& af_control_any_rev(mixer->afilter,
mp_tmsg(MSGT_GLOBAL, MSGL_V, "[Mixer] Inserting volume filter.\n");
if (!(af_add(mixer->af, "volume", NULL)
&& af_control_any_rev(mixer->af,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET,
db_vals)))
vals)))
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
"[Mixer] No volume control available.\n");
}
}
void mixer_setvolume(mixer_t *mixer, float l, float r)
void mixer_setvolume(struct mixer *mixer, float l, float r)
{
checkvolume(mixer); // to check mute status and AO support for volume
checkvolume(mixer); // to check mute status
if (mixer->vol_l == l && mixer->vol_r == r)
return; // just prevent af_volume insertion when not needed
mixer->vol_l = av_clipf(l, 0, 100);
mixer->vol_r = av_clipf(r, 0, 100);
if (!mixer->ao || mixer->muted_using_volume)
return;
setvolume_internal(mixer, mixer->vol_l, mixer->vol_r);
mixer->user_set_volume = true;
if (mixer->ao && !(mixer->emulate_mute && mixer->muted))
setvolume_internal(mixer, mixer->vol_l, mixer->vol_r);
}
void mixer_getbothvolume(mixer_t *mixer, float *b)
void mixer_getbothvolume(struct mixer *mixer, float *b)
{
float mixer_l, mixer_r;
mixer_getvolume(mixer, &mixer_l, &mixer_r);
@@ -143,17 +158,20 @@ void mixer_getbothvolume(mixer_t *mixer, float *b)
void mixer_setmute(struct mixer *mixer, bool mute)
{
checkvolume(mixer);
if (mute != mixer->muted) {
if (!mixer->softvol && !mixer->muted_using_volume && ao_control(
mixer->ao, AOCONTROL_SET_MUTE, &mute) == CONTROL_OK) {
mixer->muted_using_volume = false;
if (mute == mixer->muted)
return;
if (mixer->ao) {
mixer->muted = mute;
mixer->muted_by_us = mute;
if (mixer->emulate_mute) {
setvolume_internal(mixer, mixer->vol_l*!mute, mixer->vol_r*!mute);
} else {
setvolume_internal(mixer, mixer->vol_l*!mute, mixer->vol_r*!mute);
mixer->muted_using_volume = mute;
ao_control(mixer->ao, AOCONTROL_SET_MUTE, &mute);
}
checkvolume(mixer);
} else {
mixer->muted = mute;
mixer->muted_by_us = mute;
mixer->user_set_mute = true;
}
}
@@ -165,26 +183,25 @@ bool mixer_getmute(struct mixer *mixer)
static void addvolume(struct mixer *mixer, float d)
{
checkvolume(mixer);
mixer_setvolume(mixer, mixer->vol_l + d, mixer->vol_r + d);
if (d > 0)
mixer_setmute(mixer, false);
float vol_l, vol_r;
mixer_getvolume(mixer, &vol_l, &vol_r);
mixer_setvolume(mixer, vol_l + d, vol_r + d);
}
void mixer_incvolume(mixer_t *mixer)
void mixer_incvolume(struct mixer *mixer)
{
addvolume(mixer, mixer->volstep);
addvolume(mixer, mixer->opts->volstep);
}
void mixer_decvolume(mixer_t *mixer)
void mixer_decvolume(struct mixer *mixer)
{
addvolume(mixer, -mixer->volstep);
addvolume(mixer, -mixer->opts->volstep);
}
void mixer_getbalance(mixer_t *mixer, float *val)
void mixer_getbalance(struct mixer *mixer, float *val)
{
if (mixer->afilter)
af_control_any_rev(mixer->afilter,
if (mixer->af)
af_control_any_rev(mixer->af,
AF_CONTROL_PAN_BALANCE | AF_CONTROL_GET,
&mixer->balance);
*val = mixer->balance;
@@ -201,7 +218,7 @@ void mixer_getbalance(mixer_t *mixer, float *val)
* are significantly below 1 will be overwritten with much higher values.
*/
void mixer_setbalance(mixer_t *mixer, float val)
void mixer_setbalance(struct mixer *mixer, float val)
{
float level[AF_NCH];
int i;
@@ -210,23 +227,22 @@ void mixer_setbalance(mixer_t *mixer, float val)
mixer->balance = val;
if (!mixer->afilter)
if (!mixer->af)
return;
if (af_control_any_rev(mixer->afilter,
if (af_control_any_rev(mixer->af,
AF_CONTROL_PAN_BALANCE | AF_CONTROL_SET, &val))
return;
if (val == 0 || mixer->ao->channels.num < 2)
return;
if (!(af_pan_balance = af_add(mixer->afilter, "pan", NULL))) {
if (!(af_pan_balance = af_add(mixer->af, "pan", NULL))) {
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
"[Mixer] No balance control available.\n");
return;
}
af_init(mixer->afilter);
/* make all other channels pass thru since by default pan blocks all */
memset(level, 0, sizeof(level));
for (i = 2; i < AF_NCH; i++) {
@@ -242,39 +258,125 @@ void mixer_setbalance(mixer_t *mixer, float val)
AF_CONTROL_PAN_BALANCE | AF_CONTROL_SET, &val);
}
// Called after the audio filter chain is built or rebuilt.
void mixer_reinit(struct mixer *mixer, struct ao *ao)
char *mixer_get_volume_restore_data(struct mixer *mixer)
{
mixer->ao = ao;
/* Use checkvolume() to see if softvol needs to be enabled because of
* lacking AO support, but first store values it could overwrite. */
float left = mixer->vol_l, right = mixer->vol_r;
bool muted = mixer->muted_by_us;
checkvolume(mixer);
/* Try to avoid restoring volume stored from one control method with
* another. Especially, restoring softvol volume (typically high) on
* system mixer could have very nasty effects. */
const char *restore_reason = mixer->softvol ? "softvol" :
mixer->ao->driver->info->short_name;
if (mixer->restore_volume && !strcmp(mixer->restore_volume,
restore_reason))
mixer_setvolume(mixer, left, right);
/* We turn mute off at AO uninit, so it has to be restored (unless
* we're reinitializing filter chain while keeping AO); but we only
* enable mute, not turn external mute off. */
if (muted)
mixer_setmute(mixer, true);
if (mixer->balance != 0)
mixer_setbalance(mixer, mixer->balance);
mixer->user_set_mute = false;
mixer->user_set_volume = false;
if (!mixer->driver[0])
return NULL;
return talloc_asprintf(NULL, "%s:%f:%f:%d", mixer->driver, mixer->vol_l,
mixer->vol_r, mixer->muted_by_us);
}
/* Called before uninitializing the audio output. The main purpose is to
static void probe_softvol(struct mixer *mixer)
{
if (mixer->opts->softvol == SOFTVOL_AUTO) {
// No system-wide volume => fine with AO volume control.
mixer->softvol = !(mixer->ao->per_application_mixer ||
mixer->ao->no_persistent_volume);
} else {
mixer->softvol = mixer->opts->softvol == SOFTVOL_YES;
}
// If we can't use real volume control => force softvol.
if (!mixer->softvol) {
ao_control_vol_t vol;
if (ao_control(mixer->ao, AOCONTROL_GET_VOLUME, &vol) != CONTROL_OK) {
mixer->softvol = true;
mp_tmsg(MSGT_GLOBAL, MSGL_WARN,
"[mixer] Hardware volume control unavailable.\n");
}
}
// Probe native mute support.
mixer->emulate_mute = true;
if (!mixer->softvol) {
if (ao_control(mixer->ao, AOCONTROL_GET_MUTE, &(bool){0}) == CONTROL_OK)
mixer->emulate_mute = false;
}
}
static void restore_volume(struct mixer *mixer)
{
struct MPOpts *opts = mixer->opts;
struct ao *ao = mixer->ao;
float force_vol_l = -1, force_vol_r = -1;
int force_mute = -1;
const char *prev_driver = mixer->driver;
mixer->driver = mixer->softvol ? "softvol" : ao->driver->info->short_name;
bool restore = mixer->softvol || ao->no_persistent_volume;
// Restore old parameters if volume won't survive reinitialization.
// But not if volume scale is possibly different.
if (restore && strcmp(mixer->driver, prev_driver) == 0) {
force_vol_l = mixer->vol_l;
force_vol_r = mixer->vol_r;
}
// Set mute if we disabled it on uninit last time.
if (mixer->muted_by_us)
force_mute = 1;
// Set parameters from command line.
if (opts->mixer_init_volume >= 0)
force_vol_l = force_vol_r = opts->mixer_init_volume;
if (opts->mixer_init_mute >= 0)
force_mute = opts->mixer_init_mute;
// Set parameters from playback resume.
char *restore_data = mixer->opts->mixer_restore_volume_data;
if (restore && restore_data && restore_data[0]) {
char drv[40];
float v_l, v_r;
int m;
if (sscanf(restore_data, "%39[^:]:%f:%f:%d", drv, &v_l, &v_r, &m) == 4) {
if (strcmp(mixer->driver, drv) == 0) {
force_vol_l = v_l;
force_vol_r = v_r;
force_mute = !!m;
}
}
talloc_free(restore_data);
mixer->opts->mixer_restore_volume_data = NULL;
}
// Using --volume should not reset the volume on every file (i.e. reinit),
// OTOH mpv --{ --volume 10 f1.mkv --} --{ --volume 20 f2.mkv --} must work.
// Resetting the option volumes to "auto" (-1) is easiest. If file local
// options (as shown above) are used, the option handler code will reset
// them to other values, and force the volume to be reset as well.
opts->mixer_init_volume = -1;
opts->mixer_init_mute = -1;
checkvolume(mixer);
if (force_vol_l >= 0 && force_vol_r >= 0)
mixer_setvolume(mixer, force_vol_l, force_vol_r);
if (force_mute >= 0)
mixer_setmute(mixer, force_mute);
}
// Called after the audio filter chain is built or rebuilt.
// (Can be called multiple times, even without mixer_uninit() in-between.)
void mixer_reinit_audio(struct mixer *mixer, struct ao *ao, struct af_stream *af)
{
if (!ao || !af)
return;
mixer->ao = ao;
mixer->af = af;
probe_softvol(mixer);
restore_volume(mixer);
if (mixer->balance != 0)
mixer_setbalance(mixer, mixer->balance);
}
/* Called before uninitializing the audio filter chain. The main purpose is to
* turn off mute, in case it's a global/persistent setting which might
* otherwise be left enabled even after this player instance exits.
*/
void mixer_uninit(struct mixer *mixer)
void mixer_uninit_audio(struct mixer *mixer)
{
if (!mixer->ao)
return;
@@ -294,4 +396,5 @@ void mixer_uninit(struct mixer *mixer)
mixer->muted_by_us = true;
}
mixer->ao = NULL;
mixer->af = NULL;
}
+19 -28
View File
@@ -21,40 +21,31 @@
#include <stdbool.h>
// Values of MPOpts.softvol
enum {
SOFTVOL_NO = 0,
SOFTVOL_YES = 1,
SOFTVOL_AUTO = 2,
};
typedef struct mixer {
struct ao *ao;
struct af_stream *afilter;
int volstep;
int softvol;
float softvol_max;
bool muted;
bool muted_by_us;
bool muted_using_volume;
float vol_l, vol_r;
/* Contains ao driver name or "softvol" if volume is not persistent
* and needs to be restored after the driver is reinitialized. */
const char *restore_volume;
float balance;
bool user_set_mute;
bool user_set_volume;
} mixer_t;
struct MPOpts;
struct ao;
struct af_stream;
struct mixer;
void mixer_reinit(struct mixer *mixer, struct ao *ao);
void mixer_uninit(struct mixer *mixer);
void mixer_getvolume(mixer_t *mixer, float *l, float *r);
void mixer_setvolume(mixer_t *mixer, float l, float r);
void mixer_incvolume(mixer_t *mixer);
void mixer_decvolume(mixer_t *mixer);
void mixer_getbothvolume(mixer_t *mixer, float *b);
void mixer_setmute(mixer_t *mixer, bool mute);
bool mixer_getmute(mixer_t *mixer);
void mixer_getbalance(mixer_t *mixer, float *bal);
void mixer_setbalance(mixer_t *mixer, float bal);
struct mixer *mixer_init(void *talloc_ctx, struct MPOpts *opts);
void mixer_reinit_audio(struct mixer *mixer, struct ao *ao, struct af_stream *af);
void mixer_uninit_audio(struct mixer *mixer);
bool mixer_audio_initialized(struct mixer *mixer);
void mixer_getvolume(struct mixer *mixer, float *l, float *r);
void mixer_setvolume(struct mixer *mixer, float l, float r);
void mixer_incvolume(struct mixer *mixer);
void mixer_decvolume(struct mixer *mixer);
void mixer_getbothvolume(struct mixer *mixer, float *b);
void mixer_setmute(struct mixer *mixer, bool mute);
bool mixer_getmute(struct mixer *mixer);
void mixer_getbalance(struct mixer *mixer, float *bal);
void mixer_setbalance(struct mixer *mixer, float bal);
char *mixer_get_volume_restore_data(struct mixer *mixer);
#endif /* MPLAYER_MIXER_H */
+4 -5
View File
@@ -32,13 +32,10 @@
#include "mpvcore/mp_msg.h"
#include "mpvcore/mpv_global.h"
// there are some globals:
struct ao *global_ao;
char *ao_subdevice = NULL;
extern const struct ao_driver audio_out_oss;
extern const struct ao_driver audio_out_coreaudio;
extern const struct ao_driver audio_out_rsound;
extern const struct ao_driver audio_out_sndio;
extern const struct ao_driver audio_out_pulse;
extern const struct ao_driver audio_out_jack;
extern const struct ao_driver audio_out_openal;
@@ -47,7 +44,6 @@ extern const struct ao_driver audio_out_alsa;
extern const struct ao_driver audio_out_dsound;
extern const struct ao_driver audio_out_wasapi;
extern const struct ao_driver audio_out_pcm;
extern const struct ao_driver audio_out_pss;
extern const struct ao_driver audio_out_lavc;
extern const struct ao_driver audio_out_portaudio;
extern const struct ao_driver audio_out_sdl;
@@ -60,6 +56,9 @@ static const struct ao_driver * const audio_out_drivers[] = {
#ifdef CONFIG_PULSE
&audio_out_pulse,
#endif
#ifdef CONFIG_SNDIO
&audio_out_sndio,
#endif
#ifdef CONFIG_ALSA
&audio_out_alsa,
#endif
-2
View File
@@ -96,8 +96,6 @@ struct ao {
struct mp_log *log; // Using e.g. "[ao/coreaudio]" as prefix
};
extern char *ao_subdevice;
struct mpv_global;
struct ao *ao_init_best(struct mpv_global *global,
struct input_ctx *input_ctx,
+35 -55
View File
@@ -38,7 +38,6 @@
#include "config.h"
#include "mpvcore/options.h"
#include "mpvcore/m_option.h"
#include "audio/mixer.h"
#include "mpvcore/mp_msg.h"
#define ALSA_PCM_NEW_HW_PARAMS_API
@@ -73,8 +72,7 @@ struct priv {
#define CHECK_ALSA_ERROR(message) \
do { \
if (err < 0) { \
mp_msg(MSGT_VO, MSGL_ERR, "[AO_ALSA] %s: %s\n", \
(message), snd_strerror(err)); \
MP_ERR(ao, "%s: %s\n", (message), snd_strerror(err)); \
goto alsa_error; \
} \
} while (0)
@@ -94,10 +92,10 @@ static void alsa_error_handler(const char *file, int line, const char *function,
va_end(va);
if (err) {
mp_msg(MSGT_AO, MSGL_ERR, "[AO_ALSA] alsa-lib: %s:%i:(%s) %s: %s\n",
mp_msg(MSGT_AO, MSGL_ERR, "alsa-lib: %s:%i:(%s) %s: %s\n",
file, line, function, tmp, snd_strerror(err));
} else {
mp_msg(MSGT_AO, MSGL_ERR, "[AO_ALSA] alsa-lib: %s:%i:(%s) %s\n",
mp_msg(MSGT_AO, MSGL_ERR, "alsa-lib: %s:%i:(%s) %s\n",
file, line, function, tmp);
}
}
@@ -145,10 +143,9 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
elem = snd_mixer_find_selem(handle, sid);
if (!elem) {
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AO_ALSA] Unable to find simple control '%s',%i.\n",
snd_mixer_selem_id_get_name(sid),
snd_mixer_selem_id_get_index(sid));
MP_VERBOSE(ao, "Unable to find simple control '%s',%i.\n",
snd_mixer_selem_id_get_name(sid),
snd_mixer_selem_id_get_index(sid));
goto alsa_error;
}
@@ -164,15 +161,14 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
err = snd_mixer_selem_set_playback_volume
(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol);
CHECK_ALSA_ERROR("Error setting left channel");
mp_msg(MSGT_AO, MSGL_DBG2, "left=%li, ", set_vol);
MP_DBG(ao, "left=%li, ", set_vol);
set_vol = vol->right / f_multi + pmin + 0.5;
err = snd_mixer_selem_set_playback_volume
(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol);
CHECK_ALSA_ERROR("Error setting right channel");
mp_msg(MSGT_AO, MSGL_DBG2,
"right=%li, pmin=%li, pmax=%li, mult=%f\n",
MP_DBG(ao, "right=%li, pmin=%li, pmax=%li, mult=%f\n",
set_vol, pmin, pmax,
f_multi);
break;
@@ -185,8 +181,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
snd_mixer_selem_get_playback_volume
(elem, SND_MIXER_SCHN_FRONT_RIGHT, &get_vol);
vol->right = (get_vol - pmin) * f_multi;
mp_msg(MSGT_AO, MSGL_DBG2, "left=%f, right=%f\n", vol->left,
vol->right);
MP_DBG(ao, "left=%f, right=%f\n", vol->left, vol->right);
break;
}
case AOCONTROL_SET_MUTE: {
@@ -303,9 +298,8 @@ static const char *select_chmap(struct ao *ao)
}
char *name = mp_chmap_to_str(&ao->channels);
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AO_ALSA] channel layout %s (%d ch) not supported.\n",
name, ao->channels.num);
MP_ERR(ao, "channel layout %s (%d ch) not supported.\n",
name, ao->channels.num);
talloc_free(name);
return "default";
}
@@ -370,9 +364,8 @@ static int init(struct ao *ao)
struct priv *p = ao->priv;
mp_msg(MSGT_AO, MSGL_V,
"alsa-init: requested format: %d Hz, %d channels, %x\n",
ao->samplerate, ao->channels.num, ao->format);
MP_VERBOSE(ao, "requested format: %d Hz, %d channels, %x\n",
ao->samplerate, ao->channels.num, ao->format);
p->prepause_frames = 0;
p->delay_before_pause = 0;
@@ -386,9 +379,8 @@ static int init(struct ao *ao)
const char *device;
if (AF_FORMAT_IS_IEC61937(ao->format)) {
device = "iec958";
mp_msg(MSGT_AO, MSGL_V,
"alsa-spdif-init: playing AC3/iec61937/iec958, %i channels\n",
ao->channels.num);
MP_VERBOSE(ao, "playing AC3/iec61937/iec958, %i channels\n",
ao->channels.num);
} else {
device = select_chmap(ao);
if (strcmp(device, "default") != 0 && ao->format == AF_FORMAT_FLOAT_NE)
@@ -400,11 +392,11 @@ static int init(struct ao *ao)
if (p->cfg_device && p->cfg_device[0])
device = p->cfg_device;
mp_msg(MSGT_AO, MSGL_V, "alsa-init: using device %s\n", device);
MP_VERBOSE(ao, "using device: %s\n", device);
p->can_pause = 1;
mp_msg(MSGT_AO, MSGL_V, "alsa-init: using ALSA %s\n", snd_asoundlib_version());
MP_VERBOSE(ao, "using ALSA version: %s\n", snd_asoundlib_version());
snd_lib_error_set_handler(alsa_error_handler);
int open_mode = p->cfg_block ? 0 : SND_PCM_NONBLOCK;
@@ -413,7 +405,7 @@ static int init(struct ao *ao)
err = try_open_device(ao, device, open_mode, isac3);
if (err < 0) {
if (err != -EBUSY && !p->cfg_block) {
mp_tmsg(MSGT_AO, MSGL_INFO, "[AO_ALSA] Open in nonblock-mode "
MP_WARN(ao, "Open in nonblock-mode "
"failed, trying to open in block-mode.\n");
err = try_open_device(ao, device, 0, isac3);
}
@@ -422,11 +414,9 @@ static int init(struct ao *ao)
err = snd_pcm_nonblock(p->alsa, 0);
if (err < 0) {
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AL_ALSA] Error setting block-mode %s.\n",
snd_strerror(err));
MP_ERR(ao, "Error setting block-mode: %s.\n", snd_strerror(err));
} else {
mp_msg(MSGT_AO, MSGL_V, "alsa-init: pcm opened in blocking mode\n");
MP_VERBOSE(ao, "pcm opened in blocking mode\n");
}
snd_pcm_hw_params_t *alsa_hwparams;
@@ -451,8 +441,8 @@ static int init(struct ao *ao)
err = snd_pcm_hw_params_test_format(p->alsa, alsa_hwparams, p->alsa_fmt);
if (err < 0) {
mp_tmsg(MSGT_AO, MSGL_INFO, "[AO_ALSA] Format %s is not supported "
"by hardware, trying default.\n", af_fmt2str_short(ao->format));
MP_INFO(ao, "Format %s is not supported by hardware, trying default.\n",
af_fmt2str_short(ao->format));
p->alsa_fmt = SND_PCM_FORMAT_S16_LE;
if (AF_FORMAT_IS_AC3(ao->format))
ao->format = AF_FORMAT_AC3_LE;
@@ -471,8 +461,7 @@ static int init(struct ao *ao)
CHECK_ALSA_ERROR("Unable to set channels");
if (num_channels != ao->channels.num) {
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AO_ALSA] Couldn't get requested number of channels.\n");
MP_ERR(ao, "Couldn't get requested number of channels.\n");
mp_chmap_from_channels_alsa(&ao->channels, num_channels);
}
@@ -508,13 +497,12 @@ static int init(struct ao *ao)
CHECK_ALSA_ERROR("Unable to get buffersize");
p->buffersize = bufsize * p->bytes_per_sample;
mp_msg(MSGT_AO, MSGL_V, "alsa-init: got buffersize=%i\n",
p->buffersize);
MP_VERBOSE(ao, "got buffersize=%i\n", p->buffersize);
err = snd_pcm_hw_params_get_period_size(alsa_hwparams, &chunk_size, NULL);
CHECK_ALSA_ERROR("Unable to get period size");
mp_msg(MSGT_AO, MSGL_V, "alsa-init: got period size %li\n", chunk_size);
MP_VERBOSE(ao, "got period size %li\n", chunk_size);
p->outburst = chunk_size * p->bytes_per_sample;
/* setting software parameters */
@@ -546,10 +534,9 @@ static int init(struct ao *ao)
p->can_pause = snd_pcm_hw_params_can_pause(alsa_hwparams);
mp_msg(MSGT_AO, MSGL_V,
"alsa: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n",
ao->samplerate, ao->channels.num, (int)p->bytes_per_sample,
p->buffersize, snd_pcm_format_description(p->alsa_fmt));
MP_VERBOSE(ao, "opened: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n",
ao->samplerate, ao->channels.num, (int)p->bytes_per_sample,
p->buffersize, snd_pcm_format_description(p->alsa_fmt));
return 0;
@@ -573,7 +560,7 @@ static void uninit(struct ao *ao, bool immed)
err = snd_pcm_close(p->alsa);
CHECK_ALSA_ERROR("pcm close error");
mp_msg(MSGT_AO, MSGL_V, "alsa-uninit: pcm closed\n");
MP_VERBOSE(ao, "uninit: pcm closed\n");
}
alsa_error:
@@ -590,8 +577,8 @@ static void audio_pause(struct ao *ao)
p->delay_before_pause = get_delay(ao);
err = snd_pcm_pause(p->alsa, 1);
CHECK_ALSA_ERROR("pcm pause error");
mp_msg(MSGT_AO, MSGL_V, "alsa-pause: pause supported by hardware\n");
} else {
MP_VERBOSE(ao, "pause not supported by hardware\n");
if (snd_pcm_delay(p->alsa, &p->prepause_frames) < 0
|| p->prepause_frames < 0)
p->prepause_frames = 0;
@@ -610,16 +597,15 @@ static void audio_resume(struct ao *ao)
int err;
if (snd_pcm_state(p->alsa) == SND_PCM_STATE_SUSPENDED) {
mp_tmsg(MSGT_AO, MSGL_INFO,
"[AO_ALSA] Pcm in suspend mode, trying to resume.\n");
MP_INFO(ao, "PCM in suspend mode, trying to resume.\n");
while ((err = snd_pcm_resume(p->alsa)) == -EAGAIN)
sleep(1);
}
if (p->can_pause) {
err = snd_pcm_pause(p->alsa, 0);
CHECK_ALSA_ERROR("pcm resume error");
mp_msg(MSGT_AO, MSGL_V, "alsa-resume: resume supported by hardware\n");
} else {
MP_VERBOSE(ao, "resume not supported by hardware\n");
err = snd_pcm_prepare(p->alsa);
CHECK_ALSA_ERROR("pcm prepare error");
if (p->prepause_frames) {
@@ -664,10 +650,8 @@ static int play(struct ao *ao, void *data, int len, int flags)
len = len / p->outburst * p->outburst;
num_frames = len / p->bytes_per_sample;
//mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len);
if (!p->alsa) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO_ALSA] Device configuration error.");
MP_ERR(ao, "Device configuration error.");
return 0;
}
@@ -681,16 +665,12 @@ static int play(struct ao *ao, void *data, int len, int flags)
/* nothing to do */
res = 0;
} else if (res == -ESTRPIPE) { /* suspend */
mp_tmsg(MSGT_AO, MSGL_INFO,
"[AO_ALSA] Pcm in suspend mode, trying to resume.\n");
MP_INFO(ao, "PCM in suspend mode, trying to resume.\n");
while ((res = snd_pcm_resume(p->alsa)) == -EAGAIN)
sleep(1);
}
if (res < 0) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO_ALSA] Write error: %s\n",
snd_strerror(res));
mp_tmsg(MSGT_AO, MSGL_INFO,
"[AO_ALSA] Trying to reset soundcard.\n");
MP_ERR(ao, "Write error: %s\n", snd_strerror(res));
res = snd_pcm_prepare(p->alsa);
int err = res;
CHECK_ALSA_ERROR("pcm prepare error");
+9 -6
View File
@@ -112,6 +112,7 @@ static OSStatus render_cb_lpcm(void *ctx, AudioUnitRenderActionFlags *aflags,
if (mp_ring_buffered(p->buffer) < requested) {
MP_VERBOSE(ao, "buffer underrun\n");
audio_pause(ao);
memset(buf.mData, 0, requested);
} else {
mp_ring_read(p->buffer, buf.mData, requested);
}
@@ -267,14 +268,16 @@ static int init(struct ao *ao)
selected_device = p->opt_device_id;
}
char *device_name;
err = CA_GET_STR(selected_device, kAudioObjectPropertyName, &device_name);
CHECK_CA_ERROR("could not get selected audio device name");
if (mp_msg_test_log(ao->log, MSGL_V)) {
char *name;
err = CA_GET_STR(selected_device, kAudioObjectPropertyName, &name);
CHECK_CA_ERROR("could not get selected audio device name");
MP_VERBOSE(ao, "selected audio output device: %s (%" PRIu32 ")\n",
device_name, selected_device);
MP_VERBOSE(ao, "selected audio output device: %s (%" PRIu32 ")\n",
name, selected_device);
talloc_free(device_name);
talloc_free(name);
}
// Save selected device id
p->device = selected_device;
+24 -48
View File
@@ -152,24 +152,9 @@ static void UninitDirectSound(struct ao *ao)
FreeLibrary(p->hdsound_dll);
p->hdsound_dll = NULL;
}
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: DirectSound uninitialized\n");
MP_VERBOSE(ao, "DirectSound uninitialized\n");
}
/**
\brief print the commandline help
*/
static void print_help(void)
{
mp_msg(MSGT_AO, MSGL_FATAL,
"\n-ao dsound commandline help:\n"
"Example: mpv -ao dsound:device=1\n"
" sets 1st device\n"
"\nOptions:\n"
" device=<device-number>\n"
" Sets device number, use -v to get a list\n");
}
/**
\brief enumerate direct sound devices
\return TRUE to continue with the enumeration
@@ -180,13 +165,13 @@ static BOOL CALLBACK DirectSoundEnum(LPGUID guid, LPCSTR desc, LPCSTR module,
struct ao *ao = context;
struct priv *p = ao->priv;
mp_msg(MSGT_AO, MSGL_V, "%i %s ", p->device_index, desc);
MP_VERBOSE(ao, "%i %s ", p->device_index, desc);
if (p->device_num == p->device_index) {
mp_msg(MSGT_AO, MSGL_V, "<--");
MP_VERBOSE(ao, "<--");
if (guid)
memcpy(&p->device, guid, sizeof(GUID));
}
mp_msg(MSGT_AO, MSGL_V, "\n");
MP_VERBOSE(ao, "\n");
p->device_index++;
return TRUE;
}
@@ -210,7 +195,7 @@ static int InitDirectSound(struct ao *ao)
p->hdsound_dll = LoadLibrary("DSOUND.DLL");
if (p->hdsound_dll == NULL) {
mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: cannot load DSOUND.DLL\n");
MP_ERR(ao, "cannot load DSOUND.DLL\n");
return 0;
}
OurDirectSoundCreate = (void *)GetProcAddress(p->hdsound_dll,
@@ -219,21 +204,20 @@ static int InitDirectSound(struct ao *ao)
"DirectSoundEnumerateA");
if (OurDirectSoundCreate == NULL || OurDirectSoundEnumerate == NULL) {
mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: GetProcAddress FAILED\n");
MP_ERR(ao, "GetProcAddress FAILED\n");
FreeLibrary(p->hdsound_dll);
return 0;
}
// Enumerate all directsound p->devices
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Output Devices:\n");
MP_VERBOSE(ao, "Output Devices:\n");
OurDirectSoundEnumerate(DirectSoundEnum, ao);
// Create the direct sound object
if (FAILED(OurDirectSoundCreate((p->device_num) ? &p->device : NULL,
&p->hds, NULL)))
{
mp_msg(MSGT_AO, MSGL_ERR,
"ao_dsound: cannot create a DirectSound device\n");
MP_ERR(ao, "cannot create a DirectSound device\n");
FreeLibrary(p->hdsound_dll);
return 0;
}
@@ -251,22 +235,20 @@ static int InitDirectSound(struct ao *ao)
if (IDirectSound_SetCooperativeLevel(p->hds, GetDesktopWindow(),
DSSCL_EXCLUSIVE))
{
mp_msg(MSGT_AO, MSGL_ERR,
"ao_dsound: cannot set direct sound cooperative level\n");
MP_ERR(ao, "cannot set direct sound cooperative level\n");
IDirectSound_Release(p->hds);
FreeLibrary(p->hdsound_dll);
return 0;
}
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: DirectSound initialized\n");
MP_VERBOSE(ao, "DirectSound initialized\n");
memset(&dscaps, 0, sizeof(DSCAPS));
dscaps.dwSize = sizeof(DSCAPS);
if (DS_OK == IDirectSound_GetCaps(p->hds, &dscaps)) {
if (dscaps.dwFlags & DSCAPS_EMULDRIVER)
mp_msg(MSGT_AO, MSGL_V,
"ao_dsound: DirectSound is emulated, waveOut may give better performance\n");
MP_VERBOSE(ao, "DirectSound is emulated\n");
} else {
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: cannot get device capabilities\n");
MP_VERBOSE(ao, "cannot get device capabilities\n");
}
return 1;
@@ -424,9 +406,8 @@ static int init(struct ao *ao)
case AF_FORMAT_U8:
break;
default:
mp_msg(MSGT_AO, MSGL_V,
"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",
af_fmt2str_short(format));
MP_VERBOSE(ao, "format %s not supported defaulting to Signed 16-bit Little-Endian\n",
af_fmt2str_short(format));
format = AF_FORMAT_S16_LE;
}
//set our audio parameters
@@ -434,11 +415,10 @@ static int init(struct ao *ao)
ao->format = format;
ao->bps = ao->channels.num * rate * (af_fmt2bits(format) >> 3);
int buffersize = ao->bps; // space for 1 sec
mp_msg(MSGT_AO, MSGL_V,
"ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate,
ao->channels.num, af_fmt2str_short(format));
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Buffersize:%d bytes (%d msec)\n",
buffersize, buffersize / ao->bps * 1000);
MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate,
ao->channels.num, af_fmt2str_short(format));
MP_VERBOSE(ao, "Buffersize:%d bytes (%d msec)\n",
buffersize, buffersize / ao->bps * 1000);
//fill waveformatex
ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE));
@@ -494,19 +474,16 @@ static int init(struct ao *ao)
res = IDirectSound_CreateSoundBuffer(p->hds, &dsbpridesc, &p->hdspribuf, NULL);
if (res != DS_OK) {
UninitDirectSound(ao);
mp_msg(MSGT_AO, MSGL_ERR,
"ao_dsound: cannot create primary buffer (%s)\n",
dserr2str(res));
MP_ERR(ao, "cannot create primary buffer (%s)\n", dserr2str(res));
return -1;
}
res = IDirectSoundBuffer_SetFormat(p->hdspribuf, (WAVEFORMATEX *)&wformat);
if (res != DS_OK) {
mp_msg(MSGT_AO, MSGL_WARN,
"ao_dsound: cannot set primary buffer format (%s), using "
"standard setting (bad quality)", dserr2str(res));
MP_WARN(ao, "cannot set primary buffer format (%s), using "
"standard setting (bad quality)", dserr2str(res));
}
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: primary buffer created\n");
MP_VERBOSE(ao, "primary buffer created\n");
// now create the stream buffer
@@ -519,13 +496,12 @@ static int init(struct ao *ao)
}
if (res != DS_OK) {
UninitDirectSound(ao);
mp_msg(MSGT_AO, MSGL_ERR,
"ao_dsound: cannot create secondary (stream)buffer (%s)\n",
MP_ERR(ao, "cannot create secondary (stream)buffer (%s)\n",
dserr2str(res));
return -1;
}
}
mp_msg(MSGT_AO, MSGL_V, "ao_dsound: secondary (stream)buffer created\n");
MP_VERBOSE(ao, "secondary (stream)buffer created\n");
return 0;
}
+6 -6
View File
@@ -169,7 +169,7 @@ static int init(struct ao *ao)
struct priv *p = ao->priv;
const char **matching_ports = NULL;
char *port_name = p->cfg_port && p->cfg_port[0] ? p->cfg_port : NULL;
jack_options_t open_options = JackUseExactName;
jack_options_t open_options = JackNullOption;
int port_flags = JackPortIsInput;
int i;
@@ -190,7 +190,7 @@ static int init(struct ao *ao)
open_options |= JackNoStartServer;
p->client = jack_client_open(p->cfg_client_name, open_options, NULL);
if (!p->client) {
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n");
MP_FATAL(ao, "cannot open server\n");
goto err_out;
}
jack_set_process_callback(p->client, outputaudio, ao);
@@ -201,7 +201,7 @@ static int init(struct ao *ao)
port_flags |= JackPortIsPhysical;
matching_ports = jack_get_ports(p->client, port_name, NULL, port_flags);
if (!matching_ports || !matching_ports[0]) {
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");
MP_FATAL(ao, "no physical ports available\n");
goto err_out;
}
i = 1;
@@ -220,19 +220,19 @@ static int init(struct ao *ao)
jack_port_register(p->client, pname, JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);
if (!p->ports[i]) {
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] not enough ports available\n");
MP_FATAL(ao, "not enough ports available\n");
goto err_out;
}
}
if (jack_activate(p->client)) {
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] activate failed\n");
MP_FATAL(ao, "activate failed\n");
goto err_out;
}
for (i = 0; i < p->num_ports; i++) {
if (jack_connect(p->client, jack_port_name(p->ports[i]),
matching_ports[i]))
{
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] connecting failed\n");
MP_FATAL(ao, "connecting failed\n");
goto err_out;
}
}
+30 -44
View File
@@ -71,13 +71,7 @@ static int init(struct ao *ao)
AVCodec *codec;
if (!encode_lavc_available(ao->encode_lavc_ctx)) {
mp_msg(MSGT_ENCODE, MSGL_ERR,
"ao-lavc: the option --o (output file) must be specified\n");
return -1;
}
if (ac->stream) {
mp_msg(MSGT_ENCODE, MSGL_ERR, "ao-lavc: rejecting reinitialization\n");
MP_ERR(ao, "the option --o (output file) must be specified\n");
return -1;
}
@@ -85,7 +79,7 @@ static int init(struct ao *ao)
AVMEDIA_TYPE_AUDIO);
if (!ac->stream) {
mp_msg(MSGT_ENCODE, MSGL_ERR, "ao-lavc: could not get a new audio stream\n");
MP_ERR(ao, "could not get a new audio stream\n");
return -1;
}
@@ -243,8 +237,7 @@ out_takefirst:
}
if (!found_format && !found_planar_format) {
// shouldn't happen
mp_msg(MSGT_ENCODE, MSGL_ERR,
"ao-lavc: sample format not found\n");
MP_ERR(ao, "sample format not found\n");
}
}
@@ -285,8 +278,7 @@ out_takefirst:
ao->priv = ac;
if (ac->planarize)
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: need to planarize audio data\n");
MP_WARN(ao, "need to planarize audio data\n");
return 0;
}
@@ -311,8 +303,7 @@ static void uninit(struct ao *ao, bool cut_audio)
struct encode_lavc_context *ectx = ao->encode_lavc_ctx;
if (!encode_lavc_start(ectx)) {
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: not even ready to encode audio at end -> dropped");
MP_WARN(ao, "not even ready to encode audio at end -> dropped");
return;
}
@@ -329,8 +320,7 @@ static void uninit(struct ao *ao, bool cut_audio)
ac->sample_size, ac->sample_padding);
int written = play(ao, paddingbuf, ao->buffer.len + extralen, 0);
if (written < ao->buffer.len) {
mp_msg(MSGT_ENCODE, MSGL_ERR,
"ao-lavc: did not write enough data at the end\n");
MP_ERR(ao, "did not write enough data at the end\n");
}
talloc_free(paddingbuf);
ao->buffer.len = 0;
@@ -392,7 +382,7 @@ static int encode(struct ao *ao, double apts, void *data)
ac->stream->codec->sample_fmt, data,
audiolen, 1))
{
mp_msg(MSGT_ENCODE, MSGL_ERR, "ao-lavc: error filling\n");
MP_ERR(ao, "error filling\n");
return -1;
}
@@ -408,9 +398,8 @@ static int encode(struct ao *ao, double apts, void *data)
if (ac->lastpts != MP_NOPTS_VALUE && frame_pts <= ac->lastpts) {
// this indicates broken video
// (video pts failing to increase fast enough to match audio)
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: audio frame pts went backwards "
"(%d <- %d), autofixed\n", (int)frame->pts,
(int)ac->lastpts);
MP_WARN(ao, "audio frame pts went backwards (%d <- %d), autofixed\n",
(int)frame->pts, (int)ac->lastpts);
frame_pts = ac->lastpts + 1;
frame->pts = av_rescale_q(frame_pts, ac->worst_time_base, ac->stream->codec->time_base);
}
@@ -436,17 +425,15 @@ static int encode(struct ao *ao, double apts, void *data)
status = avcodec_encode_audio2(ac->stream->codec, &packet, NULL, &gotpacket);
}
if(status)
{
mp_msg(MSGT_ENCODE, MSGL_ERR, "ao-lavc: error encoding\n");
if(status) {
MP_ERR(ao, "error encoding\n");
return -1;
}
if(!gotpacket)
return 0;
mp_msg(MSGT_ENCODE, MSGL_DBG2,
"ao-lavc: got pts %f (playback time: %f); out size: %d\n",
MP_DBG(ao, "got pts %f (playback time: %f); out size: %d\n",
apts, realapts, packet.size);
encode_lavc_write_stats(ao->encode_lavc_ctx, ac->stream);
@@ -455,7 +442,7 @@ static int encode(struct ao *ao, double apts, void *data)
// Do we need this at all? Better be safe than sorry...
if (packet.pts == AV_NOPTS_VALUE) {
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: encoder lost pts, why?\n");
MP_WARN(ao, "encoder lost pts, why?\n");
if (ac->savepts != MP_NOPTS_VALUE)
packet.pts = ac->savepts;
}
@@ -475,7 +462,7 @@ static int encode(struct ao *ao, double apts, void *data)
ac->savepts = MP_NOPTS_VALUE;
if (encode_lavc_write_frame(ao->encode_lavc_ctx, &packet) < 0) {
mp_msg(MSGT_ENCODE, MSGL_ERR, "ao-lavc: error writing at %f %f/%f\n",
MP_ERR(ao, "error writing at %f %f/%f\n",
realapts, (double) ac->stream->time_base.num,
(double) ac->stream->time_base.den);
return -1;
@@ -501,13 +488,11 @@ static int play(struct ao *ao, void *data, int len, int flags)
len /= ac->sample_size * ao->channels.num;
if (!encode_lavc_start(ectx)) {
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: not ready yet for encoding audio\n");
MP_WARN(ao, "not ready yet for encoding audio\n");
return 0;
}
if (pts == MP_NOPTS_VALUE) {
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: frame without pts, please report; synthesizing pts instead\n");
MP_WARN(ao, "frame without pts, please report; synthesizing pts instead\n");
// synthesize pts from previous expected next pts
pts = ac->expected_next_pts;
}
@@ -516,19 +501,21 @@ static int play(struct ao *ao, void *data, int len, int flags)
//if (ac->stream->codec->time_base.num / ac->stream->codec->time_base.den >= ac->stream->time_base.num / ac->stream->time_base.den)
if (ac->stream->codec->time_base.num * (double) ac->stream->time_base.den >=
ac->stream->time_base.num * (double) ac->stream->codec->time_base.den) {
mp_msg(MSGT_ENCODE, MSGL_V, "ao-lavc: NOTE: using codec time base "
"(%d/%d) for pts adjustment; the stream base (%d/%d) is "
"not worse.\n", (int)ac->stream->codec->time_base.num,
(int)ac->stream->codec->time_base.den, (int)ac->stream->time_base.num,
(int)ac->stream->time_base.den);
MP_VERBOSE(ao, "NOTE: using codec time base (%d/%d) for pts "
"adjustment; the stream base (%d/%d) is not worse.\n",
(int)ac->stream->codec->time_base.num,
(int)ac->stream->codec->time_base.den,
(int)ac->stream->time_base.num,
(int)ac->stream->time_base.den);
ac->worst_time_base = ac->stream->codec->time_base;
ac->worst_time_base_is_stream = 0;
} else {
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: NOTE: not using codec time "
"base (%d/%d) for pts adjustment; the stream base (%d/%d) "
"is worse.\n", (int)ac->stream->codec->time_base.num,
(int)ac->stream->codec->time_base.den, (int)ac->stream->time_base.num,
(int)ac->stream->time_base.den);
MP_WARN(ao, "NOTE: not using codec time base (%d/%d) for pts "
"adjustment; the stream base (%d/%d) is worse.\n",
(int)ac->stream->codec->time_base.num,
(int)ac->stream->codec->time_base.den,
(int)ac->stream->time_base.num,
(int)ac->stream->time_base.den);
ac->worst_time_base = ac->stream->time_base;
ac->worst_time_base_is_stream = 1;
}
@@ -596,7 +583,7 @@ static int play(struct ao *ao, void *data, int len, int flags)
*/
int finalbufpos = len - (len - bufpos) % ac->aframesize;
if (finalbufpos < 0) {
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: cannot attain the "
MP_WARN(ao, "cannot attain the "
"exact requested audio sync; shifting by %d frames\n",
-finalbufpos);
bufpos -= finalbufpos;
@@ -611,8 +598,7 @@ static int play(struct ao *ao, void *data, int len, int flags)
ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
}
else if (fabs(nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts) > 30) {
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: detected an unexpected discontinuity (pts jumped by "
MP_WARN(ao, "detected an unexpected discontinuity (pts jumped by "
"%f seconds)\n",
nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts);
ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+3 -3
View File
@@ -127,7 +127,7 @@ static int init(struct ao *ao)
int i;
struct priv *p = ao->priv;
if (ao_data) {
mp_msg(MSGT_AO, MSGL_FATAL, "[OpenAL] Not reentrant!\n");
MP_FATAL(ao, "Not reentrant!\n");
return -1;
}
ao_data = ao;
@@ -145,13 +145,13 @@ static int init(struct ao *ao)
speakers[i] = speaker_pos[n];
}
if (speakers[i].id < 0) {
mp_msg(MSGT_AO, MSGL_FATAL, "[OpenAL] Unknown channel layout\n");
MP_FATAL(ao, "Unknown channel layout\n");
goto err_out;
}
}
dev = alcOpenDevice(p->cfg_device && p->cfg_device[0] ? p->cfg_device : NULL);
if (!dev) {
mp_msg(MSGT_AO, MSGL_FATAL, "[OpenAL] could not open device\n");
MP_FATAL(ao, "could not open device\n");
goto err_out;
}
ctx = alcCreateContext(dev, attribs);
+43 -54
View File
@@ -36,7 +36,6 @@
#include "config.h"
#include "mpvcore/options.h"
#include "mpvcore/mp_msg.h"
#include "audio/mixer.h"
#ifdef HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
@@ -107,8 +106,6 @@ static int format2oss(int format)
if (format_table[n][1] == format)
return format_table[n][0];
}
mp_msg(MSGT_AO, MSGL_V, "OSS: Unknown/not supported internal format: %s\n",
af_fmt2str_short(format));
return -1;
}
@@ -118,8 +115,6 @@ static int oss2format(int format)
if (format_table[n][0] == format)
return format_table[n][1];
}
mp_tmsg(MSGT_GLOBAL, MSGL_ERR, "[AO OSS] Unknown/Unsupported OSS format: %x.\n",
format);
return -1;
}
@@ -204,16 +199,15 @@ static int init(struct ao *ao)
if (p->cfg_oss_mixer_channel && p->cfg_oss_mixer_channel[0])
mchan = p->cfg_oss_mixer_channel;
mp_msg(MSGT_AO, MSGL_V, "ao2: %d Hz %d chans %s\n", ao->samplerate,
ao->channels.num, af_fmt2str_short(ao->format));
MP_VERBOSE(ao, "%d Hz %d chans %s\n", ao->samplerate,
ao->channels.num, af_fmt2str_short(ao->format));
if (mchan) {
int fd, devs, i;
if ((fd = open(p->oss_mixer_device, O_RDONLY)) == -1) {
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AO OSS] audio_setup: Can't open mixer device %s: %s\n",
p->oss_mixer_device, strerror(errno));
MP_ERR(ao, "Can't open mixer device %s: %s\n",
p->oss_mixer_device, strerror(errno));
} else {
ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
close(fd);
@@ -221,9 +215,8 @@ static int init(struct ao *ao)
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (!strcasecmp(mixer_channels[i], mchan)) {
if (!(devs & (1 << i))) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: "
"Audio card mixer does not have channel '%s', "
"using default.\n", mchan);
MP_ERR(ao, "Audio card mixer does not have "
"channel '%s', using default.\n", mchan);
i = SOUND_MIXER_NRDEVICES + 1;
break;
}
@@ -232,20 +225,17 @@ static int init(struct ao *ao)
}
}
if (i == SOUND_MIXER_NRDEVICES) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Audio card "
"mixer does not have channel '%s', using default.\n",
mchan);
MP_ERR(ao, "Audio card mixer does not have "
"channel '%s', using default.\n", mchan);
}
}
} else {
p->oss_mixer_channel = SOUND_MIXER_PCM;
}
mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' dsp device\n", p->dsp);
mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' mixer device\n",
p->oss_mixer_device);
mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' mixer device\n",
mixer_channels[p->oss_mixer_channel]);
MP_VERBOSE(ao, "using '%s' dsp device\n", p->dsp);
MP_VERBOSE(ao, "using '%s' mixer device\n", p->oss_mixer_device);
MP_VERBOSE(ao, "using '%s' mixer device\n", mixer_channels[p->oss_mixer_channel]);
#ifdef __linux__
p->audio_fd = open(p->dsp, O_WRONLY | O_NONBLOCK);
@@ -253,17 +243,14 @@ static int init(struct ao *ao)
p->audio_fd = open(p->dsp, O_WRONLY);
#endif
if (p->audio_fd < 0) {
mp_tmsg(MSGT_AO, MSGL_ERR,
"[AO OSS] audio_setup: Can't open audio device %s: %s\n",
p->dsp, strerror(errno));
MP_ERR(ao, "Can't open audio device %s: %s\n", p->dsp, strerror(errno));
return -1;
}
#ifdef __linux__
/* Remove the non-blocking flag */
if (fcntl(p->audio_fd, F_SETFL, 0) < 0) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Can't make file "
"descriptor blocking: %s\n", strerror(errno));
MP_ERR(ao, "Can't make file descriptor blocking: %s\n", strerror(errno));
return -1;
}
#endif
@@ -281,6 +268,8 @@ ac3_retry:
ao->format = AF_FORMAT_AC3_NE;
oss_format = format2oss(ao->format);
if (oss_format == -1) {
MP_VERBOSE(ao, "Unknown/not supported internal format: %s\n",
af_fmt2str_short(ao->format));
#if BYTE_ORDER == BIG_ENDIAN
oss_format = AFMT_S16_BE;
#else
@@ -291,19 +280,20 @@ ac3_retry:
if (ioctl(p->audio_fd, SNDCTL_DSP_SETFMT, &oss_format) < 0 ||
oss_format != format2oss(ao->format))
{
mp_tmsg(MSGT_AO, MSGL_WARN, "[AO OSS] Can't set audio device %s to %s "
"output, trying %s...\n", p->dsp, af_fmt2str_short(ao->format),
MP_WARN(ao, "Can't set audio device %s to %s output, trying %s...\n",
p->dsp, af_fmt2str_short(ao->format),
af_fmt2str_short(AF_FORMAT_S16_NE));
ao->format = AF_FORMAT_S16_NE;
goto ac3_retry;
}
ao->format = oss2format(oss_format);
if (ao->format == -1)
if (ao->format == -1) {
MP_ERR(ao, "Unknown/Unsupported OSS format: %x.\n", oss_format);
return -1;
}
mp_msg(MSGT_AO, MSGL_V, "audio_setup: sample format: %s\n",
af_fmt2str_short(ao->format));
MP_VERBOSE(ao, "sample format: %s\n", af_fmt2str_short(ao->format));
if (!AF_FORMAT_IS_AC3(ao->format)) {
struct mp_chmap_sel sel = {0};
@@ -317,45 +307,39 @@ ac3_retry:
if (ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1 ||
nchannels != reqchannels)
{
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Failed to "
"set audio device to %d channels.\n", reqchannels);
MP_ERR(ao, "Failed to set audio device to %d channels.\n",
reqchannels);
return -1;
}
} else {
int c = reqchannels - 1;
if (ioctl(p->audio_fd, SNDCTL_DSP_STEREO, &c) == -1) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Failed to "
"set audio device to %d channels.\n", reqchannels);
MP_ERR(ao, "Failed to set audio device to %d channels.\n",
reqchannels);
return -1;
}
if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, c + 1))
return -1;
}
mp_msg(MSGT_AO, MSGL_V,
"audio_setup: using %d channels (requested: %d)\n",
ao->channels.num, reqchannels);
MP_VERBOSE(ao, "using %d channels (requested: %d)\n",
ao->channels.num, reqchannels);
// set rate
ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate);
mp_msg(MSGT_AO, MSGL_V, "audio_setup: using %d Hz samplerate\n",
ao->samplerate);
MP_VERBOSE(ao, "using %d Hz samplerate\n", ao->samplerate);
}
if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &p->zz) == -1) {
int r = 0;
mp_tmsg(MSGT_AO, MSGL_WARN, "[AO OSS] audio_setup: driver doesn't "
"support SNDCTL_DSP_GETOSPACE\n");
MP_WARN(ao, "driver doesn't support SNDCTL_DSP_GETOSPACE\n");
if (ioctl(p->audio_fd, SNDCTL_DSP_GETBLKSIZE, &r) == -1)
mp_msg(MSGT_AO, MSGL_V, "audio_setup: %d bytes/frag (config.h)\n",
p->outburst);
MP_VERBOSE(ao, "%d bytes/frag (config.h)\n", p->outburst);
else {
p->outburst = r;
mp_msg(MSGT_AO, MSGL_V, "audio_setup: %d bytes/frag (GETBLKSIZE)\n",
p->outburst);
MP_VERBOSE(ao, "%d bytes/frag (GETBLKSIZE)\n", p->outburst);
}
} else {
mp_msg(MSGT_AO, MSGL_V,
"audio_setup: frags: %3d/%d (%d bytes/frag) free: %6d\n",
p->zz.fragments, p->zz.fragstotal, p->zz.fragsize, p->zz.bytes);
MP_VERBOSE(ao, "frags: %3d/%d (%d bytes/frag) free: %6d\n",
p->zz.fragments, p->zz.fragstotal, p->zz.fragsize, p->zz.bytes);
p->buffersize = p->zz.bytes;
p->outburst = p->zz.fragsize;
}
@@ -381,9 +365,8 @@ ac3_retry:
}
free(data);
if (p->buffersize == 0) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS]\n *** Your audio driver "
"DOES NOT support select() ***\n Recompile mpv with "
"#undef HAVE_AUDIO_SELECT in config.h !\n\n");
MP_ERR(ao, "*** Your audio driver DOES NOT support select() ***\n");
MP_ERR(ao, "Recompile mpv with #undef HAVE_AUDIO_SELECT in config.h!\n");
return -1;
}
#endif
@@ -433,8 +416,8 @@ static void reset(struct ao *ao)
close_device(ao);
p->audio_fd = open(p->dsp, O_WRONLY);
if (p->audio_fd < 0) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS]\nFatal error: *** CANNOT "
"RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
MP_ERR(ao, "Fatal error: *** CANNOT "
"RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
return;
}
@@ -493,7 +476,11 @@ static void audio_pause(struct ao *ao)
{
struct priv *p = ao->priv;
p->prepause_space = get_space(ao);
#ifdef SNDCTL_DSP_RESET
ioctl(p->audio_fd, SNDCTL_DSP_RESET, NULL);
#else
close_device(ao);
#endif
}
// plays 'len' bytes of 'data'
@@ -517,7 +504,9 @@ static void audio_resume(struct ao *ao)
{
struct priv *p = ao->priv;
int fillcnt;
#ifndef SNDCTL_DSP_RESET
reset(ao);
#endif
fillcnt = get_space(ao) - p->prepause_space;
if (fillcnt > 0 && !(ao->format & AF_FORMAT_SPECIAL_MASK)) {
void *silence = calloc(fillcnt, 1);
+6 -10
View File
@@ -141,19 +141,16 @@ static int init(struct ao *ao)
ao->bps = ao->channels.num * ao->samplerate * (af_fmt2bits(ao->format) / 8);
mp_tmsg(MSGT_AO, MSGL_INFO, "[AO PCM] File: %s (%s)\n"
"PCM: Samplerate: %d Hz Channels: %d Format: %s\n",
MP_INFO(ao, "File: %s (%s)\nPCM: Samplerate: %d Hz Channels: %d Format: %s\n",
priv->outputfilename,
priv->waveheader ? "WAVE" : "RAW PCM", ao->samplerate,
ao->channels.num, af_fmt2str_short(ao->format));
mp_tmsg(MSGT_AO, MSGL_INFO,
"[AO PCM] Info: Faster dumping is achieved with -no-video\n"
"[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).\n");
MP_INFO(ao, "Info: Faster dumping is achieved with -no-video\n");
MP_INFO(ao, "Info: To write WAVE files use -ao pcm:waveheader (default).\n");
priv->fp = fopen(priv->outputfilename, "wb");
if (!priv->fp) {
mp_tmsg(MSGT_AO, MSGL_ERR, "[AO PCM] Failed to open %s for writing!\n",
priv->outputfilename);
MP_ERR(ao, "Failed to open %s for writing!\n", priv->outputfilename);
return -1;
}
if (priv->waveheader) // Reserve space for wave header
@@ -177,11 +174,10 @@ static void uninit(struct ao *ao, bool cut_audio)
GetFileType((HANDLE)_get_osfhandle(_fileno(priv->fp)));
#endif
if (broken_seek || fseek(priv->fp, 0, SEEK_SET) != 0)
mp_msg(MSGT_AO, MSGL_ERR, "Could not seek to start, "
"WAV size headers not updated!\n");
MP_ERR(ao, "Could not seek to start, WAV size headers not updated!\n");
else {
if (priv->data_length > 0xfffff000) {
mp_msg(MSGT_AO, MSGL_ERR, "File larger than allowed for "
MP_ERR(ao, "File larger than allowed for "
"WAV files, may play truncated!\n");
priv->data_length = 0xfffff000;
}
+5 -6
View File
@@ -68,11 +68,11 @@ static const struct format_map format_maps[] = {
static bool check_pa_ret(int ret)
{
if (ret < 0) {
mp_msg(MSGT_AO, MSGL_ERR, "[portaudio] %s\n",
mp_msg(MSGT_AO, MSGL_ERR, "[ao/portaudio] %s\n",
Pa_GetErrorText(ret));
if (ret == paUnanticipatedHostError) {
const PaHostErrorInfo* hosterr = Pa_GetLastHostErrorInfo();
mp_msg(MSGT_AO, MSGL_ERR, "[portaudio] Host error: %s\n",
mp_msg(MSGT_AO, MSGL_ERR, "[ao/portaudio] Host error: %s\n",
hosterr->errorText);
}
return false;
@@ -121,7 +121,7 @@ static int find_device(const char *name)
}
}
if (found == paNoDevice && !help)
mp_msg(MSGT_AO, MSGL_WARN, "[portaudio] Device '%s' not found!\n",
mp_msg(MSGT_AO, MSGL_WARN, "[ao/portaudio] Device '%s' not found!\n",
name);
return found;
}
@@ -183,7 +183,7 @@ static int stream_callback(const void *input,
res = paComplete;
priv->play_remaining = false;
} else {
mp_msg(MSGT_AO, MSGL_ERR, "[portaudio] Buffer underflow!\n");
MP_ERR(ao, "Buffer underflow!\n");
}
fill_silence(output, len_bytes);
}
@@ -253,8 +253,7 @@ static int init(struct ao *ao)
fmt++;
}
if (!fmt->pa_format) {
mp_msg(MSGT_AO, MSGL_V,
"[portaudio] Unsupported format, using default.\n");
MP_VERBOSE(ao, "Unsupported format, using default.\n");
fmt = format_maps;
}
+40 -30
View File
@@ -57,9 +57,9 @@ struct priv {
char *cfg_sink;
};
#define GENERIC_ERR_MSG(ctx, str) \
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] "str": %s\n", \
pa_strerror(pa_context_errno(ctx)))
#define GENERIC_ERR_MSG(str) \
MP_ERR(ao, str": %s\n", \
pa_strerror(pa_context_errno(((struct priv *)ao->priv)->context)))
static void context_state_cb(pa_context *c, void *userdata)
{
@@ -232,6 +232,7 @@ static int init(struct ao *ao)
{
struct pa_sample_spec ss;
struct pa_channel_map map;
pa_proplist *proplist = NULL;
struct priv *priv = ao->priv;
char *host = priv->cfg_host && priv->cfg_host[0] ? priv->cfg_host : NULL;
char *sink = priv->cfg_sink && priv->cfg_sink[0] ? priv->cfg_sink : NULL;
@@ -247,20 +248,19 @@ static int init(struct ao *ao)
* hangs somewhen. */
if (strncmp(version, "0.9.1", 5) == 0 && version[5] >= '1'
&& version[5] <= '4') {
mp_msg(MSGT_AO, MSGL_WARN,
"[pulse] working around probably broken pause functionality,\n"
" see http://www.pulseaudio.org/ticket/440\n");
MP_WARN(ao, "working around probably broken pause functionality,\n"
" see http://www.pulseaudio.org/ticket/440\n");
priv->broken_pause = true;
}
if (!(priv->mainloop = pa_threaded_mainloop_new())) {
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Failed to allocate main loop\n");
MP_ERR(ao, "Failed to allocate main loop\n");
goto fail;
}
if (!(priv->context = pa_context_new(pa_threaded_mainloop_get_api(
priv->mainloop), PULSE_CLIENT_NAME))) {
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Failed to allocate context\n");
MP_ERR(ao, "Failed to allocate context\n");
goto fail;
}
@@ -286,8 +286,7 @@ static int init(struct ao *ao)
const struct format_map *fmt_map = format_maps;
while (fmt_map->mp_format != ao->format) {
if (fmt_map->mp_format == AF_FORMAT_UNKNOWN) {
mp_msg(MSGT_AO, MSGL_V,
"AO: [pulse] Unsupported format, using default\n");
MP_VERBOSE(ao, "Unsupported format, using default\n");
fmt_map = format_maps;
break;
}
@@ -297,17 +296,27 @@ static int init(struct ao *ao)
ss.format = fmt_map->pa_format;
if (!pa_sample_spec_valid(&ss)) {
mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Invalid sample spec\n");
goto fail;
MP_ERR(ao, "Invalid sample spec\n");
goto unlock_and_fail;
}
if (!select_chmap(ao, &map))
goto fail;
if (!(priv->stream = pa_stream_new(priv->context, "audio stream", &ss,
&map)))
goto unlock_and_fail;
if (!(proplist = pa_proplist_new())) {
MP_ERR(ao, "Failed to allocate proplist\n");
goto unlock_and_fail;
}
(void)pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, "video");
if (!(priv->stream = pa_stream_new_with_proplist(priv->context,
"audio stream", &ss,
&map, proplist)))
goto unlock_and_fail;
pa_proplist_free(proplist);
proplist = NULL;
pa_stream_set_state_callback(priv->stream, stream_state_cb, ao);
pa_stream_set_write_callback(priv->stream, stream_request_cb, ao);
pa_stream_set_latency_update_callback(priv->stream,
@@ -342,8 +351,12 @@ fail:
if (priv->context) {
if (!(pa_context_errno(priv->context) == PA_ERR_CONNECTIONREFUSED
&& ao->probing))
GENERIC_ERR_MSG(priv->context, "Init failed");
GENERIC_ERR_MSG("Init failed");
}
if (proplist)
pa_proplist_free(proplist);
uninit(ao, true);
return -1;
}
@@ -355,7 +368,7 @@ static void cork(struct ao *ao, bool pause)
priv->retval = 0;
if (!waitop(priv, pa_stream_cork(priv->stream, pause, success_cb, ao)) ||
!priv->retval)
GENERIC_ERR_MSG(priv->context, "pa_stream_cork() failed");
GENERIC_ERR_MSG("pa_stream_cork() failed");
}
// Play the specified data to the pulseaudio server
@@ -365,7 +378,7 @@ static int play(struct ao *ao, void *data, int len, int flags)
pa_threaded_mainloop_lock(priv->mainloop);
if (pa_stream_write(priv->stream, data, len, NULL, 0,
PA_SEEK_RELATIVE) < 0) {
GENERIC_ERR_MSG(priv->context, "pa_stream_write() failed");
GENERIC_ERR_MSG("pa_stream_write() failed");
len = -1;
}
if (flags & AOPLAY_FINAL_CHUNK) {
@@ -387,7 +400,7 @@ static void reset(struct ao *ao)
priv->retval = 0;
if (!waitop(priv, pa_stream_flush(priv->stream, success_cb, ao)) ||
!priv->retval)
GENERIC_ERR_MSG(priv->context, "pa_stream_flush() failed");
GENERIC_ERR_MSG("pa_stream_flush() failed");
cork(ao, false);
}
@@ -438,20 +451,20 @@ static float get_delay(struct ao *ao)
struct priv *priv = ao->priv;
pa_threaded_mainloop_lock(priv->mainloop);
if (!waitop(priv, pa_stream_update_timing_info(priv->stream, NULL, NULL))) {
GENERIC_ERR_MSG(priv->context, "pa_stream_update_timing_info() failed");
GENERIC_ERR_MSG("pa_stream_update_timing_info() failed");
return 0;
}
pa_threaded_mainloop_lock(priv->mainloop);
const pa_timing_info *ti = pa_stream_get_timing_info(priv->stream);
if (!ti) {
pa_threaded_mainloop_unlock(priv->mainloop);
GENERIC_ERR_MSG(priv->context, "pa_stream_get_timing_info() failed");
GENERIC_ERR_MSG("pa_stream_get_timing_info() failed");
return 0;
}
const struct pa_sample_spec *ss = pa_stream_get_sample_spec(priv->stream);
if (!ss) {
pa_threaded_mainloop_unlock(priv->mainloop);
GENERIC_ERR_MSG(priv->context, "pa_stream_get_sample_spec() failed");
GENERIC_ERR_MSG("pa_stream_get_sample_spec() failed");
return 0;
}
// data left in PulseAudio's main buffers (not written to sink yet)
@@ -485,7 +498,7 @@ static void info_func(struct pa_context *c, const struct pa_sink_input_info *i,
struct ao *ao = userdata;
struct priv *priv = ao->priv;
if (is_last < 0) {
GENERIC_ERR_MSG(priv->context, "Failed to get sink input info");
GENERIC_ERR_MSG("Failed to get sink input info");
return;
}
if (!i)
@@ -504,8 +517,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
pa_threaded_mainloop_lock(priv->mainloop);
if (!waitop(priv, pa_context_get_sink_input_info(priv->context, devidx,
info_func, ao))) {
GENERIC_ERR_MSG(priv->context,
"pa_stream_get_sink_input_info() failed");
GENERIC_ERR_MSG("pa_stream_get_sink_input_info() failed");
return CONTROL_ERROR;
}
// Warning: some information in pi might be unaccessible, because
@@ -548,8 +560,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
&volume, NULL, NULL);
if (!o) {
pa_threaded_mainloop_unlock(priv->mainloop);
GENERIC_ERR_MSG(priv->context,
"pa_context_set_sink_input_volume() failed");
GENERIC_ERR_MSG("pa_context_set_sink_input_volume() failed");
return CONTROL_ERROR;
}
} else if (cmd == AOCONTROL_SET_MUTE) {
@@ -558,8 +569,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
*mute, NULL, NULL);
if (!o) {
pa_threaded_mainloop_unlock(priv->mainloop);
GENERIC_ERR_MSG(priv->context,
"pa_context_set_sink_input_mute() failed");
GENERIC_ERR_MSG("pa_context_set_sink_input_mute() failed");
return CONTROL_ERROR;
}
} else
+14 -16
View File
@@ -124,7 +124,7 @@ static unsigned int ceil_power_of_two(unsigned int x)
static int init(struct ao *ao)
{
if (SDL_WasInit(SDL_INIT_AUDIO)) {
mp_msg(MSGT_AO, MSGL_ERR, "[sdl] already initialized\n");
MP_ERR(ao, "already initialized\n");
return -1;
}
@@ -132,7 +132,7 @@ static int init(struct ao *ao)
if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
if (!ao->probing)
mp_msg(MSGT_AO, MSGL_ERR, "[sdl] SDL_Init failed\n");
MP_ERR(ao, "SDL_Init failed\n");
uninit(ao, true);
return -1;
}
@@ -174,24 +174,23 @@ static int init(struct ao *ao)
desired.callback = audio_callback;
desired.userdata = ao;
mp_msg(MSGT_AO, MSGL_V, "[sdl] requested format: %d Hz, %d channels, %x, "
"buffer size: %d samples\n",
(int) desired.freq, (int) desired.channels,
(int) desired.format, (int) desired.samples);
MP_VERBOSE(ao, "requested format: %d Hz, %d channels, %x, "
"buffer size: %d samples\n",
(int) desired.freq, (int) desired.channels,
(int) desired.format, (int) desired.samples);
obtained = desired;
if (SDL_OpenAudio(&desired, &obtained)) {
if (!ao->probing)
mp_msg(MSGT_AO, MSGL_ERR, "[sdl] could not open audio: %s\n",
SDL_GetError());
MP_ERR(ao, "could not open audio: %s\n", SDL_GetError());
uninit(ao, true);
return -1;
}
mp_msg(MSGT_AO, MSGL_V, "[sdl] obtained format: %d Hz, %d channels, %x, "
"buffer size: %d samples\n",
(int) obtained.freq, (int) obtained.channels,
(int) obtained.format, (int) obtained.samples);
MP_VERBOSE(ao, "obtained format: %d Hz, %d channels, %x, "
"buffer size: %d samples\n",
(int) obtained.freq, (int) obtained.channels,
(int) obtained.format, (int) obtained.samples);
switch (obtained.format) {
case AUDIO_U8: ao->format = AF_FORMAT_U8; break;
@@ -214,8 +213,7 @@ static int init(struct ao *ao)
#endif
default:
if (!ao->probing)
mp_msg(MSGT_AO, MSGL_ERR,
"[sdl] could not find matching format\n");
MP_ERR(ao, "could not find matching format\n");
uninit(ao, true);
return -1;
}
@@ -229,13 +227,13 @@ static int init(struct ao *ao)
priv->buffer = av_fifo_alloc(obtained.size * priv->bufcnt);
priv->buffer_mutex = SDL_CreateMutex();
if (!priv->buffer_mutex) {
mp_msg(MSGT_AO, MSGL_ERR, "[sdl] SDL_CreateMutex failed\n");
MP_ERR(ao, "SDL_CreateMutex failed\n");
uninit(ao, true);
return -1;
}
priv->underrun_cond = SDL_CreateCond();
if (!priv->underrun_cond) {
mp_msg(MSGT_AO, MSGL_ERR, "[sdl] SDL_CreateCond failed\n");
MP_ERR(ao, "SDL_CreateCond failed\n");
uninit(ao, true);
return -1;
}
+340
View File
@@ -0,0 +1,340 @@
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
* Copyright (c) 2013 Christian Neukirchen <chneukirchen@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <sys/types.h>
#include <poll.h>
#include <errno.h>
#include <sndio.h>
#include "mpvcore/m_option.h"
#include "mpvcore/mp_msg.h"
#include "audio/format.h"
#include "ao.h"
struct priv {
struct sio_hdl *hdl;
struct sio_par par;
int delay;
int vol;
int havevol;
#define SILENCE_NMAX 0x1000
char silence[SILENCE_NMAX];
struct pollfd *pfd;
char *dev;
};
/*
* misc parameters (volume, etc...)
*/
static int control(struct ao *ao, enum aocontrol cmd, void *arg)
{
struct priv *p = ao->priv;
ao_control_vol_t *vol = arg;
switch (cmd) {
case AOCONTROL_GET_VOLUME:
if (!p->havevol)
return CONTROL_FALSE;
vol->left = vol->right = p->vol * 100 / SIO_MAXVOL;
break;
case AOCONTROL_SET_VOLUME:
if (!p->havevol)
return CONTROL_FALSE;
sio_setvol(p->hdl, vol->left * SIO_MAXVOL / 100);
break;
default:
return CONTROL_UNKNOWN;
}
return CONTROL_OK;
}
/*
* call-back invoked to notify of the hardware position
*/
static void movecb(void *addr, int delta)
{
struct priv *p = addr;
p->delay -= delta * (int)(p->par.bps * p->par.pchan);
}
/*
* call-back invoked to notify about volume changes
*/
static void volcb(void *addr, unsigned newvol)
{
struct priv *p = addr;
p->vol = newvol;
}
static const struct mp_chmap sndio_layouts[MP_NUM_CHANNELS + 1] = {
{0}, // empty
{1, {MP_SPEAKER_ID_FL}}, // mono
MP_CHMAP2(FL, FR), // stereo
{0}, // 2.1
MP_CHMAP4(FL, FR, BL, BR), // 4.0
{0}, // 5.0
MP_CHMAP6(FL, FR, BL, BR, FC, LFE), // 5.1
{0}, // 6.1
MP_CHMAP8(FL, FR, BL, BR, FC, LFE, SL, SR), // 7.1
/* above is the fixed channel assignment for sndio, since we need to fill
all channels and cannot insert silence, not all layouts are supported. */
};
/*
* open device and setup parameters
* return: 0=success -1=fail
*/
static int init(struct ao *ao)
{
struct priv *p = ao->priv;
struct af_to_par {
int format, bits, sig, le;
} static const af_to_par[] = {
{AF_FORMAT_U8, 8, 0, 0},
{AF_FORMAT_S8, 8, 1, 0},
{AF_FORMAT_U16_LE, 16, 0, 1},
{AF_FORMAT_U16_BE, 16, 0, 0},
{AF_FORMAT_S16_LE, 16, 1, 1},
{AF_FORMAT_S16_BE, 16, 1, 0},
{AF_FORMAT_U24_LE, 16, 0, 1},
{AF_FORMAT_U24_BE, 24, 0, 0},
{AF_FORMAT_S24_LE, 24, 1, 1},
{AF_FORMAT_S24_BE, 24, 1, 0},
{AF_FORMAT_U32_LE, 32, 0, 1},
{AF_FORMAT_U32_BE, 32, 0, 0},
{AF_FORMAT_S32_LE, 32, 1, 1},
{AF_FORMAT_S32_BE, 32, 1, 0}
}, *ap;
int i;
p->hdl = sio_open(p->dev, SIO_PLAY, 0);
if (p->hdl == NULL) {
MP_ERR(ao, "can't open sndio %s\n", p->dev);
goto error;
}
sio_initpar(&p->par);
for (i = 0, ap = af_to_par;; i++, ap++) {
if (i == sizeof(af_to_par) / sizeof(struct af_to_par)) {
MP_VERBOSE(ao, "unsupported format\n");
p->par.bits = 16;
p->par.sig = 1;
p->par.le = SIO_LE_NATIVE;
break;
}
if (ap->format == ao->format) {
p->par.bits = ap->bits;
p->par.sig = ap->sig;
if (ap->bits > 8)
p->par.le = ap->le;
if (ap->bits != SIO_BPS(ap->bits))
p->par.bps = ap->bits / 8;
break;
}
}
p->par.rate = ao->samplerate;
struct mp_chmap_sel sel = {0};
for (int n = 0; n < MP_NUM_CHANNELS+1; n++)
mp_chmap_sel_add_map(&sel, &sndio_layouts[n]);
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
goto error;
p->par.pchan = ao->channels.num;
p->par.appbufsz = p->par.rate * 250 / 1000; /* 250ms buffer */
p->par.round = p->par.rate * 10 / 1000; /* 10ms block size */
if (!sio_setpar(p->hdl, &p->par)) {
MP_ERR(ao, "couldn't set params\n");
goto error;
}
if (!sio_getpar(p->hdl, &p->par)) {
MP_ERR(ao, "couldn't get params\n");
goto error;
}
if (p->par.bits == 8 && p->par.bps == 1) {
ao->format = p->par.sig ? AF_FORMAT_S8 : AF_FORMAT_U8;
} else if (p->par.bits == 16 && p->par.bps == 2) {
ao->format = p->par.sig ?
(p->par.le ? AF_FORMAT_S16_LE : AF_FORMAT_S16_BE) :
(p->par.le ? AF_FORMAT_U16_LE : AF_FORMAT_U16_BE);
} else if ((p->par.bits == 24 || p->par.msb) && p->par.bps == 3) {
ao->format = p->par.sig ?
(p->par.le ? AF_FORMAT_S24_LE : AF_FORMAT_S24_BE) :
(p->par.le ? AF_FORMAT_U24_LE : AF_FORMAT_U24_BE);
} else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4) {
ao->format = p->par.sig ?
(p->par.le ? AF_FORMAT_S32_LE : AF_FORMAT_S32_BE) :
(p->par.le ? AF_FORMAT_U32_LE : AF_FORMAT_U32_BE);
} else {
MP_ERR(ao, "couldn't set format\n");
goto error;
}
ao->bps = p->par.bps * p->par.pchan * p->par.rate;
ao->no_persistent_volume = true;
p->havevol = sio_onvol(p->hdl, volcb, p);
sio_onmove(p->hdl, movecb, p);
p->delay = 0;
if (!sio_start(p->hdl))
MP_ERR(ao, "init: couldn't start\n");
p->pfd = calloc (sio_nfds(p->hdl), sizeof (struct pollfd));
if (!p->pfd)
goto error;
return 0;
error:
if (p->hdl)
sio_close(p->hdl);
return -1;
}
/*
* close device
*/
static void uninit(struct ao *ao, bool immed)
{
struct priv *p = ao->priv;
if (p->hdl)
sio_close(p->hdl);
free(p->pfd);
}
/*
* stop playing and empty buffers (for seeking/pause)
*/
static void reset(struct ao *ao)
{
struct priv *p = ao->priv;
if (!sio_stop(p->hdl))
MP_ERR(ao, "reset: couldn't stop\n");
p->delay = 0;
if (!sio_start(p->hdl))
MP_ERR(ao, "reset: couldn't start\n");
}
/*
* play given number of bytes until sio_write() blocks
*/
static int play(struct ao *ao, void *data, int len, int flags)
{
struct priv *p = ao->priv;
int n;
n = sio_write(p->hdl, data, len);
p->delay += n;
if (flags & AOPLAY_FINAL_CHUNK)
reset(ao);
return n;
}
/*
* how many bytes can be played without blocking
*/
static int get_space(struct ao *ao)
{
struct priv *p = ao->priv;
int n;
/*
* call poll() and sio_revents(), so the
* delay counter is updated
*/
n = sio_pollfd(p->hdl, p->pfd, POLLOUT);
while (poll(p->pfd, n, 0) < 0 && errno == EINTR)
; /* nothing */
sio_revents(p->hdl, p->pfd);
return p->par.bufsz * p->par.pchan * p->par.bps - p->delay;
}
/*
* return: delay in seconds between first and last sample in buffer
*/
static float get_delay(struct ao *ao)
{
struct priv *p = ao->priv;
return (float)p->delay / (p->par.bps * p->par.pchan * p->par.rate);
}
/*
* stop playing, keep buffers (for pause)
*/
static void audio_pause(struct ao *ao)
{
reset(ao);
}
/*
* resume playing, after audio_pause()
*/
static void audio_resume(struct ao *ao)
{
struct priv *p = ao->priv;
int n, count, todo;
/*
* we want to start with buffers full, because mplayer uses
* get_space() pointer as clock, which would cause video to
* accelerate while buffers are filled.
*/
todo = p->par.bufsz * p->par.pchan * p->par.bps;
while (todo > 0) {
count = todo;
if (count > SILENCE_NMAX)
count = SILENCE_NMAX;
n = sio_write(p->hdl, p->silence, count);
if (n == 0)
break;
todo -= n;
p->delay += n;
}
}
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_sndio = {
.info = &(const struct ao_info) {
"sndio audio output",
"sndio",
"Alexandre Ratchov <alex@caoua.org>, Christian Neukirchen <chneukirchen@gmail.com>",
"under development"
},
.init = init,
.uninit = uninit,
.control = control,
.get_space = get_space,
.play = play,
.get_delay = get_delay,
.pause = audio_pause,
.resume = audio_resume,
.reset = reset,
.priv_size = sizeof(struct priv),
.options = (const struct m_option[]) {
OPT_STRING("device", dev, 0, OPTDEF_STR(SIO_DEVANY)),
{0}
},
};
Vendored
+270 -40
View File
@@ -286,12 +286,16 @@ Installation directories:
--datadir=DIR directory for installing machine independent
data files (skins, etc) [PREFIX/share/mpv]
--mandir=DIR directory for installing man pages [PREFIX/share/man]
--docdir=DIR directory for installing docs [PREFIX/share/doc/mpv]
--confdir=DIR directory for installing configuration files
[PREFIX/etc/mpv]
--localedir=DIR directory for gettext locales [PREFIX/share/locale]
Optional features:
--disable-encoding disable encoding functionality [enable]
--disable-lua disable Lua scripting support [autodetect]
--lua=LUA select Lua package which should be autodetected
Choices: 51 51deb 52 52deb luajit
--disable-libguess disable libguess [autodetect]
--enable-terminfo use terminfo database for key codes [autodetect]
--enable-termcap use termcap database for key codes [autodetect]
@@ -316,16 +320,15 @@ Optional features:
--disable-bluray disable Blu-ray support [autodetect]
--disable-dvdread disable libdvdread [autodetect]
--disable-enca disable ENCA charset oracle library [autodetect]
--enable-macosx-bundle enable Mac OS X bundle file locations [autodetect]
--disable-pthreads disable Posix threads support [autodetect]
--disable-libass disable subtitle rendering with libass [autodetect]
--disable-libass-osd disable OSD rendering with libass [autodetect]
--enable-rpath enable runtime linker path for extra libs [disabled]
--disable-libpostproc disable postprocess filter (vf_pp) [autodetect]
--disable-libavdevice enable libavdevice demuxers [autodetect]
--disable-libavfilter enable libavfilter [autodetect]
--disable-vf-lavfi enable vf_lavfi libavfilter bridge [audodetect]
--disable-af-lavfi enable af_lavfi libavfilter bridge [audodetect]
--disable-libavdevice disable libavdevice demuxers [autodetect]
--disable-libavfilter disable libavfilter [autodetect]
--disable-vf-lavfi disable vf_lavfi libavfilter bridge [audodetect]
--disable-af-lavfi disable af_lavfi libavfilter bridge [audodetect]
Codecs:
--enable-mng enable MNG input support [autodetect]
@@ -347,6 +350,8 @@ Video output:
--enable-sdl2 enable SDL 2.0+ audio and video output [disable]
--enable-xv enable Xv video output [autodetect]
--enable-vdpau enable VDPAU acceleration [autodetect]
--enable-vda enable VDA acceleration [autodetect]
--enable-vaapi enable VAAPI acceleration [autodetect]
--enable-vm enable XF86VidMode support [autodetect]
--enable-xinerama enable Xinerama support [autodetect]
--enable-x11 enable X11 video output [autodetect]
@@ -359,6 +364,7 @@ Audio output:
--disable-alsa disable ALSA audio output [autodetect]
--disable-ossaudio disable OSS audio output [autodetect]
--disable-rsound disable RSound audio output [autodetect]
--disable-sndio disable sndio audio output [autodetect]
--disable-pulse disable Pulseaudio audio output [autodetect]
--disable-portaudio disable PortAudio audio output [autodetect]
--disable-jack disable JACK audio output [autodetect]
@@ -380,6 +386,7 @@ Miscellaneous options:
--enable-static build a statically linked binary
--with-install=PATH path to a custom install program
--disable-manpage do not build and install manpage [auto]
--disable-pdf do not build and install PDF manual [auto]
--disable-build-date do not include binary compile time
Advanced options:
@@ -421,6 +428,9 @@ _wayland=auto
_xss=auto
_xv=auto
_vdpau=auto
_vda=auto
_vda_refcounting=auto
_vaapi=auto
_direct3d=auto
_sdl=no
_sdl2=no
@@ -450,6 +460,7 @@ _lcms2=auto
_xinerama=auto
_vm=auto
_xf86keysym=auto
_sndio=auto
_alsa=auto
_select=yes
_radio=no
@@ -474,12 +485,12 @@ _cdda=auto
_coreaudio=auto
_corevideo=auto
_cocoa=auto
_macosx_bundle=auto
_enca=auto
_pthreads=auto
_ass=auto
_libass_osd=auto
_rpath=no
lua=auto
libpostproc=auto
libavfilter=auto
vf_lavfi=auto
@@ -490,6 +501,7 @@ _priority=no
def_dos_paths="#define HAVE_DOS_PATHS 0"
def_priority="#undef CONFIG_PRIORITY"
_build_man=auto
_build_pdf=auto
_build_date=yes
for ac_option do
case "$ac_option" in
@@ -505,6 +517,9 @@ for ac_option do
--mandir=*)
_mandir=$(echo $ac_option | cut -d '=' -f 2)
;;
--docdir=*)
_docdir=$(echo $ac_option | cut -d '=' -f 2)
;;
--confdir=*)
_confdir=$(echo $ac_option | cut -d '=' -f 2)
;;
@@ -582,6 +597,10 @@ for ac_option do
--disable-xv) _xv=no ;;
--enable-vdpau) _vdpau=yes ;;
--disable-vdpau) _vdpau=no ;;
--enable-vda) _vda=yes ;;
--disable-vda) _vda=no ;;
--enable-vaapi) _vaapi=yes ;;
--disable-vaapi) _vaapi=no ;;
--enable-direct3d) _direct3d=yes ;;
--disable-direct3d) _direct3d=no ;;
--enable-sdl) _sdl=yes ;;
@@ -608,6 +627,8 @@ for ac_option do
--disable-ossaudio) _ossaudio=no ;;
--enable-rsound) _rsound=yes ;;
--disable-rsound) _rsound=no ;;
--enable-sndio) _sndio=yes ;;
--disable-sndio) _sndio=no ;;
--enable-pulse) _pulse=yes ;;
--disable-pulse) _pulse=no ;;
--enable-portaudio) _portaudio=yes ;;
@@ -666,6 +687,9 @@ for ac_option do
--disable-libavresample) _disable_avresample=yes ;;
--enable-libavresample) _disable_avresample=no ;;
--enable-lua) lua=yes ;;
--disable-lua) lua=no ;;
--lua=*) lua_pkg=$(echo $ac_option | cut -d '=' -f 2) ;;
--enable-lirc) _lirc=yes ;;
--disable-lirc) _lirc=no ;;
--enable-lircc) _lircc=yes ;;
@@ -708,11 +732,11 @@ for ac_option do
--disable-corevideo) _corevideo=no ;;
--enable-cocoa) _cocoa=yes ;;
--disable-cocoa) _cocoa=no ;;
--enable-macosx-bundle) _macosx_bundle=yes ;;
--disable-macosx-bundle) _macosx_bundle=no ;;
--enable-manpage) _build_man=yes ;;
--disable-manpage) _build_man=no ;;
--enable-pdf) _build_pdf=yes ;;
--disable-pdf) _build_pdf=no ;;
--enable-build-date) _build_date=yes ;;
--disable-build-date) _build_date=no ;;
@@ -727,6 +751,7 @@ done
# Atmos: moved this here, to be correct, if --prefix is specified
test -z "$_bindir" && _bindir="$_prefix/bin"
test -z "$_mandir" && _mandir="$_prefix/share/man"
test -z "$_docdir" && _docdir="$_prefix/share/doc/mpv"
test -z "$_confdir" && _confdir="$_prefix/etc/mpv"
test -z "$_localedir" && _localedir="$_prefix/share/locale"
@@ -920,6 +945,24 @@ else
fi
echores "$_build_man"
_rst2latex=rst2latex
if [ -f "$(which rst2latex.py)" ] ; then
_rst2latex=rst2latex.py
fi
echocheck "whether to build manual PDFs with rst2latex"
texcheck() {
echo test | $_rst2latex --config=DOCS/man/docutils.conf | pdflatex -halt-on-error -draftmode -output-directory="$mplayer_tmpdir"
}
if test "$_build_pdf" = auto ; then
_build_pdf=no
command_check texcheck && _build_pdf=yes
else
_build_pdf=no
fi
echores "$_build_pdf"
echocheck "whether to print binary build date"
if test "$_build_date" = yes ; then
_build_yes=yes
@@ -1547,19 +1590,6 @@ fi
echores "$_sys_sysinfo"
if darwin; then
echocheck "Mac OS X Bundle file locations"
def_macosx_bundle='#undef CONFIG_MACOSX_BUNDLE'
test "$_macosx_bundle" = auto
if test "$_macosx_bundle" = yes ; then
extra_ldflags="$extra_ldflags -headerpad_max_install_names"
def_macosx_bundle='#define CONFIG_MACOSX_BUNDLE 1'
fi
echores "$_macosx_bundle"
fi #if darwin
echocheck "pkg-config"
if $($_pkg_config --version > /dev/null 2>&1); then
if test "$_ld_static"; then
@@ -1694,17 +1724,24 @@ depends_on_application_services(){
fi #if darwin
_wlver="1.2.0"
echocheck "Wayland"
if test "$_wayland" != no; then
if test "$_wayland" = yes || test "$_wayland" = auto; then
_wayland="no"
pkg_config_add "wayland-client >= 1.0.0 wayland-egl >= 9.0.0 wayland-cursor >= 1.0.0 xkbcommon >= 0.3.0" \
&& _wayland="yes"
pkg_config_add "wayland-client >= $_wlver wayland-cursor >= $_wlver xkbcommon >= 0.3.0" \
&& _wayland="yes"
fi
if test "$_wayland" = yes; then
res_comment=""
def_wayland='#define CONFIG_WAYLAND'
vomodules="wayland $vomodules"
else
_wayland="no"
res_comment=""
res_comment="version >= $_wlver"
def_wayland='#undef CONFIG_WAYLAND'
novomodules="wayland $novomodules"
fi
echores "$_wayland"
unset _wlver
echocheck "X11 headers presence"
_x11_headers="no"
@@ -1845,6 +1882,34 @@ fi
echores "$_vdpau"
echocheck "VAAPI"
_vaapi_vpp=no
def_vaapi_vpp='#define CONFIG_VAAPI_VPP 0'
if test "$_vaapi" = auto && test "$_x11" = yes ; then
_vaapi=no
if test "$_dl" = yes ; then
pkg_config_add 'libva >= 0.32.0 libva-x11 >= 0.32.0' && _vaapi=yes
fi
fi
if test "$_vaapi" = yes ; then
def_vaapi='#define CONFIG_VAAPI 1'
vomodules="vaapi $vomodules"
else
def_vaapi='#define CONFIG_VAAPI 0'
novomodules="vaapi $novomodules"
fi
echores "$_vaapi"
if test "$_vaapi" = yes ; then
echocheck "VAAPI VPP"
if pkg-config 'libva >= 0.34.0' ; then
_vaapi_vpp=yes
def_vaapi_vpp='#define CONFIG_VAAPI_VPP 1'
fi
echores "$_vaapi_vpp"
fi
echocheck "Xinerama"
if test "$_xinerama" = auto && test "$_x11" = yes ; then
_xinerama=no
@@ -2016,7 +2081,8 @@ EOF
fi
done
fi
if test "$_wayland" = yes && cc_check -DGL_WAYLAND -lGL -lEGL ; then
if test "$_wayland" = yes && cc_check -DGL_WAYLAND -lGL -lEGL &&
pkg_config_add "wayland-egl >= 9.0.0"; then
_gl=yes
_gl_wayland=yes
libs_mplayer="$libs_mplayer -lGL -lEGL"
@@ -2261,6 +2327,23 @@ else
fi
echocheck "sndio"
if test "$_sndio" = auto ; then
_sndio=no
statement_check sndio.h 'struct sio_par par; sio_initpar(&par);' -lsndio && _sndio=yes
fi
echores "$_sndio"
if test "$_sndio" = yes ; then
def_sndio='#define CONFIG_SNDIO 1'
aomodules="sndio $_aomodules"
libs_mplayer="$libs_mplayer -lsndio"
else
def_sndio='#undef CONFIG_SNDIO'
noaomodules="sndio $_noaomodules"
fi
echocheck "pulse"
if test "$_pulse" = auto ; then
_pulse=no
@@ -2656,16 +2739,6 @@ if test "$_vdpau" = yes ; then
fi
fi
echocheck "libavcodec AV_CODEC_PROP_TEXT_SUB API"
_avcodec_has_text_flag_api=no
statement_check libavcodec/avcodec.h 'int x = AV_CODEC_PROP_TEXT_SUB' && _avcodec_has_text_flag_api=yes
if test "$_avcodec_has_text_flag_api" = yes ; then
def_avcodec_has_text_flag_api='#define HAVE_AV_CODEC_PROP_TEXT_SUB 1'
else
def_avcodec_has_text_flag_api='#define HAVE_AV_CODEC_PROP_TEXT_SUB 0'
fi
echores "$_avcodec_has_text_flag_api"
echocheck "libavcodec avcodec_enum_to_chroma_pos API"
_avcodec_has_chroma_pos_api=no
@@ -2803,6 +2876,44 @@ else
fi
echores "$libpostproc"
def_vda='#define CONFIG_VDA 0'
if darwin ; then
echocheck "VDA"
if test "$_vda" = auto ; then
_vda=no
if test "$_avutil_has_refcounting" = "yes" ; then
header_check VideoDecodeAcceleration/VDADecoder.h &&
statement_check libavcodec/vda.h 'ff_vda_create_decoder(NULL, NULL, NULL)' &&
_vda=yes
else
res_comment="libavutil too old"
fi
fi
if test "$_vda" = yes ; then
def_vda='#define CONFIG_VDA 1'
libs_mplayer="$libs_mplayer -framework VideoDecodeAcceleration -framework QuartzCore -framework IOSurface"
else
def_vda='#define CONFIG_VDA 0'
fi
echores "$_vda"
echocheck "VDA libavcodec refcounting"
_vda_refcounting=no
if test "$_vda" = yes ; then
statement_check libavcodec/vda.h 'struct vda_context a = (struct vda_context) { .use_ref_buffer = 1 }' &&
_vda_refcounting=yes
fi
if test "$_vda_refcounting" = "yes" ; then
def_vda_refcounting='#define HAVE_VDA_LIBAVCODEC_REFCOUNTING 1'
else
def_vda_refcounting='#define HAVE_VDA_LIBAVCODEC_REFCOUNTING 0'
fi
echores "$_vda_refcounting"
fi
echocheck "TV interface"
if test "$_tv" = yes ; then
@@ -2899,6 +3010,111 @@ fi
echores "$_pvr"
# Note: Lua has no official .pc file, so there are different OS-specific ones.
# Also, we support luajit, which is compatible to 5.1.
# The situation is further complicated by distros supporting multiple Lua
# versions, without ensuring libraries linking to conflicting Lua libs don't
# cause issues. This is a real problem with libquvi.
cat > $TMPC << EOF
#include <stdlib.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
EOF
# abuse $TMPH file as second temp file
cat > $TMPH << EOF
void test_lua(void) {
lua_State *L = luaL_newstate();
lua_pushstring(L, "test");
lua_setglobal(L, "test");
}
void test_other(void) {
EOF
# test all other Lua using packages (hack that gives us time)
if test "$_libquvi4" = yes ; then
echo "#include <quvi/quvi.h>" >> $TMPC
cat >> $TMPH << EOF
quvi_t q;
if (quvi_init(&q) == QUVI_OK)
quvi_supported(q, "http://nope");
EOF
fi
if test "$_libquvi9" = yes ; then
echo "#include <quvi.h>" >> $TMPC
cat >> $TMPH << EOF
quvi_t q = quvi_new();
if (quvi_ok(q))
quvi_supports(q, "http://nope", QUVI_SUPPORTS_MODE_OFFLINE, QUVI_SUPPORTS_TYPE_MEDIA);
EOF
fi
cat >> $TMPH << EOF
}
int main(void) {
test_lua();
test_other();
return 0;
}
EOF
cat $TMPH >> $TMPC
test_lua() {
# changed by pkg_config_add
old_extra_cflags="$extra_cflags"
old_libs_mplayer="$libs_mplayer"
echocheck "Lua $2 ($1)"
if test "$lua" = yes ; then
echores "no"
return 1
fi
if test "x$lua_pkg" != "x" && test "$lua_pkg" != "$1" ; then
echores "no"
return 1
fi
if pkg_config_add "$2" ; then
if test $_cross_compile = no ; then
if cc_check && tmp_run ; then
echo > /dev/null # idiot NOP
else
extra_cflags="$old_extra_cflags"
libs_mplayer="$old_libs_mplayer"
echores "no - does not run"
return 1
fi
fi
lua=yes
fi
echores "$lua"
test "$lua" = yes
return $?
}
if test "$lua" = auto ; then
lua=no
test_lua 51 "lua >= 5.1.0 lua < 5.2.0"
test_lua 51deb "lua5.1 >= 5.1.0" # debian
test_lua luajit "luajit >= 2.0.0"
# assume all our dependencies (libquvi in particular) link with 5.1
test_lua 52 "lua >= 5.2.0"
test_lua 52deb "lua5.2 >= 5.2.0" # debian
fi
if test "$lua" = yes ; then
def_lua='#define CONFIG_LUA 1'
else
def_lua='#undef CONFIG_LUA'
fi
echocheck "encoding"
if test "$_encoding" = yes ; then
def_encoding="#define CONFIG_ENCODING 1"
@@ -3010,6 +3226,7 @@ CONFIGURATION = $configuration
prefix = \$(DESTDIR)$_prefix
BINDIR = \$(DESTDIR)$_bindir
MANDIR = \$(DESTDIR)$_mandir
DOCDIR = \$(DESTDIR)$_docdir
CONFDIR = \$(DESTDIR)$_confdir
LOCALEDIR = \$(DESTDIR)$_localedir
@@ -3028,6 +3245,8 @@ GETCH = $_getch
TIMER = $_timer
RST2MAN = $_rst2man
BUILD_MAN = $_build_man
RST2LATEX = $_rst2latex
BUILD_PDF = $_build_pdf
EXESUF = $_exesuf
EXESUFS_ALL = .exe
@@ -3069,6 +3288,7 @@ DUMMY_OSD = $_dummy_osd
LIBBLURAY = $_bluray
LIBBS2B = $_libbs2b
LCMS2 = $_lcms2
LUA = $lua
LIBPOSTPROC = $libpostproc
LIBAVDEVICE = $libavdevice
LIBAVFILTER = $libavfilter
@@ -3079,7 +3299,6 @@ LIBQUVI = $_libquvi4
LIBQUVI9 = $_libquvi9
LIBGUESS = $_libguess
LIRC = $_lirc
MACOSX_BUNDLE = $_macosx_bundle
MNG = $_mng
MPG123 = $_mpg123
OPENAL = $_openal
@@ -3092,6 +3311,7 @@ PVR = $_pvr
RADIO=$_radio
RADIO_CAPTURE=$_radio_capture
RSOUND = $_rsound
SNDIO = $_sndio
STREAM_CACHE = $_stream_cache
TV = $_tv
TV_V4L2 = $_tv_v4l2
@@ -3099,6 +3319,10 @@ VCD = $_vcd
VDPAU = $_vdpau
VDPAU_DEC = $_vdpau_dec
VDPAU_DEC_OLD = $_vdpau_dec_old
VDA = $_vda
VDA_REFCOUNTING = $_vda_refcounting
VAAPI = $_vaapi
VAAPI_VPP = $_vaapi_vpp
WIN32 = $_win32
X11 = $_x11
WAYLAND = $_wayland
@@ -3108,6 +3332,8 @@ XV = $_xv
ENCODING = $_encoding
CONFIG_VDPAU = $_vdpau
CONFIG_VDA = $_vda
CONFIG_VAAPI = $_vaapi
CONFIG_ZLIB = $_zlib
HAVE_PTHREADS = $_pthreads
@@ -3165,7 +3391,6 @@ $def_termios
$def_dl
$def_dos_paths
$def_iconv
$def_macosx_bundle
$def_priority
@@ -3202,7 +3427,6 @@ $def_zlib
$def_avutil_has_refcounting
$def_avutil_has_qp_api
$def_avcodec_new_vdpau_api
$def_avcodec_has_text_flag_api
$def_avcodec_has_chroma_pos_api
$def_libpostproc
$def_libavdevice
@@ -3224,6 +3448,7 @@ $def_ossaudio_devmixer
$def_pulse
$def_portaudio
$def_rsound
$def_sndio
$def_ladspa
$def_libbs2b
@@ -3252,6 +3477,7 @@ $def_libquvi9
$def_libguess
$def_lcms2
$def_lua
/* libvo options */
@@ -3274,6 +3500,10 @@ $def_jpeg
$def_mng
$def_v4l2
$def_vdpau
$def_vda
$def_vda_refcounting
$def_vaapi
$def_vaapi_vpp
$def_vm
$def_x11
$def_wayland
+1
View File
@@ -312,6 +312,7 @@ static const struct mp_codec_tag mp_video_codec_tags[] = {
{MKTAG('V', 'Q', 'A', 'V'), "ws_vqa"},
{MKTAG('C', '9', '3', 'V'), "c93"},
{MKTAG('V', 'P', '9', '0'), "vp9"},
{MKTAG('p', 'r', '0', '0'), "prores"},
{0},
};
+84 -50
View File
@@ -59,6 +59,7 @@ extern const demuxer_desc_t demuxer_desc_lavf;
extern const demuxer_desc_t demuxer_desc_mng;
extern const demuxer_desc_t demuxer_desc_libass;
extern const demuxer_desc_t demuxer_desc_subreader;
extern const demuxer_desc_t demuxer_desc_playlist;
/* Please do not add any new demuxers here. If you want to implement a new
* demuxer, add it to libavformat, except for wrappers around external
@@ -77,12 +78,13 @@ const demuxer_desc_t *const demuxer_list[] = {
#endif
&demuxer_desc_matroska,
&demuxer_desc_lavf,
&demuxer_desc_subreader,
&demuxer_desc_mf,
#ifdef CONFIG_MNG
&demuxer_desc_mng,
#endif
// auto-probe last, because it checks file-extensions only
&demuxer_desc_mf,
&demuxer_desc_playlist,
// Pretty aggressive, so should be last.
&demuxer_desc_subreader,
/* Please do not add any new demuxers here. If you want to implement a new
* demuxer, add it to libavformat, except for wrappers around external
* libraries and demuxers requiring binary support. */
@@ -114,12 +116,11 @@ static void ds_free_packs(struct demux_stream *ds)
ds->eof = 0;
}
static int packet_destroy(void *ptr)
static void packet_destroy(void *ptr)
{
struct demux_packet *dp = ptr;
talloc_free(dp->avpacket);
free(dp->allocation);
return 0;
}
static struct demux_packet *create_packet(size_t len)
@@ -191,10 +192,9 @@ void free_demux_packet(struct demux_packet *dp)
talloc_free(dp);
}
static int destroy_avpacket(void *pkt)
static void destroy_avpacket(void *pkt)
{
av_free_packet(pkt);
return 0;
}
struct demux_packet *demux_copy_packet(struct demux_packet *dp)
@@ -309,6 +309,8 @@ static void free_sh_stream(struct sh_stream *sh)
void free_demuxer(demuxer_t *demuxer)
{
if (!demuxer)
return;
if (demuxer->desc->close)
demuxer->desc->close(demuxer);
// free streams:
@@ -466,7 +468,7 @@ struct demux_packet *demux_read_packet(struct sh_stream *sh)
// packets from the queue.
double demux_get_next_pts(struct sh_stream *sh)
{
if (sh) {
if (sh && sh->ds->selected) {
ds_get_packets(sh);
if (sh->ds->head)
return sh->ds->head->pts;
@@ -538,6 +540,7 @@ static struct demuxer *open_given_type(struct MPOpts *opts,
.filepos = -1,
.opts = opts,
.filename = talloc_strdup(demuxer, stream->url),
.metadata = talloc_zero(demuxer, struct mp_tags),
};
demuxer->params = params; // temporary during open()
stream_seek(stream, stream->start_pos);
@@ -600,6 +603,10 @@ struct demuxer *demux_open(struct stream *stream, char *force_format,
}
}
// Peek this much data to avoid that stream_read() run by some demuxers
// or stream filters will flush previous peeked data.
stream_peek(stream, STREAM_BUFFER_SIZE);
// Test demuxers from first to last, one pass for each check_levels[] entry
for (int pass = 0; check_levels[pass] != -1; pass++) {
enum demux_check level = check_levels[pass];
@@ -624,8 +631,7 @@ void demux_flush(demuxer_t *demuxer)
demuxer->warned_queue_overflow = false;
}
int demux_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
int flags)
int demux_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
if (!demuxer->seekable) {
mp_tmsg(MSGT_SEEK, MSGL_WARN, "Cannot seek in this file.\n");
@@ -672,11 +678,47 @@ int demux_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
dmx_seek:
if (demuxer->desc->seek)
demuxer->desc->seek(demuxer, rel_seek_secs, audio_delay, flags);
demuxer->desc->seek(demuxer, rel_seek_secs, flags);
return 1;
}
void mp_tags_set_str(struct mp_tags *tags, const char *key, const char *value)
{
mp_tags_set_bstr(tags, bstr0(key), bstr0(value));
}
void mp_tags_set_bstr(struct mp_tags *tags, bstr key, bstr value)
{
for (int n = 0; n < tags->num_keys; n++) {
if (bstrcasecmp0(key, tags->keys[n]) == 0) {
talloc_free(tags->values[n]);
tags->values[n] = talloc_strndup(tags, value.start, value.len);
return;
}
}
MP_RESIZE_ARRAY(tags, tags->keys, tags->num_keys + 1);
MP_RESIZE_ARRAY(tags, tags->values, tags->num_keys + 1);
tags->keys[tags->num_keys] = talloc_strndup(tags, key.start, key.len);
tags->values[tags->num_keys] = talloc_strndup(tags, value.start, value.len);
tags->num_keys++;
}
char *mp_tags_get_str(struct mp_tags *tags, const char *key)
{
return mp_tags_get_bstr(tags, bstr0(key));
}
char *mp_tags_get_bstr(struct mp_tags *tags, bstr key)
{
for (int n = 0; n < tags->num_keys; n++) {
if (bstrcasecmp0(key, tags->keys[n]) == 0)
return tags->values[n];
}
return NULL;
}
int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param)
{
return demux_info_add_bstr(demuxer, bstr0(opt), bstr0(param));
@@ -684,49 +726,34 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param)
int demux_info_add_bstr(demuxer_t *demuxer, struct bstr opt, struct bstr param)
{
char **info = demuxer->info;
int n = 0;
for (n = 0; info && info[2 * n] != NULL; n++) {
if (!bstrcasecmp(opt, bstr0(info[2*n]))) {
if (!bstrcmp(param, bstr0(info[2*n + 1]))) {
mp_msg(MSGT_DEMUX, MSGL_V, "Demuxer info %.*s set to unchanged value %.*s\n",
BSTR_P(opt), BSTR_P(param));
return 0;
}
mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Demuxer info %.*s changed to %.*s\n",
BSTR_P(opt), BSTR_P(param));
talloc_free(info[2*n + 1]);
info[2*n + 1] = talloc_strndup(demuxer->info, param.start, param.len);
char *oldval = mp_tags_get_bstr(demuxer->metadata, opt);
if (oldval) {
if (bstrcmp0(param, oldval) == 0)
return 0;
}
mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Demuxer info %.*s changed to %.*s\n",
BSTR_P(opt), BSTR_P(param));
}
info = demuxer->info = talloc_realloc(demuxer, info, char *, 2 * (n + 2));
info[2*n] = talloc_strndup(demuxer->info, opt.start, opt.len);
info[2*n + 1] = talloc_strndup(demuxer->info, param.start, param.len);
memset(&info[2 * (n + 1)], 0, 2 * sizeof(char *));
mp_tags_set_bstr(demuxer->metadata, opt, param);
return 1;
}
int demux_info_print(demuxer_t *demuxer)
{
char **info = demuxer->info;
struct mp_tags *info = demuxer->metadata;
int n;
if (!info)
if (!info || !info->num_keys)
return 0;
mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Clip info:\n");
for (n = 0; info[2 * n] != NULL; n++) {
mp_msg(MSGT_DEMUX, MSGL_INFO, " %s: %s\n", info[2 * n],
info[2 * n + 1]);
for (n = 0; n < info->num_keys; n++) {
mp_msg(MSGT_DEMUX, MSGL_INFO, " %s: %s\n", info->keys[n],
info->values[n]);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CLIP_INFO_NAME%d=%s\n", n,
info[2 * n]);
info->keys[n]);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CLIP_INFO_VALUE%d=%s\n", n,
info[2 * n + 1]);
info->values[n]);
}
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CLIP_INFO_N=%d\n", n);
@@ -735,15 +762,7 @@ int demux_info_print(demuxer_t *demuxer)
char *demux_info_get(demuxer_t *demuxer, const char *opt)
{
int i;
char **info = demuxer->info;
for (i = 0; info && info[2 * i] != NULL; i++) {
if (!strcasecmp(opt, info[2 * i]))
return info[2 * i + 1];
}
return NULL;
return mp_tags_get_str(demuxer->metadata, opt);
}
void demux_info_update(struct demuxer *demuxer)
@@ -849,18 +868,33 @@ void demuxer_sort_chapters(demuxer_t *demuxer)
}
int demuxer_add_chapter(demuxer_t *demuxer, struct bstr name,
uint64_t start, uint64_t end)
uint64_t start, uint64_t end, uint64_t demuxer_id)
{
struct demux_chapter new = {
.original_index = demuxer->num_chapters,
.start = start,
.end = end,
.name = name.len ? bstrdup0(demuxer, name) : NULL,
.metadata = talloc_zero(demuxer, struct mp_tags),
.demuxer_id = demuxer_id,
};
mp_tags_set_bstr(new.metadata, bstr0("TITLE"), name);
MP_TARRAY_APPEND(demuxer, demuxer->chapters, demuxer->num_chapters, new);
return 0;
}
void demuxer_add_chapter_info(struct demuxer *demuxer, uint64_t demuxer_id,
bstr key, bstr value)
{
for (int n = 0; n < demuxer->num_chapters; n++) {
struct demux_chapter *ch = &demuxer->chapters[n];
if (ch->demuxer_id == demuxer_id) {
mp_tags_set_bstr(ch->metadata, key, value);
return;
}
}
}
static void add_stream_chapters(struct demuxer *demuxer)
{
if (demuxer->num_chapters)
@@ -871,7 +905,7 @@ static void add_stream_chapters(struct demuxer *demuxer)
if (stream_control(demuxer->stream, STREAM_CTRL_GET_CHAPTER_TIME, &p)
!= STREAM_OK)
return;
demuxer_add_chapter(demuxer, bstr0(""), p * 1e9, 0);
demuxer_add_chapter(demuxer, bstr0(""), p * 1e9, 0, 0);
}
}
+34 -14
View File
@@ -55,14 +55,16 @@ enum timestamp_type {
#define DEMUXER_CTRL_OK 1
#define DEMUXER_CTRL_GUESS 2
#define DEMUXER_CTRL_UPDATE_INFO 8
#define DEMUXER_CTRL_SWITCHED_TRACKS 9
#define DEMUXER_CTRL_GET_TIME_LENGTH 10
#define DEMUXER_CTRL_GET_START_TIME 11
#define DEMUXER_CTRL_SWITCH_AUDIO 12
#define DEMUXER_CTRL_RESYNC 13
#define DEMUXER_CTRL_SWITCH_VIDEO 14
#define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
enum demux_ctrl {
DEMUXER_CTRL_UPDATE_INFO = 1,
DEMUXER_CTRL_SWITCHED_TRACKS,
DEMUXER_CTRL_GET_TIME_LENGTH,
DEMUXER_CTRL_GET_START_TIME,
DEMUXER_CTRL_SWITCH_AUDIO,
DEMUXER_CTRL_RESYNC,
DEMUXER_CTRL_SWITCH_VIDEO,
DEMUXER_CTRL_IDENTIFY_PROGRAM,
};
#define SEEK_ABSOLUTE (1 << 0)
#define SEEK_FACTOR (1 << 1)
@@ -107,16 +109,23 @@ typedef struct demuxer_desc {
// The following functions are all optional
int (*fill_buffer)(struct demuxer *demuxer); // 0 on EOF, otherwise 1
void (*close)(struct demuxer *demuxer);
void (*seek)(struct demuxer *demuxer, float rel_seek_secs,
float audio_delay, int flags);
void (*seek)(struct demuxer *demuxer, float rel_seek_secs, int flags);
int (*control)(struct demuxer *demuxer, int cmd, void *arg);
} demuxer_desc_t;
struct mp_tags {
char **keys;
char **values;
int num_keys;
};
typedef struct demux_chapter
{
int original_index;
uint64_t start, end;
char *name;
struct mp_tags *metadata;
uint64_t demuxer_id; // for mapping to internal demuxer data structures
} demux_chapter_t;
struct matroska_data {
@@ -141,6 +150,7 @@ typedef struct demux_attachment
} demux_attachment_t;
struct demuxer_params {
int matroska_num_wanted_uids;
unsigned char (*matroska_wanted_uids)[16];
int matroska_wanted_segment;
bool *matroska_was_valid;
@@ -183,8 +193,12 @@ typedef struct demuxer {
// for trivial demuxers which just read the whole file for codec to use
struct bstr file_contents;
// If the file is a playlist file
struct playlist *playlist;
struct mp_tags *metadata;
void *priv; // demuxer-specific internal data
char **info; // metadata
struct MPOpts *opts;
struct demuxer_params *params;
} demuxer_t;
@@ -222,8 +236,7 @@ struct demuxer *demux_open(struct stream *stream, char *force_format,
struct demuxer_params *params, struct MPOpts *opts);
void demux_flush(struct demuxer *demuxer);
int demux_seek(struct demuxer *demuxer, float rel_seek_secs, float audio_delay,
int flags);
int demux_seek(struct demuxer *demuxer, float rel_seek_secs, int flags);
int demux_info_add(struct demuxer *demuxer, const char *opt, const char *param);
int demux_info_add_bstr(struct demuxer *demuxer, struct bstr opt,
@@ -245,7 +258,9 @@ void demuxer_help(void);
int demuxer_add_attachment(struct demuxer *demuxer, struct bstr name,
struct bstr type, struct bstr data);
int demuxer_add_chapter(struct demuxer *demuxer, struct bstr name,
uint64_t start, uint64_t end);
uint64_t start, uint64_t end, uint64_t demuxer_id);
void demuxer_add_chapter_info(struct demuxer *demuxer, uint64_t demuxer_id,
bstr key, bstr value);
int demuxer_seek_chapter(struct demuxer *demuxer, int chapter,
double *seek_pts);
void demuxer_sort_chapters(demuxer_t *demuxer);
@@ -281,4 +296,9 @@ double demux_packet_list_duration(struct demux_packet **pkts, int num_pkts);
struct demux_packet *demux_packet_list_fill(struct demux_packet **pkts,
int num_pkts, int *current);
void mp_tags_set_str(struct mp_tags *tags, const char *key, const char *value);
void mp_tags_set_bstr(struct mp_tags *tags, bstr key, bstr value);
char *mp_tags_get_str(struct mp_tags *tags, const char *key);
char *mp_tags_get_bstr(struct mp_tags *tags, bstr key);
#endif /* MPLAYER_DEMUXER_H */
+55 -12
View File
@@ -603,12 +603,33 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
avfc->pb = priv->pb;
}
if (avformat_open_input(&avfc, priv->filename, priv->avif, NULL) < 0) {
AVDictionary *dopts = NULL;
if (matches_avinputformat_name(priv, "rtsp")) {
const char *transport = NULL;
switch (opts->network_rtsp_transport) {
case 1: transport = "udp"; break;
case 2: transport = "tcp"; break;
case 3: transport = "http"; break;
}
if (transport)
av_dict_set(&dopts, "rtsp_transport", transport, 0);
}
if (avformat_open_input(&avfc, priv->filename, priv->avif, &dopts) < 0) {
mp_msg(MSGT_HEADER, MSGL_ERR,
"LAVF_header: avformat_open_input() failed\n");
av_dict_free(&dopts);
return -1;
}
t = NULL;
while ((t = av_dict_get(dopts, "", t, AV_DICT_IGNORE_SUFFIX))) {
mp_msg(MSGT_OPEN, MSGL_V, "[lavf] Could not set demux option %s=%s\n",
t->key, t->value);
}
av_dict_free(&dopts);
priv->avfc = avfc;
if (avformat_find_stream_info(avfc, NULL) < 0) {
mp_msg(MSGT_HEADER, MSGL_ERR,
@@ -627,7 +648,12 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
(AVRational){1, 1000000000});
t = av_dict_get(c->metadata, "title", NULL, 0);
demuxer_add_chapter(demuxer, t ? bstr0(t->value) : bstr0(NULL),
start, end);
start, end, i);
AVDictionaryEntry *t = NULL;
while ((t = av_dict_get(c->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
demuxer_add_chapter_info(demuxer, i, bstr0(t->key),
bstr0(t->value));
}
}
add_new_streams(demuxer);
@@ -691,10 +717,9 @@ static void seek_reset(demuxer_t *demux)
priv->num_packets = 0;
}
static int destroy_avpacket(void *pkt)
static void destroy_avpacket(void *pkt)
{
av_free_packet(pkt);
return 0;
}
static int read_more_av_packets(demuxer_t *demux)
@@ -804,13 +829,12 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
return 1;
}
static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs,
float audio_delay, int flags)
static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
lavf_priv_t *priv = demuxer->priv;
int avsflags = 0;
mp_msg(MSGT_DEMUX, MSGL_DBG2, "demux_seek_lavf(%p, %f, %f, %d)\n",
demuxer, rel_seek_secs, audio_delay, flags);
mp_msg(MSGT_DEMUX, MSGL_DBG2, "demux_seek_lavf(%p, %f, %d)\n",
demuxer, rel_seek_secs, flags);
seek_reset(demuxer);
@@ -863,12 +887,31 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs,
// API by default, because there are some major issues.
// Set max_ts==ts, so that demuxing starts from an earlier position in
// the worst case.
int r = avformat_seek_file(priv->avfc, -1, INT64_MIN,
priv->last_pts, priv->last_pts, avsflags);
// To make this horrible situation even worse, some lavf demuxers have
// broken timebase handling (everything that uses
// ff_subtitles_queue_seek()), and always uses the stream timebase. So
// we use the timebase and stream index of the first enabled stream
// (i.e. a stream which can participate in seeking).
int stream_index = -1;
AVRational time_base = {1, AV_TIME_BASE};
for (int n = 0; n < priv->num_streams; n++) {
struct sh_stream *stream = priv->streams[n];
AVStream *st = priv->avfc->streams[n];
if (stream && st->discard != AVDISCARD_ALL) {
stream_index = n;
time_base = st->time_base;
break;
}
}
int64_t pts = priv->last_pts;
if (pts != AV_NOPTS_VALUE)
pts = pts / (double)AV_TIME_BASE * av_q2d(av_inv_q(time_base));
int r = avformat_seek_file(priv->avfc, stream_index, INT64_MIN,
pts, pts, avsflags);
// Similar issue as in the normal seeking codepath.
if (r < 0) {
avformat_seek_file(priv->avfc, -1, INT64_MIN,
priv->last_pts, INT64_MAX, avsflags);
avformat_seek_file(priv->avfc, stream_index, INT64_MIN,
pts, INT64_MAX, avsflags);
}
}
}
+2 -1
View File
@@ -47,7 +47,8 @@ static void free_mf(mf_t *mf)
}
}
static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
static void demux_seek_mf(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
mf_t * mf = (mf_t *)demuxer->priv;
int newpos = (flags & SEEK_ABSOLUTE)?0:mf->curr_frame - 1;
+61 -25
View File
@@ -188,7 +188,7 @@ typedef struct mkv_demuxer {
uint64_t skip_to_timecode;
int v_skip_to_keyframe, a_skip_to_keyframe;
bool subtitle_preroll;
int subtitle_preroll;
} mkv_demuxer_t;
#define REALHEADER_SIZE 16
@@ -196,6 +196,10 @@ typedef struct mkv_demuxer {
#define RAPROPERTIES4_SIZE 56
#define RAPROPERTIES5_SIZE 70
// Maximum number of subtitle packets that are accepted for pre-roll.
// (Subtitle packets added before first A/V keyframe packet is found with seek.)
#define NUM_SUB_PREROLL_PACKETS 500
/**
* \brief ensures there is space for at least one additional element
* \param array array to grow
@@ -369,7 +373,7 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
mkv_d->duration);
}
if (info.n_title) {
demux_info_add_bstr(demuxer, bstr0("title"), info.title);
demux_info_add_bstr(demuxer, bstr0("TITLE"), info.title);
}
if (info.n_segment_uid) {
int len = info.segment_uid.len;
@@ -388,11 +392,11 @@ static int demux_mkv_read_info(demuxer_t *demuxer)
}
if (demuxer->params && demuxer->params->matroska_wanted_uids) {
unsigned char (*uids)[16] = demuxer->params->matroska_wanted_uids;
if (!info.n_segment_uid)
uids = NULL;
for (int i = 0; i < MP_TALLOC_ELEMS(uids); i++) {
if (!memcmp(info.segment_uid.start, uids[i], 16))
goto out;
if (info.n_segment_uid) {
for (int i = 0; i < demuxer->params->matroska_num_wanted_uids; i++) {
if (!memcmp(info.segment_uid.start, uids[i], 16))
goto out;
}
}
mp_tmsg(MSGT_DEMUX, MSGL_INFO,
"[mkv] This is not one of the wanted files. "
@@ -778,6 +782,7 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
{
struct MPOpts *opts = demuxer->opts;
stream_t *s = demuxer->stream;
int wanted_edition = opts->edition_id;
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing chapters ] ---------\n");
struct ebml_chapters file_chapters = {};
@@ -789,8 +794,8 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
int selected_edition = 0;
int num_editions = file_chapters.n_edition_entry;
struct ebml_edition_entry *editions = file_chapters.edition_entry;
if (opts->edition_id >= 0 && opts->edition_id < num_editions) {
selected_edition = opts->edition_id;
if (wanted_edition >= 0 && wanted_edition < num_editions) {
selected_edition = wanted_edition;
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] User-specified edition: %d\n",
selected_edition);
} else
@@ -874,7 +879,8 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
BSTR_P(name));
if (idx == selected_edition){
demuxer_add_chapter(demuxer, name, chapter.start, chapter.end);
demuxer_add_chapter(demuxer, name, chapter.start, chapter.end,
ca->chapter_uid);
if (editions[idx].edition_flag_ordered) {
chapter.name = talloc_strndup(m_chapters, name.start,
name.len);
@@ -909,11 +915,21 @@ static int demux_mkv_read_tags(demuxer_t *demuxer)
for (int i = 0; i < tags.n_tag; i++) {
struct ebml_tag tag = tags.tag[i];
if (tag.targets.target_track_uid || tag.targets.target_edition_uid ||
tag.targets.target_chapter_uid || tag.targets.target_attachment_uid)
tag.targets.target_attachment_uid)
continue;
for (int j = 0; j < tag.n_simple_tag; j++)
demux_info_add_bstr(demuxer, tag.simple_tag[j].tag_name, tag.simple_tag[j].tag_string);
if (tag.targets.target_chapter_uid) {
for (int j = 0; j < tag.n_simple_tag; j++) {
demuxer_add_chapter_info(demuxer, tag.targets.target_chapter_uid,
tag.simple_tag[j].tag_name,
tag.simple_tag[j].tag_string);
}
} else {
for (int j = 0; j < tag.n_simple_tag; j++) {
demux_info_add_bstr(demuxer, tag.simple_tag[j].tag_name,
tag.simple_tag[j].tag_string);
}
}
}
talloc_free(parse_ctx.talloc_ctx);
@@ -1152,6 +1168,7 @@ static const videocodec_info_t vinfo[] = {
{MKV_V_VP8, mmioFOURCC('V', 'P', '8', '0'), 0},
{MKV_V_VP9, mmioFOURCC('V', 'P', '9', '0'), 0},
{MKV_V_DIRAC, mmioFOURCC('d', 'r', 'a', 'c'), 0},
{MKV_V_PRORES, mmioFOURCC('p', 'r', '0', '0'), 0},
{NULL, 0, 0}
};
@@ -1613,6 +1630,8 @@ static const char *mkv_sub_tag[][2] = {
{ MKV_S_TEXTASCII, "subrip"},
{ MKV_S_TEXTUTF8, "subrip"},
{ MKV_S_PGS, "hdmv_pgs_subtitle"},
{ MKV_S_WEBVTT_S, "webvtt-webm"},
{ MKV_S_WEBVTT_C, "webvtt-webm"},
{0}
};
@@ -2156,6 +2175,14 @@ static void mkv_parse_packet(mkv_track_t *track, bstr *buffer)
buffer->len = size;
}
#endif
} else if (track->codec_id && strcmp(track->codec_id, MKV_V_PRORES) == 0) {
size_t newlen = buffer->len + 8;
char *data = talloc_size(NULL, newlen);
AV_WB32(data + 0, newlen);
AV_WB32(data + 4, MKBETAG('i', 'c', 'p', 'f'));
memcpy(data + 8, buffer->start, buffer->len);
buffer->start = data;
buffer->len = newlen;
}
}
@@ -2266,7 +2293,17 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
if (mkv_d->v_skip_to_keyframe)
use_this_block = 0;
} else if (track->type == MATROSKA_TRACK_SUBTITLE) {
use_this_block |= mkv_d->subtitle_preroll;
if (!use_this_block && mkv_d->subtitle_preroll)
use_this_block = 1;
if (use_this_block) {
if (mkv_d->subtitle_preroll) {
mkv_d->subtitle_preroll--;
} else {
// This could overflow the demuxer queue.
if (mkv_d->a_skip_to_keyframe || mkv_d->v_skip_to_keyframe)
use_this_block = 0;
}
}
if (use_this_block) {
if (laces > 1) {
mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Subtitles use Matroska "
@@ -2313,7 +2350,7 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
if (stream->type == STREAM_VIDEO) {
mkv_d->v_skip_to_keyframe = 0;
mkv_d->skip_to_timecode = 0;
mkv_d->subtitle_preroll = false;
mkv_d->subtitle_preroll = 0;
} else if (stream->type == STREAM_AUDIO)
mkv_d->a_skip_to_keyframe = 0;
@@ -2557,7 +2594,7 @@ static struct mkv_index *seek_with_cues(struct demuxer *demuxer, int seek_id,
if (index) { /* We've found an entry. */
uint64_t seek_pos = index->filepos;
if (mkv_d->subtitle_preroll) {
if (flags & SEEK_SUBPREROLL) {
uint64_t prev_target = 0;
for (int i = 0; i < mkv_d->num_indexes; i++) {
if (seek_id < 0 || mkv_d->indexes[i].tnum == seek_id) {
@@ -2576,8 +2613,7 @@ static struct mkv_index *seek_with_cues(struct demuxer *demuxer, int seek_id,
return index;
}
static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
float audio_delay, int flags)
static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
mkv_demuxer_t *mkv_d = demuxer->priv;
int64_t old_pos = stream_tell(demuxer->stream);
@@ -2594,7 +2630,9 @@ static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
a_tnum = track->tnum;
}
}
mkv_d->subtitle_preroll = (flags & SEEK_SUBPREROLL) && st_active[STREAM_SUB];
mkv_d->subtitle_preroll = NUM_SUB_PREROLL_PACKETS;
if (!st_active[STREAM_SUB] || !st_active[STREAM_VIDEO])
flags &= ~SEEK_SUBPREROLL;
if (!(flags & (SEEK_BACKWARD | SEEK_FORWARD))) {
if (flags & SEEK_ABSOLUTE || rel_seek_secs < 0)
flags |= SEEK_BACKWARD;
@@ -2623,14 +2661,13 @@ static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
if (!index)
stream_seek(demuxer->stream, old_pos);
if (st_active[STREAM_VIDEO])
mkv_d->v_skip_to_keyframe = 1;
mkv_d->v_skip_to_keyframe = st_active[STREAM_VIDEO];
mkv_d->a_skip_to_keyframe = st_active[STREAM_AUDIO];
if (flags & SEEK_FORWARD)
mkv_d->skip_to_timecode = target_timecode;
else
mkv_d->skip_to_timecode = index ? index->timecode * mkv_d->tc_scale
: 0;
mkv_d->a_skip_to_keyframe = 1;
demux_mkv_fill_buffer(demuxer);
} else if ((demuxer->movi_end <= 0) || !(flags & SEEK_ABSOLUTE))
@@ -2666,10 +2703,9 @@ static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
mkv_d->cluster_end = 0;
stream_seek(s, index->filepos);
if (st_active[STREAM_VIDEO])
mkv_d->v_skip_to_keyframe = 1;
mkv_d->v_skip_to_keyframe = st_active[STREAM_VIDEO];
mkv_d->a_skip_to_keyframe = st_active[STREAM_AUDIO];
mkv_d->skip_to_timecode = index->timecode * mkv_d->tc_scale;
mkv_d->a_skip_to_keyframe = 1;
demux_mkv_fill_buffer(demuxer);
}
+1 -2
View File
@@ -457,8 +457,7 @@ static void demux_mng_close(demuxer_t* demuxer)
* \param[in] audio_delay unused, MNG does not contain audio
* \param[in] flags bit flags, \p 1: absolute, \p 2: fractional position
*/
static void demux_mng_seek(demuxer_t * demuxer, float rel_seek_secs,
float audio_delay, int flags)
static void demux_mng_seek(demuxer_t * demuxer, float rel_seek_secs, int flags)
{
mng_priv_t * mng_priv = demuxer->priv;
mng_handle h_mng = mng_priv->h_mng;
+171
View File
@@ -0,0 +1,171 @@
/*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mpvcore/mp_common.h"
#include "mpvcore/options.h"
#include "mpvcore/mp_msg.h"
#include "mpvcore/playlist.h"
#include "mpvcore/path.h"
#include "stream/stream.h"
#include "demux.h"
#define PROBE_SIZE (8 * 1024)
struct pl_parser {
struct stream *s;
char buffer[8 * 1024];
int utf16;
struct playlist *pl;
bool probing;
};
static char *pl_get_line0(struct pl_parser *p)
{
char *res = stream_read_line(p->s, p->buffer, sizeof(p->buffer), p->utf16);
if (res) {
int len = strlen(res);
if (len > 0 && res[len - 1] == '\n')
res[len - 1] = '\0';
}
return res;
}
static bstr pl_get_line(struct pl_parser *p)
{
return bstr0(pl_get_line0(p));
}
static void pl_add(struct pl_parser *p, bstr entry)
{
char *s = bstrto0(NULL, entry);
playlist_add_file(p->pl, s);
talloc_free(s);
}
static bool pl_eof(struct pl_parser *p)
{
return p->s->eof;
}
static int parse_m3u(struct pl_parser *p)
{
bstr line = bstr_strip(pl_get_line(p));
if (!bstr_equals0(line, "#EXTM3U"))
return -1;
if (p->probing)
return 0;
while (!pl_eof(p)) {
line = bstr_strip(pl_get_line(p));
if (line.len == 0 || bstr_startswith0(line, "#"))
continue;
pl_add(p, line);
}
return 0;
}
static int parse_ref_init(struct pl_parser *p)
{
bstr line = bstr_strip(pl_get_line(p));
if (!bstr_equals0(line, "[Reference]"))
return -1;
while (!pl_eof(p)) {
line = bstr_strip(pl_get_line(p));
if (bstr_case_startswith(line, bstr0("Ref"))) {
bstr_split_tok(line, "=", &(bstr){0}, &line);
if (line.len)
pl_add(p, line);
}
}
return 0;
}
static int parse_mov_rtsptext(struct pl_parser *p)
{
bstr line = pl_get_line(p);
if (!bstr_eatstart(&line, bstr0("RTSPtext")))
return -1;
if (p->probing)
return 0;
line = bstr_strip(line);
do {
if (bstr_case_startswith(line, bstr0("rtsp://"))) {
pl_add(p, line);
return 0;
}
} while (!pl_eof(p) && (line = bstr_strip(pl_get_line(p))).len);
return -1;
}
struct pl_format {
const char *name;
int (*parse)(struct pl_parser *p);
};
static const struct pl_format formats[] = {
{"m3u", parse_m3u},
{"ini", parse_ref_init},
{"mov", parse_mov_rtsptext},
};
static const struct pl_format *probe_pl(struct pl_parser *p, bool force)
{
int64_t start = stream_tell(p->s);
for (int n = 0; n < MP_ARRAY_SIZE(formats); n++) {
const struct pl_format *fmt = &formats[n];
stream_seek(p->s, start);
if (fmt->parse(p) >= 0)
return fmt;
}
return NULL;
}
static int open_file(struct demuxer *demuxer, enum demux_check check)
{
bool force = check < DEMUX_CHECK_UNSAFE || check == DEMUX_CHECK_REQUEST;
struct pl_parser *p = talloc_zero(NULL, struct pl_parser);
p->pl = talloc_zero(p, struct playlist);
bstr probe_buf = stream_peek(demuxer->stream, PROBE_SIZE);
p->s = open_memory_stream(probe_buf.start, probe_buf.len);
p->utf16 = stream_skip_bom(p->s);
p->probing = true;
const struct pl_format *fmt = probe_pl(p, force);
free_stream(p->s);
playlist_clear(p->pl);
if (!fmt) {
talloc_free(p);
return -1;
}
p->probing = false;
p->s = demuxer->stream;
p->utf16 = stream_skip_bom(p->s);
bool ok = fmt->parse(p) >= 0;
if (ok)
playlist_add_base_path(p->pl, mp_dirname(demuxer->filename));
demuxer->playlist = talloc_steal(demuxer, p->pl);
demuxer->filetype = fmt->name;
talloc_free(p);
return ok ? 0 : -1;
}
const struct demuxer_desc demuxer_desc_playlist = {
.name = "playlist",
.desc = "Playlist file",
.open = open_file,
};
+7 -5
View File
@@ -35,6 +35,7 @@
struct priv {
int frame_size;
int read_frames;
double frame_rate;
};
@@ -52,8 +53,8 @@ const m_option_t demux_rawaudio_opts[] = {
static int vformat = MP_FOURCC_I420;
static int mp_format;
static char *codec;
static int width = 0;
static int height = 0;
static int width = 1280;
static int height = 720;
static float fps = 25;
static int imgsize = 0;
@@ -107,6 +108,7 @@ static int demux_rawaudio_open(demuxer_t *demuxer, enum demux_check check)
*p = (struct priv) {
.frame_size = samplesize * sh_audio->channels.num,
.frame_rate = samplerate,
.read_frames = samplerate,
};
return 0;
@@ -191,6 +193,7 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check)
*p = (struct priv) {
.frame_size = imgsize,
.frame_rate = fps,
.read_frames = 1,
};
return 0;
@@ -203,7 +206,7 @@ static int raw_fill_buffer(demuxer_t *demuxer)
if (demuxer->stream->eof)
return 0;
struct demux_packet *dp = new_demux_packet(p->frame_size);
struct demux_packet *dp = new_demux_packet(p->frame_size * p->read_frames);
dp->pos = stream_tell(demuxer->stream) - demuxer->movi_start;
dp->pts = (dp->pos / p->frame_size) / p->frame_rate;
@@ -214,8 +217,7 @@ static int raw_fill_buffer(demuxer_t *demuxer)
return 1;
}
static void raw_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
int flags)
static void raw_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
struct priv *p = demuxer->priv;
stream_t *s = demuxer->stream;
+3 -2
View File
@@ -1341,6 +1341,8 @@ static int d_open_file(struct demuxer *demuxer, enum demux_check check)
if (!res)
return -1;
demuxer->filetype = sr.name;
sub_data *sd = sub_read_file(demuxer->stream, &sr);
if (!sd)
return -1;
@@ -1367,8 +1369,7 @@ static int d_fill_buffer(struct demuxer *demuxer)
return demuxer_add_packet(demuxer, p->sh, dp);
}
static void d_seek(struct demuxer *demuxer, float secs, float audio_delay,
int flags)
static void d_seek(struct demuxer *demuxer, float secs, int flags)
{
struct priv *p = demuxer->priv;
demux_packet_list_seek(p->pkts, p->num_pkts, &p->current, secs, flags);
+3
View File
@@ -79,6 +79,7 @@
#define MKV_V_MJPEG "V_MJPEG"
#define MKV_V_UNCOMPRESSED "V_UNCOMPRESSED"
#define MKV_V_DIRAC "V_DIRAC"
#define MKV_V_PRORES "V_PRORES"
#define MKV_S_TEXTASCII "S_TEXT/ASCII"
#define MKV_S_TEXTUTF8 "S_TEXT/UTF8"
@@ -88,5 +89,7 @@
#define MKV_S_PGS "S_HDMV/PGS"
#define MKV_S_SSA "S_SSA" // Deprecated
#define MKV_S_ASS "S_ASS" // Deprecated
#define MKV_S_WEBVTT_S "D_WEBVTT/SUBTITLES"
#define MKV_S_WEBVTT_C "D_WEBVTT/CAPTIONS"
#endif /* MPLAYER_MATROSKA_H */
+1
View File
@@ -131,6 +131,7 @@ typedef struct sh_video {
struct vf_instance *vfilter; // video filter chain
const struct vd_functions *vd_driver;
int vf_initialized; // -1 failed, 0 not done, 1 done
long vf_reconfig_count; // incremented each mpcodecs_reconfig_vo() call
struct mp_image_params *vf_input; // video filter input params
struct mp_hwdec_info *hwdec_info; // video output hwdec handles
// win32-compatible codec parameters:
+33 -24
View File
@@ -3,23 +3,30 @@
#
# Configuration files are read system-wide from /usr/local/etc/mpv.conf
# and per-user from ~/.mpv/config, where per-user settings override
# system-wide settings, all of which are overrriden by the command line.
# system-wide settings, all of which are overridden by the command line.
#
# The configuration file settings are the same as the command line
# options without the preceding '--'.
# Configuration file settings and the command line options use the same
# underlying mechanisms. Most options can be put into the configuration file
# by dropping the preceding '--'. See the man page for a complete list of
# options.
#
# Lines starting with '#' are comments and are ignored.
#
# See the CONFIGURATION FILES section in the man page
# for a detailed description of the syntax.
#
# Profiles should be placed at the bottom of the configuration file to ensure
# that settings wanted as defaults are not restricted to specific profiles.
#
# Note that the commented example options usually do _not_ set the default
# values. Calling mpv with --list-options is a nice way to see the default
# values for most options.
##################
# video settings #
##################
# Specify default video driver (see -vo help for a list).
# Specify default video driver (see --vo=help for a list).
#vo=vdpau
# Start in fullscreen mode by default.
@@ -31,6 +38,9 @@
# don't allow a new window to have a size larger than 90% of the screen size
#autofit-larger=90%x90%
# Disable the On Screen Controller (OSC).
#osc=no
# Keep the player window on top of all other windows.
#ontop=yes
@@ -39,7 +49,7 @@
# audio settings #
##################
# Specify default audio driver (see -ao help for a list).
# Specify default audio driver (see --ao=help for a list).
#ao=alsa
# Disable softvol usage, and always use the system mixer if available.
@@ -50,20 +60,15 @@
# other settings #
##################
# Pretend to be Window Media Player.
# Fixes playback when playlist and media file use the same URL.
#user-agent=NSPlayer/4.1.0.3856
# Pretend to be Winamp
# Fixes playback of some NSV streams
#user-agent="Winamp NSV Player/5.12 (ultravox/2.0)"
# Drop frames to preserve audio/video sync.
#framedrop = yes
# Pretend to be a web browser. Might fix playback with some streaming sites.
#user-agent="Mozilla/5.0"
# cache settings
#
# Use 8MB input cache by default.
# Use 8MB input cache by default. The cache is enabled for network streams only.
#cache-default = 8192
#
# Use 8MB input cache for everything, even local files.
#cache = 8192
#
# Prefill 20% of the cache before starting playback.
@@ -72,15 +77,15 @@
# Prefill 50% of the cache before restarting playback after the cache emptied.
#cache-seek-min = 50
# DVD: Display English subtitles if available.
# Display English subtitles if available.
#slang = en
# DVD: Play English audio tracks if available.
#alang = en
# Use this for a widescreen monitor, non-square pixels.
#monitoraspect=16:9
# Play Finnish audio if available, fall back to English otherwise.
#alang = fi,en
# Enable hardware decoding if available. Often, this requires using an certain
# video output, otherwise no hardware decoding will be used.
#hwdec = auto
############
# Profiles #
@@ -89,7 +94,11 @@
# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.
#[vo.vdpau]
# The following profile can be enabled on the command line with: --profile=vdpau
#[vdpau]
# The profile forces the vdpau VO.
#vo=vdpau
# Use hardware decoding (this might break playback of some h264 files)
#hwdec=vdpau
# Most video filters do not work with vdpau.
+140 -141
View File
@@ -27,171 +27,170 @@
# key combinations is only supported through the video windows of certain
# output drivers (not in output windows of other drivers or in a terminal).
MOUSE_BTN0 ignore # don't do anything
MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
MOUSE_BTN2 cycle pause # toggle pause on/off
MOUSE_BTN3 seek 10
MOUSE_BTN4 seek -10
MOUSE_BTN5 add volume 1
MOUSE_BTN6 add volume -1
# All lines in this file are commented. If you want to remap a key, copy the
# file to ~/.mpv/input.conf, and uncomment and edit the binding you want to
# change.
# Developer note: this file is baked into the mpv binary, and internally,
# entries are uncommented and added as default bindings. Lines that have a
# space after the '#' are ignored.
#MOUSE_BTN0 ignore # don't do anything
#MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
#MOUSE_BTN2 cycle pause # toggle pause on/off
#MOUSE_BTN3 seek 10
#MOUSE_BTN4 seek -10
#MOUSE_BTN5 add volume 1
#MOUSE_BTN6 add volume -1
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
AXIS_UP seek 10
AXIS_DOWN seek -10
AXIS_LEFT add volume 1
AXIS_RIGHT add volume -1
#AXIS_UP seek 10
#AXIS_DOWN seek -10
#AXIS_LEFT seek 5
#AXIS_RIGHT seek -5
# Seek units are in seconds, but note that these are limited by keyframes
RIGHT seek 10
LEFT seek -10
UP seek 60
DOWN seek -60
## Seek units are in seconds, but note that these are limited by keyframes
#RIGHT seek 10
#LEFT seek -10
#UP seek 60
#DOWN seek -60
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
Shift+RIGHT no-osd seek 1 - exact
Shift+LEFT no-osd seek -1 - exact
Shift+UP no-osd seek 5 - exact
Shift+DOWN no-osd seek -5 - exact
PGUP seek 600
PGDWN seek -600
+ add audio-delay 0.100 # this changes audio/video sync
- add audio-delay -0.100
[ speed_mult 0.9091 # scale playback speed
] speed_mult 1.1
{ speed_mult 0.5
} speed_mult 2.0
BS set speed 1.0 # reset speed to normal
q quit
Q quit_watch_later
q {encode} quit
ESC quit
p cycle pause # toggle pause/playback mode
. frame_step # advance one frame and pause
, frame_back_step # go back by one frame and pause
SPACE cycle pause
> playlist_next # skip to next file
ENTER playlist_next force # skip to next file or quit
< playlist_prev # skip to previous file
o osd # cycle through OSD mode
I show_text "${filename}" # display filename in osd
P show_progress
z add sub-delay -0.1 # subtract 100 ms delay from subs
x add sub-delay +0.1 # add
9 add volume -1
/ add volume -1
0 add volume 1
* add volume 1
( add balance -0.1 # adjust audio balance in favor of left
) add balance 0.1 # right
m cycle mute
1 add contrast -1
2 add contrast 1
3 add brightness -1
4 add brightness 1
5 add gamma -1
6 add gamma 1
7 add saturation -1
8 add saturation 1
d cycle framedrop # cycle through framedrop modes
#Shift+RIGHT no-osd seek 1 - exact
#Shift+LEFT no-osd seek -1 - exact
#Shift+UP no-osd seek 5 - exact
#Shift+DOWN no-osd seek -5 - exact
#PGUP seek 600
#PGDWN seek -600
#+ add audio-delay 0.100 # this changes audio/video sync
#- add audio-delay -0.100
#[ speed_mult 0.9091 # scale playback speed
#] speed_mult 1.1
#{ speed_mult 0.5
#} speed_mult 2.0
#BS set speed 1.0 # reset speed to normal
#q quit
#Q quit_watch_later
#q {encode} quit
#ESC quit
#p cycle pause # toggle pause/playback mode
#. frame_step # advance one frame and pause
#, frame_back_step # go back by one frame and pause
#SPACE cycle pause
#> playlist_next # skip to next file
#ENTER playlist_next force # skip to next file or quit
#< playlist_prev # skip to previous file
#o osd # cycle through OSD mode
#I show_text "${filename}" # display filename in osd
#P show_progress
#z add sub-delay -0.1 # subtract 100 ms delay from subs
#x add sub-delay +0.1 # add
#9 add volume -1
#/ add volume -1
#0 add volume 1
#* add volume 1
#( add balance -0.1 # adjust audio balance in favor of left
#) add balance 0.1 # right
#m cycle mute
#1 add contrast -1
#2 add contrast 1
#3 add brightness -1
#4 add brightness 1
#5 add gamma -1
#6 add gamma 1
#7 add saturation -1
#8 add saturation 1
#d cycle framedrop # cycle through framedrop modes
# toggle deinterlacer; requires either vdpau output, -vf yadif or kerndeint
D cycle deinterlace
c cycle colormatrix
#D cycle deinterlace
#c cycle colormatrix
# Next 3 currently only work with --no-ass
r add sub-pos -1 # move subtitles up
t add sub-pos +1 # down
v cycle sub-visibility
#r add sub-pos -1 # move subtitles up
#t add sub-pos +1 # down
#v cycle sub-visibility
# stretch SSA/ASS subtitles with anamorphic videos to match historical
V cycle ass-vsfilter-aspect-compat
j cycle sub # cycle through subtitles
J cycle sub down # ...backwards
F cycle sub-forced-only
SHARP cycle audio # switch audio streams
_ cycle video
TAB cycle program
T cycle ontop # toggle video window ontop of other windows
f cycle fullscreen # toggle fullscreen
s screenshot # take a screenshot
S screenshot video # ...without subtitles
Alt+s screenshot - each-frame # automatically screenshot every frame
w add panscan -0.1 # zoom out with -panscan 0 -fs
e add panscan +0.1 # in
POWER quit
MENU cycle osd
PLAY cycle pause
PAUSE cycle pause
PLAYPAUSE cycle pause
STOP quit
FORWARD seek 60
REWIND seek -60
NEXT playlist_next
PREV playlist_prev
VOLUME_UP add volume 1
VOLUME_DOWN add volume -1
MUTE cycle mute
CLOSE_WIN quit
CLOSE_WIN {encode} quit
! add chapter -1 # skip to previous chapter
@ add chapter 1 # next
E cycle edition # next edition
A cycle angle
U stop
#V cycle ass-vsfilter-aspect-compat
#j cycle sub # cycle through subtitles
#J cycle sub down # ...backwards
#F cycle sub-forced-only
#SHARP cycle audio # switch audio streams
#_ cycle video
#TAB cycle program
#T cycle ontop # toggle video window ontop of other windows
#f cycle fullscreen # toggle fullscreen
#s screenshot # take a screenshot
#S screenshot video # ...without subtitles
#Alt+s screenshot - each-frame # automatically screenshot every frame
#w add panscan -0.1 # zoom out with -panscan 0 -fs
#e add panscan +0.1 # in
#POWER quit
#MENU cycle osd
#PLAY cycle pause
#PAUSE cycle pause
#PLAYPAUSE cycle pause
#STOP quit
#FORWARD seek 60
#REWIND seek -60
#NEXT playlist_next
#PREV playlist_prev
#VOLUME_UP add volume 1
#VOLUME_DOWN add volume -1
#MUTE cycle mute
#CLOSE_WIN quit
#CLOSE_WIN {encode} quit
#! add chapter -1 # skip to previous chapter
#@ add chapter 1 # next
#E cycle edition # next edition
#A cycle angle
#U stop
l cycle quvi-format 1
L cycle quvi-format -1
#l cycle quvi-format 1
#L cycle quvi-format -1
# TV
h tv_step_channel 1
k tv_step_channel -1
n tv_step_norm
u tv_step_chanlist
#h tv_step_channel 1
#k tv_step_channel -1
#n tv_step_norm
#u tv_step_chanlist
# Apple Remote section
AR_PLAY cycle pause
AR_PLAY_HOLD quit
AR_CENTER cycle pause
AR_CENTER_HOLD quit
AR_NEXT seek 10
AR_NEXT_HOLD seek 120
AR_PREV seek -10
AR_PREV_HOLD seek -120
AR_MENU show_progress
AR_MENU_HOLD cycle mute
AR_VUP add volume 1
AR_VUP_HOLD add chapter 1
AR_VDOWN add volume -1
AR_VDOWN_HOLD add chapter -1
# Media Keys section
MK_PLAY cycle pause
MK_PREV playlist_prev
MK_NEXT playlist_next
#AR_PLAY cycle pause
#AR_PLAY_HOLD quit
#AR_CENTER cycle pause
#AR_CENTER_HOLD quit
#AR_NEXT seek 10
#AR_NEXT_HOLD seek 120
#AR_PREV seek -10
#AR_PREV_HOLD seek -120
#AR_MENU show_progress
#AR_MENU_HOLD cycle mute
#AR_VUP add volume 1
#AR_VUP_HOLD add chapter 1
#AR_VDOWN add volume -1
#AR_VDOWN_HOLD add chapter -1
# Joystick section
# WARNING: joystick support has to be explicitly enabled at
# compiletime with --enable-joystick
#
JOY_AXIS0_PLUS seek 10
JOY_AXIS0_MINUS seek -10
JOY_AXIS1_MINUS seek 60
JOY_AXIS1_PLUS seek -60
JOY_BTN0 cycle pause
JOY_BTN1 cycle osd
JOY_BTN2 add volume 1
JOY_BTN3 add volume -1
# Mostly for internal purposes
MOUSE_MOVE ignore
MOUSE_LEAVE ignore
#JOY_AXIS0_PLUS seek 10
#JOY_AXIS0_MINUS seek -10
#JOY_AXIS1_MINUS seek 60
#JOY_AXIS1_PLUS seek -60
#JOY_BTN0 cycle pause
#JOY_BTN1 cycle osd
#JOY_BTN2 add volume 1
#JOY_BTN3 add volume -1
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
#? add sub-scale +0.1 # increase subtitle font size
#? add sub-scale -0.1 # decrease subtitle font size
#? sub_step -1 # immediately display next subtitle
#? sub_step +1 # previous
# ? add sub-scale +0.1 # increase subtitle font size
# ? add sub-scale -0.1 # decrease subtitle font size
# ? sub_step -1 # immediately display next subtitle
# ? sub_step +1 # previous
-239
View File
@@ -1,239 +0,0 @@
/* XPM */
static char * mplayer_xpm[] = {
"32 32 204 2",
" c None",
". c #1D153E",
"+ c #251B4F",
"@ c #2D2161",
"# c #362773",
"$ c #3A2A7D",
"% c #3A2A7C",
"& c #23194C",
"* c #2C205E",
"= c #342670",
"- c #39297B",
"; c #787682",
"> c #817C94",
", c #8982A6",
"' c #9087B5",
") c #9188B6",
"! c #857BAF",
"~ c #493B87",
"{ c #29AEDE",
"] c #E3F6FC",
"^ c #FFFFFF",
"/ c #F1F0F6",
"( c #4A4561",
"_ c #0BAEE7",
": c #AAE3F7",
"< c #D1D1D1",
"[ c #077399",
"} c #0BAEE8",
"| c #D9F2FB",
"1 c #FEFEFE",
"2 c #087DA7",
"3 c #E0F5FC",
"4 c #07678A",
"5 c #E1F5FC",
"6 c #E5F6FD",
"7 c #E7F7FD",
"8 c #F5F4F8",
"9 c #D2CEE1",
"0 c #E2E0EC",
"a c #E4E2ED",
"b c #F0EFF5",
"c c #CDC9DE",
"d c #D1CEE1",
"e c #FBFBFC",
"f c #DFDFDF",
"g c #CBCBCB",
"h c #086B8E",
"i c #E8F8FD",
"j c #C2BDD7",
"k c #3B2B7D",
"l c #E1DFEB",
"m c #5C4E93",
"n c #8177AC",
"o c #C5C0D9",
"p c #4E408A",
"q c #655899",
"r c #8980B1",
"s c #C1C1C1",
"t c #535353",
"u c #0A87B4",
"v c #0BAAE3",
"w c #EDF9FD",
"x c #A199C1",
"y c #6D619E",
"z c #4A3B87",
"A c #645799",
"B c #55478F",
"C c #756AA4",
"D c #7F74AA",
"E c #929292",
"F c #8D8D8D",
"G c #9A9A9A",
"H c #919191",
"I c #424242",
"J c #DEDEDE",
"K c #3E3E3E",
"L c #5D5D5D",
"M c #CFCFCF",
"N c #878787",
"O c #494949",
"P c #BEBEBE",
"Q c #4D4D4D",
"R c #3B3B3B",
"S c #F3F3F3",
"T c #FDFEFF",
"U c #0BA3D9",
"V c #0993C4",
"W c #8075AB",
"X c #A59DC3",
"Y c #3F2F80",
"Z c #A9A2C6",
"` c #463785",
" . c #574A90",
".. c #B5AFCE",
"+. c #575757",
"@. c #C8C8C8",
"#. c #141414",
"$. c #E2E2E2",
"%. c #2A2A2A",
"&. c #A9A9A9",
"*. c #767676",
"=. c #5C5C5C",
"-. c #848484",
";. c #ADADAD",
">. c #C2C2C2",
",. c #5F5F5F",
"'. c #DDDDDD",
"). c #FAFDFF",
"!. c #0879A1",
"~. c #F3FBFE",
"{. c #9087B6",
"]. c #DCD9E8",
"^. c #A098C0",
"/. c #FAF9FC",
"(. c #776CA5",
"_. c #CCC8DE",
":. c #968DBA",
"<. c #BBBBBB",
"[. c #656565",
"}. c #9B9B9B",
"|. c #686868",
"1. c #DADADA",
"2. c #565656",
"3. c #B4B4B4",
"4. c #B2B2B2",
"5. c #757575",
"6. c #B5B5B5",
"7. c #B1B1B1",
"8. c #B0B0B0",
"9. c #065F7E",
"0. c #F4FBFE",
"a. c #C0C0C0",
"b. c #7F7F7F",
"c. c #FDFDFD",
"d. c #F7FCFE",
"e. c #066587",
"f. c #E1DEEB",
"g. c #FCFBFD",
"h. c #087FA9",
"i. c #FAFDFE",
"j. c #BCB6D3",
"k. c #665A9A",
"l. c #6A5E9D",
"m. c #51438C",
"n. c #A8A1C6",
"o. c #FFFEFF",
"p. c #F1F1F1",
"q. c #B6B0CF",
"r. c #625597",
"s. c #BFBDC8",
"t. c #EDEDED",
"u. c #EFEEF5",
"v. c #7368A3",
"w. c #9B93BD",
"x. c #EEF9FD",
"y. c #9998A1",
"z. c #F8F8FB",
"A. c #EBEAF2",
"B. c #111111",
"C. c #8A8A8A",
"D. c #F7F7F7",
"E. c #F8F7FA",
"F. c #84C2E3",
"G. c #065A77",
"H. c #221A42",
"I. c #A19AC1",
"J. c #EBE9F2",
"K. c #FBFAFC",
"L. c #CECADF",
"M. c #7A6FA7",
"N. c #000000",
"O. c #1E1E1E",
"P. c #A1A1A1",
"Q. c #958DB9",
"R. c #32246B",
"S. c #291E58",
"T. c #201746",
"U. c #221949",
"V. c #867CAF",
"W. c #2F2F2F",
"X. c #BFBFBF",
"Y. c #A099C1",
"Z. c #352671",
"`. c #56498F",
" + c #FDFDFE",
".+ c #151515",
"++ c #979797",
"@+ c #FCFCFC",
"#+ c #7065A1",
"$+ c #1E1641",
"%+ c #1D153F",
"&+ c #251B51",
"*+ c #9C94BE",
"=+ c #D8D8D8",
"-+ c #EFEFEF",
";+ c #B8B2D0",
">+ c #2E2162",
",+ c #2A1F5B",
"'+ c #7165A1",
")+ c #B3ADCD",
"!+ c #B7B1D0",
"~+ c #302366",
"{+ c #1F1642",
"]+ c #201744",
" ",
" ",
" . ",
" + @ # $ $ $ $ $ % ",
" & * = $ $ $ $ $ $ $ $ $ $ $ $ $ - ",
" ; > , ' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ! ~ ",
" { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / ( ",
" _ : ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ < ",
"[ } | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 1 ",
"2 } 3 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ",
"4 } 5 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ",
" } 6 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ",
" } 7 ^ 8 9 ^ 0 a b c d e f g ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ h ",
" } i ^ j k l m n o p q r s t ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ u ",
" v w ^ x ~ y z A o B C D E F G H I J K J L M N O P Q R S T U ",
" V w ^ W X Y Z ` o ...b +.@.#.$.R S %.&.*.=.-.;.>.,.'.^ ).} ",
" !.~.^ {.].^./.(._.:.^ ^ *.<.[.}.|.1.2.O 3.4.5.6.7.8.^ ^ ).} ",
" 9.0.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ a.*.b.c.^ ^ ^ ^ ^ ^ ^ ).} ",
" d.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ).} e.",
" ).^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 1 a f.g.^ ^ ).} h.",
" i.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ j.B k.l.m.n.o.).} !.",
" p.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ q.r.s.t.^ u.v.w.x.} ",
" y.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ z.m.A.}.B.C.D.E.B F.G. ",
" H.I.J././././.K.^ ^ ^ ^ ^ ^ ^ ^ ^ ^ L.M.^ }.N.N.O.P.Q. ",
" $ $ $ $ $ $ $ $ $ $ $ $ $ - R.S.T.U.V.^ }.N.N.W.X.Y. ",
" T.$ $ $ $ $ $ Z.* & `. +}..+++@+^ #+ ",
" $+%+ &+*+=+-+^ ^ ;+>+ ",
" ,+'+)+!+D ~+ ",
" {+]+ ",
" ",
" ",
" "};
Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

-556
View File
@@ -1,556 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
id="svg2985"
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="icon-mplayer3.svg"
inkscape:export-filename="/Users/pigoz/Documents/mplayer-icons/compiled/icon-mplayer2.png"
inkscape:export-xdpi="85.699997"
inkscape:export-ydpi="85.699997"
enable-background="new">
<defs
id="defs2987">
<linearGradient
id="linearGradient5632">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5634" />
<stop
style="stop-color:#646464;stop-opacity:1;"
offset="1"
id="stop5636" />
</linearGradient>
<linearGradient
id="linearGradient3979">
<stop
style="stop-color:#d2d2d2;stop-opacity:1;"
offset="0"
id="stop3981" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3983" />
</linearGradient>
<linearGradient
id="linearGradient3877">
<stop
style="stop-color:#3cc8ff;stop-opacity:1;"
offset="0"
id="stop3879" />
<stop
id="stop3885"
offset="1"
style="stop-color:#14b4ff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient3857"
osb:paint="solid">
<stop
style="stop-color:#03062a;stop-opacity:1;"
offset="0"
id="stop3859" />
</linearGradient>
<linearGradient
id="linearGradient3943">
<stop
id="stop3772"
offset="0"
style="stop-color:#44c8fd;stop-opacity:1;" />
<stop
style="stop-color:#284aef;stop-opacity:1;"
offset="0.46829268"
id="stop3788" />
<stop
style="stop-color:#06082a;stop-opacity:1;"
offset="1"
id="stop3947" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3877"
id="radialGradient3929"
gradientUnits="userSpaceOnUse"
cx="256.71875"
cy="256.15625"
fx="256.71875"
fy="256.15625"
r="235"
gradientTransform="translate(6.6751888,0)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3877"
id="radialGradient3932"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.6751888,0)"
cx="256.71875"
cy="256.15625"
fx="256.71875"
fy="256.15625"
r="235" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3979"
id="linearGradient3924"
x1="256.12192"
y1="491.25339"
x2="256.12192"
y2="11.186499"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3943"
id="radialGradient3943"
cx="227.08333"
cy="218.25"
fx="227.08333"
fy="218.25"
r="197.08333"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3877"
id="radialGradient3964"
gradientUnits="userSpaceOnUse"
cx="258.69565"
cy="381.56522"
fx="258.69565"
fy="381.56522"
r="169.56522" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3979-0"
id="linearGradient3985"
x1="259.45453"
y1="256.90909"
x2="259.45453"
y2="38.000004"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,2)" />
<linearGradient
id="linearGradient3979-0">
<stop
style="stop-color:#ffffff;stop-opacity:0.01960784;"
offset="0"
id="stop3981-1" />
<stop
style="stop-color:#ffffff;stop-opacity:0.86274511;"
offset="1"
id="stop3983-0" />
</linearGradient>
<linearGradient
y2="38.000004"
x2="259.45453"
y1="256.90909"
x1="259.45453"
gradientTransform="translate(0,2)"
gradientUnits="userSpaceOnUse"
id="linearGradient4907"
xlink:href="#linearGradient3979-0"
inkscape:collect="always" />
<filter
inkscape:collect="always"
id="filter5485">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="6.7826086"
id="feGaussianBlur5487" />
</filter>
<filter
inkscape:collect="always"
id="filter5501">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="3.3913043"
id="feGaussianBlur5503" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3943-7"
id="radialGradient3943-9"
cx="227.08333"
cy="218.25"
fx="227.08333"
fy="218.25"
r="197.08333"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3943-7">
<stop
id="stop3772-1"
offset="0"
style="stop-color:#44c8fd;stop-opacity:1;" />
<stop
style="stop-color:#284aef;stop-opacity:1;"
offset="0.46829268"
id="stop3788-5" />
<stop
style="stop-color:#06082a;stop-opacity:1;"
offset="1"
id="stop3947-6" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5607">
<path
sodipodi:type="arc"
style="fill:#000000;fill-opacity:0.74509804;stroke:none"
id="path5609"
sodipodi:cx="227.08333"
sodipodi:cy="218.25"
sodipodi:rx="197.08333"
sodipodi:ry="197.08333"
d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
transform="matrix(1.2962957,0,0,1.2962957,-37.866811,203.33677)"
mask="none" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5611">
<path
sodipodi:type="arc"
style="fill:#000000;fill-opacity:0.74509804;stroke:none"
id="path5613"
sodipodi:cx="227.08333"
sodipodi:cy="218.25"
sodipodi:rx="197.08333"
sodipodi:ry="197.08333"
d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
transform="matrix(0.91114848,0,0,0.91114848,50.372646,143.15146)"
mask="none" />
</clipPath>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5632"
id="linearGradient5657"
gradientUnits="userSpaceOnUse"
x1="280.81955"
y1="224.967"
x2="280.81955"
y2="438.65695"
gradientTransform="translate(0,2)" />
<filter
inkscape:collect="always"
id="filter5667">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.32939063"
id="feGaussianBlur5669" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5632-0"
id="linearGradient5657-3"
gradientUnits="userSpaceOnUse"
x1="280.81955"
y1="224.967"
x2="280.81955"
y2="438.65695"
gradientTransform="translate(0,2)" />
<linearGradient
id="linearGradient5632-0">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5634-4" />
<stop
style="stop-color:#646464;stop-opacity:1;"
offset="1"
id="stop5636-0" />
</linearGradient>
<filter
inkscape:collect="always"
id="filter5717">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="4.2775091"
id="feGaussianBlur5719" />
</filter>
<filter
inkscape:collect="always"
id="filter5729">
<feBlend
inkscape:collect="always"
mode="darken"
in2="BackgroundImage"
id="feBlend5731" />
</filter>
<filter
inkscape:collect="always"
id="filter5737">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.9374501"
id="feGaussianBlur5739" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3877"
id="radialGradient5741"
gradientUnits="userSpaceOnUse"
cx="258.69565"
cy="381.56522"
fx="258.69565"
fy="381.56522"
r="169.56522" />
<filter
inkscape:collect="always"
id="filter5784">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="10.173913"
id="feGaussianBlur5786" />
</filter>
<filter
inkscape:collect="always"
id="filter5792">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="8.4782608"
id="feGaussianBlur5794" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3877"
id="radialGradient5796"
gradientUnits="userSpaceOnUse"
cx="258.69565"
cy="381.56522"
fx="258.69565"
fy="381.56522"
r="169.56522" />
<filter
inkscape:collect="always"
id="filter5845"
x="-0.16900845"
width="1.3380169"
y="-0.20256461"
height="1.4051292">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="21.923266"
id="feGaussianBlur5847" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.59"
inkscape:cx="247.81648"
inkscape:cy="251.19615"
inkscape:current-layer="layer9"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1629"
inkscape:window-height="1006"
inkscape:window-x="47"
inkscape:window-y="0"
inkscape:window-maximized="0" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="shadow"
id="g4931"
inkscape:groupmode="layer"
style="filter:url(#filter5729)"
sodipodi:insensitive="true">
<path
transform="matrix(1.0008681,0,0,1.0008681,-0.32354214,1.8790597)"
d="m 500.88873,255.89879 a 244.78751,244.78751 0 1 1 -489.575009,0 244.78751,244.78751 0 1 1 489.575009,0 z"
sodipodi:ry="244.78751"
sodipodi:rx="244.78751"
sodipodi:cy="255.89879"
sodipodi:cx="256.10123"
id="path4933"
style="fill:#000000;fill-opacity:0.74509804;stroke:none;filter:url(#filter5737)"
sodipodi:type="arc" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="chrome"
sodipodi:insensitive="true">
<path
sodipodi:type="arc"
style="fill:url(#linearGradient3924);fill-opacity:1;stroke:none"
id="path3148"
sodipodi:cx="256.10123"
sodipodi:cy="255.89879"
sodipodi:rx="244.78751"
sodipodi:ry="244.78751"
d="m 500.88873,255.89879 a 244.78751,244.78751 0 1 1 -489.575009,0 244.78751,244.78751 0 1 1 489.575009,0 z"
transform="matrix(1.0008681,0,0,1.0008681,-0.32354214,-0.12094033)" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="base-glass"
sodipodi:insensitive="true">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient3943);fill-opacity:1;stroke:none"
id="path3927"
sodipodi:cx="227.08333"
sodipodi:cy="218.25"
sodipodi:rx="197.08333"
sodipodi:ry="197.08333"
d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
transform="matrix(1.1467231,0,0,1.1467231,-4.401693,5.727699)"
mask="none" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="glows"
sodipodi:insensitive="true"
style="display:inline">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient5741);fill-opacity:1;stroke:none;filter:url(#filter5501)"
id="path3946"
sodipodi:cx="258.69565"
sodipodi:cy="381.56522"
sodipodi:rx="169.56522"
sodipodi:ry="169.56522"
d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
transform="matrix(1.2585469,0,0,1.2585469,-67.79803,-174.43515)"
clip-path="url(#clipPath5611)" />
<path
transform="matrix(0.88461539,0,0,0.88461539,29.095871,-174.14716)"
d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
sodipodi:ry="169.56522"
sodipodi:rx="169.56522"
sodipodi:cy="381.56522"
sodipodi:cx="258.69565"
id="path3962"
style="fill:url(#radialGradient3964);fill-opacity:1;stroke:none;filter:url(#filter5485)"
sodipodi:type="arc"
clip-path="url(#clipPath5607)" />
</g>
<g
inkscape:label="glows2"
id="g5762"
inkscape:groupmode="layer"
style="opacity:0.73999999;display:inline"
sodipodi:insensitive="true">
<path
clip-path="url(#clipPath5611)"
transform="matrix(1.2585469,0,0,1.2585469,-67.79803,-174.43515)"
d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
sodipodi:ry="169.56522"
sodipodi:rx="169.56522"
sodipodi:cy="381.56522"
sodipodi:cx="258.69565"
id="path5764"
style="fill:url(#radialGradient5796);fill-opacity:1;stroke:none;filter:url(#filter5792)"
sodipodi:type="arc" />
<path
clip-path="url(#clipPath5607)"
sodipodi:type="arc"
style="fill:url(#radialGradient3964);fill-opacity:1;stroke:none;filter:url(#filter5784)"
id="path5766"
sodipodi:cx="258.69565"
sodipodi:cy="381.56522"
sodipodi:rx="169.56522"
sodipodi:ry="169.56522"
d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
transform="matrix(0.88461539,0,0,0.88461539,29.095871,-174.14716)" />
</g>
<g
inkscape:groupmode="layer"
id="layer9"
inkscape:label="glow3"
style="opacity:0.7">
<path
sodipodi:type="arc"
style="fill:#23c8ff;fill-opacity:1;stroke:none;filter:url(#filter5845)"
id="path5799"
sodipodi:cx="260.0629"
sodipodi:cy="345.01886"
sodipodi:rx="155.66037"
sodipodi:ry="129.87421"
d="m 415.72327,345.01886 a 155.66037,129.87421 0 1 1 -311.32074,0 155.66037,129.87421 0 1 1 311.32074,0 z"
transform="matrix(0.92027607,0,0,0.82232826,17.588582,32.614052)"
inkscape:export-filename="/Users/pigoz/Documents/mplayer-icons/compiled/path5799.png"
inkscape:export-xdpi="85.699997"
inkscape:export-ydpi="85.699997" />
</g>
<g
inkscape:groupmode="layer"
id="layer8"
inkscape:label="gloss-clipping"
sodipodi:insensitive="true" />
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="play"
sodipodi:insensitive="true">
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;filter:url(#filter5717)"
inkscape:transform-center-x="-31.26597"
inkscape:transform-center-y="-0.032805761"
d="m 190.37028,382.72523 0,-120.00058 0,-120.0006 93.87484,60.04949 93.87489,60.04951 -93.87489,59.95109 z"
id="path3999-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
inkscape:export-xdpi="85.699997"
inkscape:export-ydpi="85.699997" />
<path
style="fill:url(#linearGradient5657);fill-opacity:1;stroke:#000000;stroke-width:6;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:transform-center-x="-29.755544"
inkscape:transform-center-y="-0.03121957"
d="m 194.68911,375.82668 0,-114.20348 0,-114.2035 89.33985,57.14856 89.33989,57.14858 -89.33989,57.05492 z"
id="path3999"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
inkscape:export-xdpi="85.699997"
inkscape:export-ydpi="85.699997" />
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="white-gloss"
style="opacity:0.9137931;display:inline"
sodipodi:insensitive="true">
<path
style="fill:url(#linearGradient4907);fill-opacity:1;stroke:none;display:inline;filter:url(#filter5667)"
d="M 256,42.90625 C 142.67988,42.90625 49.723058,129.38336 40.3125,239.5 98.19077,257.96934 164.46733,270.1875 258,270.1875 c 96.86848,0 137.8965,-5.8873 213.8125,-29.4375 C 463.00354,130.03648 369.74992,42.90625 256,42.90625 z"
id="path3950"
inkscape:connector-curvature="0"
sodipodi:nodetypes="scscs"
inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
inkscape:export-xdpi="85.699997"
inkscape:export-ydpi="85.699997"
transform="matrix(0.99524152,0,0,0.99524152,0.95307007,-2.3236889)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 264 KiB

+23
View File
@@ -0,0 +1,23 @@
[Desktop Entry]
Type=Application
Name=mpv Media Player
Name[ca]=Reproductor multimèdia mpv
Name[pl]=mpv odtwarzacz multimedialny
Name[ru]=Проигрыватель mpv
GenericName=Multimedia player
Comment=Play movies and songs
Comment[ca]=Reproduïu vídeos i cançons
Comment[de]=Filme und Musik abspielen
Comment[es]=Reproduzca vídeos y canciones
Comment[fr]=Lecteur multimédia
Comment[it]=Lettore multimediale
Comment[pl]=Odtwarzaj filmy i muzykę
Comment[ru]=Воспроизвести фильмы и музыку
Comment[zh]=多媒体播放器
Icon=mpv
TryExec=mpv
Exec=mpv --really-quiet --force-window -- %F
Terminal=false
NoDisplay=true
Categories=AudioVideo;Audio;Video;Player;TV;
MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/mp4;video/msvideo;video/x-msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-flv;video/x-theora;video/x-matroska;video/webm;audio/x-flac;
+2 -11
View File
@@ -449,7 +449,6 @@ asx_parse_ref(ASX_Parser_t* parser, char** attribs) {
static void asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) {
char *href;
stream_t* stream;
if(parser->deep > 0)
return;
@@ -459,16 +458,8 @@ static void asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs
asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" );
return;
}
stream=stream_open(href, NULL);
if(!stream) {
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",href);
free(href);
return;
}
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Not recursively loading playlist %s\n",href);
free_stream(stream);
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Recursive playlist %s\n", href);
playlist_add_file(parser->pl, href);
free(href);
//mp_msg(MSGT_PLAYTREE,MSGL_INFO,"Need to implement entryref\n");
}
+29 -14
View File
@@ -41,6 +41,13 @@
#include <libavfilter/avfilter.h>
#endif
#ifdef CONFIG_LIBAVRESAMPLE
#include <libavresample/avresample.h>
#endif
#ifdef CONFIG_LIBSWRESAMPLE
#include <libswresample/swresample.h>
#endif
static int av_log_level_to_mp_level(int av_level)
{
if (av_level > AV_LOG_VERBOSE)
@@ -48,7 +55,7 @@ static int av_log_level_to_mp_level(int av_level)
if (av_level > AV_LOG_INFO)
return MSGL_V;
if (av_level > AV_LOG_WARNING)
return MSGL_INFO;
return MSGL_V;
if (av_level > AV_LOG_ERROR)
return MSGL_WARN;
if (av_level > AV_LOG_FATAL)
@@ -140,22 +147,30 @@ void init_libav(void)
}
#define V(x) (x)>>16, (x)>>8 & 255, (x) & 255
static void print_version(char *name, unsigned buildv, unsigned runv)
static void print_version(int v, char *name, unsigned buildv, unsigned runv)
{
if (buildv == runv)
mp_msg(MSGT_CPLAYER, MSGL_V, "Compiled against %s version %d.%d.%d\n",
name, V(buildv));
else
mp_msg(MSGT_CPLAYER, MSGL_V, "Compiled against %s version %d.%d.%d "
"(runtime %d.%d.%d)\n", name, V(buildv), V(runv));
mp_msg(MSGT_CPLAYER, v, " %-15s %d.%d.%d", name, V(buildv));
if (buildv != runv)
mp_msg(MSGT_CPLAYER, v, " (runtime %d.%d.%d)", V(runv));
mp_msg(MSGT_CPLAYER, v, "\n");
}
#undef V
void print_libav_versions(void)
void print_libav_versions(int v)
{
print_version("libavutil", LIBAVUTIL_VERSION_INT, avutil_version());
print_version("libavcodec", LIBAVCODEC_VERSION_INT, avcodec_version());
print_version("libavformat", LIBAVFORMAT_VERSION_INT, avformat_version());
print_version("libswscale", LIBSWSCALE_VERSION_INT, swscale_version());
mp_msg(MSGT_CPLAYER, v, "%s library versions:\n", LIB_PREFIX);
print_version(v, "libavutil", LIBAVUTIL_VERSION_INT, avutil_version());
print_version(v, "libavcodec", LIBAVCODEC_VERSION_INT, avcodec_version());
print_version(v, "libavformat", LIBAVFORMAT_VERSION_INT, avformat_version());
print_version(v, "libswscale", LIBSWSCALE_VERSION_INT, swscale_version());
#ifdef CONFIG_LIBAVFILTER
print_version(v, "libavfilter", LIBAVFILTER_VERSION_INT, avfilter_version());
#endif
#ifdef CONFIG_LIBAVRESAMPLE
print_version(v, "libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version());
#endif
#ifdef CONFIG_LIBSWRESAMPLE
print_version(v, "libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version());
#endif
}
+1 -1
View File
@@ -1,2 +1,2 @@
void init_libav(void);
void print_libav_versions(void);
void print_libav_versions(int v);
+72 -1
View File
@@ -273,18 +273,89 @@ int bstr_decode_utf8(struct bstr s, struct bstr *out_next)
return -1;
codepoint &= 127 >> bytes;
for (int n = 1; n < bytes; n++) {
int tmp = s.start[0];
int tmp = (unsigned char)s.start[0];
if ((tmp & 0xC0) != 0x80)
return -1;
codepoint = (codepoint << 6) | (tmp & ~0xC0);
s.start++; s.len--;
}
if (codepoint > 0x10FFFF || (codepoint >= 0xD800 && codepoint <= 0xDFFF))
return -1;
// Overlong sequences - check taken from libavcodec.
// (The only reason we even bother with this is to make libavcodec's
// retarded subtitle utf-8 check happy.)
unsigned int min = bytes == 2 ? 0x80 : 1 << (5 * bytes - 4);
if (codepoint < min)
return -1;
}
if (out_next)
*out_next = s;
return codepoint;
}
int bstr_validate_utf8(struct bstr s)
{
while (s.len) {
if (bstr_decode_utf8(s, &s) < 0) {
// Try to guess whether the sequence was just cut-off.
unsigned int codepoint = (unsigned char)s.start[0];
int bytes = bstr_parse_utf8_code_length(codepoint);
if (bytes > 1 && s.len < 6) {
// Manually check validity of left bytes
for (int n = 1; n < bytes; n++) {
if (n >= s.len) {
// Everything valid until now - just cut off.
return -(bytes - s.len);
}
int tmp = (unsigned char)s.start[n];
if ((tmp & 0xC0) != 0x80)
break;
}
}
return -8;
}
}
return 0;
}
static void append_bstr(bstr *buf, bstr s)
{
buf->start = talloc_realloc(NULL, buf->start, unsigned char, buf->len + s.len);
memcpy(buf->start + buf->len, s.start, s.len);
buf->len += s.len;
}
struct bstr bstr_sanitize_utf8_latin1(void *talloc_ctx, struct bstr s)
{
bstr new = {0};
bstr left = s;
unsigned char *first_ok = s.start;
while (left.len) {
int r = bstr_decode_utf8(left, &left);
if (r < 0) {
append_bstr(&new, (bstr){first_ok, left.start - first_ok});
uint32_t codepoint = (unsigned char)left.start[0];
char data[8];
uint8_t tmp;
char *output = data;
PUT_UTF8(codepoint, tmp, *output++ = tmp;);
append_bstr(&new, (bstr){data, output - data});
left.start += 1;
left.len -= 1;
first_ok = left.start;
}
}
if (!new.start)
return s;
if (first_ok != left.start)
append_bstr(&new, (bstr){first_ok, left.start - first_ok});
// For convenience
append_bstr(&new, (bstr){"\0", 1});
new.len -= 1;
talloc_steal(talloc_ctx, new.start);
return new;
}
bool bstr_case_startswith(struct bstr s, struct bstr prefix)
{
struct bstr start = bstr_splice(s, 0, prefix.len);
+17
View File
@@ -92,6 +92,23 @@ int bstr_decode_utf8(struct bstr str, struct bstr *out_next);
// On error, -1 is returned. On success, it returns a value in the range [1, 4].
int bstr_parse_utf8_code_length(unsigned char b);
// Return >= 0 if the string is valid UTF-8, otherwise negative error code.
// Embedded \0 bytes are considered valid.
// This returns -N if the UTF-8 string was likely just cut-off in the middle of
// an UTF-8 sequence: -1 means 1 byte was missing, -5 5 bytes missing.
// If the string was likely not cut off, -8 is returned.
// Use (return_value > -8) to check whether the string is valid UTF-8 or valid
// but cut-off UTF-8.
int bstr_validate_utf8(struct bstr s);
// Force the input string to valid UTF-8. If invalid UTF-8 encoding is
// encountered, the invalid bytes are interpreted as Latin-1.
// Embedded \0 bytes are considered valid.
// If replacement happens, a newly allocated string is returned (with a \0
// byte added past its end for convenience). The string is allocated via
// talloc, with talloc_ctx as parent.
struct bstr bstr_sanitize_utf8_latin1(void *talloc_ctx, struct bstr s);
// Return the text before the next line break, and return it. Change *rest to
// point to the text following this line break. (rest can be NULL.)
// Line break characters are not stripped.
+33 -12
View File
@@ -41,6 +41,12 @@
#include "charset_conv.h"
bool mp_charset_is_utf8(const char *user_cp)
{
return user_cp && (strcasecmp(user_cp, "utf8") == 0 ||
strcasecmp(user_cp, "utf-8") == 0);
}
// Split the string on ':' into components.
// out_arr is at least max entries long.
// Return number of out_arr entries filled.
@@ -70,9 +76,13 @@ static int split_colon(const char *user_cp, int max, bstr *out_arr)
bool mp_charset_requires_guess(const char *user_cp)
{
bstr res[2] = {{0}};
split_colon(user_cp, 2, res);
int r = split_colon(user_cp, 2, res);
// Note that "utf8" is the UTF-8 codepage, while "utf8:..." specifies UTF-8
// by default, plus a codepage that is used if the input is not UTF-8.
return bstrcasecmp0(res[0], "enca") == 0 ||
bstrcasecmp0(res[0], "guess") == 0;
bstrcasecmp0(res[0], "guess") == 0 ||
(r > 1 && bstrcasecmp0(res[0], "utf-8") == 0) ||
(r > 1 && bstrcasecmp0(res[0], "utf8") == 0);
}
#ifdef CONFIG_ENCA
@@ -110,9 +120,6 @@ static const char *enca_guess(bstr buf, const char *language)
#ifdef CONFIG_LIBGUESS
static const char *libguess_guess(bstr buf, const char *language)
{
if (libguess_validate_utf8(buf.start, buf.len))
return "UTF-8";
if (!language || !language[0] || strcmp(language, "help") == 0) {
mp_msg(MSGT_SUBREADER, MSGL_ERR, "libguess needs a language: "
"japanese taiwanese chinese korean russian arabic turkish "
@@ -129,11 +136,17 @@ static const char *libguess_guess(bstr buf, const char *language)
// If user_cp doesn't refer to any known auto-detection (for example because
// it's a real iconv codepage), user_cp is returned without even looking at
// the buf data.
const char *mp_charset_guess(bstr buf, const char *user_cp)
const char *mp_charset_guess(bstr buf, const char *user_cp, int flags)
{
if (!mp_charset_requires_guess(user_cp))
return user_cp;
// Do our own UTF-8 detection, because at least ENCA seems to get it
// wrong sometimes (suggested by divVerent).
int r = bstr_validate_utf8(buf);
if (r >= 0 || (r > -8 && (flags & MP_ICONV_ALLOW_CUTOFF)))
return "UTF-8";
bstr params[3] = {{0}};
split_colon(user_cp, 3, params);
@@ -152,6 +165,10 @@ const char *mp_charset_guess(bstr buf, const char *user_cp)
if (bstrcasecmp0(type, "guess") == 0)
res = libguess_guess(buf, lang);
#endif
if (bstrcasecmp0(type, "utf8") == 0 || bstrcasecmp0(type, "utf-8") == 0) {
if (!fallback)
fallback = params[1].start; // must be already 0-terminated
}
if (res) {
mp_msg(MSGT_SUBREADER, MSGL_DBG2, "%.*s detected charset: '%s'\n",
@@ -160,9 +177,12 @@ const char *mp_charset_guess(bstr buf, const char *user_cp)
res = fallback;
mp_msg(MSGT_SUBREADER, MSGL_DBG2,
"Detection with %.*s failed: fallback to %s\n",
BSTR_P(type), res && res[0] ? res : "no conversion");
BSTR_P(type), res && res[0] ? res : "broken UTF-8/Latin1");
}
if (!res && !(flags & MP_STRICT_UTF8))
res = "UTF-8-BROKEN";
return res;
}
@@ -176,7 +196,7 @@ const char *mp_charset_guess(bstr buf, const char *user_cp)
// returns: same as mp_iconv_to_utf8()
bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags)
{
return mp_iconv_to_utf8(buf, mp_charset_guess(buf, user_cp), flags);
return mp_iconv_to_utf8(buf, mp_charset_guess(buf, user_cp, flags), flags);
}
// Use iconv to convert buf to UTF-8.
@@ -193,16 +213,17 @@ bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags)
bstr mp_iconv_to_utf8(bstr buf, const char *cp, int flags)
{
#ifdef CONFIG_ICONV
const char *tocp = "UTF-8";
if (!cp || !cp[0] || strcasecmp(cp, tocp) == 0)
if (!cp || !cp[0] || mp_charset_is_utf8(cp))
return buf;
if (strcasecmp(cp, "ASCII") == 0)
return buf;
if (strcasecmp(cp, "UTF-8-BROKEN") == 0)
return bstr_sanitize_utf8_latin1(NULL, buf);
iconv_t icdsc;
if ((icdsc = iconv_open(tocp, cp)) == (iconv_t) (-1)) {
if ((icdsc = iconv_open("UTF-8", cp)) == (iconv_t) (-1)) {
if (flags & MP_ICONV_VERBOSE)
mp_msg(MSGT_SUBREADER, MSGL_ERR,
"Error opening iconv with codepage '%s'\n", cp);
+3 -1
View File
@@ -7,10 +7,12 @@
enum {
MP_ICONV_VERBOSE = 1, // print errors instead of failing silently
MP_ICONV_ALLOW_CUTOFF = 2, // allow partial input data
MP_STRICT_UTF8 = 4, // don't fall back to UTF-8-BROKEN when guessing
};
bool mp_charset_is_utf8(const char *user_cp);
bool mp_charset_requires_guess(const char *user_cp);
const char *mp_charset_guess(bstr buf, const char *user_cp);
const char *mp_charset_guess(bstr buf, const char *user_cp, int flags);
bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags);
bstr mp_iconv_to_utf8(bstr buf, const char *cp, int flags);
+535 -205
View File
File diff suppressed because it is too large. Load diff
+19 -2
View File
@@ -22,12 +22,29 @@
struct MPContext;
struct mp_cmd;
void mp_get_osd_mouse_pos(struct MPContext *mpctx, float *x, float *y);
void command_init(struct MPContext *mpctx);
void command_uninit(struct MPContext *mpctx);
void run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
char *mp_property_expand_string(struct MPContext *mpctx, char *str);
char *mp_property_expand_string(struct MPContext *mpctx, const char *str);
void property_print_help(void);
int mp_property_do(const char* name, int action, void* val,
struct MPContext *mpctx);
const struct m_option *mp_get_property_list(void);
enum mp_event {
MP_EVENT_NONE,
MP_EVENT_TICK,
MP_EVENT_PROPERTY, // char*, property that is changed
MP_EVENT_TRACKS_CHANGED,
MP_EVENT_START_FILE,
MP_EVENT_END_FILE,
};
void mp_notify(struct MPContext *mpctx, enum mp_event event, void *arg);
void mp_notify_property(struct MPContext *mpctx, const char *property);
void mp_flush_events(struct MPContext *mpctx);
#endif /* MPLAYER_COMMAND_H */
+460 -282
View File
File diff suppressed because it is too large. Load diff
+16 -4
View File
@@ -43,6 +43,7 @@ enum mp_command_type {
MP_CMD_PLAYLIST_REMOVE,
MP_CMD_PLAYLIST_MOVE,
MP_CMD_SUB_STEP,
MP_CMD_SUB_SEEK,
MP_CMD_TV_SET_CHANNEL,
MP_CMD_TV_LAST_CHANNEL,
MP_CMD_TV_SET_FREQ,
@@ -74,7 +75,7 @@ enum mp_command_type {
MP_CMD_DISABLE_INPUT_SECTION,
/// DVB commands
MP_CMD_DVB_SET_CHANNEL = 5101,
MP_CMD_DVB_SET_CHANNEL,
/// Audio Filter commands
MP_CMD_AF,
@@ -85,6 +86,12 @@ enum mp_command_type {
/// Video output commands
MP_CMD_VO_CMDLINE,
/// Internal for Lua scripts
MP_CMD_SCRIPT_DISPATCH,
MP_CMD_OVERLAY_ADD,
MP_CMD_OVERLAY_REMOVE,
// Internal
MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p
};
@@ -116,6 +123,10 @@ enum mp_input_section_flags {
// other sections for it (like the default section). Instead, an unbound
// key warning will be printed.
MP_INPUT_EXCLUSIVE = 1,
// Let mp_input_test_dragging() return true, even if inside the mouse area.
MP_INPUT_ALLOW_VO_DRAGGING = 2,
// Don't force mouse pointer visible, even if inside the mouse area.
MP_INPUT_ALLOW_HIDE_CURSOR = 4,
};
struct input_ctx;
@@ -209,7 +220,8 @@ struct mp_cmd *mp_input_get_cmd(struct input_ctx *ictx, int time,
// Parse text and return corresponding struct mp_cmd.
// The location parameter is for error messages.
struct mp_cmd *mp_input_parse_cmd(bstr str, const char *location);
struct mp_cmd *mp_input_parse_cmd(struct input_ctx *ictx, bstr str,
const char *location);
// After getting a command from mp_input_get_cmd you need to free it using this
// function
@@ -262,8 +274,8 @@ bool mp_input_test_mouse_active(struct input_ctx *ictx, int x, int y);
bool mp_input_test_dragging(struct input_ctx *ictx, int x, int y);
// Initialize the input system
struct MPOpts;
struct input_ctx *mp_input_init(struct MPOpts *opts);
struct mpv_global;
struct input_ctx *mp_input_init(struct mpv_global *global);
void mp_input_uninit(struct input_ctx *ictx);
+120 -120
View File
@@ -27,90 +27,96 @@
#define MP_KEY_TAB 9
/* Control keys */
#define MP_KEY_BACKSPACE (MP_KEY_BASE+0)
#define MP_KEY_DELETE (MP_KEY_BASE+1)
#define MP_KEY_INSERT (MP_KEY_BASE+2)
#define MP_KEY_HOME (MP_KEY_BASE+3)
#define MP_KEY_END (MP_KEY_BASE+4)
#define MP_KEY_PAGE_UP (MP_KEY_BASE+5)
#define MP_KEY_PAGE_DOWN (MP_KEY_BASE+6)
#define MP_KEY_ESC (MP_KEY_BASE+7)
#define MP_KEY_PRINT (MP_KEY_BASE+8)
#define MP_KEY_BACKSPACE (MP_KEY_BASE+0)
#define MP_KEY_DELETE (MP_KEY_BASE+1)
#define MP_KEY_INSERT (MP_KEY_BASE+2)
#define MP_KEY_HOME (MP_KEY_BASE+3)
#define MP_KEY_END (MP_KEY_BASE+4)
#define MP_KEY_PAGE_UP (MP_KEY_BASE+5)
#define MP_KEY_PAGE_DOWN (MP_KEY_BASE+6)
#define MP_KEY_ESC (MP_KEY_BASE+7)
#define MP_KEY_PRINT (MP_KEY_BASE+8)
/* Control keys short name */
#define MP_KEY_BS MP_KEY_BACKSPACE
#define MP_KEY_DEL MP_KEY_DELETE
#define MP_KEY_INS MP_KEY_INSERT
#define MP_KEY_PGUP MP_KEY_PAGE_UP
#define MP_KEY_PGDOWN MP_KEY_PAGE_DOWN
#define MP_KEY_PGDWN MP_KEY_PAGE_DOWN
#define MP_KEY_BS MP_KEY_BACKSPACE
#define MP_KEY_DEL MP_KEY_DELETE
#define MP_KEY_INS MP_KEY_INSERT
#define MP_KEY_PGUP MP_KEY_PAGE_UP
#define MP_KEY_PGDOWN MP_KEY_PAGE_DOWN
#define MP_KEY_PGDWN MP_KEY_PAGE_DOWN
/* Cursor movement */
#define MP_KEY_CRSR (MP_KEY_BASE+0x10)
#define MP_KEY_RIGHT (MP_KEY_CRSR+0)
#define MP_KEY_LEFT (MP_KEY_CRSR+1)
#define MP_KEY_DOWN (MP_KEY_CRSR+2)
#define MP_KEY_UP (MP_KEY_CRSR+3)
#define MP_KEY_CRSR (MP_KEY_BASE+0x10)
#define MP_KEY_RIGHT (MP_KEY_CRSR+0)
#define MP_KEY_LEFT (MP_KEY_CRSR+1)
#define MP_KEY_DOWN (MP_KEY_CRSR+2)
#define MP_KEY_UP (MP_KEY_CRSR+3)
/* Multimedia keyboard/remote keys */
#define MP_KEY_MM_BASE (MP_KEY_BASE+0x20)
#define MP_KEY_POWER (MP_KEY_MM_BASE+0)
#define MP_KEY_MENU (MP_KEY_MM_BASE+1)
#define MP_KEY_PLAY (MP_KEY_MM_BASE+2)
#define MP_KEY_PAUSE (MP_KEY_MM_BASE+3)
#define MP_KEY_PLAYPAUSE (MP_KEY_MM_BASE+4)
#define MP_KEY_STOP (MP_KEY_MM_BASE+5)
#define MP_KEY_FORWARD (MP_KEY_MM_BASE+6)
#define MP_KEY_REWIND (MP_KEY_MM_BASE+7)
#define MP_KEY_NEXT (MP_KEY_MM_BASE+8)
#define MP_KEY_PREV (MP_KEY_MM_BASE+9)
#define MP_KEY_VOLUME_UP (MP_KEY_MM_BASE+10)
#define MP_KEY_VOLUME_DOWN (MP_KEY_MM_BASE+11)
#define MP_KEY_MUTE (MP_KEY_MM_BASE+12)
/* Multimedia/internet keyboard/remote keys */
#define MP_KEY_MM_BASE (MP_KEY_BASE+0x20)
#define MP_KEY_POWER (MP_KEY_MM_BASE+0)
#define MP_KEY_MENU (MP_KEY_MM_BASE+1)
#define MP_KEY_PLAY (MP_KEY_MM_BASE+2)
#define MP_KEY_PAUSE (MP_KEY_MM_BASE+3)
#define MP_KEY_PLAYPAUSE (MP_KEY_MM_BASE+4)
#define MP_KEY_STOP (MP_KEY_MM_BASE+5)
#define MP_KEY_FORWARD (MP_KEY_MM_BASE+6)
#define MP_KEY_REWIND (MP_KEY_MM_BASE+7)
#define MP_KEY_NEXT (MP_KEY_MM_BASE+8)
#define MP_KEY_PREV (MP_KEY_MM_BASE+9)
#define MP_KEY_VOLUME_UP (MP_KEY_MM_BASE+10)
#define MP_KEY_VOLUME_DOWN (MP_KEY_MM_BASE+11)
#define MP_KEY_MUTE (MP_KEY_MM_BASE+12)
#define MP_KEY_HOMEPAGE (MP_KEY_MM_BASE+13)
#define MP_KEY_WWW (MP_KEY_MM_BASE+14)
#define MP_KEY_MAIL (MP_KEY_MM_BASE+15)
#define MP_KEY_FAVORITES (MP_KEY_MM_BASE+16)
#define MP_KEY_SEARCH (MP_KEY_MM_BASE+17)
#define MP_KEY_SLEEP (MP_KEY_MM_BASE+18)
/* Function keys */
#define MP_KEY_F (MP_KEY_BASE+0x40)
/* Keypad keys */
#define MP_KEY_KEYPAD (MP_KEY_BASE+0x60)
#define MP_KEY_KP0 (MP_KEY_KEYPAD+0)
#define MP_KEY_KP1 (MP_KEY_KEYPAD+1)
#define MP_KEY_KP2 (MP_KEY_KEYPAD+2)
#define MP_KEY_KP3 (MP_KEY_KEYPAD+3)
#define MP_KEY_KP4 (MP_KEY_KEYPAD+4)
#define MP_KEY_KP5 (MP_KEY_KEYPAD+5)
#define MP_KEY_KP6 (MP_KEY_KEYPAD+6)
#define MP_KEY_KP7 (MP_KEY_KEYPAD+7)
#define MP_KEY_KP8 (MP_KEY_KEYPAD+8)
#define MP_KEY_KP9 (MP_KEY_KEYPAD+9)
#define MP_KEY_KPDEC (MP_KEY_KEYPAD+10)
#define MP_KEY_KPINS (MP_KEY_KEYPAD+11)
#define MP_KEY_KPDEL (MP_KEY_KEYPAD+12)
#define MP_KEY_KPENTER (MP_KEY_KEYPAD+13)
#define MP_KEY_KEYPAD (MP_KEY_BASE+0x60)
#define MP_KEY_KP0 (MP_KEY_KEYPAD+0)
#define MP_KEY_KP1 (MP_KEY_KEYPAD+1)
#define MP_KEY_KP2 (MP_KEY_KEYPAD+2)
#define MP_KEY_KP3 (MP_KEY_KEYPAD+3)
#define MP_KEY_KP4 (MP_KEY_KEYPAD+4)
#define MP_KEY_KP5 (MP_KEY_KEYPAD+5)
#define MP_KEY_KP6 (MP_KEY_KEYPAD+6)
#define MP_KEY_KP7 (MP_KEY_KEYPAD+7)
#define MP_KEY_KP8 (MP_KEY_KEYPAD+8)
#define MP_KEY_KP9 (MP_KEY_KEYPAD+9)
#define MP_KEY_KPDEC (MP_KEY_KEYPAD+10)
#define MP_KEY_KPINS (MP_KEY_KEYPAD+11)
#define MP_KEY_KPDEL (MP_KEY_KEYPAD+12)
#define MP_KEY_KPENTER (MP_KEY_KEYPAD+13)
// Joystick input module
#define MP_JOY_BASE (MP_KEY_BASE+0x70)
#define MP_JOY_AXIS0_PLUS (MP_JOY_BASE+0)
#define MP_JOY_AXIS0_MINUS (MP_JOY_BASE+1)
#define MP_JOY_AXIS1_PLUS (MP_JOY_BASE+2)
#define MP_JOY_AXIS1_MINUS (MP_JOY_BASE+3)
#define MP_JOY_AXIS2_PLUS (MP_JOY_BASE+4)
#define MP_JOY_AXIS2_MINUS (MP_JOY_BASE+5)
#define MP_JOY_AXIS3_PLUS (MP_JOY_BASE+6)
#define MP_JOY_AXIS3_MINUS (MP_JOY_BASE+7)
#define MP_JOY_AXIS4_PLUS (MP_JOY_BASE+8)
#define MP_JOY_AXIS4_MINUS (MP_JOY_BASE+9)
#define MP_JOY_AXIS5_PLUS (MP_JOY_BASE+10)
#define MP_JOY_AXIS5_MINUS (MP_JOY_BASE+11)
#define MP_JOY_AXIS6_PLUS (MP_JOY_BASE+12)
#define MP_JOY_AXIS6_MINUS (MP_JOY_BASE+13)
#define MP_JOY_AXIS7_PLUS (MP_JOY_BASE+14)
#define MP_JOY_AXIS7_MINUS (MP_JOY_BASE+15)
#define MP_JOY_AXIS8_PLUS (MP_JOY_BASE+16)
#define MP_JOY_AXIS8_MINUS (MP_JOY_BASE+17)
#define MP_JOY_AXIS9_PLUS (MP_JOY_BASE+18)
#define MP_JOY_AXIS9_MINUS (MP_JOY_BASE+19)
#define MP_JOY_BASE (MP_KEY_BASE+0x70)
#define MP_JOY_AXIS0_PLUS (MP_JOY_BASE+0)
#define MP_JOY_AXIS0_MINUS (MP_JOY_BASE+1)
#define MP_JOY_AXIS1_PLUS (MP_JOY_BASE+2)
#define MP_JOY_AXIS1_MINUS (MP_JOY_BASE+3)
#define MP_JOY_AXIS2_PLUS (MP_JOY_BASE+4)
#define MP_JOY_AXIS2_MINUS (MP_JOY_BASE+5)
#define MP_JOY_AXIS3_PLUS (MP_JOY_BASE+6)
#define MP_JOY_AXIS3_MINUS (MP_JOY_BASE+7)
#define MP_JOY_AXIS4_PLUS (MP_JOY_BASE+8)
#define MP_JOY_AXIS4_MINUS (MP_JOY_BASE+9)
#define MP_JOY_AXIS5_PLUS (MP_JOY_BASE+10)
#define MP_JOY_AXIS5_MINUS (MP_JOY_BASE+11)
#define MP_JOY_AXIS6_PLUS (MP_JOY_BASE+12)
#define MP_JOY_AXIS6_MINUS (MP_JOY_BASE+13)
#define MP_JOY_AXIS7_PLUS (MP_JOY_BASE+14)
#define MP_JOY_AXIS7_MINUS (MP_JOY_BASE+15)
#define MP_JOY_AXIS8_PLUS (MP_JOY_BASE+16)
#define MP_JOY_AXIS8_MINUS (MP_JOY_BASE+17)
#define MP_JOY_AXIS9_PLUS (MP_JOY_BASE+18)
#define MP_JOY_AXIS9_MINUS (MP_JOY_BASE+19)
#define MP_JOY_BTN_BASE ((MP_KEY_BASE+0x90)|MP_NO_REPEAT_KEY)
#define MP_JOY_BTN0 (MP_JOY_BTN_BASE+0)
@@ -126,54 +132,54 @@
// Mouse events from VOs
#define MP_MOUSE_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP)
#define MP_MOUSE_BTN0 (MP_MOUSE_BASE+0)
#define MP_MOUSE_BTN1 (MP_MOUSE_BASE+1)
#define MP_MOUSE_BTN2 (MP_MOUSE_BASE+2)
#define MP_MOUSE_BTN3 (MP_MOUSE_BASE+3)
#define MP_MOUSE_BTN4 (MP_MOUSE_BASE+4)
#define MP_MOUSE_BTN5 (MP_MOUSE_BASE+5)
#define MP_MOUSE_BTN6 (MP_MOUSE_BASE+6)
#define MP_MOUSE_BTN7 (MP_MOUSE_BASE+7)
#define MP_MOUSE_BTN8 (MP_MOUSE_BASE+8)
#define MP_MOUSE_BTN9 (MP_MOUSE_BASE+9)
#define MP_MOUSE_BTN10 (MP_MOUSE_BASE+10)
#define MP_MOUSE_BTN11 (MP_MOUSE_BASE+11)
#define MP_MOUSE_BTN12 (MP_MOUSE_BASE+12)
#define MP_MOUSE_BTN13 (MP_MOUSE_BASE+13)
#define MP_MOUSE_BTN14 (MP_MOUSE_BASE+14)
#define MP_MOUSE_BTN15 (MP_MOUSE_BASE+15)
#define MP_MOUSE_BTN16 (MP_MOUSE_BASE+16)
#define MP_MOUSE_BTN17 (MP_MOUSE_BASE+17)
#define MP_MOUSE_BTN18 (MP_MOUSE_BASE+18)
#define MP_MOUSE_BTN19 (MP_MOUSE_BASE+19)
#define MP_MOUSE_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP)
#define MP_MOUSE_BTN0 (MP_MOUSE_BASE+0)
#define MP_MOUSE_BTN1 (MP_MOUSE_BASE+1)
#define MP_MOUSE_BTN2 (MP_MOUSE_BASE+2)
#define MP_MOUSE_BTN3 (MP_MOUSE_BASE+3)
#define MP_MOUSE_BTN4 (MP_MOUSE_BASE+4)
#define MP_MOUSE_BTN5 (MP_MOUSE_BASE+5)
#define MP_MOUSE_BTN6 (MP_MOUSE_BASE+6)
#define MP_MOUSE_BTN7 (MP_MOUSE_BASE+7)
#define MP_MOUSE_BTN8 (MP_MOUSE_BASE+8)
#define MP_MOUSE_BTN9 (MP_MOUSE_BASE+9)
#define MP_MOUSE_BTN10 (MP_MOUSE_BASE+10)
#define MP_MOUSE_BTN11 (MP_MOUSE_BASE+11)
#define MP_MOUSE_BTN12 (MP_MOUSE_BASE+12)
#define MP_MOUSE_BTN13 (MP_MOUSE_BASE+13)
#define MP_MOUSE_BTN14 (MP_MOUSE_BASE+14)
#define MP_MOUSE_BTN15 (MP_MOUSE_BASE+15)
#define MP_MOUSE_BTN16 (MP_MOUSE_BASE+16)
#define MP_MOUSE_BTN17 (MP_MOUSE_BASE+17)
#define MP_MOUSE_BTN18 (MP_MOUSE_BASE+18)
#define MP_MOUSE_BTN19 (MP_MOUSE_BASE+19)
#define MP_MOUSE_BTN_END (MP_MOUSE_BASE+20)
#define MP_KEY_IS_MOUSE_BTN_SINGLE(code) \
((code) >= MP_MOUSE_BASE && (code) < MP_MOUSE_BTN_END)
#define MP_MOUSE_BASE_DBL ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY)
#define MP_MOUSE_BTN0_DBL (MP_MOUSE_BASE_DBL+0)
#define MP_MOUSE_BTN1_DBL (MP_MOUSE_BASE_DBL+1)
#define MP_MOUSE_BTN2_DBL (MP_MOUSE_BASE_DBL+2)
#define MP_MOUSE_BTN3_DBL (MP_MOUSE_BASE_DBL+3)
#define MP_MOUSE_BTN4_DBL (MP_MOUSE_BASE_DBL+4)
#define MP_MOUSE_BTN5_DBL (MP_MOUSE_BASE_DBL+5)
#define MP_MOUSE_BTN6_DBL (MP_MOUSE_BASE_DBL+6)
#define MP_MOUSE_BTN7_DBL (MP_MOUSE_BASE_DBL+7)
#define MP_MOUSE_BTN8_DBL (MP_MOUSE_BASE_DBL+8)
#define MP_MOUSE_BTN9_DBL (MP_MOUSE_BASE_DBL+9)
#define MP_MOUSE_BTN10_DBL (MP_MOUSE_BASE_DBL+10)
#define MP_MOUSE_BTN11_DBL (MP_MOUSE_BASE_DBL+11)
#define MP_MOUSE_BTN12_DBL (MP_MOUSE_BASE_DBL+12)
#define MP_MOUSE_BTN13_DBL (MP_MOUSE_BASE_DBL+13)
#define MP_MOUSE_BTN14_DBL (MP_MOUSE_BASE_DBL+14)
#define MP_MOUSE_BTN15_DBL (MP_MOUSE_BASE_DBL+15)
#define MP_MOUSE_BTN16_DBL (MP_MOUSE_BASE_DBL+16)
#define MP_MOUSE_BTN17_DBL (MP_MOUSE_BASE_DBL+17)
#define MP_MOUSE_BTN18_DBL (MP_MOUSE_BASE_DBL+18)
#define MP_MOUSE_BTN19_DBL (MP_MOUSE_BASE_DBL+19)
#define MP_MOUSE_BTN_DBL_END (MP_MOUSE_BASE_DBL+20)
#define MP_MOUSE_BASE_DBL ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY)
#define MP_MOUSE_BTN0_DBL (MP_MOUSE_BASE_DBL+0)
#define MP_MOUSE_BTN1_DBL (MP_MOUSE_BASE_DBL+1)
#define MP_MOUSE_BTN2_DBL (MP_MOUSE_BASE_DBL+2)
#define MP_MOUSE_BTN3_DBL (MP_MOUSE_BASE_DBL+3)
#define MP_MOUSE_BTN4_DBL (MP_MOUSE_BASE_DBL+4)
#define MP_MOUSE_BTN5_DBL (MP_MOUSE_BASE_DBL+5)
#define MP_MOUSE_BTN6_DBL (MP_MOUSE_BASE_DBL+6)
#define MP_MOUSE_BTN7_DBL (MP_MOUSE_BASE_DBL+7)
#define MP_MOUSE_BTN8_DBL (MP_MOUSE_BASE_DBL+8)
#define MP_MOUSE_BTN9_DBL (MP_MOUSE_BASE_DBL+9)
#define MP_MOUSE_BTN10_DBL (MP_MOUSE_BASE_DBL+10)
#define MP_MOUSE_BTN11_DBL (MP_MOUSE_BASE_DBL+11)
#define MP_MOUSE_BTN12_DBL (MP_MOUSE_BASE_DBL+12)
#define MP_MOUSE_BTN13_DBL (MP_MOUSE_BASE_DBL+13)
#define MP_MOUSE_BTN14_DBL (MP_MOUSE_BASE_DBL+14)
#define MP_MOUSE_BTN15_DBL (MP_MOUSE_BASE_DBL+15)
#define MP_MOUSE_BTN16_DBL (MP_MOUSE_BASE_DBL+16)
#define MP_MOUSE_BTN17_DBL (MP_MOUSE_BASE_DBL+17)
#define MP_MOUSE_BTN18_DBL (MP_MOUSE_BASE_DBL+18)
#define MP_MOUSE_BTN19_DBL (MP_MOUSE_BASE_DBL+19)
#define MP_MOUSE_BTN_DBL_END (MP_MOUSE_BASE_DBL+20)
#define MP_KEY_IS_MOUSE_BTN_DBL(code) \
((code) >= MP_MOUSE_BTN0_DBL && (code) < MP_MOUSE_BTN_DBL_END)
@@ -195,12 +201,6 @@
#define MP_AR_VDOWN (MP_AR_BASE + 12)
#define MP_AR_VDOWN_HOLD (MP_AR_BASE + 13)
// Apple Media Keys input module
#define MP_MK_BASE (MP_KEY_BASE+0xF0)
#define MP_MK_PLAY (MP_MK_BASE + 0)
#define MP_MK_PREV (MP_MK_BASE + 1)
#define MP_MK_NEXT (MP_MK_BASE + 2)
// Mouse wheels or touchpad input
#define MP_AXIS_BASE (MP_KEY_BASE+0x100)
#define MP_AXIS_UP (MP_AXIS_BASE+0)
+98
View File
@@ -0,0 +1,98 @@
local ass_mt = {}
ass_mt.__index = ass_mt
local function ass_new()
return setmetatable({ scale = 4, text = "" }, ass_mt)
end
function ass_mt.new_event(ass)
-- osd_libass.c adds an event per line
if #ass.text > 0 then
ass.text = ass.text .. "\n"
end
end
function ass_mt.draw_start(ass)
ass.text = string.format("%s{\\p%d}", ass.text, ass.scale)
end
function ass_mt.draw_stop(ass)
ass.text = ass.text .. "{\\p0}"
end
function ass_mt.coord(ass, x, y)
local scale = math.pow(2, ass.scale - 1)
local ix = math.ceil(x * scale)
local iy = math.ceil(y * scale)
ass.text = string.format("%s %d %d", ass.text, ix, iy)
end
function ass_mt.append(ass, s)
ass.text = ass.text .. s
end
function ass_mt.merge(ass1, ass2)
ass1.text = ass1.text .. ass2.text
end
function ass_mt.pos(ass, x, y)
ass:append(string.format("{\\pos(%f,%f)}", x, y))
end
function ass_mt.an(ass, an)
ass:append(string.format("{\\an%d}", an))
end
function ass_mt.move_to(ass, x, y)
ass:append(" m")
ass:coord(x, y)
end
function ass_mt.line_to(ass, x, y)
ass:append(" l")
ass:coord(x, y)
end
function ass_mt.bezier_curve(ass, x1, y1, x2, y2, x3, y3)
ass:append(" b")
ass:coord(x1, y1)
ass:coord(x2, y2)
ass:coord(x3, y3)
end
function ass_mt.rect_ccw(ass, x0, y0, x1, y1)
ass:move_to(x0, y0)
ass:line_to(x0, y1)
ass:line_to(x1, y1)
ass:line_to(x1, y0)
end
function ass_mt.rect_cw(ass, x0, y0, x1, y1)
ass:move_to(x0, y0)
ass:line_to(x1, y0)
ass:line_to(x1, y1)
ass:line_to(x0, y1)
end
function ass_mt.round_rect_cw(ass, x0, y0, x1, y1, r)
ass:move_to(x0 + r, y0)
ass:line_to(x1 - r, y0) -- top line
if r > 0 then
ass:bezier_curve(x1, y0, x1, y0, x1, y0 + r) -- top right corner
end
ass:line_to(x1, y1 - r) -- right line
if r > 0 then
ass:bezier_curve(x1, y1, x1, y1, x1 - r, y1) -- bottom right corner
end
ass:line_to(x0 + r, y1) -- bottom line
if r > 0 then
ass:bezier_curve(x0, y1, x0, y1, x0, y1 - r) -- bottom left corner
end
ass:line_to(x0, y0 + r) -- left line
if r > 0 then
ass:bezier_curve(x0, y0, x0, y0, x0 + r, y0) -- top left corner
end
end
return {ass_new = ass_new}
+82
View File
@@ -0,0 +1,82 @@
local callbacks = {}
-- each script has its own section, so that they don't conflict
local default_section = "input_" .. mp.script_name
-- Set the list of key bindings. These will override the user's bindings, so
-- you should use this sparingly.
-- A call to this function will remove all bindings previously set with this
-- function. For example, set_key_bindings({}) would remove all script defined
-- key bindings.
-- Note: the bindings are not active by default. Use enable_key_bindings().
--
-- list is an array of key bindings, where each entry is an array as follow:
-- {key, callback}
-- {key, callback, callback_down}
-- key is the key string as used in input.conf, like "ctrl+a"
-- callback is a Lua function that is called when the key binding is used.
-- callback_down can be given too, and is called when a mouse button is pressed
-- if the key is a mouse button. (The normal callback will be for mouse button
-- down.)
--
-- callback can be a string too, in which case the following will be added like
-- an input.conf line: key .. " " .. callback
-- (And callback_down is ignored.)
function mp.set_key_bindings(list, section)
local cfg = ""
for i = 1, #list do
local entry = list[i]
local key = entry[1]
local cb = entry[2]
local cb_down = entry[3]
if type(cb) == "function" then
callbacks[#callbacks + 1] = {press=cb, before_press=cb_down}
cfg = cfg .. key .. " script_dispatch " .. mp.script_name
.. " " .. #callbacks .. "\n"
else
cfg = cfg .. key .. " " .. cb .. "\n"
end
end
mp.input_define_section(section or default_section, cfg)
end
function mp.enable_key_bindings(section, flags)
mp.input_enable_section(section or default_section, flags)
end
function mp.disable_key_bindings(section)
mp.input_disable_section(section or default_section)
end
function mp.set_mouse_area(x0, y0, x1, y1, section)
mp.input_set_section_mouse_area(section or default_section, x0, y0, x1, y1)
end
-- called by C on script_dispatch input command
function mp_script_dispatch(id, event)
local cb = callbacks[id]
if cb then
if event == "press" and cb.press then
cb.press()
elseif event == "keyup_follows" and cb.before_press then
cb.before_press()
end
end
end
mp.msg = {
log = mp.log,
fatal = function(...) return mp.log("fatal", ...) end,
error = function(...) return mp.log("error", ...) end,
warn = function(...) return mp.log("warn", ...) end,
info = function(...) return mp.log("info", ...) end,
verbose = function(...) return mp.log("verbose", ...) end,
debug = function(...) return mp.log("debug", ...) end,
}
_G.print = mp.msg.info
package.loaded["mp"] = mp
package.loaded["mp.msg"] = mp.msg
return {}
+1241
View File
File diff suppressed because it is too large. Load diff
+5 -6
View File
@@ -180,13 +180,12 @@ static void add_options(struct m_config *config,
struct m_config_option *parent,
const struct m_option *defs);
static int config_destroy(void *p)
static void config_destroy(void *p)
{
struct m_config *config = p;
m_config_restore_backups(config);
for (struct m_config_option *copt = config->opts; copt; copt = copt->next)
m_option_free(copt->opt, copt->data);
return 0;
}
struct m_config *m_config_new(void *talloc_parent, size_t size,
@@ -333,7 +332,7 @@ static void add_negation_option(struct m_config *config,
.name = talloc_asprintf(no_opt, "no-%s", opt->name),
.type = CONF_TYPE_STORE,
.flags = opt->flags & (M_OPT_NOCFG | M_OPT_GLOBAL | M_OPT_PRE_PARSE),
.new = opt->new,
.is_new_option = opt->is_new_option,
.p = opt->p,
.offset = opt->offset,
.max = value,
@@ -381,7 +380,7 @@ static struct m_config_option *m_config_add_option(struct m_config *config,
void *optstruct = config->optstruct;
if (parent && (parent->opt->type->flags & M_OPT_TYPE_USE_SUBSTRUCT))
optstruct = substruct_read_ptr(parent->data);
co->data = arg->new ? (char *)optstruct + arg->offset : arg->p;
co->data = arg->is_new_option ? (char *)optstruct + arg->offset : arg->p;
if (parent) {
// Merge case: pretend it has no parent (note that we still must follow
@@ -727,10 +726,10 @@ struct m_profile *m_config_add_profile(struct m_config *config, char *name)
return p;
}
void m_profile_set_desc(struct m_profile *p, char *desc)
void m_profile_set_desc(struct m_profile *p, bstr desc)
{
talloc_free(p->desc);
p->desc = talloc_strdup(p, desc);
p->desc = bstrdup0(p, desc);
}
int m_config_set_profile_option(struct m_config *config, struct m_profile *p,
+1 -1
View File
@@ -188,7 +188,7 @@ struct m_profile *m_config_add_profile(struct m_config *config, char *name);
* \param p The profile object.
* \param arg The profile's name.
*/
void m_profile_set_desc(struct m_profile *p, char *desc);
void m_profile_set_desc(struct m_profile *p, bstr desc);
/* Add an option to a profile.
* Used by the config file parser when defining a profile.
+44 -1
View File
@@ -186,6 +186,7 @@ const m_option_type_t m_option_type_store = {
.size = sizeof(int),
.flags = M_OPT_TYPE_OPTIONAL_PARAM,
.parse = parse_store,
.copy = copy_opt,
};
// Same for float types
@@ -214,6 +215,7 @@ const m_option_type_t m_option_type_float_store = {
.size = sizeof(float),
.flags = M_OPT_TYPE_OPTIONAL_PARAM,
.parse = parse_store_float,
.copy = copy_opt,
};
// Integer
@@ -651,6 +653,7 @@ const m_option_type_t m_option_type_double = {
.pretty_print = print_double_f3,
.copy = copy_opt,
.clamp = clamp_double,
.add = add_double,
};
#undef VAL
@@ -1329,6 +1332,7 @@ const m_option_type_t m_option_type_color = {
.name = "Color",
.size = sizeof(struct m_color),
.parse = parse_color,
.copy = copy_opt,
};
@@ -1473,6 +1477,7 @@ const m_option_type_t m_option_type_geometry = {
.name = "Window geometry",
.size = sizeof(struct m_geometry),
.parse = parse_geometry,
.copy = copy_opt,
};
static int parse_size_box(const m_option_t *opt, struct bstr name,
@@ -1502,6 +1507,7 @@ const m_option_type_t m_option_type_size_box = {
.name = "Window size",
.size = sizeof(struct m_geometry),
.parse = parse_size_box,
.copy = copy_opt,
};
@@ -1595,7 +1601,7 @@ static int parse_afmt(const m_option_t *opt, struct bstr name,
}
int fmt = af_str2fmt_short(param);
if (fmt == -1) {
if (!fmt) {
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
"Option %.*s: unknown format name: '%.*s'\n",
BSTR_P(name), BSTR_P(param));
@@ -2397,11 +2403,48 @@ static int parse_obj_settings_list(const m_option_t *opt, struct bstr name,
return 1;
}
static void append_param(char **res, char *param)
{
if (strspn(param, NAMECH) == strlen(param)) {
*res = talloc_strdup_append(*res, param);
} else {
// Simple escaping: %BYTECOUNT%STRING
*res = talloc_asprintf_append(*res, "%%%zd%%%s", strlen(param), param);
}
}
static char *print_obj_settings_list(const m_option_t *opt, const void *val)
{
m_obj_settings_t *list = VAL(val);
char *res = talloc_strdup(NULL, "");
for (int n = 0; list && list[n].name; n++) {
m_obj_settings_t *entry = &list[n];
if (n > 0)
res = talloc_strdup_append(res, ",");
// Assume labels and names don't need escaping
if (entry->label && entry->label[0])
res = talloc_asprintf_append(res, "@%s:", entry->label);
res = talloc_strdup_append(res, entry->name);
if (entry->attribs && entry->attribs[0]) {
res = talloc_strdup_append(res, "=");
for (int i = 0; entry->attribs[i * 2 + 0]; i++) {
if (i > 0)
res = talloc_strdup_append(res, ":");
append_param(&res, entry->attribs[i * 2 + 0]);
res = talloc_strdup_append(res, "=");
append_param(&res, entry->attribs[i * 2 + 1]);
}
}
}
return res;
}
const m_option_type_t m_option_type_obj_settings_list = {
.name = "Object settings list",
.size = sizeof(m_obj_settings_t *),
.flags = M_OPT_TYPE_DYNAMIC | M_OPT_TYPE_ALLOW_WILDCARD,
.parse = parse_obj_settings_list,
.print = print_obj_settings_list,
.copy = copy_obj_settings_list,
.free = free_obj_settings_list,
};
+5 -5
View File
@@ -313,12 +313,12 @@ struct m_option {
*/
void *priv;
int new;
int is_new_option;
int offset;
// Initialize variable to given default before parsing options
void *defval;
const void *defval;
};
@@ -505,12 +505,12 @@ int m_option_required_params(const m_option_t *opt);
#define OPTDEF_INT(i) .defval = (void *)&(const int){i}
#define OPT_GENERAL(ctype, optname, varname, flagv, ...) \
{.name = optname, .flags = flagv, .new = 1, \
{.name = optname, .flags = flagv, .is_new_option = 1, \
.offset = MP_CHECKED_OFFSETOF(OPT_BASE_STRUCT, varname, ctype), \
__VA_ARGS__}
#define OPT_GENERAL_NOTYPE(optname, varname, flagv, ...) \
{.name = optname, .flags = flagv, .new = 1, \
{.name = optname, .flags = flagv, .is_new_option = 1, \
.offset = offsetof(OPT_BASE_STRUCT, varname), \
__VA_ARGS__}
@@ -624,7 +624,7 @@ int m_option_required_params(const m_option_t *opt);
OPT_GENERAL(struct m_geometry, __VA_ARGS__, .type = &m_option_type_size_box)
#define OPT_TRACKCHOICE(name, var) \
OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"no", -2}, {"auto", -1}))
OPT_CHOICE_OR_INT(name, var, 0, 1, 8190, ({"no", -2}, {"auto", -1}))
#define OPT_STRING_VALIDATE_(optname, varname, flags, validate_fn, ...) \
OPT_GENERAL(char*, optname, varname, flags, __VA_ARGS__, \
+35 -22
View File
@@ -214,8 +214,39 @@ static void append_str(char **s, int *len, bstr append)
*len = *len + append.len;
}
char *m_properties_expand_string(const m_option_t *prop_list, char *str0,
void *ctx)
static int expand_property(const m_option_t *prop_list, char **ret, int *ret_len,
bstr prop, bool silent_error, void *ctx)
{
bool cond_yes = bstr_eatstart0(&prop, "?");
bool cond_no = !cond_yes && bstr_eatstart0(&prop, "!");
bool test = cond_yes || cond_no;
bool raw = bstr_eatstart0(&prop, "=");
bstr comp_with = {0};
bool comp = test && bstr_split_tok(prop, "==", &prop, &comp_with);
if (test && !comp)
raw = true;
int method = raw ? M_PROPERTY_GET_STRING : M_PROPERTY_PRINT;
char *s = NULL;
int r = m_property_do_bstr(prop_list, prop, method, &s, ctx);
bool skip;
if (comp) {
skip = ((s && bstr_equals0(comp_with, s)) != cond_yes);
} else if (test) {
skip = (!!s != cond_yes);
} else {
skip = !!s;
char *append = s;
if (!s && !silent_error && !raw)
append = (r == M_PROPERTY_UNAVAILABLE) ? "(unavailable)" : "(error)";
append_str(ret, ret_len, bstr0(append));
}
talloc_free(s);
return skip;
}
char *m_properties_expand_string(const m_option_t *prop_list,
const char *str0, void *ctx)
{
char *ret = NULL;
int ret_len = 0;
@@ -240,26 +271,8 @@ char *m_properties_expand_string(const m_option_t *prop_list, char *str0,
bool have_fallback = bstr_eatstart0(&str, ":");
if (!skip) {
bool cond_yes = bstr_eatstart0(&name, "?");
bool cond_no = !cond_yes && bstr_eatstart0(&name, "!");
bool raw = bstr_eatstart0(&name, "=");
int method = (raw || cond_yes || cond_no)
? M_PROPERTY_GET_STRING : M_PROPERTY_PRINT;
char *s = NULL;
int r = m_property_do_bstr(prop_list, name, method, &s, ctx);
if (cond_yes || cond_no) {
skip = (!!s != cond_yes);
} else {
skip = !!s;
char *append = s;
if (!s && !have_fallback && !raw) {
append = r == M_PROPERTY_UNAVAILABLE
? "(unavailable)" : "(error)";
}
append_str(&ret, &ret_len, bstr0(append));
}
talloc_free(s);
skip = expand_property(prop_list, &ret, &ret_len, name,
have_fallback, ctx);
if (skip)
skip_level = level;
}
+2 -2
View File
@@ -124,8 +124,8 @@ void m_properties_print_help_list(const struct m_option* list);
// STR is recursively expanded using the same rules.
// "$$" can be used to escape "$", and "$}" to escape "}".
// "$>" disables parsing of "$" for the rest of the string.
char* m_properties_expand_string(const struct m_option* prop_list, char *str,
void *ctx);
char* m_properties_expand_string(const struct m_option* prop_list,
const char *str, void *ctx);
// Trivial helpers for implementing properties.
int m_property_int_ro(const struct m_option* prop, int action, void* arg,
+49 -11
View File
@@ -22,27 +22,65 @@
#include "mpvcore/bstr.h"
#include "mpvcore/mp_common.h"
char *mp_format_time(double time, bool fractions)
#define appendf(ptr, ...) \
do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
// Return a talloc'ed string formatted according to the format string in fmt.
// On error, return NULL.
// Valid formats:
// %H, %h: hour (%H is padded with 0 to two digits)
// %M: minutes from 00-59 (hours are subtracted)
// %m: total minutes (includes hours, unlike %M)
// %S: seconds from 00-59 (minutes and hours are subtracted)
// %s: total seconds (includes hours and minutes)
// %f: like %s, but as float
// %T: milliseconds (000-999)
char *mp_format_time_fmt(const char *fmt, double time)
{
if (time == MP_NOPTS_VALUE)
return talloc_strdup(NULL, "unknown");
char sign[2] = {0};
if (time < 0) {
time = -time;
sign[0] = '-';
}
char *sign = time < 0 ? "-" : "";
time = time < 0 ? -time : time;
long long int itime = time;
long long int h, m, s;
long long int h, m, tm, s;
int ms;
s = itime;
tm = s / 60;
h = s / 3600;
s -= h * 3600;
m = s / 60;
s -= m * 60;
char *res = talloc_asprintf(NULL, "%s%02lld:%02lld:%02lld", sign, h, m, s);
if (fractions)
res = talloc_asprintf_append(res, ".%03d",
(int)((time - itime) * 1000));
ms = (time - itime) * 1000;
char *res = talloc_strdup(NULL, "");
while (*fmt) {
if (fmt[0] == '%') {
fmt++;
switch (fmt[0]) {
case 'h': appendf(&res, "%s%lld", sign, h); break;
case 'H': appendf(&res, "%s%02lld", sign, h); break;
case 'm': appendf(&res, "%s%lld", sign, tm); break;
case 'M': appendf(&res, "%02lld", m); break;
case 's': appendf(&res, "%s%lld", sign, itime); break;
case 'S': appendf(&res, "%02lld", s); break;
case 'T': appendf(&res, "%03d", ms); break;
case '%': appendf(&res, "%s", "%"); break;
default: goto error;
}
fmt++;
} else {
appendf(&res, "%c", *fmt);
fmt++;
}
}
return res;
error:
talloc_free(res);
return NULL;
}
char *mp_format_time(double time, bool fractions)
{
return mp_format_time_fmt(fractions ? "%H:%M:%S.%T" : "%H:%M:%S", time);
}
// Set rc to the union of rc and rc2
+7
View File
@@ -36,8 +36,14 @@
#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
#define MPSWAP(type, a, b) \
do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
// align must be a power of two (align >= 1), x >= 0
#define MP_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1))
#define MP_ALIGN_DOWN(x, align) ((x) & ~((align) - 1))
#define CONTROL_OK 1
#define CONTROL_TRUE 1
#define CONTROL_FALSE 0
@@ -49,6 +55,7 @@ extern const char *mplayer_version;
extern const char *mplayer_builddate;
char *mp_format_time(double time, bool fractions);
char *mp_format_time_fmt(const char *fmt, double time);
struct mp_rect {
int x0, y0;
+27 -15
View File
@@ -22,15 +22,14 @@
#include <stdbool.h>
#include "mpvcore/options.h"
#include "audio/mixer.h"
#include "demux/demux.h"
// definitions used internally by the core player code
#define INITIALIZED_VO 1
#define INITIALIZED_AO 2
#define INITIALIZED_VOL 4
#define INITIALIZED_GETCH2 8
#define INITIALIZED_PLAYBACK 16
#define INITIALIZED_STREAM 64
#define INITIALIZED_DEMUXER 512
#define INITIALIZED_ACODEC 1024
@@ -41,7 +40,8 @@
enum stop_play_reason {
KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
AT_END_OF_FILE, // file has ended normally, prepare to play next
AT_END_OF_FILE, // file has ended, prepare to play next
// also returned on unrecoverable playback errors
PT_NEXT_ENTRY, // prepare to play next entry in playlist
PT_CURRENT_ENTRY, // prepare to play mpctx->playlist->current
PT_STOP, // stop playback, clear playlist
@@ -76,6 +76,13 @@ enum mp_osd_seek_info {
OSD_SEEK_INFO_EDITION = 8,
};
enum seek_type {
MPSEEK_NONE = 0,
MPSEEK_RELATIVE,
MPSEEK_ABSOLUTE,
MPSEEK_FACTOR,
};
struct track {
enum stream_type type;
// The type specific ID, also called aid (audio), sid (subs), vid (video).
@@ -99,10 +106,9 @@ struct track {
// If the track's stream changes with the timeline (ordered chapters).
bool under_timeline;
// NULL if not backed by a demuxer (e.g. external subtitles).
// Value can change if under_timeline==true.
struct demuxer *demuxer;
// Invariant: (!demuxer && !stream) || stream->demuxer == demuxer
// Invariant: !stream || stream->demuxer == demuxer
struct sh_stream *stream;
// For external subtitles, which are read fully on init. Do not attempt
@@ -142,6 +148,8 @@ typedef struct MPContext {
bool has_quit_custom_rc;
bool error_playing;
int64_t shown_vframes, shown_aframes;
struct demuxer **sources;
int num_sources;
@@ -160,6 +168,8 @@ typedef struct MPContext {
struct track **tracks;
int num_tracks;
char *track_layout_hash;
// Selected tracks. NULL if no track selected.
struct track *current_track[STREAM_TYPE_COUNT];
@@ -172,7 +182,7 @@ typedef struct MPContext {
// demuxer defines metadata), or special purpose demuxers like TV.
struct demuxer *master_demuxer;
mixer_t mixer;
struct mixer *mixer;
struct ao *ao;
struct vo *video_out;
@@ -222,6 +232,8 @@ typedef struct MPContext {
double last_vo_pts;
// Video PTS, or audio PTS if video has ended.
double playback_pts;
// Used to determine whether the video filter chain was rebuilt.
long last_vf_reconfig_count;
// History of video frames timestamps that were queued in the VO
// This includes even skipped frames during hr-seek
@@ -239,7 +251,7 @@ typedef struct MPContext {
double mouse_timer;
unsigned int mouse_event_ts;
int mouse_waiting_hide;
bool mouse_cursor_visible;
// used to prevent hanging in some error cases
double start_timestamp;
@@ -251,9 +263,7 @@ typedef struct MPContext {
// Used to communicate the parameters of a seek between parts
struct seek_params {
enum seek_type {
MPSEEK_NONE, MPSEEK_RELATIVE, MPSEEK_ABSOLUTE, MPSEEK_FACTOR
} type;
enum seek_type type;
double amount;
int exact; // -1 = disable, 0 = default, 1 = enable
// currently not set by commands, only used internally by seek()
@@ -285,10 +295,9 @@ typedef struct MPContext {
bool drop_message_shown;
struct screenshot_ctx *screenshot_ctx;
char *track_layout_hash;
struct command_ctx *command_ctx;
struct encode_lavc_context *encode_lavc_ctx;
struct lua_ctx *lua_ctx;
} MPContext;
@@ -300,7 +309,7 @@ extern int forced_subs_only;
void uninit_player(struct MPContext *mpctx, unsigned int mask);
void reinit_audio_chain(struct MPContext *mpctx);
double playing_audio_pts(struct MPContext *mpctx);
struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename, int noerr);
struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename);
int reinit_video_chain(struct MPContext *mpctx);
int reinit_video_filters(struct MPContext *mpctx);
int reinit_audio_filters(struct MPContext *mpctx);
@@ -325,10 +334,13 @@ void mp_switch_track(struct MPContext *mpctx, enum stream_type type,
struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type,
int tid);
bool mp_remove_track(struct MPContext *mpctx, struct track *track);
struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction);
struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
bool force);
int mp_get_cache_percent(struct MPContext *mpctx);
void mp_write_watch_later_conf(struct MPContext *mpctx);
void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e);
struct playlist_entry *mp_resume_playlist(struct playlist *playlist,
struct MPOpts *opts);
void mp_force_video_refresh(struct MPContext *mpctx);
void mp_print_version(int always);
Loaded 100 of 255 files, more files were not shown because too many files have changed in this diff. Show more