0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
Commit Graph

277 Commits

Author SHA1 Message Date
wm4
82068ec56c demux: rename demux_packet.h to packet.h
This always bothered me.
2013-11-18 18:46:44 +01:00
wm4
d5bc4ee798 audio: drop buffered filter data when seeking
This could lead to (barely) audible artifacts with --af=scaletempo and
modified playback speed.
2013-11-18 14:21:01 +01:00
wm4
5594718b6b audio/filter: remove unneeded AF_CONTROLs, convert to enum
The AF control commands used an elaborate and unnecessary organization
for the command constants. Get rid of all that and convert the
definitions to a simple enum. Also remove the control commands that
were not really needed, because they were not used outside of the
filters that implemented them.
2013-11-18 14:21:01 +01:00
wm4
75dd3ec210 player: simplify audio reset when seeking
Some decoders used to read packets and decode data when calling
resync_audio_stream(). This required a special case in mp_seek() for
audio. (A comment mentions liba52, which is long gone; but until
recently ad_mpg123.c actually exposed this behavior.)

No decoder does this anymore, and resync_audio_stream() works similar
as resync_video_stream(). Remove the special case.
2013-11-18 14:21:01 +01:00
wm4
1151dac5f0 audio: use the decoder buffer's format, not sh_audio
When the decoder detects a format change, it overwrites the values
stored in sh_audio (this affects the members sample_format, samplerate,
channels). In the case when the old audio data still needs to be
played/filtered, the audio format as identified by sh_audio and the
format used for the decoder buffer can mismatch. In particular, they
will mismatch in the very unlikely but possible case the audio chain is
reinitialized while old data is draining during a format change.

Or in other words, sh_audio might contain the new format, while the
audio chain is still configured to use the old format.

Currently, the audio code (player/audio.c and init_audio_filters) access
sh_audio to get the current format. This is in theory incorrect for the
reasons mentioned above. Use the decoder buffer's format instead, which
should be correct at any point.
2013-11-18 14:21:00 +01:00
wm4
8438c557cf player: write final audo chunk only if there is audio left
Don't call ao_play() if there's nothing left. Of course this still asks
the AO to play internally buffered audio by setting drain=true.
2013-11-17 16:22:32 +01:00
wm4
b3eed7374e player: don't remove playback status when reinitializing DVB
Also break that line a bit.
2013-11-17 16:22:14 +01:00
wm4
a2a24b957e demux: simplify handling of filepos field
demuxer->filepos contains the byte offset of the last read packet. This
is so that the player can estimate the current playback position, if no
proper timestamps are available. Simplify it to use demux_packet->pos in
the generic demuxer code, instead of bothering every demuxer
implementation about it.

(Note that this is still a bit incorrect: it relfects the position of
the last packet read by the demuxer, not that returned to the user. But
that was already broken, and is not that trivial to fix.)
2013-11-16 21:46:17 +01:00
wm4
8cc44a64e8 encode_lavc: add missing newline in error message 2013-11-16 21:46:17 +01:00
wm4
a9d98082aa mp_ring: remove unused function
This was needed for ao_jack.c., but not anymore.
2013-11-15 21:08:48 +01:00
wm4
8444c916d4 m_option: handle audio/filter filters with old option parsing
These use the _oldargs_ hack, which failed in combination with playback
resume. Make it work.

It would be better to port all filters to new option parsing, but that's
obviously too much work, and most filters will probably be deleted and
replaced by libavfilter in the long run.
2013-11-13 20:10:17 +01:00
wm4
22b3f522ca audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.

Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)

ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 23:39:09 +01:00
wm4
824e6550f8 audio/filter: fix mul/delay scale and values
Before this commit, the af_instance->mul/delay values were in bytes.
Using bytes is confusing for non-interleaved audio, so switch mul to
samples, and delay to seconds. For delay, seconds are more intuitive
than bytes or samples, because it's used for the latency calculation.
We also might want to replace the delay mechanism with real PTS
tracking inside the filter chain some time in the future, and PTS
will also require time-adjustments to be done in seconds.

For most filters, we just remove the redundant mul=1 initialization.
(Setting this used to be required, but not anymore.)
2013-11-12 23:34:35 +01:00
wm4
347a86198b audio: switch output to mp_audio_buffer
Replace the code that used a single buffer with mp_audio_buffer. This
also enables non-interleaved output operation, although it's still
disabled, and no AO supports it yet.
2013-11-12 23:29:53 +01:00
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