Commit Graph

35864 Commits

Author SHA1 Message Date
Stefano Pigozzi 94df9ef797 cocoa_common: use new log API 2013-08-01 08:23:53 +02:00
Alexander Preisinger 6443a9b16c wayland: switch to the new mp_msg api 2013-07-31 21:52:16 +02:00
wm4 03bef3adfd video/out: use new mp_msg stuff for vo.c and vo_opengl
The first step; also serves as example.
2013-07-31 21:46:40 +02:00
wm4 88d79fc00d mp_msg: introduce new log functions and macros
This has two goals:
1. Getting rid of global variables to make the core library-safe.
2. Getting rid of all the MSGT_* constants and the inconsistent
   prefixes spread throughout the source code.

Both goals are not immediately reached with this commit. It's a huge
transition that will take time. There are over >2500 mp_msg calls in the
source, which all have to be replaced for this to work.

The inconsistent prefixes are in particular annoying. Lots of code
manually prefixes messages, e.g. mp_msg(MSGT_VO, MSGL_V, "[vo] ...").
Sometimes the prefixes don't even follow this convention (for example
vo_direct3d.c uses "<vo_direct3d>" as prefix). This commit allows
automatically adding prefixes on request, so consistency will
hopefully improve.

For now, this commit adds unused stuff, and behavior should not change.

In mplayer.c, move the GetCpuCaps() call, because that used mp_msg()
before mp_msg_init() was run.
2013-07-31 21:46:40 +02:00
wm4 d1de1e090f options: handle presets directly in m_config
This means that "mpv -vo opengl-hq:help" will actually show the correct
defaults, instead those of plain vo_opengl.
2013-07-31 20:56:00 +02:00
wm4 d6592dd2e2 m_option: fix skipping of missing -vo/-ao entries
The -vo/-ao options support skipping of unknown entries for the sake of
allowing using the same config on possibly very different systems, which
have different sets of VO/AOs available.

Unfortunately skipping didn't quite work, possibly a rebase error when
this was originally committed. Fix it.
2013-07-31 20:55:59 +02:00
wm4 a8a0c5023b m_config: remove alias information
We don't need to store anymore whether an option is aliased by another
option (which is what the alias_owner member did). Also, that member
had a really bad name.

This also removes some unneeded code from config_destroy(). Calling
m_option_free() is always ok; this just skipped the call if it did
nothing. In particular, it's ok to call m_option_free() on the same
pointer multiple times. (Maybe that function is misnamed, and it should
be m_option_clear().)
2013-07-31 20:55:59 +02:00
wm4 0656411e97 m_config: store file local backup options differently
File local options need to backup the global option value while a file
is played. Instead of keeping a pointer in m_config_option for the
backup value, put it into a separate list. This reduces per-option
overhead for a rarely used obscure feature. (This implementation would
have been a bit dumb in pre-mpv m_config, because there local options
were the default, and _all_ options were backed up when starting
playback of a file. This is not the case anymore, and normally only
a very small number of options are backed up by default.)
2013-07-31 20:53:00 +02:00
wm4 42f06fb915 m_config: make m_profile struct non-public 2013-07-31 20:43:31 +02:00
Stefano Pigozzi ff3b98d11c cocoa_common: simplify resize code
This introduces some changes in resize behaviour. Most importantly the window
frame is not constrained to it's screen's `visibleFrame`. Anyone who still wants
that kind of behaviour when opening a video, can use `--autofit-larger`.

Even though the size of the window is not constrained, it's position is, so
that the titlebar will always be visible. When using `--no-border` even the
position will not be constrained in any way.
2013-07-30 20:02:48 +02:00
wm4 a34c707f03 vd_lavc: print warning if hardware decoding API is not available
At least currently, this case pretty much happens only in the case vdpau
is requested, but not compiled in.
2013-07-30 16:32:21 +02:00
wm4 7f5303fbb6 vd_lavc: fix CONFIG_VDPAU check
CONFIG_VDPAU was just defined to 0, instead of undefined when vdpau was
unavailable. I blame the old mplayer code, which apparently can't have
consistent conventions.
2013-07-30 16:26:54 +02:00
wm4 a8153f59d5 configure: fix vdpau test if vdpau is disabled/unavailable
The check for HAVE_AV_CODEC_NEW_VDPAU_API just determines whether the
new vdpau libavutil pixel format is available (which implies presence of
the new API). However, that pixel format (and the correspondig config
test define) is also used in generic code (compiled even without vdpau)
in fmt-conversion.c. Since the configure test didn't define the symbol
if vdpau was not available, it broke in this case.
2013-07-30 16:21:33 +02:00
James Ross-Gowan 103fbf043f mpv.rc: update Windows icon
Based on the OSX bundle icon.
2013-07-30 16:15:37 +02:00
wm4 3c8190e49d crosscompile-mingw.txt: it's "MinGW" not "MingGW" 2013-07-30 16:15:37 +02:00
wm4 4f970a8179 crosscompile-mingw.txt: mingw-w64 now has modern OpenGL headers in trunk 2013-07-30 16:15:36 +02:00
wm4 1848be363e stream: remove inactive URL option fields
The URL option parser only accesses certain fields. Remove the fields
that are not accessed, and thus are completely unused and inaccessible.

Historically, these fields were supposed to be settable using an extra
list of options passed to open_stream(). Commit f518cf7 removed these
extra options. Apparently nothing ever actually used this facility.
2013-07-30 16:15:36 +02:00
wm4 06996810bf stream_dvd: fix .ifo redirection
This was blatantly broken after stream->url was changed to talloc.
2013-07-30 16:15:36 +02:00
Jonathan Yong 29b0be400c Fix some warnings 2013-07-30 11:05:39 -03:00
Stefano Pigozzi e777a86b69 ao_coreaudio: use default output unit when no device is specified
Using the default output audio unit should provide a much better user
exeperience since it changes automatically the output device based on which
becomes the default one.
2013-07-29 08:22:33 +02:00
wm4 5f9aa74279 command: silence a warning
This is unreachable code, but the compiler doesn't always determine
this. This change shuts up the warning in these cases.
2013-07-29 01:03:36 +02:00
wm4 fece4e3053 build: fix build with vdpau, simplify
Instead of generating vdpau_template.c with a Perl script, just include
the generated file in git. This is ok because it changes very rarely,
and the script is larger than the output it generates.

It also simplify the Makefile, and fixes the build. The problem was that
transitive dependencies do not work with generated files: there is no
dependency information yet when building it the first time. I overlooked
this because I didn't delete the .d files for testing (which contained
the correct dependencies, but only _after_ a first successful build).
2013-07-29 00:59:07 +02:00
wm4 050997addf build: fix vdpau_template.c generation 2013-07-29 00:10:50 +02:00
wm4 3e59ee25ea TOOLS: add script for emulating "unique application" functionality on Linux
See github issue #43.

This comes with a load of caveats, so be sure to read the comments at
the start of the script.
2013-07-28 23:08:05 +02:00
wm4 5accc5e7c1 vdpau: split off decoder parts, use "new" libavcodec vdpau hwaccel API
Move the decoder parts from vo_vdpau.c to a new file vdpau_old.c. This
file is named so because because it's written against the "old"
libavcodec vdpau pseudo-decoder (e.g. "h264_vdpau").

Add support for the "new" libavcodec vdpau support. This was recently
added and replaces the "old" vdpau parts. (In fact, Libav is about to
deprecate and remove the "old" API without deprecation grace period,
so we have to support it now. Moreover, there will probably be no Libav
release which supports both, so the transition is even less smooth than
we could hope, and we have to support both the old and new API.)

Whether the old or new API is used is checked by a configure test: if
the new API is found, it is used, otherwise the old API is assumed.

Some details might be handled differently. Especially display preemption
is a bit problematic with the "new" libavcodec vdpau support: it wants
to keep a pointer to a specific vdpau API function (which can be driver
specific, because preemption might switch drivers). Also, surface IDs
are now directly stored in AVFrames (and mp_images), so they can't be
forced to VDP_INVALID_HANDLE on preemption. (This changes even with
older libavcodec versions, because mp_image always uses the newer
representation to make vo_vdpau.c simpler.)

Decoder initialization in the new code tries to deal with codec
profiles, while the old code always uses the highest profile per codec.

Surface allocation changes. Since the decoder won't call config() in
vo_vdpau.c on video size change anymore, we allow allocating surfaces
of arbitrary size instead of locking it to what the VO was configured.
The non-hwdec code also has slightly different allocation behavior now.

Enabling the old vdpau special decoders via e.g. --vd=lavc:h264_vdpau
doesn't work anymore (a warning suggesting the --hwdec option is
printed instead).
2013-07-28 19:25:07 +02:00
wm4 1a7f062503 lavc_dr1: make reference counting thread-safe
See previous commits. This time, the lock is kept for rather long
times (e.g. for the duration of a big image memory allocation), but
this (probably) still doesn't matter at all.

This also affects legacy code only (pre-refcounting libavcodec).
2013-07-28 19:25:07 +02:00
wm4 c28bafcfb6 mp_image_pool: make reference counting thread-safe
See previous commits. Also simplify this thing: 2 flags per pool image
are enough to avoid a weird central refcount and an associated shared
object keeping the refcount. We could even just store these two flags
in the mp_image itself (like in mp_image.flags or mp_image.priv), but
let's not for the sake of readability.
2013-07-28 19:25:07 +02:00
wm4 a9a6cf3b6c mp_image: make reference counting thread-safe
This hasn't been done yet, because pthreads is still an optional
dependency, so this is a bit annoying. Now doing it anyway, because
maybe we will need this capability in the future.

We keep it as simple as possible. We (probably) don't need anything
more sophisticated, and keeping it simple avoids introducing weird
bugs. So, no atomic instructions, no fine grained locks, no cleverness.
2013-07-28 18:56:49 +02:00
wm4 0293eac84a m_config: try to print min/max values as integers in --list-options
This switched to exponential representation too soon, and large integer
values looked bad in the --list-options output.
2013-07-28 18:56:49 +02:00
wm4 a737308f73 m_config: hide no-* opts in --list-options, simplify positional subopts
All these --no-... options in --list-options made the output rather
unreadable, so hide them. Make the code for finding positional
parameters (which are supposed to skip these no-* options) slightly
simpler too.
2013-07-28 18:56:48 +02:00
wm4 85bee4f071 options: print default values in --list-options
Do this by recreating the m_config from scratch, which then must
contain the default values. This doesn't quite work with legacy options
using global variables: the default values get lost, so using
--list-options will print the value as set by the config file. This
also introduces a memory leak for string options backed by global
variables. All of these issues will be eventually fixed by moving all
options to structs.
2013-07-28 18:56:09 +02:00
wm4 c070fa865f m_config: refactor some things
Change how m_config is initialized. Make it more uniform; now all
m_config structs are intialized in exactly the same way. Make sure
there's only a single m_option[] array defining the options, and keep
around the pointer to the optstruct default value, and the optstruct
size as well. This will allow reconstructing the option default values
in the following commit.

In particular, stop pretending that the handling of some special options
(like --profile, --v, and some others) is in any way elegant, and make
them explicit hacks. This is really more readable and easier to
understand than what was before, and simplifies the code.
2013-07-28 18:44:21 +02:00
wm4 da2b4aa587 core: make mpctx->opts a pointer
Prevents some awkwardness in a later commit, and makes the code more
uniform with other places where MPOpts is accessed.

This is a pretty annoying commit (touches tons of lines all over the
place), but it hurts only once.
2013-07-28 18:44:21 +02:00
wm4 2fc07dcf30 command: mark special options as unavailable
Special options (like -v, -playlist, etc.) don't have data associated
with them, so reading them with the "options" property makes no sense.
2013-07-28 18:44:21 +02:00
wm4 13a0e6373e mp_image: pass through colorspace info to libavfilter
This change affects vf_lavfi. Until recently, libavfilter was not
colorspace aware at all. This changed with the addition of colorspace
fields to AVFrame. libavfilter's vf_scale picks them up (as of recent
ffmpeg git). Since this support is still kind of wonky and not part of
the normal format negotiation, this won't set the correct output
colorspace, though.

Not adding a separate test for HAVE_AVFRAME_COLORSPACE. This is slightly
unclean, but on the other hand adding an explicit test seems like a
waste of effort.
2013-07-28 18:44:20 +02:00
wm4 ff0680c9b4 vf: fix unintended overwriting of image info
The symptom was that "-vf scale,format=rgba" broke the vsfilter
colorspace hack in sd_ass. vf->reconfig is allowed to overwrite its
input parameter for convenience (maybe that was a bad idea).
2013-07-28 18:44:20 +02:00
Stefano Pigozzi ca678dce4d ao_coreaudio: prevent buffer underruns to output garbage
This was removed in d427b4fd. I now found a sample that causes underruns when
moving to a chapter and apparently this is also a problem when taking
screenshots.
2013-07-28 11:21:03 +02:00
Dmitry Kalinkin 721071a5ec ao_coreaudio: fix compilation on OS X 10.7
Reverts one of the changes from 18777ecf. `kAudioObjectPropertyScopeOutput`
was introduced in the 10.8 SDK while `kAudioDevicePropertyScopeOutput` was
moved to `AudioHardwareDeprecated.h`. Since the deprecation is silent for now
(no warnings), just use the old constant.

Either way, they both evaluate to 'outp', and in the 10.8 SDK the deprecated
constant is defined in terms of the non-deprecated one.

Fixes #155
2013-07-28 09:48:49 +02:00
James Ross-Gowan 8e1461b9f8 ao_wasapi: don't check the audio feed while paused 2013-07-27 14:28:42 +10:00
Diogo Franco (Kovensky) fac2d9097e getch2: Load the "ce", "ks" and "ke" caps into a static buffer
Fixes reports of printing of garbage (or anything else) other than clearing
the status line to the end of line: the buffer returned by termcap_get
could get moved, and if that happened then these 3 caps pointed to garbage.
2013-07-26 16:03:56 -03:00
Diogo Franco (Kovensky) 630edc0637 getch2: Deactivate getch2 on SIGINT; also handle SIGQUIT 2013-07-26 15:51:48 -03:00
Diogo Franco (Kovensky) 15742504d0 getch2: Only send ESC if it was typed twice
Avoids quitting mpv if any unknown escape is entered.
2013-07-26 11:30:10 -03:00
Diogo Franco (Kovensky) 3928b39988 getch2: Handle setupterm errors
setupterm abort()s if it can't initialize the terminal and the last
parameter is NULL; handle setupterm errors and retry with "ansi" if
the TERM env var was unset.
2013-07-26 11:29:34 -03:00
wm4 ca039d42bb getch2: fix compilation 2013-07-26 02:13:35 +02:00
wm4 3bddc16431 options: simplify --correct-pts handling
Remove the (now unused) code for determining correct-pts mode based on
the demuxer in use. Change its description in the manpage to reflect
what this option does now.
2013-07-26 02:11:34 +02:00
Diogo Franco (Kovensky) fb67770ed6 getch2: Support ESC keypresses again
Due to the termcap matching and the hardcoded fallbacks, the ESC keypress
has to be followed by another non-matching keypress (such as another ESC)
for it to be accepted. We drop the second ESC in case it was typed twice.
2013-07-25 21:10:06 -03:00
wm4 590f011df1 configure: fix terminfo check
On Linux, the check fails because NULL is not defined. Fix by using 0
instead, which is a perfectly valid null pointer constant, but doesn't
require stddef.h.
2013-07-26 01:47:02 +02:00
wm4 efd3361c81 gl_video: make sure image parameters are correctly set on screenshots
Makes sure the chroma_location doesn't get lost.
2013-07-26 00:26:04 +02:00
wm4 bd1d3eaacb command: allow printing time properties with milliseconds
Doing e.g. show_text "${time-pos/full}" will show the time formatted
with a milliseconds part.

This is actually special cased for a few properties which use
CONF_TYPE_TIME, instead of making all properties using CONF_TYPE_TIME
respect this. This is a technical limitation.

I'm not entirely happy with this approach, so I'll leave it
undocumented. It's relatively ok, but he fact that it's special-cased to
some properties is not elegant. So for now, this is just a hack to make
ChrisK2 happy (hi there).
2013-07-26 00:19:15 +02:00
wm4 d1d6db25c0 command: add pseudo-property that allows you to read global options
The "options" pseudo-property allows reading global like this:

   show_text ${options/name}

Where "name" maps to the option "--name". This allows retrieving option
values that are not properties. Write-access is not possible: this is
reserved for normal properties.

Note: it is possible that we'll change this again, and don't require the "options/" prefix to access options.
2013-07-26 00:19:15 +02:00