Commit Graph

16 Commits

Author SHA1 Message Date
wm4 d8b59aa17f player: merge no-correct-pts with correct-pts code
Now the --no-correct-pts mode is like the normal mode, just with
different timestamp calculations. The semantics should be about the
same as before this commit.
2013-11-25 23:12:18 +01:00
wm4 e5311586ab Rename sub.c/.h to osd.c/.h
This was way too misleading. osd.c merely calls the subtitle renderers,
instead of actually dealing with subtitles.
2013-11-24 14:44:58 +01:00
wm4 3486302514 video: move decoder context from sh_video into new struct
This is similar to the sh_audio commit.

This is mostly cosmetic in nature, except that it also adds automatical
freeing of the decoder driver's state struct (which was in
sh_video->context, now in dec_video->priv).

Also remove all the stheader.h fields that are not needed anymore.
2013-11-23 21:36:20 +01:00
wm4 0f5ec05d8f audio: move decoder context from sh_audio into new struct
Move all state that basically changes during decoding or is needed in
order to manage decoding itself into a new struct (dec_audio).

sh_audio (defined in stheader.h) is supposed to be the audio stream
header. This should reflect the file headers for the stream. Putting the
decoder context there is strange design, to say the least.
2013-11-23 21:22:17 +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 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 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 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
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 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 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 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