Commit Graph

34003 Commits

Author SHA1 Message Date
Stefano Pigozzi dd7607756d cocoa_common: split window creation in helper functions
This commit hopefully makes it easier to follow the flow of the program.
2012-10-16 07:19:33 +02:00
Stefano Pigozzi b3cc274c57 cocoa_common: cosmetics / reformat
Use 80columns almost exclusively and reformat Objective-C messages declarations
to follow Apple's style (i.e.: - (int)name; instead of - (int) name;).
2012-10-16 07:19:33 +02:00
Stefano Pigozzi 5db96c0837 gl_common: remove useless cocoa wrapper functions 2012-10-16 07:19:32 +02:00
Stefano Pigozzi 539021c779 cocoa_common: remove useless import
QuartzCore was probably forgot after extracting the code from `vo_corevideo`.
The OpenGL.h include can be avoided with no warnings/errors.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi 5931e53dcc cocoa_common: replace TickCount() with NSProcessInfo#systemUptime
TickCount is depracted in OS X 10.8. Substitute it with a public Cocoa API
call available since OS X 10.6.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi f5de0aac96 cocoa_common: use IOKit to perform power management
This allows to remove the call to the deprecated `UpdateSystemActivity`. The
additional benefit is power management is disabled only if the video is really
playing. A paused video will not stop the system from idling.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi b946197243 cocoa_common: save state in the vo struct
Save the cocoa state in an instance variable for the Objective-C part of the
code and use a field in the vo struct for the raw C part of the code.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi 511d5478f9 codecs: add Video Decode Acceleration Framework codec
Video Decode Acceleration Framework is a framework by Apple to provide
GPU assisted H.264 decoding. It is available on Mac OS X v10.6.3 and
later with Mac models equipped with the NVIDIA GeForce 9400M, GeForce 320M,
GeForce GT 330M, ATI HD Radeon GFX, Intel HD Graphics and others.

This commit uses the new video decoder added in FFmpeg based upon this
framework.
2012-10-16 07:19:32 +02:00
Stefano Pigozzi c4f68de145 TOOLS: add script for osx bundle generation
Add a make task and python script to create a Mac OS X Application Bundle
to be used when compiling with the --enable-macosx-finder and
--enable-macosx-bundle configure flags.

The main svg icon was created by me and heavily inspired by Apple's iTunes
and AppStore icon designs. We are still looking for something better.
For the audio, movie and subtitles icons I added the main logo to MPlayer OSX
Extended icons.

Use with `make osxbundle` after running configure and make.
2012-10-16 07:15:12 +02:00
wm4 6557f206ef manpage: improvements to vo_opengl documentation
Mention the FBO format chaos.

Some other things were not entirely correct anymore.

Also update the "builtin" documentation in vo_opengl.c.
2012-10-15 00:28:59 +02:00
wm4 f2e662fe3f input: fix mp_cmd memory leak
mp_input_feed_key() didn't free the command, if it was discarded due
to the queue exceeding its maximum size.
2012-10-14 23:45:41 +02:00
wm4 73b44b44a4 input: minor simplification to mp_input_get_cmd() 2012-10-14 23:45:31 +02:00
wm4 38eb7f2fcf command: reduce some property boilerplate
Reduces code needed for implementing string and int64_t read-only
properties.

Originally, there actually was a m_property_string_ro(), but it was
removed, as that would have implicitly strdup'ed the string. But the
new name m_property_strdup_ro() should make it quite clear what is
happening.
2012-10-14 23:12:03 +02:00
wm4 187cbd7aa7 input: add input test mode
In input test mode, key bindings won't be executed, but are shown on the
OSD.  The OSD includes various information, such as the name of the key,
the command itself, whether it's builtin, and the config file location
it was defined.

The input test mode can be enabled with "--input=test". No effort is
spent trying to react to key bindings that normally exit the player;
they are treated just like any other binding.
2012-10-14 22:28:51 +02:00
wm4 ad5bc380e2 input: track location info for input commands
If parsing a command fails, its location is printed. The location is
the path to the input.conf, and the line number of the key binding and
the associated input command.
2012-10-14 22:28:51 +02:00
wm4 0ff7dd992f osd_libass: fix \n escapes
Apparently libass can't be made to not interpret "\n" as escape. That
means "\n" can't be printed literally. Use the same hack that was added
to mplayer2 when that project merged osd_libass.c: add an invisible
zero-width joiner character between "\" and "n". It seems U+FEFF is
deprecated, because it has been redefined as BOM mark. Use U+2060, which
seems to be the replacement.
2012-10-14 22:28:51 +02:00
wm4 7d3efa8940 stream: remove NULL checks for open calls
open_stream() and open_output_stream() checked for filename==NULL, and
if true, printed an error message asking to report this as bug.

Internal logic errors should just crash. Use assert() instead.
2012-10-14 22:28:51 +02:00
wm4 a19f197cb1 core: show quvi page title in window title, clean up libquvi handling
Clean up handling of libquvi (which resolves URLs of streaming sites
into URLs to the actual media playable by mpv). Move the code out of
open.c to quvi.c, and invoke it explicitly from mplayer.c, instead of
trying to resolve every filename passed to open_stream().

This allows easily passing metadata from the quvi context to the
frontend. Expose QUVIPROP_PAGETITLE as "media-title" property, and use
that instead of "filename" for the mplayer window title. (For YouTube,
this is the video title.) It's cleaner too.

Handle a potential reliability issue: check quvi_getprop return values.

Since open.c contains barely anything but the open_stream() stub, move
that to stream.c and delete open.c.
2012-10-14 22:26:41 +02:00
wm4 9dfcd3e9a2 input: don't warn on commands for disabled optional features
Always recognize input commands for optional features (like TV commands
etc.). If these features are disabled, the commands are parsed, but
simply do nothing.

This fixes annoying warnings on start with the default/builtin
input.conf, if certain optional features are not compiled.
2012-10-14 21:43:15 +02:00
wm4 c176499925 vo_opengl: fix filter reinitialization
The second scaling filter (cscale) was never reset correctly due to a
fatal oversight. In particular, this could lead to OpenGL errors, if
the new filter needs a 2D texture, but the old texture was 1D (because
init_scaler reuses the texture).
2012-10-14 21:43:15 +02:00
Stefano Pigozzi 44d1756e33 ad_ffmpeg: add support for planar sample formats
FFmpeg and Libav are starting to return a growing number of planar samples
when decoding formats that save data like that.

In this first implementation planar formats are immediately converted to
packed formats. Fututre developments should move to use libavresample.

Original work by Nicolas George on mplayer(1).
2012-10-14 21:30:47 +02:00
Uoti Urpala 977116a0ca fmt-conversion.h: fix pixfmt.h #include; fixes latest Libav
Change fmt-conversion.h to include <libavutil/pixfmt.h> instead of
<libavutil/avutil.h> which no longer indirectly includes the former.
This fixes compilation with latest Libav. Also remove superfluous
config.h #include.

The pixfmt.h #include is needed for 'enum PixelFormat'. avutil.h
already stopped including pixfmt.h more than a year ago, but that did
not cause visible breakage at the time. AFAIK the C standard does not
allow incomplete enum types, but it seems that GCC and other relevant
compilers accept function declarations using not-yet-defined enum
types without warnings. However, Libav now renamed 'enum PixelFormat'
to 'enum AVPixelFormat', adding a '#define PixelFormat AVPixelFormat'
for backwards compatibility. We need this compatibility define because
we're still using the PixelFormat name, but it of course does not work
if pixfmt.h is not included; thus the missing include now caused a
compilation failure.
2012-10-14 21:27:02 +02:00
wm4 85d185441a Merge branch 'input_changes' into master
Conflicts:
	DOCS/man/en/vo.rst
	etc/input.conf
	input/input.c
	m_property.c
2012-10-12 11:53:53 +02:00
wm4 65fc530f0c Rename to "mpv"
This changes the name of this project to mpv. Most user-visible mentions
of "MPlayer" and "mplayer" are changed to "mpv". The binary name and the
default config file location are changed as well.

The new default config file location is: ~/.mpv/

Remove etc/mplayer.desktop. Apparently this was for the MPlayer GUI,
which has been removed from mplayer2 ages ago.

We don't have a logo, and the MS Windows resource files sort-of require
one, so leave etc/mplayer.ico/.xpm as-is.

Remove the debian and rpm packaging scripts. These contained outdated
dependencies and likely were more harmful than useful. (Patches which
add working and well-tested packaging are welcome.)
2012-10-12 10:14:32 +02:00
wm4 3d712eb56d manpage: remove old manpage 2012-10-12 10:14:23 +02:00
wm4 e1b15dee4c commands: use "up" and "down" as 2nd argument for cycle command
Allow the values "up" and "down" as step argument for the cycle input
command. Previously, this argument was a float, which specified an
arbitrary step value and direction (similar to the add command).
Instead of "1" and "-1", "up" and "down" is to be used.

Float values are still accepted. That capability might be removed in the
future, as there's probably hardly any actual use for arbitrary step
values.
2012-10-12 10:13:43 +02:00
wm4 32fe890cc1 commands: add print_text input command to print text on the terminal
In theory, this could take over the role of the get_property slave
command, and is more general.
2012-10-12 10:13:43 +02:00
wm4 c9df2c8bd8 sub: add --ass-style-override option to disable style overrides
There are a number of options which modify ASS subtitle rendering. Most
of these do things that can interfere with the styling done by subtitle
scripts, resulting in incorrect rendering. Add the --ass-style-override
option to make it easy to disable all overrides. This helps trouble-
shooting, and makes it more practical to use the override features. (You
can simply toggle the ass-style-override property at runtime, should
one of the style override options break subtitle rendering at a certain
point.)

This mainly affects whether most --ass-* options are applied, as well
as --sub-pos. Some things, like explicit style overrides loaded with
--ass-force-style, can't be changed at runtime using the
ass-style-override property.
2012-10-12 10:13:42 +02:00
wm4 2f6713bede sub: enable sub-pos with libass
The --sub-pos option and sub-pos property control the vertical position
of a subtitle.

Also change how sub-pos is handled in the old subtitle renderer (used
with -no-ass). The new behavior doesn't render subtitles out of the
screen if the subtitle is located near the top screen border and has
too many lines.
2012-10-12 10:13:42 +02:00
wm4 fd56c168ae options: add --status-msg
Replaces the status line with a custom string.

This is probably useful for hacking old slave mode applications into
working again. Even if not, this might be generally useful.
2012-10-12 10:13:42 +02:00
wm4 65074ec1f0 manpage: document input.conf related things
This directly corresponds to DOCS/OUTDATED-tech/slave.txt.

Changes from the recent commits are included too.
2012-10-12 10:10:33 +02:00
wm4 1d1f59234b commands: move legacy property wrapper to m_property.c 2012-10-12 10:10:33 +02:00
wm4 12da72e135 commands: sub_step takes only one argument 2012-10-12 10:10:33 +02:00
wm4 a2adb6b333 TOOLS/mplayer2_identify.sh: program property is not readable
And it never was. This property is write-only and exists only for
setting the program. Making it readable is possible, but would require
demuxer changes.
2012-10-12 10:10:32 +02:00
wm4 503b124659 commands: disable deprecation warnings
This disables warning messages when the legacy input command bridge is
used. For now, user input.confs should just keep working as if nothing
has changed. The deprecation warnings will be enabled again at a later
point, and the legacy bridge will be eventually removed.
2012-10-12 10:10:32 +02:00
wm4 ea90bdbfa2 commands: rename show_tracks/chapters_osd command 2012-10-12 10:10:32 +02:00
wm4 4f1aad1f06 commands: attempt to fix "program" property
The user-visible track IDs are normalized and don't match with whatever
the demuxer uses.

Completely untested. It might actually work with both demux_lavf and
demux_ts.
2012-10-12 10:10:32 +02:00
wm4 8fc2aef3b7 commands: don't use dummy option declaration for properties
The property-to-option bridge (when properties change values normally
set by the command line parser) uses M_PROPERTY_GET_TYPE to get the
exact option type. In these cases, the entry in mp_properties[] is
unused, except for the name field and the property callback. Instead,
mp_property_generic_option() implements M_PROPERTY_GET_TYPE and returns
the m_option as defined in cfg-mplayer.h. However, if a property is
unavailable, mp_property_generic_option() is never actually called, and
M_PROPERTY_GET_TYPE will return the dummy option entry.

We could make sure that the dummy option entry equals the option entry
defined in cfg-mplayer.h. But this would duplicate all information.

Add a dummy option type m_option_type_dummy, which is used by entries
using the property-to-option bridge. Make M_PROPERTY_GET_TYPE fail if
this type is encountered.

This dummy should never be used, as it isn
2012-10-12 10:10:32 +02:00
wm4 46e8d33809 commands: make exact seeking default bindings not use OSD
The OSD bar is very annoying when seeking. Especially when the seeks
are very small, the OSD doesn't show any interesting information. The
exact seeking commands are a use case where the user definitely never
wants to see a seek bar.
2012-10-12 10:10:32 +02:00
wm4 e79efd28f8 commands: more user-control whether a command shows OSD bars/messages
The "no-osd" prefix was introduced earlier to disable OSD selectively
based on the key binding. Extend this, and allow the user to force
display of an OSD bar ("osd-bar"), OSD message ("osd-msg") or both
("osd-msg-bar"). This changes mainly how property setting functions
behave.

The default behavior is still the same.
2012-10-12 10:10:32 +02:00
wm4 88849fd1d4 commands: add choice type to input commands
Allow using the choice type (as it used for command line) for arguments
of input commands. Change the magic integer arguments of some commands
(like seek) to use choices instead. The old numeric values are still
allowed (but only those which made sense before, not arbitrary
integers).

In order to do this, remove the input.c specific types (like
MP_CMD_ARG_INT) completely and specify commands using the m_option
types.

Also, add the special choice "-" to some arguments. It's supposed to
signify the default value, so arguments can be easily skipped. Maybe the
choice option should recognize this and not change the previous value,
but we'll leave this for later.

For now, leave compatibility integer values for all new choice
arguments, e.g. "0" maps to 0. We could let the choice option type do
this automatically, but we don't, because we want user input values and
internal mplayer values decoupled in general. The compatibility options
will be removed one day, too.

Also, remove optional args for strings - would require either annoying
additional code, or copying strings twice. It's not used, so remove it.
2012-10-12 10:10:32 +02:00
wm4 a441cd3eeb m_option.h: separate creating choices array into M_CHOICES macro
Reduces code duplication, increases reusability.
2012-10-12 10:10:32 +02:00
wm4 38a8a8d3d2 talloc: fix strndup group of functions
This bug has been fixed years ago in upstream talloc.
2012-10-12 10:10:32 +02:00
wm4 32c5a87a01 commands: change property expansion format string
This affects property format strings like they are used in the
"show_text" input command, for --playing-msg, and other places.

To quote the documentation comment on m_properties_expand_string():

    ${NAME} is expanded to the value of property NAME.
    If NAME starts with '=', use the raw value of the property.
    ${NAME:STR} expands to the property, or STR if the property is not
    available.
    ${?NAME:STR} expands to STR if the property is available.
    ${!NAME:STR} expands to STR if the property is not available.
    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.

Most importantly, "?(property:str)" becomes "${?property:str}".

Make the simple fallback case easier, e.g. "${property:fallback}"
instead of "${property}?(!property:fallback)".

Add the ability to escape the format meta characters. "$" is used for
escaping, because escaping with "\" is taken by the commands parser in
the layer below. "$>" can be used to disable interpretation of format
strings (of course escapes by the commands parser can't be canceled).

By default, properties which are unavailable or don't exist are turned
into a string signaling the status (e.g. "(unavailable)"), instead of
an empty string. If an empty string is desired, this has to be done
explicitly: "${property:}" (the fallback part is an empty string). Raw
properties still return an empty string on error.

m_properties_expand_string() now returns a talloc'ed pointer, instead of
a malloc'ed one.
2012-10-12 10:10:32 +02:00
wm4 df2b0f9948 Fix MP_TARRAY_GROW macro
This macro is supposed to make sure an array has enough memory allocated
for a given number of elements. Unfortunately, a condition was inverted
(I... what???). It only allocated if there was still enough memory left,
or only one additional element had to be allocated.

Since this macro was only used by MP_TARRAY_APPEND, this case was never
actually triggered. It's still utter non-sense.
2012-10-12 10:10:32 +02:00
wm4 0de86f5bf3 input: warn about non-existing commands, add explicit "ignore" command
If a command is not found, warn about it at loading time (just like
other command parsing errors are printed at loading time).

Add an explicit "ignore" command. input.conf instructs users to use this
command to cancel out existing mapping. This clashed with the
warning added in this commit. Make "ignore" a real command and remove
the specialcasing for it from get_cmd_from_keys(). Now "ignore" is
ignored because it's not handled in command.c.
2012-10-12 10:10:32 +02:00
wm4 d232012287 input: handle escapes always in command parser
Previously, both the command parser and property expansion
(m_properties_expand_string) handled escapes with '\'. Move all escape
handling into the command parser, and remove it from the property code.

This removes the need to escape strings twice for commands that use
property expansion.

The command parser is practically rewritten: it uses m_option for the
actual parsing, and reduces hackish C-string handling.
2012-10-12 10:10:32 +02:00
wm4 84af173380 commands: cosmetics: rename things
This is Better (tm).

The only actual change is that with M_PROPERTY_SET_STRING, the option
parser will use the property name, instead whatever was set in the
name field of the option returned by M_PROPERTY_GET_TYPE. In most cases,
these should be the same, though.
2012-10-12 10:10:32 +02:00
wm4 b591688a27 input: verify input.conf on loading
When input.conf is loaded, verify each command and print a warning if
it's invalid or uses legacy commands. This is done for both the user's
and the embedded config files.

The diff is a bit noisy, because mp_input_parse_cmd() is changed to take
a bstr as argument instead of a char*.
2012-10-12 10:10:32 +02:00
wm4 45b432f4c3 commands: replace "switch" with "add" and "cycle"
Now it depends on the command whether a property wraps around, or stops
at min/max valid property value.

For practically all properties, it's quite unambiguous what the "switch"
command should have done, and there's technically no need to replace it
with these new commands. More over, most properties that cycle are
boolean anyway. But it seems more orthogonal to make the difference
explicit, rather than hardcoding it. Having different commands also
makes it more explicit to the user what these commands do, both just due
to the naming, and what wrapping policy is used. The code is simpler
too.
2012-10-12 10:10:31 +02:00