Commit Graph

263 Commits

Author SHA1 Message Date
wm4 1a5c863a32 player: set PulseAudio stream title to window title
Set the PulseAudio stream title, just like the VO window title is set.
Refactor update_vo_window_title() so that we can use it for AOs too.

The ao_pulse.c bit is stolen from MPlayer.
2013-11-10 00:49:13 +01:00
wm4 53d3827843 Remove sh_audio->samplesize
This member was redundant. sh_audio->sample_format indicates the sample
size already.

The TV code is a bit strange: the redundant sample size was part of the
internal TV interface. Assume it's really redundant and not something
else. The PCM decoder ignores the sample size anyway.
2013-11-09 23:32:58 +01:00
wm4 6354a6b07d player: factor audio buffer clearing code
Note that the change in seek_reset is not entirely equivalent: we even
drop the remainder of buffered audio when seeking. This should be more
correct, because the whole point of the reset_ao parameter is to control
whether audio queued for output should be dropped or not.
2013-11-08 20:29:26 +01:00
wm4 8125252399 audio: don't let ao_lavc access frontend internals, change gapless audio
ao_lavc.c accesses ao->buffer, which I consider internal. The access was
done in ao_lavc.c/uninit(), which tried to get the left-over audio in
order to write the last (possibly partial) audio frame. The play()
function didn't accept partial frames, because the AOPLAY_FINAL_CHUNK
flag was not correctly set, and handling it otherwise would require an
internal FIFO.

Fix this by making sure that with gapless audio (used with encoding),
the AOPLAY_FINAL_CHUNK is set only once, instead when each file ends.
Basically, move the hack in ao_lavc's uninit to uninit_player.

One thing can not be entirely correctly handled: if gapless audio is
active, we don't know really whether the AO is closed because the file
ended playing (i.e. we want to send the buffered remainder of the audio
to the AO), or whether the user is quitting the player. (The stop_play
flag is overwritten, fixing that is perhaps not worth it.) Handle this
by adding additional code to drain the AO and the buffers when playback
is quit (see play_current_file() change).

Test case: mpv avdevice://lavfi:sine=441 avdevice://lavfi:sine=441 -length 0.2267  -gapless-audio
2013-11-08 20:00:58 +01:00
Rudolf Polzer 633fde4ae5 sd_lavc, sd_spu: make dvdsub stretching conditional on --stretch-dvd-subs.
We found that the stretching - although it usually improves the looks of
the fonts - is incorrect.

On DVD, subtitles can cover the full area of the picture, and they have
the same pixel aspect as the movie itself.

Too bad many commercially released DVDs use bitmap fonts made with the
wrong pixel aspect (i.e. assuming 1:1) - --stretch-dvd-subs will make
these more pretty then.
2013-11-07 12:56:07 +01:00
wm4 6d2c5fc99a vd_lavc: remove explicit crystalhd support
This removes "--hwdec=crystalhd".

I doubt anyone even tried to use this. But even if someone wants to
use it, the decoders can still be explicitly invoked with e.g.:

    --vd=lavc:h264_crystalhd

The only advantage our special code provided was fallback to
software decoding. (But I'm not sure how the ffmpeg crystalhd
pseudo-decoder actually behaves.)

Removing this will allow some simplifications as soon as we don't need
vdpau_old.c anymore.
2013-11-06 00:47:53 +01:00
wm4 3cfbe81038 input: remove unused key_down_event command
There's no real use-case for this, and is wasn't documented (didn't even
appear on the "undocumented commands" list).
2013-11-06 00:08:38 +01:00
wm4 9dc0dfbd54 input: disallow autorepeat by default for most commands
This drops autorepeated key events for a number of commands. This should
help with slow situations accidentally triggering too many repeats. (I'm
not sure if this actually happened to users - maybe.)

It's not clear whether MP_CMD_COMMAND_LIST (multiple commands on one
binding separated by ';') should be repeated, or whether it should try
to do something clever. For now, disallow autorepeat with it.
2013-11-06 00:05:12 +01:00
wm4 ed02cbf92f playlist: rewrite PLS parser
Somehow the new parser ends up much smaller. Much of it is because we
don't parse some additional information. We just skip it, instead of
parsing it and then throwing it away.

More importantly, we use the physical order of entries, instead of
trying to sort them by entry number. Each "File" entry is followed by a
number that is supposed to be the entry number, and "File1" is first.
(Should it turn out that this is really needed, an additional field
should be added to playlist_entry, and then qsort().)
2013-11-04 23:55:41 +01:00
wm4 f7b2d644ef Merge branch 'master' into have_configure
Conflicts:
	configure
2013-11-04 00:43:06 +01:00
Paweł Forysiuk 25affdcc88 Fix -Wshadow warning about seek function in playloop.c
mpvcore/player/playloop.c: In function 'seek':
mpvcore/player/playloop.c:209:54: warning: declaration of 'seek' shadows a global declaration [-Wshadow]
mpvcore/player/playloop.c:209:12: warning: shadowed declaration is here [-Wshadow]
mpvcore/player/playloop.c: In function 'queue_seek':
mpvcore/player/playloop.c:360:25: warning: declaration of 'seek' shadows a global declaration [-Wshadow]
mpvcore/player/playloop.c:209:12: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: wm4 <wm4@nowhere>
2013-11-04 00:13:24 +01:00
Stefano Pigozzi 37388ebb0e configure: uniform the defines to #define HAVE_xxx (0|1)
The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:

  * #define HAVE_HURR 1   / #undef HAVE_DURR
  * #define HAVE_HURR     / #undef HAVE_DURR
  * #define CONFIG_HURR 1 / #undef CONFIG_DURR
  * #define HAVE_HURR 1   / #define HAVE_DURR 0
  * #define CONFIG_HURR 1 / #define CONFIG_DURR 0

All is now uniform and uses:
  * #define HAVE_HURR 1
  * #define HAVE_DURR 0

We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.

[1]: http://xkcd.com/927/ related
2013-11-03 21:59:54 +01:00
wm4 388f43f6f7 player: fix quvi 0.9 playlist loading
The code made no sense at all.
2013-11-03 19:22:13 +01:00
wm4 a49ab7cc2f demux: make determining seek capability generic
Instead of having each demuxer do it (only demux_mkv actually did...),
let generic code determine whether the file is seekable. This requires
adding exceptions to demuxers where the stream is not seekable, but the
demuxer is.

Sort-of try to improve handling of unseekable files in the player. Exit
early if the file is determined to be unseekable, instead of resetting
all decoders and then performing a pointless seek.

Add an exception to allow seeking if the file is not seekable, but the
stream cache is enabled. Print a warning in this case, because seeking
outside the cache (which we can't prevent since the demuxer is not aware
of this problem) still messes everything up.
2013-11-03 19:21:47 +01:00
wm4 847cbe9d5d demux: remove movi_start/movi_end fields
Pointless, using stream->start_pos/end_pos instead.

demux_mf was the only place where this was used specially, but we can
rely on timestamps instead for this case.
2013-11-03 18:50:00 +01:00
wm4 e0b6fdeb8d Fix some more -Wshadow warnings
These aren't printed with newer gcc or clang versions for some reason.

All of them seem to be about local variables shadowing global functions.
2013-11-01 17:35:38 +01:00
wm4 4b6c00c50a tl_matroska: initialize segment related arrays with 0
mpv crashed when linked files were not found. The reason was that the
chapters array contained some uninitialized data.

I have no idea how this code works (after the merge). The old code
actually seems to remove missing chapters, while the new code just
leaves them unintiialized. Work around the crash by initializing the
chapters array (and a bunch of other things) with 0, which means the
missing chapter will be located at 00:00:00 and have no name.

There is a regression since commit af0306d.
2013-11-01 17:35:38 +01:00
wm4 24897eb94c video: check profiles with hardware decoding
We had some code for checking profiles earlier, which was removed in
commits 2508f38 and adfb71b. These commits mentioned that (working) hw
decoding was sometimes prevented due to profile checking, but I can't
find the samples anymore that showed this behavior. Also, I changed my
opinion, and I think checking the profiles is something that should be
done for better fallback to software decoding behavior.

The checks roughly follow VLC's vdpau profile checks, although we do
not check codec levels. (VLC's profile checks aren't necessarily
completely correct, but they're a welcome help anyway.)

Add a --vd-lavc-check-hw-profile option, which skips the profile check.
2013-11-01 17:33:33 +01:00
wm4 dd344b43e8 Enable -Wshadow
This one really did bite me hard (see previous commit), so enable it by
default.

Fix some cases of shadowing throughout the codebase. None of these
change behavior, and all of these were correct code, and just tripped up
the warning.
2013-11-01 13:00:15 +01:00
wm4 2696148d64 options: fix positional suboption asrguments
E.g. "-vf scale=848:480" set the w argument twice, instead of setting w
and then h.

This was caused by accidental shadowing of a local variable.

Regression since probably 4cd143e.
2013-11-01 12:27:04 +01:00
wm4 482009d170 input: show deprecation warnings for some recently replaced commands
Let's see if I get annoyed reactions...
2013-11-01 00:25:42 +01:00
wm4 39fc0060fb command: replace speed_mult with multiply command
The compatibility layer still takes care of the old speed_mult command.
2013-10-31 23:30:14 +01:00
wm4 71ded03123 command: add generic "multiply" command
Essentially works like "add".
2013-10-31 23:30:14 +01:00
wm4 94542abf2e command: add property to scale window size 2013-10-31 23:30:14 +01:00
wm4 53218f33b9 main: improve a terminal message
Better prefer real English...
2013-10-30 22:19:31 +01:00
wm4 2ccc3721ef player: merge mp_osd.h into mp_core.h
Just doing this because mp_osd.h and osd.c is not consistent.

There are some other header files (command.h and screenshot.h), but
since I don't feel too good about inflating mp_core.h, I'm not merging
them, at least not yet.
2013-10-30 22:19:31 +01:00
wm4 fdd1b8cac1 mp_core: sort function prototypes by source file
I considered making a header file for each .c file, but decided against
it. Asking around, not making separate headers was deemed acceptable. In
the end, all of these depend on MPContext and store state inside of it,
so separate headers aren't all that useful anyway.
2013-10-30 22:19:31 +01:00
wm4 b19414f3bf Split mplayer.c
mplayer.c was a bit too big. Split it into multiple files. I hope the
way it's split makes sense. Maybe some things don't make too much sense,
or go against intuition. These will fixed as soon as I notice them.

Some files are a bit questionable (misc.c, osd.c, configfiles.c), and
suggestions how to organize this better are welcome.

Regressions are possible due to reorganized include statements.
Obviously I didn't just copy mplayer.c's orgy of include statements, but
recreated them for each file. It's easily possible that there are
oversights and mistakes, which will show up on other platforms.

There is one actual change: the public avutil.h include is removed from
encode.h, and I tried to replace most FFMIN/FFMAX/av_clip uses. I
consider using libavutil too much as dangerous, because the set of
include files they recursively pull in is rather arbitrary and is
different between FFmpeg and Libav.
2013-10-30 01:53:53 +01:00
wm4 a84258d769 Move files part of the playback core to player sub-directory
All these files access mp_core.h and MPContext, and form the actual
player application. They should be all in one place, and separate
from the other sources that are mere utility helpers.

Preparation for splitting mplayer.c into multiple smaller parts.
2013-10-30 01:51:28 +01:00
wm4 40e68d6514 mplayer: handle subtitle renderer cleanup via uninit_player
This might actually fix an issue with DVB channel switching, because
that uses some sort of hack to reinitialize the demuxer, which causes
the subtitle renderer to initialize twice. As consequence, the assert in
add_subtitle_fonts_from_sources() would trigger.

I didn't actually test the DVB case, because I don't have the hardware.
2013-10-28 23:16:00 +01:00
wm4 5e9c226229 command: disable autorepeat for some commands (actually properties)
Disable autorepeat for the "add"/"cycle" commands when changing
properties that are choices (such as fullscreen, pause, and more).
In these cases, autorepeat is not very useful, and can rather harmful
effects (like triggering too many repeated commands if command
execution is slow).

(Actually, the commands are just dropped _after_ being repeated, since
input.c itself does not know enough about the commands to decide whether
or not they should be repeated.)
2013-10-28 00:33:52 +01:00
wm4 d2ee5c0330 command: don't include stream_dvd.h 2013-10-27 00:40:01 +02:00
wm4 7abc1bef40 af: replace macros with too generic names
Defining names like min, max etc. in an often used header is not really
a good idea.

Somewhat similar to MPlayer svn commit 36491, but don't use libavutil,
because that typically causes us sorrow.
2013-10-26 15:05:59 +02:00
Ben Boeckel 1fb1868afe mpvcore: add a note about desync on track switches 2013-10-26 12:37:42 +02:00
ChrisK2 c341edda35 osc: display cache status only below 45%
Turnes out, when playing stuff over WiFi, the cache may go below 48%
quite frequently.
2013-10-26 11:09:06 +02:00
ChrisK2 e02ec80192 osc: fix bug for no-duration cases 2013-10-26 11:08:06 +02:00
ChrisK2 c54335e7df osc: add experimental seekbar tooltip
Not up to my quality standards (need ASS boundingboxes), so disabled by default and undocumented for now.

Can be enabled with seektooltip=yes in plugin_osc.conf
2013-10-26 05:01:33 +02:00
ChrisK2 3a181bac1f osc: make sure the OSC actually fits into the video 2013-10-26 03:50:11 +02:00
wm4 ecc0705f83 options: don't let watch_later etc. overwite command line options
There are certain cases where mpv will automatically set options, such
as per-file configs, per protocol/VO/AO/extension profiles, and
watch_later resume configs. All these were overwriting the user's
options, even when they were specified on command line.

Add something that explicitly preserves command line options. This
means you can now actually use the command line to override any
options that the playback resume functionality backups and restores.

It still happily overrides options set at runtime (e.g. changed via
properties while playing a file; then playing the next file might
override them again), but maybe that's not a problem with typical use.
2013-10-25 22:52:54 +02:00
wm4 607892b741 mplayer: make --length relative to actual start of file, instead of 0
We always use the file's timestamps, so the start time can be easily
something different from 0. Make the --length option respect this.
2013-10-25 18:39:15 +02:00
wm4 2c6f6c9f4e m_config: slightly improve name handling 2013-10-25 18:39:15 +02:00
wm4 28d3fe1d6d m_config: remove unused fields
We don't need that anymore, because the old way to get default values
by recreating the m_config is gone.
2013-10-25 18:39:15 +02:00
wm4 75e1c6f295 m_config: allow not allocating option struct, and use it
In cases we're just listing options or checking their values (as it
happens with -vo/-vf etc. suboption parsing), we don't need to allocate
abd initialize the actual option struct. All we're interested in is
the list of options.
2013-10-25 18:39:15 +02:00
wm4 60aea74f44 m_config: refactor option defaults handling
Keep track of the default values directly, instead of creating a new
instance of the option struct just to get the defaults.

Also get rid of the special handling of m_obj_desc.init_options.
Instead, handle it purely by the option parser. Originally, I wanted to
handle --vo=opengl-hq and --vo=direct3d_shaders with this (by making
them aliases to the real VOs with a different preset), but since --vo
=opengl-hq=help prints the wrong values (as consequence of the
simplification), I'm not doing that, and instead use something
different.
2013-10-24 22:50:13 +02:00
wm4 f6bceacaff options: fix bogus entry
This didn't make sense and caused issues with the following commit: if
it's an option with a data pointer, it should be writable.
2013-10-24 22:50:13 +02:00
wm4 7204dee3c7 m_config: don't require dragging along parent in initialization
Instead, track the opstruct explicitly. It turns out we don't need the
parent at all. Also, add something rudimentary to track the default
values.
2013-10-24 22:50:13 +02:00
wm4 b707589e7e m_config: minor simplification
I think in this case, having a separate function is confusing.
2013-10-24 22:50:13 +02:00
wm4 4cd143e4d8 m_config: store m_config_options in an array instead of a list
Might reduce memory overhead, and is also less annoying.

Since pointers to m_config_options are kept around, this assumes
they're added only during initialization. Otherwise you'd get
dangling pointers.
2013-10-24 22:50:13 +02:00
wm4 a217c08b17 m_config: refactor initialization, reduce amount of malloc'ed strings
Allocate strings only if needed (when we have to prefix sub-options).
Prepare for storing m_config_options in an array instead of a list.
2013-10-24 22:50:13 +02:00
wm4 cfc72d4fff m_config: slightly simplify dynamic option initialization
We can assume memcpy is enough, because the source should be from
static data. (It wouldn't work if the data could contain pointers
back into itself.)
2013-10-24 22:50:13 +02:00