Move the URL parsing code from m_option.c to stream.c, and simplify it
dramatically. This code originates from times when http code used this,
but now it's just relict from other stream implementations reusing this
code. Remove the unused bits and simplify the rest.
stream_vcd is insane, and the priv struct is different on every
platform, so drop the URL parsing. This means you can't specify a track
anymore, only the device. (Does anyone use stream_vcd? Not like this
couldn't be fixed, but it doesn't seem worth the effort, especially
because it'd require potentially touching platform specific code.)
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.
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.
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().)
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.)
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).
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.
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.
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.
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.
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.
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).
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.
The --profile top-level option is handled specially in m_config.c. But
this code also broke sub-options that happened to be named "profile"
(e.g. when trying to use "-af-add=bs2b=profile=cmoy"). Handle it
specially only if it's the top-level --profile option.
This didn't setup the linked list of sub-commands for multi-part
commands ("a ; b ; c") correctly. Also, the new commands were attached
to the allocation of the _old_ command instead of the new one. (Wow,
whatever the hell I was (not) thinking when I wrote this code.)
In general, this warning can hint to actual bugs. We don't enable it
yet, because it would conflict with some unmerged code, and we should
check with clang too (this commit was done by testing with gcc).
Commit 9a83d03 accidentally removed this. (Overlooked "static"?)
The handling of this rather sucks. Maybe a better solution will be
possible once we clean up the mp_msg code.
This also affects --audiofile. The previous behavior wasn't really
useful. There are even separate switches for that: --audio-demuxer and
--sub-demuxer.
Make the VF/VO/AO option parser available to audio filters. No audio
filter uses this yet, but it's still a quite intrusive change.
In particular, the commands for manipulating filters at runtime
completely change. We delete the old code, and use the same
infrastructure as for video filters. (This forces complete
reinitialization of the filter chain, which hopefully isn't a problem
for any use cases. The old code forced reinitialization too, but it
could potentially allow a filter to cache things; e.g. consider loaded
ladspa plugins and such.)
These two options were supported by ALSA and OSS only. Further, their
values were specific to the respective audio systems, so it doesn't make
sense to keep them as top-level options.
The AO creation part was split into two separate parts (one calling
ao_create and one calling ao_init). This didn't really have good
reasons, and obfuscates how AO creation works. Put them together.
Nothing should change from user perspective.
mpv --vo=opengl:help now works.
Remove the vo_opengl inline help text. The new code can list option
names for you, but that's it. Refer to the manpage if you have trouble.
This is in preparation of making VOs and AOs use the parser which
originally was for video filters only.
The --vo and --ao options have several very annoying features, which are
added here:
- They can skip unknown video outputs (might be useful if a config file
is supposed to work on several systems, where not all VOs/AOs are
available everywhere)
- The trailing "," in "-vo a,b," was significant, and meant that if "a"
and "b" don't work, try the normal autoprobe order as fallback
- There were deprecated VO names (like "gl3" and "gl"), which have to be
handled with the option parser
- Separating VO/VF names and options is different
("-vf foo=opts" vs. "-vo foo:opts")
- vo_opengl.c provides opengl-hq as opengl + preset options
This is printed with --list-options or e.g. --vf=lavfi=help.
Note that in theory, the options should be able to print their own help,
and we shouldn't special case certain types (like m_option_type_choice
in the commit). But that is too hairy for now, so we don't do it.
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)
This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.
This commit will allow using the -vf option parser for other things,
like VOs and AOs.
Windows generates WM_MOUSEMOVE messages internally whenever the window
manager wants to know where the mouse is[1] and broadcasts that to
everyone; w32_common doesn't check whether the position is different
and just (indirectly) calls this.
Do the check on input.c since it's possible some other VO or frontend
also do the same thing.
[1]: http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx