Commit Graph

34202 Commits

Author SHA1 Message Date
wm4 d356219824 commands: remove M_PROPERTY_SWITCH from edition property
Instead, communicate the new value range with M_PROPERTY_GET_TYPE. Add
M_PROPERTY_GET_WRAP to allow properties to enable cycling instead of
stopping at min/max.
2012-10-12 10:10:31 +02:00
wm4 74adc534b9 commands: make M_PROPERTY_GET_TYPE return an option copy
Change the type of the arg for this action from m_option** to m_option*.
This makes it easier to change some aspects of the option dynamically.
2012-10-12 10:10:31 +02:00
wm4 e4dda184aa commands: cosmetics: reindent colormatrix property 2012-10-12 10:10:31 +02:00
wm4 d7207b4cbc commands: don't replicate mapping to option in levels_property_helper
This should be done by mp_property_generic_option() only. Also reindent
levels_property_helper() to make it a little bit more readable.

Remove the m_option_get_ptr() function, which doesn't really make sense
anymore.
2012-10-12 10:10:31 +02:00
wm4 ed8e738e0f commands: cosmetic changes mostly to m_property.h
The Doxygen-style documentation comments were nothing but bloat.

Also move mp_property_do() and mp_property_print() to command.h, where
they should belong, and fix their argument types. m_property.c/h is
supposed to be generic, while command.h provides declarations specific
to the mplayer core.
2012-10-12 10:10:31 +02:00
wm4 d6dad9e934 commands: remove fallback for M_PROPERTY_PARSE and M_PROPERTY_TO_STRING
These should never be overridden by property implementations anyway,
because it would likely result in inconsistencies. The right way to do
this is adding a new m_option type.

Also some cosmetics.
2012-10-12 10:10:31 +02:00
wm4 dec53f760e commands: add more property-option bridge uses, rename some options
Make more properties use the property-to-option bridge to reduce code
size and to enforce consistency. Some options are renamed to the same
as the properties (the property names are better in all cases).

Do some other minor cleanups. One bigger issue was memory management of
strings: M_PROPERTY_TO_STRING assumed the strings were statically
allocated, and no dynamic allocations could be returned. Fix this in
case the need for such properties arises in the future. Get rid of
m_property_string_ro(), because it's not always clear that the "action"
parameter is M_PROPERTY_SET and the string argument will be used.
2012-10-12 10:10:31 +02:00
wm4 28f43ce9a9 commands: minor improvement to error message
Also remove two slave mode messages.
2012-10-12 10:10:31 +02:00
wm4 86ed6efd8a commands: handle property clamping in m_option
Instead of clamping property values to the valid range in each property
implementation, handle it in the property layer. The functionality to
handle clamping for each type is in m_option.c.

It's not really clear whether this is really needed. Normally, the raw
values for M_PROPERTY_SET come only from m_option_type.parse (setting
properties as string) or from m_option_parse.add (using the "switch"
input command). However, since this was already done before, and since
we _really_ want to be sure only to write valid values, add this code
anyway. The newly added warnings/error messages should never actually
be printed during normal operation and are for debugging (if they
happen, we definitely want to see them).
2012-10-12 10:10:31 +02:00
wm4 426640204b options: simplify somewhat by introducing a union for option values
The m_option_value union is supposed to contain a field for each
possible option type (as long as it actually stores data). This helps
avoiding silly temporary memory alocations. Using a pointer to an union
and to a field of the union interchangeably should be allowed by
standard C.
2012-10-12 10:10:31 +02:00
wm4 1a5a7a4929 options: accept "yes" and "no" only for flags
This removes the alternative values like "off", "0", "false" etc., and
also the non-English versions of these.

This is done for general consistency. It's better to have a single way
of doing things when multiple ways don't add singificant value.

Also update some choices for consistency.
2012-10-12 10:10:31 +02:00
wm4 69ce4591d0 commands: generally handle property formatting with m_option
Use the m_option code by default to format property values, instead of
having separate code in m_property.

To facilitate that, add a pretty_print callback to option types. These
format values in a more human readable and user friendly way, as opposed
to the print callback, which produces parseable values.

This also changes the strings used with flags. Instead of "enabled" and
"disabled", flags are formatted as "yes" and "no". (We could use the
pretty_print callback to deal with this, but we don't for consistency.)
2012-10-12 10:10:31 +02:00
wm4 f607d104b6 commands: remove pointless NULL checks
Most property implementations checked whether the "arg" parameter was
NULL. This is entirely pointless, because NULL is actually never pased.
It was inconsistently done, too. Remove the checks.
2012-10-12 10:10:31 +02:00
wm4 cac7702565 commands: handle property stepping in a generic way
Instead of forcing each property implementation implement its own logic
for M_PROPERTY_STEP_UP/M_PROPERTY_STEP_DOWN, handle it in the generic
property code.

Rename the M_PROPERTY_STEP_UP command to M_PROPERTY_SWITCH (the other
property command, M_PROPERTY_STEP_DOWN, isn't needed anymore: stepping
downwards is done by passing a negative argument). Always use double as
argument type; it makes the code easier, and covers all property types.
Move the code which does the actual type-specific value stepping to
m_option.c (the idea is that m_option handles types).

Some properties still have custom handlers implemented with
M_PROPERTY_SWITCH. They can't be mapped to the generic mechanism,
because their value range is dynamic or entirely unknown.

For some properties, the default step stride is changed to 1. This is no
issue, because the default bindings in input.conf all use an explicit
stride in the affected cases.
2012-10-12 10:10:31 +02:00
wm4 3d67041089 options: remove CONF_TYPE_POSITION
This was the option parser for the off_t C type. These days, off_t is
always int64_t, so replace all its uses by int64_t and CONF_TYPE_INT64.

Fix the --sstep option. It used CONF_TYPE_INT with an off_t variable,
which will result in invalid memory accesses. Make it use type double
instead, which seems to make more sense for this option.
2012-10-12 10:10:30 +02:00
wm4 10437c35df commands: rename "osdlevel" option and property, make it a choice
Rename both the option and property to "osd-level", which fits a bit
better with the general naming scheme. Make it a choice instead of an
integer range. I failed to come up with good names for the various
levels, so leave them as-is.

Remove the useless property handler for the "loop" property too.
2012-10-12 10:10:30 +02:00
wm4 6f1486b397 commands: replace --hardframedrop, change framedropping property
Replace --hardframedrop with --framedrop=hard. Rename the framedrop
property from "framedropping" to "framedrop" for the sake of making
command line options have the same name as their corresponding
property. Change the property to accept choice values instead of
numeric values.

Remove unused/forgotten auto_quality variable.
2012-10-12 10:10:30 +02:00
wm4 a59eee4893 commands: remove third parameter for "switch"
This could change the direction (i.e. invoke STEP_PROPERTY_DOWN), but
you can just pass a negative value as second argument instead.
2012-10-12 10:10:30 +02:00
wm4 a749c61437 commands: rename osd_show_[property_]text and osd_show_progression
osd_show_[property_]text => show_text
osd_show_progression => show_progress

show_text, osd_show_property_text and osd_show_text both map to the
code for the previous osd_show_property_text. The only special thing
about osd_show_text is that you don't need to escape "$". Also,
unfortunately osd_show_property_text requires escaping things twice,
one time for the command parser, and the other time for the property
formatting code, while osd_show_text needed only one level of escaping.
2012-10-12 10:10:30 +02:00
wm4 950999dd7b commands: remove speed_set/speed_incr commands
Redundant with set/switch commands.
2012-10-12 10:10:30 +02:00
wm4 4e2fab5846 commands: rename properties, update input.conf
Use "-" instead of "_" in property names. The intent is that property
names and options names should be the same (if they refer to the same
thing), and options use "-" as word separator.

Rename some other properties too, e.g. "switch_audio" -> "audio".

Add a way to translate the old property names to the new ones, similar
to the input command legacy bridge.

Update input.conf. Use the new property names, and don't use legacy
commands.
2012-10-12 10:10:30 +02:00
wm4 cd25a671b5 commands: remove unimplemented "use_master" command
The implementation for this command was removed in 2002.
2012-10-12 10:10:30 +02:00
wm4 a668ae0ff9 commands: change input commands to make OSD usage explicit
Most input commands had their own policy whether to display an OSD
message for user feedback or not. Some commands had two variants, one
that showed an OSD message and one that didn't (e.g. step_property_osd
and step_property).

Change it such that all commands show a message on the OSD. Add a
"no-osd" modifier that disables OSD for that command. Rename the
"step_property" and "step_property_osd" command to "switch", and rename
"set_property" and "set_property_osd" to "set".

Note that commands which haven't used OSD before still don't use OSD.
That will possibly be fixed later. (E.g. "screenshot" could display an
OSD message instead of just printing a message on the terminal.)

The chapter and edition properties still produce OSD messages even with
"no-osd", because they don't map so well to the property_osd_display[]
mechanism.
2012-10-12 10:10:30 +02:00
wm4 6096966dee commands: minor cleanup for property_osd_display array
Make the definition more compact and less confusing by omitting rarely
used fields. Avoid having to initialize osd_id with -1 in every entry
by making 0 an unused OSD ID instead.
2012-10-12 10:10:30 +02:00
wm4 e41378ea71 commands: simplify legacy command-to-property bridge
There are many input commands which are redundant to properties. They
were parsed like normal commands, but set_property_command() in
command.c handled them automatically using the property mechanism. This
still required having the command specifications around, and the code in
command.c was quite messy.

Replace this with a text based replacement mechanism. Some corner cases
are not handled: commands of form "seek_chapter 3 1" are supposed to set
the "chapter" property to 3. This use is probably rare, and doesn't show
up in the default input.conf.

The reason compatibility is kept is because breaking input.conf is quite
annoying, so a minimal effort is made to avoid this. Currently we print
an annoying warning every time a legacy command is used, though.

Also add a compatibility entry for "pt_step", which was removed some
time ago. Variations in whitespace are not handled, but it's good enough
to deal with old input.conf entries.
2012-10-12 10:10:30 +02:00
wm4 0a54f5e741 commands: remove legacy slave mode get commands
These have been replaced by properties. Also remove some other slave-
mode specific get commands that can be replaced by property uses.

The get_metadata() function didn't actually contain anything useful,
and just replicated code from other parts of mplayer.
2012-10-12 10:10:28 +02:00
Rudolf Polzer 4401862751 encoding_example_profiles: add the better AAC encoders
ffmpeg also does libvo_aacenc (libfaac level) and libfdk_aac (supposedly
great).
2012-10-12 06:31:50 +02:00
Stefano Pigozzi db984edf24 gl_common: allow compilation on Mac OS 10.6
Define just enough constants to allow compilation on OS X Snow Leopard.
mpv's OpenGL autodetection features should make the rest.
2012-10-07 19:22:18 +02:00
wm4 abc0ab8f61 build: fix ao_dsound config checks
ao_dsound.c depended on the same configure check as vo_directx.c, which
was removed in commit 0e2c48a3ce. This accidentally disabled
inclusion of ao_dsound.

Fix it by adding a new check. Also, move it below ao_portaudio on the
auto-select list, as ao_dsound is considered deprecated.

Unrelated to that, move ao_lavc below ao_null to prevent it from being
auto-selected.
2012-10-05 15:26:31 +02:00
wm4 bc97dab886 vo_opengl: don't try to map an empty buffer
The change detection signalled a full re-upload on initialization, but
no texture reallocation. Binding the uninitialized buffer caused an
OpenGL error.

Fixes error messages on start with "opengl-hq".
2012-10-03 03:17:54 +02:00
wm4 703e02a6ee vo_opengl: change default FBO format
GL_RGB16 doesn't seem to work universally (e.g. Intel). Use GL_RGB by
default, and use GL_RGB16 for "opengl-hq" only.

This may require users of Intel GPUs to manually experiment with the
fbo-format suboption when using "opengl-hq", as GL_RGB16 doesn't seem to
work there in some cases (black screen).
2012-10-03 03:17:53 +02:00
wm4 5d60ac11b5 vo_opengl: use PBOs by default with opengl-hq
It's not really known whether PBO use causes problems of any kind (most
likely not). They should slightly increase performance. Use them by
default with "opengl-hq".

Even though PBOs don't have anything to do with rendering quality,
"opengl-hq" provides a test bed for features that should be enabled by
default, but aren't out of fear for regressions.
2012-10-03 03:17:53 +02:00
wm4 47d15a5b6b vo_opengl: use low quality default settings, add opengl-hq alias
Change the default settings for vo_opengl to highest performance and
compatibility, but lowest quality. Use bilinear as default scaler.

Add "opengl-hq" as alias for high quality settings. This alias uses
exactly the same settings as vo_opengl did before this commit.
2012-10-03 03:17:53 +02:00
wm4 3cbce1eb07 VO: add mechanism to replace old VO names, use it with "gl" and "gl3"
Rather than duplicating the VO driver structs to add aliases, replace
them textually when searching for the VO on initialization.
2012-10-03 03:17:53 +02:00
wm4 7c04542e09 bstr: add bstr_equals/bstr_equals0 utility function 2012-10-03 03:17:53 +02:00
wm4 d079395c5d vo_opengl: always check GL errors in first 5 frames
Normally, we don't want to call glGetError() all the time, because this
supposedly causes slowdowns. (I could not measure any on Linux with
nVidia binary drivers; maybe it's due to the fact that we have only a
few, expensive calls per frame.)

However, having to ask users to add the "debug" suboption when trying to
diagnose problems is very annoying. Since most errors happen during
initialization only, enabling it for the first 5 frames only is an
interesting compromise.
2012-10-03 03:17:39 +02:00
wm4 3611d1bf9b VO: actually rename VOs gl -> opengl-old, gl3 -> opengl
This renames vo_gl3 to vo_opengl, and makes it the default. The old
vo_gl is still available under "opengl-old".

We keep "gl3" as alias to "opengl" for short-term compatibility.

For OSX/Cocoa, the autoprobe order changes (prefer the "opengl" over
"opengl-old").

Remove "gl_nosw". This was a compatibility alias for "opengl-old", and
there's no point in keeping it.
2012-10-03 03:17:39 +02:00
wm4 4ecb1b53de VO: rename file: vo_gl3_shaders.glsl -> vo_opengl_shaders.glsl 2012-10-03 03:17:39 +02:00
wm4 7c6f229cbb VO: rename file: vo_gl3.c -> vo_opengl.c 2012-10-03 03:17:39 +02:00
wm4 fd4dd61284 VO: rename file: vo_gl.c -> vo_opengl_old.c 2012-10-03 03:17:39 +02:00
wm4 b3b20cc411 gl_common: require GLX 1.3 for vo_gl, remove old pre-1.3 code
Now both GL3 (for vo_gl3) and legacy context context creation (for
vo_gl) use the same code to create the X window. Only actual GL context
creation is different.
2012-10-03 03:17:39 +02:00
wm4 a0b43a11e4 vo_gl3: make it work on OpenGL 2.1
Now vo_gl3 should work with standard OpenGL 2.1, as long as the
GL_ARB_texture_rg extension is available. Optional features, which
require features that are always in OpenGL 3.0, but are available
as extensions only in OpenGL 2.1, are automatically disabled.

The force-gl2 suboption, which was an unreliable hack to run vo_gl3
in an OpenGL 2.1 context, is removed.

Significant changes are done to the extension loader to make it easier
to identify optional OpenGL features.

Context creation is a bit changed to simplify the code and to handle
the fallback better if OpenGL 3 context creation fails, and creating
an OpenGL legacy context is attempted.

Based on the initial work by Rudolf Polzer <divverent@xonotic.org>,
which included making the shader GLSL 1.20 compatible, and more.
2012-10-03 03:17:38 +02:00
wm4 db565ca4f8 mplayer: fix crash when muted and audio codec fails
When audio codec initialization fails, reinit_audio_chain() will call
uninit_player() to close the AO. mpctx->ao is set, but mpctx->mixer.ao
is still NULL. uninit_player() assumes both variables are always the
same, and calls mixer_uninit(), even though mpctx->mixer.ao is NULL.
That function tries to access the ao without NULL check if mute was
enabled.

Fix this in mplayer.c by not relying on the assumption that
mpctx->ao == mpctx->mixer.ao. Also, add a check for NULL to mixer.c
(function muxer_uninit()). One of the checks is redundant and only one
of them is needed, but we add both for general robustness.
2012-10-03 01:41:13 +02:00
wm4 e5afc1f405 Remove useless video filters
Most of these have very limited actual use, or are even entirely
useless. They only serve to bloat the codebase and to make life harder.
Drowning users in tons of barely useful filters isn't exactly helpful
either. Some of these filters were redundant or marked as obsolete.

The dlopen and lua (to be added soon) video filters provide ways to add
custom filters.

Detailed listing for each filter with reasons (with contributions from
divVerent and lachs0r):

1bpp:
    Replaced by "scale".
2xsai:
    Pixel art scaling algorithm, useless with lossy video.
blackframe:
    Not very useful. Apparently one use is combining it with scripts,
    that pass the
bmovl:
    Weirdly complex and insane (using FIFO commands), questionable use.
cropdetect:
    Only sort-of useful when used with scripts, and then it will be
    very fragile.
    It's probably better to use the dlopen rectangle filter, or to
    implement the common use-case in a better way.
decimate:
    Not needed/useful with modern video codecs, is an
    encoding-only filter.
denoise3d:
    "hqdn3d" is better.
detc:
    Some of the worse deteleciners.
dint:
    Useless, actually crashes. (On an assert in vf.c that is disabled
    by default in mplayer-svn.)
dvbscale:
    Not even practical, and the same effect can be achieved through
    other means.
eq:
    Worse/older version of eq2.
field:
    Limited use, available as dlopen filter.
fil:
    Quoting the manpage:
        This filter is very similar to the il filter but much faster,
        the main disadvantage is that it does not always work.
        Especially if combined with other filters it may produce
        randomly messed up images, so be happy if it works but do not
        complain if it does not for your combination of filters.
filmdint:
    Kind of redundant with pullup, and slightly worse.
fixpts:
    Never useful. (Most if not all filters have been fixed for PTS.)
framestep:
    Questionable use. For things like creating thumbnails, ffmpeg or
    --sstep should be used.
geq:
    Limited use, will be redundant with the "lua" filter.
halfpack:
    Useless, probably redundant with "scale".
harddup:
    Useless.
hue:
    Most VOs support this.
il:
    Useless.
ivtc:
    Another of the worse deteleciners.
kerndeint:
    A bad deinterlacer.
lavc:
    For DVB output devices. We removed that support.
lavcdeint:
    A bad deinterlacer, was already deprecated.
    Still available as --vf=pp=fd.
mcdeint:
    A broken deinterlacer that uses lavc internals.
ow:
    Very slow, barely any quality benefit over "hqdn3d".
palette:
    Done by "scale".
perspective:
    Files with incorrect perspective are extremely rare. About the
    only real-world use for this is keystone correction, which is
    usually done in hardware by the projector or by graphics
    drivers/compositors.
pp7:
    Another useless postprocessing filter with bad and complicated code.
    Use libpostprocess with "pp" instead.
qp:
    Useless.
remove-logo:
    Redundant with delogo, which is better and more practical.
rgbtest:
    Useless.
sab, smartblur, boxblur:
    Blur filters, redundant to "unsharp".
softskip:
    Does nothing.
spp, fspp, uspp:
    Useless postprocessing filters. "spp" needs ffmpeg internals.
    "fspp" is the optimized version of the "spp" filter (???), while
    "uspp" is the slow version (????).
    Use libpostprocess with "pp" instead.
telecine:
    Evil and useless. Available as dlopen filter for testing
    purposes.
test:
    Useless.
tfields:
    Useless, probably.
tile:
    Questionable use. Available as dlopen filter.
tinterlace:
    Evil and useless.
yuvcsp:
    Probably useless.
yvu9:
    Redundant with "scale".

Also remove the following left-over files: vd_null.c, vqf.h
2012-10-03 01:28:40 +02:00
Kovensky f9f6ded36c Fix string.format compatibility with Python 2.6 2012-10-01 14:28:29 +02:00
Rudolf Polzer 683966241c encode: remove dependency on current ffmpeg
Apparently, libav doesn't have the change for the new way to create a
libavformat context merged yet. So, we can't use that...

Rather, this commit fixes format specific avoptions another way.

On the downside, invalid format options are now detected very late, and
any attempt to set an option value to +something or -something will
append to the previously set option value (this logic can no longer be
specific to options of bitflag type, as finding out the option type is
what we simply cannot do with this interface).
2012-10-01 11:04:48 +02:00
Kovensky 22481e75c0 .gitignore: ignore .exe files 2012-09-30 15:17:37 +02:00
Kovensky 077b41971b windows support: set -mwin32 when building on Cygwin
This makes cygwin define _WIN32 / WIN32, which it doesn't otherwise
define.
2012-09-30 15:16:59 +02:00
Kovensky bc63957551 windows support: include io.h when building on Cygwin 2012-09-30 15:16:53 +02:00
Kovensky 5fca3a6ea5 windows support: define WINVER to 0x0500
This means that we require Windows 2000 or later.
2012-09-30 15:16:48 +02:00