Commit Graph

33224 Commits

Author SHA1 Message Date
wm4 4352f9feca vo_gl: add "backend" suboption to allow selecting the GUI backend
The "backend" suboption allows selecting the GUI backend used by vo_gl.
Normally, it's auto-selected, but sometimes it's desireable to explicitly
select it.

Remove the gl_sdl VO. This can now be done by using: --vo=gl:backend=sdl

This is based on svn commit 34438, and tries to be compatible with it. The
undocumented numeric backend names serve this purpose. (They are
undocumented because names are preferred.)
2012-02-09 04:58:41 +01:00
reimar 93ae55c2c3 vo_gl: minor cleanups
Fix spelling.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34006 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix disabled code.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34007 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove pointless pointer indirection for shader program strings.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34016 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove usage of glColor3f, there is not really a point in it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34149 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-02-09 04:58:27 +01:00
reimar 8767c060cf vo_gl: add noise filter
Add disabled feature: noise filter for vo_gl.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34014 b3059339-0415-0410-9bf9-f77b7e298cf2

Hook up -vo gl noise support.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34015 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-02-09 04:58:07 +01:00
wm4 bbdff34d69 core: add option to start in paused state
The --paused option will start the player in paused state. That means it
will start out with a still image of the first frame.

This can be useful in combination with --ss to inspect a certain frame.

Caveat: this plays a small bit of audio at the start, which might be
perceived as an annoying artifact. This is because this is implemented
by frame stepping after initialization in order to decode and display
the first video frame.
2012-02-09 00:36:53 +01:00
wm4 f0777d67ce i lost my brain
should be squashed with "screenshot: improve quality by using additional swscale flags"
2012-01-26 22:59:47 +01:00
wm4 02fedc7bab input.c: simplify command definitions
Using type = -1 for terminating the command argument list was an
unnecessary complication. Change it to 0 to make use of default
initialization. Remove the explicit termination from the command
definitions. Now the argument list is automatically terminated by C
default initialization rules.

Also remove other redundant {0} initializers.

When an argument's default value is actually initialized to something other
than 0, make the field being initialized explicit (e.g. {1} becomes
{.i = 1}).

Try to make use of whitespace more consistent.
2012-01-26 03:06:59 +01:00
wm4 d5a8059f93 x11: fix setting UTF-8 window titles for some special cases
Setting the WM_NAME/WM_ICON_NAME window properties didn't always work:
apparently there are some characters that can't be represented in the X
STRING or COMPOUND_TEXT encodings, such as U+2013 EN DASH. The function
Xutf8TextListToTextProperty partially converts the string, and returns
a value different from 'Success'. This means vo_x11_set_property_string
didn't set these window properties.

On most modern window managers, this is not a problem, since these use
the _NET_WM_NAME/_NET_ICON_NAME and the UTF8_STRING encoding. Some older
WMs like IceWM don't read these, and the window title remains blank.

It's not clear what exactly we should do in this situation, but fix it
by setting set the WM_NAME/WM_ICON_NAME properties as UTF8_TEXT. This
violates the ICCCM, but at least IceWM seems to handle this well.

See also:
  http://lists.freedesktop.org/archives/xorg/2004-September/003391.html
  http://lists.freedesktop.org/archives/xorg/2004-September/003395.html

Also fix a minor memory leak when conversion to COMPOUND_TEXT fails.
2012-01-25 02:51:35 +01:00
wm4 316658ad48 screenshot: add png compression setting
The default compression setting is 7, which is hopefully a good balance
between speed of compression, and resulting file sizes. The maximum png
compression will be very slow even on fast computers. On the other hand,
the lowest compression setting produces files of several MB size with
normal video resolutions, which should be avoided as well.
2012-01-18 04:45:27 +01:00
wm4 09cdd1406d screenshot: add jpg support
The screenshot image file type can now be selected with the
--screenshot-filetype option. The --screenshot-jpeg-quality option
controls the compression setting of the written JPEG image file.
2012-01-18 04:45:22 +01:00
wm4 fee4d3b473 osd: add setting to display OSD always on terminal
Now the option --term-osd=force will cause mplayer to display all OSD
messages on the terminal, even if there is video.

Possible values for --term-osd:
- auto: use video OSD, or of there's no video, the terminal (default)
- off: always use video for OSD
- force: always use terminal for OSD

-term-osd and --term-osd are equivalent to --term-osd=force. This
changes the meaning of the option, since -term-osd used to enable the
OSD default behavior, i.e. --term-osd=auto.

-noterm-osd has the same effect as --term-osd=off, and is kept for
compatibility.

Implementation note:

The location for the OSD text was shared between the two code paths (it
was in osd_state.osd_text). We can't rely on the fact that the video-OSD
update code normally isn't run when --term-osd is called. When e.g.
panscan is updated, the video OSD code will draw the OSD anyway. This
would sometimes show unwanted OSD text on the video.

Deal with this by putting the current terminal-OSD text in a different
place (in MPContext.terminal_osd_text) to deal with this.
2012-01-18 04:33:30 +01:00
wm4 6340b54d5c options: allow choice options without parameter
If an m_option_type_choice option is declared with M_OPT_IMPLICIT_DEFAULT
in its flags, it doesn't require a parameter. For example, if --opt is
such an option, it can be invoked as "--opt=val", "-opt", or "--opt".
The last two will set the option to the first choice the option declares.
Note that "-opt val" (using the old option syntax) is not allowed in this
case, as it would be ambiguous.

Normal option parsing should be unaffected.
2012-01-18 04:33:30 +01:00
wm4 55560d62ee core: add new support for reading .cue files
Playing a .cue file directly will now parse the .cue file, and load and
play the file(s) referenced in the cue. If multiple files are referenced,
a timeline including all files will be created to create the impression
of a single, flat audio file containing all the tracks.

For each track, a chapter is created. The chapter navigation commands can
be used to jump between tracks. The chapter titles will use the string
provided by the track's TITLE cue command. (The -identify command can be
used to print all chapters in a not so user friendly way.)

Other than the chapter names, there is no attempt at displaying or exposing
any other meta data contained in the cue files yet.

The handling (or lack of thereof) of gaps (track pregaps and postgaps) is
probably not correct yet. In general, mplayer's mapping of tracks to the
source audio files can be verified by examining the timeline, which will
be printed when passing the -v switch.

Note that this has nothing to do with the old cue:// support. The old code
isn't touched, and is still only able to play .cue/.bin pairs. Prefixing a
.cue file with cue:// will always invoke the old code, while playing a .cue
file directly (i.e. "mplayer file.cue") will always use the new code.

Playing audio images (.cue/.bin pairs of files) doesn't work yet.
2012-01-18 04:25:19 +01:00
wm4 f88674509e bstr: add some utility functions
bstr_strip_ext and bstr_get_ext were taken from find_subfiles.c.

bstr_cut is extended to work like bstr_splice: passing a negative
argument will start counting from the end of the string, e.g.
  bstr_cut("abc", -2) == "bc"
2012-01-18 04:24:38 +01:00
wm4 bba96eca42 Merge branch 'gradfun' into my_master 2012-01-18 04:22:48 +01:00
wm4 18b3348a73 Merge branch 'eosd' into my_master 2012-01-18 04:22:23 +01:00
wm4 6e41497d5b Merge branch 'softvol' into my_master 2012-01-18 04:21:58 +01:00
wm4 f7c2ecebcc ao_coreaudio: fix partial volume control
If digital pass-through is used, this supported setting the volume (just
mute, actually), but not getting the volume. This will probably lead to a
stuck mute state in the mplayer frontend. Make the code respond to volume
queries even if digital pass-through is used.

Ideally, ao_coreaudio should implement full mute control, but I can't
even test on OSX.
2012-01-18 04:21:46 +01:00
wm4 1d60badc3d ao_pulse: add mute control 2012-01-18 04:21:46 +01:00
wm4 08978c5fb1 ao_alsa: add mute control 2012-01-18 04:21:46 +01:00
wm4 d4cf8cd7a2 ao_alsa: use "Master" mixer channel instead of "PCM" by default
Do this, because the "Master" channel normally provides proper mute
control.

The old default can be forced with: --mixer-channel=PCM
2012-01-18 04:21:46 +01:00
wm4 06b1de2687 mixer, libao: add proper mute control
The mixer frontend code can now make use of a proper system mixer mute
toggle, if the audio output driver supports it.

The consequence is that, if support is available, mplayer will no longer
temporarily set the system volume to 0 if mute is enabled.

Generally, the code now deals with the following combinations of available
AO features:
- software volume control forced by user (--softvol / soft_vol flag)
  => if enabled, never touch the "hardware" controls
- "hardware"/driver volume control available (whether
  AOCONTROL_GET/SET_VOLUME works)
  => if not available, enable volume controls by enabling softvol
- "hardware"/driver mute control (AOCONTROL_GET/SET_MUTE)
  => if not available, emulate by setting volume to 0
- whether the volume+mute controls are kept or not when the AO is closed
  (indicated by ao->no_persistent_volume)
  => if not persistent, restore the volume/mute next time the AO is opened
2012-01-18 04:21:46 +01:00
wm4 56c1ab1c62 libao2: try to identify some audio outputs that have persistent volume
The mplayer frontend (specifically, mixer.c) needs to know this. If the
audio output doesn't remember the volume across reinitialization, the
frontend will restore the volume settings. There is also the assumption
that the volume setting isn't global in this case (i.e. changing it
won't change the volume of other applications or annoy the user
otherwise).

None of these changes have been tested. I'm guessing that ESD and NAS do
per-connection non-persistent volume settings.
2012-01-18 04:21:46 +01:00
wm4 7187b49148 af: fix crash when trying to use volume controls with AC3 pass-through
Changing the volume when softvol is enabled or if the audio output driver
doesn't support volume controls causes insertion of the "volume" filter.
This fails with AC3. Since the filter wasn't removed after that, and the
filter chain was in a bogus state, random crashes occured past this
point.

Fix it by reinitializing the filter chain completely on failure. Volume
controls simply won't work. (This can't be fixed, because AC3 is a
compressed format, and would require additional decoding/encoding passes
in order to support arbitrary volume changes.)

This also affects balance controls.
2012-01-18 04:21:46 +01:00
wm4 ad18a33f58 core: remove EDL muting
I'm not sure what's the point of this feature. Aside from that, the EDL
code is relatively buggy anyway, and I see no reason why such an obscure
feature should be left in, if it possibly causes bugs.
2012-01-18 04:21:45 +01:00
wm4 b338b16be7 audio: reset mplayer's mute state when the system mixer volume changes
Before this commit, the mute state was only reset when either mute was
explicitly cleared, or the volume was changed via mplayer controls. If
the volume controls are connected to the system mixer, and the system
mixer volume is changed otherwise (e.g. with alsamixer), the mute
setting was inconsistent.

Avoid this by checking the volume. If the returned volume is not 0, the
mute flag is considered invalid. This relies on system mixers always
returning a volume of 0 when mplayer has set the volume 0.

Possible caveat: if the audio output's volume control don't return a
volume of exactly 0 after 0 was written, enabling mute basically won't
work. It will set the volume to silence, forget the previous volume, and
report that mute is disabled.
2012-01-18 04:21:45 +01:00
wm4 6afaf948cd audio: pretend muting doesn't set volume to 0
Muting audio is implemented by setting the volume controls to 0. This
has the annoying consequence that attempting to change the volume while
the audio is muted will reset the user's volume setting. E.g. increasing
the volume while muted will start from 0, instead from the volume that
was set before muting. Changing the volume while muted effectively resets
the volume to 0 (which is not very useful), with no possibility of
restoring the old voume.

This commit makes mplayer always report the volume that was set when mute
was enabled while mute is still active.

Caveat: this might be have confusing effects when the volume control is
directly connected with a system wide mixer setting. Now it's even less
obvious (and thus more confusing) that muting will set the mixer volume
to 0.

Also always clip input volumes, and remove some minor code duplication.
2012-01-18 04:21:45 +01:00
wm4 aae97b7e25 audio: properly restore audio volume on exit when mute is used
When you mute audio, mplayer is supposed to restore the volume controls
on exit. This affects when --softvol isn't used and the audio output
driver volume controls directly affect the system wide volume controls.

This wasn't done in some cases.
2012-01-18 04:21:45 +01:00
wm4 15a318b2a5 ao_coreaudio: signal that volume controls are not persistent
This will make the mplayer frontend restore the volume on its own when
the audio device is reinitialized.
2012-01-18 04:21:45 +01:00
wm4 29effe9593 mixer: restore volume with audio output drivers without persistent volume
Some audio outputs don't provide access to a system-wide mixer control, and
do per-application audio mixing. Further, some of these forget the volume
as soon as the audio device is closed. This can be annoying, because
mplayer will "forget" the volume when playing a new file or when crossing
ordered chapter boundaries. Support restoring the volume on audio
reinitialization if an audio output driver knowingly behaves this way.
(This doesn't change that mplayer never writes any settings into the config
file, including volume settings.)

This commit doesn't yet change any actual output driver to use this code.

Hopefully make some logic in the volume restore code a bit more robust.
2012-01-18 04:21:45 +01:00
wm4 95c52f865d softvol: make sure softvol settings are restored when switching audio tracks
At least in the case when switching to no audio track and then switching
back, the volume settings were not restored with --softvol. Fix this by
moving the call restoring the settings to a better place.
2012-01-18 04:21:45 +01:00
wm4 d1b38a8a37 audio: fix crash when exiting file when mute is enabled 2012-01-18 04:21:45 +01:00
wm4 7eac60417f af: print audio filter chain in verbose mode
The string format used in print_fmt() is taken from init_audio_filters().
2012-01-18 04:21:45 +01:00
wm4 064f8c2fb6 Merge branch 'utf8_input' into my_master 2012-01-18 04:19:24 +01:00
wm4 f341b21a90 Merge remote-tracking branch 'origin/master' into my_master 2012-01-18 04:18:41 +01:00
wm4 54ed2eeed3 etc/input.conf: make file contents match default key bindings
There were some slight differences between what input.conf mapped, and
what was in input.c def_cmd_binds[]. Make them match.

Add some minor documentation improvements in input.cfg.

Also remove double comments ('##'), because they were confusing.
2012-01-18 04:14:34 +01:00
wm4 dd4452ad02 x11: remove wskeys.h
Use the <X11/keysymdef.h> xlib header instead. I'm not sure why mplayer
defined these constants itself.
2012-01-18 04:13:27 +01:00
wm4 fdc7155ced x11: add print and menu keys 2012-01-18 04:13:27 +01:00
wm4 10ab86b73d x11: add KP_Separator to key mapping
At least on some keyboards, the key between '0' and 'Enter' on the
key pad is mapped to KP_Separator. Since X11 VOs accept unicode
input, the mplayer keycode this key generates depended on the numlock
state, and with numlock enabled this mapped to an ASCII character.
This is probably not what the user wanted, since two physical keys
will always map to the same key code.

Map it to KP_DEC.
2012-01-18 04:13:27 +01:00
wm4 e722967580 input: handle UTF-8 terminal input
This assumes the terminal uses UTF-8. If invalid UTF-8 is encountered (for
example because the terminal uses a legacy encoding), the code falls back
to the old method and feeds each byte as key code to the input code.

In theory, UTF-8 input could randomly fail, because the code in getch2.c
doesn't try to fill the input buffer correctly with input sequences
longer than a byte. This is a problem with the design of the existing
code.
2012-01-18 04:13:27 +01:00
wm4 ad455c43f5 x11: allow unicode input
This change allows using non-ASCII keys with X11. These keys were ingored
before.

Technically, this creates an invisible, non-interactive input method
context. If creation fails, the code falls back to the old method, which
allows a subset of ASCII only.
2012-01-18 04:13:27 +01:00
wm4 a63e880400 input: allow unicode keys and reassign internal key codes
This moves all key codes above the highest valid unicode code point (which
is 0x10FFFF). All key codes below MP_KEY_BASE now directly map to unicode.
Configuration files (input.conf) can contain unicode characters in UTF-8
to map non-ASCII characters/keys.

This shouldn't change anything user visible, except that "direct key codes"
(as used in input.conf) will change their meaning.
2012-01-18 04:11:48 +01:00
wm4 4e76c7514f screenshot: improve quality by using additional swscale flags
Adding these flags improves the quality of the YUV->RGB conversion when
screenshots are taken. It trades precision for performance.

This doesn't affect any other swscale uses, such as vf_scale or vo_x11.

Based on a patch by cantabile. Fixes #140.
2012-01-18 02:53:30 +01:00
wm4 2e0bae181f x11: simplify setting unicode text properties 2012-01-18 02:53:30 +01:00
wm4 34b22ec6ea playtree: --shuffle shouldn't make playlist navigation useless
When --shuffle was used, the pt_step -1 jumped to the next file, instead
of the previously played file. This was because the playtree entries were
never actually shuffled, but instead a random unplayed file was picked.
Fix this by actually shuffling the playtree in advance. I couldn't see any
clear location where exactly this should happen, so it's done when a
playtree iterator is created.

Not removing the old code, since new playtree entries could be added while
an iterator is active.
2012-01-18 02:53:30 +01:00
wm4 3b03f4995d subtitles: create only one instance of ASS_Render instead of two
This simplifies the code. It also can make loading of mkv files faster, as
initializing two ASS_Render instances required scanning mkv font
attachments twice.
2012-01-18 02:53:30 +01:00
wm4 f9141fc36f input: simplify previous commit a bit more
Less mutable state = better.
2012-01-18 02:53:23 +01:00
wm4 98203198b6 input: fix crashes with libmenu
Note: now that libmenu has been removed, the related code in input.c has
been removed. If libmenu is ever added back, a queue_remove() function
that can remove any item in the input queue will be required.

libmenu triggered some special case that caused crashes by double frees.
In particular the queue_pop function is used, expecting to remove an element
that is not necessarily always the one that queue_pop removes. Fix by
adding a queue_remove functions. Rewrite the other queue functions, since
these are probably buggy as well. queue_pop didn't even attempt to
maintain the doubly linked list.
2012-01-18 02:52:34 +01:00
Uoti Urpala c4093e7d87 vd_ffmpeg: explicitly set thread count even if 1
Libav started automatically enabling threaded decoding a while ago.
This is not safe, as it means callbacks can suddenly get called from
other threads and outside calls to libavcodec. We need to know when
threading will be used and disable thread-unsafe callbacks in those
cases. Explicitly set thread count to 1 instead of leaving it at 0
(which triggers the autodetection) when we are not requesting more
threads; this should make sure that autodetection on libavcodec side
will not be used.
2012-01-17 00:07:27 +02:00
Uoti Urpala 6c57eeb7ad stream_vcd: fix option value allocated with strdup
A string freed with m_struct_free() was allocated with strdup(). This
would cause a crash when using vcd:// streams. Fix to use
talloc_strdup().
2012-01-16 22:40:14 +02:00
wm4 668654098e audio: change default preference order of AO drivers
Now PulseAudio is preferred over ALSA, which in turn is preferred over
OSS. This should give best results on all systems. On systems with
PulseAudio, we will always use it natively, rather than through the
suboptimal ALSA emulation (which the default ALSA output is normally
redirected to when PulseAudio is active; ALSA hardware devices will
not be, but to use those the user must set AO explicitly in any case,
so changing the defaults makes no difference). The fallback from
ao_pulse to ao_alsa causes no noticeable delay on systems without
PulseAudio. On systems with ALSA, we won't attempt to use OSS anymore.

Also, move OpenAL above SDL. OpenAL should generally work better than
SDL.
2012-01-16 22:40:14 +02:00