2010-01-30 23:24:23 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2010-01-30 23:24:23 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
2010-01-30 23:24:23 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2010-01-30 23:24:23 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-30 23:24:23 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_MP_CORE_H
|
|
|
|
#define MPLAYER_MP_CORE_H
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2008-12-08 18:04:08 +00:00
|
|
|
#include <stdbool.h>
|
2015-07-06 20:28:28 +00:00
|
|
|
#include <pthread.h>
|
2008-12-08 18:04:08 +00:00
|
|
|
|
2014-02-17 01:52:26 +00:00
|
|
|
#include "libmpv/client.h"
|
|
|
|
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/common.h"
|
2013-12-17 01:02:25 +00:00
|
|
|
#include "options/options.h"
|
2014-01-18 00:19:20 +00:00
|
|
|
#include "sub/osd.h"
|
2016-01-21 21:10:15 +00:00
|
|
|
#include "audio/audio.h"
|
2016-01-16 20:19:52 +00:00
|
|
|
#include "video/mp_image.h"
|
2015-07-01 17:22:40 +00:00
|
|
|
#include "video/out/vo.h"
|
2008-01-30 07:21:05 +00:00
|
|
|
|
2016-02-05 22:19:56 +00:00
|
|
|
#include "lavfi.h"
|
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
// definitions used internally by the core player code
|
|
|
|
|
2008-08-13 05:06:26 +00:00
|
|
|
enum stop_play_reason {
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
|
mplayer: attempt to skip playlist entries which can't be played
This is for situations when repeated attempts at playing a playlist
entry failed, and playlist navigation becomes impossible due to that.
For example, it wasn't possible to skip backwards past an unplayable
playlist entry:
mpv file1.mkv doesntexist.mkv file3.mkv
You couldn't skip back to file1.mkv from file3.mkv. When running a
single "playlist_prev" command, doesntexist.mkv would be played, which
would fail to load. As reaction to the failure to load it, the next file
would be played, which is file3.mkv.
To make this even worse, the file could successfully load, but run only
for a split second. So just loading successfully isn't good enough.
Attempt to solve this by marking problematic playlist entries as failed,
and by having playlist_prev skip past such playlist entries. We define
failure as not being able to play more than 3 seconds (or failing to
initialize to begin with). (The 3 seconds are in real time, not file
duration.)
"playlist_prev force" still exhibits the old behavior.
Additionally, use the same mechanism to prevent pointless infinite
reloading if none of the files on the playlist exist. (See github issue
All in all, this is a heuristic, and later adjustments might be
necessary.
Note: forward skips (playlist_next) are not affected at all. (Except for
the interaction with --loop.)
2013-09-15 03:03:37 +00:00
|
|
|
AT_END_OF_FILE, // file has ended, prepare to play next
|
|
|
|
// also returned on unrecoverable playback errors
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
PT_NEXT_ENTRY, // prepare to play next entry in playlist
|
|
|
|
PT_CURRENT_ENTRY, // prepare to play mpctx->playlist->current
|
|
|
|
PT_STOP, // stop playback, clear playlist
|
2015-07-02 12:38:03 +00:00
|
|
|
PT_RELOAD_FILE, // restart playback
|
2012-08-04 01:46:11 +00:00
|
|
|
PT_QUIT, // stop playback, quit player
|
2014-10-28 15:19:07 +00:00
|
|
|
PT_ERROR, // play next playlist entry (due to an error)
|
2008-08-13 05:06:26 +00:00
|
|
|
};
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2012-09-25 01:24:38 +00:00
|
|
|
enum mp_osd_seek_info {
|
|
|
|
OSD_SEEK_INFO_BAR = 1,
|
|
|
|
OSD_SEEK_INFO_TEXT = 2,
|
|
|
|
OSD_SEEK_INFO_CHAPTER_TEXT = 4,
|
|
|
|
OSD_SEEK_INFO_EDITION = 8,
|
2014-11-11 21:07:16 +00:00
|
|
|
OSD_SEEK_INFO_CURRENT_FILE = 16,
|
2012-09-25 01:24:38 +00:00
|
|
|
};
|
|
|
|
|
2013-10-30 20:47:14 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
// other constants
|
|
|
|
MAX_OSD_LEVEL = 3,
|
|
|
|
OSD_LEVEL_INVISIBLE = 4,
|
|
|
|
OSD_BAR_SEEK = 256,
|
2014-07-30 21:24:08 +00:00
|
|
|
|
|
|
|
MAX_NUM_VO_PTS = 100,
|
2013-10-30 20:47:14 +00:00
|
|
|
};
|
|
|
|
|
2013-08-19 20:29:55 +00:00
|
|
|
enum seek_type {
|
|
|
|
MPSEEK_NONE = 0,
|
|
|
|
MPSEEK_RELATIVE,
|
|
|
|
MPSEEK_ABSOLUTE,
|
|
|
|
MPSEEK_FACTOR,
|
2016-01-12 22:49:00 +00:00
|
|
|
MPSEEK_BACKSTEP,
|
2013-08-19 20:29:55 +00:00
|
|
|
};
|
|
|
|
|
2015-03-04 16:21:05 +00:00
|
|
|
enum seek_precision {
|
|
|
|
MPSEEK_DEFAULT = 0,
|
|
|
|
// The following values are numerically sorted by increasing precision
|
|
|
|
MPSEEK_KEYFRAME,
|
|
|
|
MPSEEK_EXACT,
|
|
|
|
MPSEEK_VERY_EXACT,
|
|
|
|
};
|
|
|
|
|
2015-08-10 16:43:25 +00:00
|
|
|
enum video_sync {
|
|
|
|
VS_DEFAULT = 0,
|
|
|
|
VS_DISP_RESAMPLE,
|
|
|
|
VS_DISP_RESAMPLE_VDROP,
|
|
|
|
VS_DISP_RESAMPLE_NONE,
|
2015-10-27 19:56:46 +00:00
|
|
|
VS_DISP_ADROP,
|
2015-08-10 16:43:25 +00:00
|
|
|
VS_DISP_VDROP,
|
|
|
|
VS_DISP_NONE,
|
|
|
|
VS_NONE,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VS_IS_DISP(x) ((x) == VS_DISP_RESAMPLE || \
|
|
|
|
(x) == VS_DISP_RESAMPLE_VDROP || \
|
|
|
|
(x) == VS_DISP_RESAMPLE_NONE || \
|
2015-10-27 19:56:46 +00:00
|
|
|
(x) == VS_DISP_ADROP || \
|
2015-08-10 16:43:25 +00:00
|
|
|
(x) == VS_DISP_VDROP || \
|
|
|
|
(x) == VS_DISP_NONE)
|
|
|
|
|
player: refactor display-sync frame duration calculations
Get rid of get_past_frame_durations(), which was a bit too messy. Add
a past_frames array, which contains the same information in a more
reasonable way. This also means that we can get the exact current and
past frame durations without going through awful stuff. (The main
problem is that vo_pts_history contains future frames as well, which is
needed for frame backstepping etc., but gets in the way here.)
Also disable the automatic disabling of display-sync if the frame
duration changes, and extend the frame durations allowed for display
sync. To allow arbitrarily high durations, vo.c needs to be changed
to pause and potentially redraw OSD while showing a single frame, so
they're still limited.
In an attempt to deal with VFR, calculate the overall speed using the
average FPS. The frame scheduling itself does not use the average FPS,
but the duration of the current frame. This does not work too well,
but provides a good base for further improvements.
Where this commit actually helps a lot is dealing with rounded
timestamps, e.g. if the container framerate is wrong or unknown, or
if the muxer wrote incorrectly rounded timestamps. While the rounding
errors apparently can't be get rid of completely in the general case,
this is still much better than e.g. disabling display-sync completely
just because some frame durations go out of bounds.
2015-11-13 21:45:40 +00:00
|
|
|
// Information about past video frames that have been sent to the VO.
|
|
|
|
struct frame_info {
|
|
|
|
double pts;
|
|
|
|
double duration; // PTS difference to next frame
|
|
|
|
double approx_duration; // possibly fixed/smoothed out duration
|
2015-11-13 21:51:39 +00:00
|
|
|
double av_diff; // A/V diff at time of scheduling
|
2015-11-13 21:48:32 +00:00
|
|
|
int num_vsyncs; // scheduled vsyncs, if using display-sync
|
player: refactor display-sync frame duration calculations
Get rid of get_past_frame_durations(), which was a bit too messy. Add
a past_frames array, which contains the same information in a more
reasonable way. This also means that we can get the exact current and
past frame durations without going through awful stuff. (The main
problem is that vo_pts_history contains future frames as well, which is
needed for frame backstepping etc., but gets in the way here.)
Also disable the automatic disabling of display-sync if the frame
duration changes, and extend the frame durations allowed for display
sync. To allow arbitrarily high durations, vo.c needs to be changed
to pause and potentially redraw OSD while showing a single frame, so
they're still limited.
In an attempt to deal with VFR, calculate the overall speed using the
average FPS. The frame scheduling itself does not use the average FPS,
but the duration of the current frame. This does not work too well,
but provides a good base for further improvements.
Where this commit actually helps a lot is dealing with rounded
timestamps, e.g. if the container framerate is wrong or unknown, or
if the muxer wrote incorrectly rounded timestamps. While the rounding
errors apparently can't be get rid of completely in the general case,
this is still much better than e.g. disabling display-sync completely
just because some frame durations go out of bounds.
2015-11-13 21:45:40 +00:00
|
|
|
};
|
|
|
|
|
2012-08-19 16:01:30 +00:00
|
|
|
struct track {
|
|
|
|
enum stream_type type;
|
2013-12-23 19:14:54 +00:00
|
|
|
|
|
|
|
// Currently used for decoding.
|
|
|
|
bool selected;
|
|
|
|
|
2012-08-19 16:01:30 +00:00
|
|
|
// The type specific ID, also called aid (audio), sid (subs), vid (video).
|
|
|
|
// For UI purposes only; this ID doesn't have anything to do with any
|
|
|
|
// IDs coming from demuxers or container files.
|
|
|
|
int user_tid;
|
|
|
|
|
2014-10-21 11:16:48 +00:00
|
|
|
int demuxer_id; // same as stream->demuxer_id. -1 if not set.
|
|
|
|
int ff_index; // same as stream->ff_index, or 0.
|
2012-08-19 16:01:30 +00:00
|
|
|
|
|
|
|
char *title;
|
2015-06-27 20:02:24 +00:00
|
|
|
bool default_track, forced_track;
|
2012-12-10 17:52:06 +00:00
|
|
|
bool attached_picture;
|
2012-08-19 16:01:30 +00:00
|
|
|
char *lang;
|
|
|
|
|
|
|
|
// If this track is from an external file (e.g. subtitle file).
|
|
|
|
bool is_external;
|
2014-01-05 15:15:30 +00:00
|
|
|
bool no_default; // pretend it's not external for auto-selection
|
2012-11-15 19:26:52 +00:00
|
|
|
char *external_filename;
|
2013-04-20 21:48:26 +00:00
|
|
|
bool auto_loaded;
|
2012-08-19 16:01:30 +00:00
|
|
|
|
|
|
|
struct demuxer *demuxer;
|
2013-09-07 18:21:11 +00:00
|
|
|
// Invariant: !stream || stream->demuxer == demuxer
|
2012-08-19 16:01:30 +00:00
|
|
|
struct sh_stream *stream;
|
|
|
|
|
2015-12-26 17:32:27 +00:00
|
|
|
// Current subtitle state (or cached state if selected==false).
|
2016-01-17 15:56:32 +00:00
|
|
|
struct dec_sub *d_sub;
|
2015-12-26 17:32:27 +00:00
|
|
|
|
2016-01-21 21:24:20 +00:00
|
|
|
// Current decoding state (NULL if selected==false)
|
2016-01-17 17:07:50 +00:00
|
|
|
struct dec_video *d_video;
|
2016-01-21 21:24:20 +00:00
|
|
|
struct dec_audio *d_audio;
|
2016-01-17 17:07:50 +00:00
|
|
|
|
2016-02-05 22:19:56 +00:00
|
|
|
// Where the decoded result goes to (one of them is not NULL if active)
|
|
|
|
struct vo_chain *vo_c;
|
|
|
|
struct ao_chain *ao_c;
|
|
|
|
struct lavfi_pad *sink;
|
2012-08-19 16:01:30 +00:00
|
|
|
};
|
|
|
|
|
2016-01-13 23:18:48 +00:00
|
|
|
// Summarizes video filtering and output.
|
|
|
|
struct vo_chain {
|
|
|
|
struct mp_log *log;
|
|
|
|
|
2016-01-17 17:07:50 +00:00
|
|
|
struct mp_hwdec_info *hwdec_info;
|
|
|
|
double container_fps;
|
|
|
|
|
2016-01-13 23:18:48 +00:00
|
|
|
struct vf_chain *vf;
|
|
|
|
struct vo *vo;
|
2016-01-16 20:19:52 +00:00
|
|
|
|
|
|
|
// 1-element input frame queue.
|
|
|
|
struct mp_image *input_mpi;
|
|
|
|
|
|
|
|
// Last known input_mpi format (so vf can be reinitialized any time).
|
|
|
|
struct mp_image_params input_format;
|
2016-01-17 17:07:50 +00:00
|
|
|
|
2016-02-05 22:19:56 +00:00
|
|
|
struct track *track;
|
|
|
|
struct lavfi_pad *filter_src;
|
2016-01-17 17:07:50 +00:00
|
|
|
struct dec_video *video_src;
|
2016-02-01 21:14:32 +00:00
|
|
|
|
|
|
|
// - video consists of a single picture, which should be shown only once
|
|
|
|
// - do not sync audio to video in any way
|
|
|
|
bool is_coverart;
|
2016-01-13 23:18:48 +00:00
|
|
|
};
|
|
|
|
|
2016-01-21 21:10:15 +00:00
|
|
|
// Like vo_chain, for audio.
|
|
|
|
struct ao_chain {
|
|
|
|
struct mp_log *log;
|
|
|
|
|
|
|
|
double pts; // timestamp of first sample output by decoder
|
|
|
|
bool spdif_passthrough, spdif_failed;
|
2016-01-29 21:44:20 +00:00
|
|
|
bool pts_reset;
|
2016-01-21 21:10:15 +00:00
|
|
|
|
|
|
|
struct af_stream *af;
|
|
|
|
struct ao *ao;
|
2016-01-21 21:41:41 +00:00
|
|
|
struct mp_audio_buffer *ao_buffer;
|
2016-01-21 21:10:15 +00:00
|
|
|
|
|
|
|
// 1-element input frame queue.
|
|
|
|
struct mp_audio *input_frame;
|
|
|
|
|
|
|
|
// Last known input_mpi format (so vf can be reinitialized any time).
|
|
|
|
struct mp_audio input_format;
|
|
|
|
|
2016-02-05 22:19:56 +00:00
|
|
|
struct track *track;
|
|
|
|
struct lavfi_pad *filter_src;
|
2016-01-21 21:10:15 +00:00
|
|
|
struct dec_audio *audio_src;
|
|
|
|
};
|
|
|
|
|
2014-07-28 18:40:43 +00:00
|
|
|
/* Note that playback can be paused, stopped, etc. at any time. While paused,
|
|
|
|
* playback restart is still active, because you want seeking to work even
|
|
|
|
* if paused.
|
|
|
|
* The main purpose of distinguishing these states is proper reinitialization
|
|
|
|
* of A/V sync.
|
|
|
|
*/
|
|
|
|
enum playback_status {
|
|
|
|
// code may compare status values numerically
|
|
|
|
STATUS_SYNCING, // seeking for a position to resume
|
|
|
|
STATUS_FILLING, // decoding more data (so you start with full buffers)
|
|
|
|
STATUS_READY, // buffers full, playback can be started any time
|
|
|
|
STATUS_PLAYING, // normal playback
|
|
|
|
STATUS_DRAINING, // decoding has ended; still playing out queued buffers
|
|
|
|
STATUS_EOF, // playback has ended, or is disabled
|
|
|
|
};
|
|
|
|
|
2013-12-24 16:46:08 +00:00
|
|
|
#define NUM_PTRACKS 2
|
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
typedef struct MPContext {
|
2014-02-10 20:01:35 +00:00
|
|
|
bool initialized;
|
2014-06-07 13:08:45 +00:00
|
|
|
bool autodetach;
|
2013-07-31 19:40:30 +00:00
|
|
|
struct mpv_global *global;
|
2013-07-27 19:24:54 +00:00
|
|
|
struct MPOpts *opts;
|
2013-07-31 19:40:30 +00:00
|
|
|
struct mp_log *log;
|
2008-04-26 07:44:59 +00:00
|
|
|
struct m_config *mconfig;
|
2008-04-30 04:15:52 +00:00
|
|
|
struct input_ctx *input;
|
2014-02-10 20:01:35 +00:00
|
|
|
struct mp_client_api *clients;
|
|
|
|
struct mp_dispatch_queue *dispatch;
|
stream: redo playback abort handling
This mechanism originates from MPlayer's way of dealing with blocking
network, but it's still useful. On opening and closing, mpv waits for
network synchronously, and also some obscure commands and use-cases can
lead to such blocking. In these situations, the stream is asynchronously
forced to stop by "interrupting" it.
The old design interrupting I/O was a bit broken: polling with a
callback, instead of actively interrupting it. Change the direction of
this. There is no callback anymore, and the player calls
mp_cancel_trigger() to force the stream to return.
libavformat (via stream_lavf.c) has the old broken design, and fixing it
would require fixing libavformat, which won't happen so quickly. So we
have to keep that part. But everything above the stream layer is
prepared for a better design, and more sophisticated methods than
mp_cancel_test() could be easily introduced.
There's still one problem: commands are still run in the central
playback loop, which we assume can block on I/O in the worst case.
That's not a problem yet, because we simply mark some commands as being
able to stop playback of the current file ("quit" etc.), so input.c
could abort playback as soon as such a command is queued. But there are
also commands abort playback only conditionally, and the logic for that
is in the playback core and thus "unreachable". For example,
"playlist_next" aborts playback only if there's a next file. We don't
want it to always abort playback.
As a quite ugly hack, abort playback only if at least 2 abort commands
are queued - this pretty much happens only if the core is frozen and
doesn't react to input.
2014-09-13 12:23:08 +00:00
|
|
|
struct mp_cancel *playback_abort;
|
2014-02-10 20:01:35 +00:00
|
|
|
|
|
|
|
struct mp_log *statusline;
|
2008-06-23 22:53:58 +00:00
|
|
|
struct osd_state *osd;
|
player: redo terminal OSD and status line handling
The terminal OSD code includes the handling of the terminal status line,
showing player OSD messages on the terminal, and showing subtitles on
terminal (the latter two only if there is no video window, or if
terminal OSD is forced).
This didn't handle some corner cases correctly. For example, showing an
OSD message on the terminal always cleared the previous line, even if
the line was an important message (or even just the command prompt, if
most other messages were silenced).
Attempt to handle this correctly by keeping track of how many lines the
terminal OSD currently consists of. Since there could be race conditions
with other messages being printed, implement this in msg.c. Now msg.c
expects that MSGL_STATUS messages rewrite the status line, so the caller
is forced to use a single mp_msg() call to set the status line.
Instead of littering print_status() all over the place, update the
status only once per playloop iteration in update_osd_msg(). In audio-
only mode, the status line might now be a little bit off, but it's
perhaps ok.
Print the status line only if it has changed, or if another message was
printed. This might help with extremely slow terminals, although in
audio+video mode, it'll still be updated very often (A-V sync display
changes on every frame).
Instead of hardcoding the terminal sequences, use
terminfo/termcap to get the sequences. Remove the --term-osd-esc option,
which allowed to override the hardcoded escapes - it's useless now.
The fallback for terminals with no escape sequences for moving the
cursor and clearing a line is removed. This somewhat breaks status line
display on these terminals, including the MS Windows console: instead of
querying the terminal size and clearing the line manually by padding the
output with spaces, the line is simply not cleared. I don't expect this
to be a problem on UNIX, and on MS Windows we could emulate escape
sequences. Note that terminal OSD (other than the status line) was
broken anyway on these terminals.
In osd.c, the function get_term_width() is not used anymore, so remove
it. To remind us that the MS Windows console apparently adds a line
break when writint the last column, adjust screen_width in terminal-
win.c accordingly.
2014-01-13 19:05:41 +00:00
|
|
|
char *term_osd_text;
|
|
|
|
char *term_osd_status;
|
2014-01-17 20:55:23 +00:00
|
|
|
char *term_osd_subs;
|
player: redo terminal OSD and status line handling
The terminal OSD code includes the handling of the terminal status line,
showing player OSD messages on the terminal, and showing subtitles on
terminal (the latter two only if there is no video window, or if
terminal OSD is forced).
This didn't handle some corner cases correctly. For example, showing an
OSD message on the terminal always cleared the previous line, even if
the line was an important message (or even just the command prompt, if
most other messages were silenced).
Attempt to handle this correctly by keeping track of how many lines the
terminal OSD currently consists of. Since there could be race conditions
with other messages being printed, implement this in msg.c. Now msg.c
expects that MSGL_STATUS messages rewrite the status line, so the caller
is forced to use a single mp_msg() call to set the status line.
Instead of littering print_status() all over the place, update the
status only once per playloop iteration in update_osd_msg(). In audio-
only mode, the status line might now be a little bit off, but it's
perhaps ok.
Print the status line only if it has changed, or if another message was
printed. This might help with extremely slow terminals, although in
audio+video mode, it'll still be updated very often (A-V sync display
changes on every frame).
Instead of hardcoding the terminal sequences, use
terminfo/termcap to get the sequences. Remove the --term-osd-esc option,
which allowed to override the hardcoded escapes - it's useless now.
The fallback for terminals with no escape sequences for moving the
cursor and clearing a line is removed. This somewhat breaks status line
display on these terminals, including the MS Windows console: instead of
querying the terminal size and clearing the line manually by padding the
output with spaces, the line is simply not cleared. I don't expect this
to be a problem on UNIX, and on MS Windows we could emulate escape
sequences. Note that terminal OSD (other than the status line) was
broken anyway on these terminals.
In osd.c, the function get_term_width() is not used anymore, so remove
it. To remind us that the MS Windows console apparently adds a line
break when writint the last column, adjust screen_width in terminal-
win.c accordingly.
2014-01-13 19:05:41 +00:00
|
|
|
char *term_osd_contents;
|
2013-11-09 23:49:13 +00:00
|
|
|
char *last_window_title;
|
2015-11-15 22:03:48 +00:00
|
|
|
struct voctrl_playback_state vo_playback_state;
|
2009-03-30 00:13:17 +00:00
|
|
|
|
2012-09-25 01:24:38 +00:00
|
|
|
int add_osd_seek_info; // bitfield of enum mp_osd_seek_info
|
2013-05-25 16:31:06 +00:00
|
|
|
double osd_visible; // for the osd bar only
|
2007-02-21 00:49:24 +00:00
|
|
|
int osd_function;
|
2013-05-25 16:31:06 +00:00
|
|
|
double osd_function_visible;
|
2014-09-25 19:14:00 +00:00
|
|
|
double osd_msg_visible;
|
2014-10-06 20:19:24 +00:00
|
|
|
double osd_msg_next_duration;
|
2013-05-25 16:31:06 +00:00
|
|
|
double osd_last_update;
|
2014-09-25 18:25:24 +00:00
|
|
|
bool osd_force_update;
|
2014-09-25 19:14:00 +00:00
|
|
|
char *osd_msg_text;
|
|
|
|
bool osd_show_pos;
|
2014-01-18 00:19:20 +00:00
|
|
|
struct osd_progbar_state osd_progbar;
|
2012-11-20 16:20:45 +00:00
|
|
|
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
struct playlist *playlist;
|
2014-09-08 22:38:38 +00:00
|
|
|
struct playlist_entry *playing; // currently playing file
|
2014-10-06 19:20:38 +00:00
|
|
|
char *filename; // immutable copy of playing->filename (or NULL)
|
command: add a mechanism to allow scripts to intercept file loads
A vague idea to get something similar what libquvi did.
Undocumented because it might change a lot, or even be removed. To give
an idea what it does, a Lua script could do the following:
-- type ID priority
mp.commandv("hook_add", "on_load", 0, 0)
mp.register_script_message("hook_run", function(param, param2)
-- param is "0", the user-chosen ID from the hook_add command
-- param2 is the magic value that has to be passed to finish
-- the hook
mp.resume_all()
-- do something, maybe set options that are reset on end:
mp.set_property("file-local-options/name", "value")
-- or change the URL that's being opened:
local url = mp.get_property("stream-open-filename")
mp.set_property("stream-open-filename", url .. ".png")
-- let the player (or the next script) continue
mp.commandv("hook_ack", param2)
end)
2014-10-15 21:09:53 +00:00
|
|
|
char *stream_open_filename;
|
2008-08-13 05:06:26 +00:00
|
|
|
enum stop_play_reason stop_play;
|
2014-10-03 17:57:49 +00:00
|
|
|
bool playback_initialized; // playloop can be run/is running
|
2014-10-30 22:54:06 +00:00
|
|
|
int error_playing;
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2012-08-04 01:46:11 +00:00
|
|
|
// Return code to use with PT_QUIT
|
2013-08-02 08:32:38 +00:00
|
|
|
int quit_custom_rc;
|
|
|
|
bool has_quit_custom_rc;
|
2014-02-25 21:34:32 +00:00
|
|
|
char **resume_defaults;
|
2012-08-04 01:46:11 +00:00
|
|
|
|
2014-10-30 22:54:06 +00:00
|
|
|
// Global file statistics
|
|
|
|
int files_played; // played without issues (even if stopped by user)
|
|
|
|
int files_errored; // played, but errors happened at one point
|
|
|
|
int files_broken; // couldn't be played at all
|
|
|
|
|
|
|
|
// Current file statistics
|
2013-09-29 19:10:36 +00:00
|
|
|
int64_t shown_vframes, shown_aframes;
|
|
|
|
|
2014-11-02 16:20:04 +00:00
|
|
|
struct demux_chapter *chapters;
|
2009-04-02 02:00:22 +00:00
|
|
|
int num_chapters;
|
2009-03-29 19:45:06 +00:00
|
|
|
|
2016-02-15 20:03:51 +00:00
|
|
|
struct demuxer *demuxer;
|
2014-12-29 21:51:18 +00:00
|
|
|
struct mp_tags *filtered_tags;
|
2012-08-19 16:01:30 +00:00
|
|
|
|
|
|
|
struct track **tracks;
|
|
|
|
int num_tracks;
|
|
|
|
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
char *track_layout_hash;
|
|
|
|
|
2012-08-19 16:01:30 +00:00
|
|
|
// Selected tracks. NULL if no track selected.
|
2013-12-24 16:46:08 +00:00
|
|
|
// There can be NUM_PTRACKS of the same STREAM_TYPE selected at once.
|
|
|
|
// Currently, this is used for the secondary subtitle track only.
|
|
|
|
struct track *current_track[NUM_PTRACKS][STREAM_TYPE_COUNT];
|
2012-08-19 16:01:30 +00:00
|
|
|
|
2016-02-05 22:19:56 +00:00
|
|
|
struct lavfi *lavfi;
|
|
|
|
|
2013-09-19 12:33:26 +00:00
|
|
|
struct mixer *mixer;
|
2011-04-09 00:03:22 +00:00
|
|
|
struct ao *ao;
|
2014-06-08 21:54:05 +00:00
|
|
|
struct mp_audio *ao_decoder_fmt; // for weak gapless audio check
|
2016-01-21 21:10:15 +00:00
|
|
|
struct ao_chain *ao_chain;
|
2014-03-07 14:24:32 +00:00
|
|
|
|
2016-01-13 23:18:48 +00:00
|
|
|
struct vo_chain *vo_chain;
|
|
|
|
|
2008-04-03 03:25:41 +00:00
|
|
|
struct vo *video_out;
|
video: fix and simplify video format changes and last frame display
The previous commit broke these things, and fixing them is separate in
this commit in order to reduce the volume of changes.
Move the image queue from the VO to the playback core. The image queue
is a remnant of the old way how vdpau was implemented, and increasingly
became more and more an artifact. In the end, it did only one thing:
computing the duration of the current frame. This was done by taking the
PTS difference between the current and the future frame. We keep this,
but by moving it out of the VO, we don't have to special-case format
changes anymore. This simplifies the code a lot.
Since we need the queue to compute the duration only, a queue size
larger than 2 makes no sense, and we can hardcode that.
Also change how the last frame is handled. The last frame is a bit of a
problem, because video timing works by showing one frame after another,
which makes it a special case. Make the VO provide a function to notify
us when the frame is done, instead. The frame duration is used for that.
This is not perfect. For example, changing playback speed during the
last frame doesn't update the end time. Pausing will not stop the clock
that times the last frame. But I don't think this matters for such a
corner case.
2014-08-12 21:17:35 +00:00
|
|
|
// next_frame[0] is the next frame, next_frame[1] the one after that.
|
2016-01-12 22:49:00 +00:00
|
|
|
// The +1 is for adding 1 additional frame in backstep mode.
|
|
|
|
struct mp_image *next_frames[VO_MAX_REQ_FRAMES + 1];
|
2015-07-01 17:22:40 +00:00
|
|
|
int num_next_frames;
|
2016-01-12 22:49:00 +00:00
|
|
|
struct mp_image *saved_frame; // for hrseek_lastframe and hrseek_backstep
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2014-07-28 18:40:43 +00:00
|
|
|
enum playback_status video_status, audio_status;
|
|
|
|
bool restart_complete;
|
2015-08-10 16:40:16 +00:00
|
|
|
// Factors to multiply with opts->playback_speed to get the total audio or
|
|
|
|
// video speed (usually 1.0, but can be set to by the sync code).
|
|
|
|
double speed_factor_v, speed_factor_a;
|
|
|
|
// Redundant values set from opts->playback_speed and speed_factor_*.
|
|
|
|
// update_playback_speed() updates them from the other fields.
|
|
|
|
double audio_speed, video_speed;
|
2015-08-10 16:43:25 +00:00
|
|
|
bool display_sync_active;
|
2015-11-27 13:40:52 +00:00
|
|
|
bool display_sync_broken;
|
2015-08-10 16:43:25 +00:00
|
|
|
int display_sync_drift_dir;
|
|
|
|
// Timing error (in seconds) due to rounding on vsync boundaries
|
|
|
|
double display_sync_error;
|
2015-11-03 19:29:25 +00:00
|
|
|
double audio_drop_throttle;
|
2015-10-30 13:05:41 +00:00
|
|
|
// Number of mistimed frames.
|
|
|
|
int mistimed_frames_total;
|
2014-12-07 01:47:09 +00:00
|
|
|
bool hrseek_active; // skip all data until hrseek_pts
|
|
|
|
bool hrseek_framedrop; // allow decoder to drop frames before hrseek_pts
|
|
|
|
bool hrseek_lastframe; // drop everything until last frame reached
|
2016-01-12 22:49:00 +00:00
|
|
|
bool hrseek_backstep; // go to frame before seek target
|
2010-12-14 23:09:47 +00:00
|
|
|
double hrseek_pts;
|
2007-03-11 06:16:14 +00:00
|
|
|
// AV sync: the next frame should be shown when the audio out has this
|
|
|
|
// much (in seconds) buffered data left. Increased when more data is
|
2014-08-25 19:28:56 +00:00
|
|
|
// written to the ao, decreased when moving to the next video frame.
|
2007-03-11 06:16:14 +00:00
|
|
|
double delay;
|
2014-08-25 19:28:56 +00:00
|
|
|
// AV sync: time in seconds until next frame should be shown
|
2013-05-25 16:31:06 +00:00
|
|
|
double time_frame;
|
2008-12-08 18:04:08 +00:00
|
|
|
// How much video timing has been changed to make it match the audio
|
|
|
|
// timeline. Used for status line information only.
|
|
|
|
double total_avsync_change;
|
2016-01-16 20:19:52 +00:00
|
|
|
// Used to compute the number of frames dropped in a row.
|
|
|
|
int dropped_frames_start;
|
2008-12-08 18:04:08 +00:00
|
|
|
// A-V sync difference when last frame was displayed. Kept to display
|
|
|
|
// the same value if the status line is updated at a time where no new
|
|
|
|
// video frame is shown.
|
|
|
|
double last_av_difference;
|
2010-12-14 20:31:39 +00:00
|
|
|
/* timestamp of video frame currently visible on screen
|
|
|
|
* (or at least queued to be flipped by VO) */
|
|
|
|
double video_pts;
|
2011-07-30 22:05:17 +00:00
|
|
|
double last_seek_pts;
|
core: add --keep-open, which doesn't close the file on EOF
The --keep-open option causes mpv not to close the current file.
Instead, it will pause, and allow the user to seek around. When
seeking beyond the end of the file, mpv does a precise seek back to
the previous last known position that produced video output.
In some corner cases, mpv might not be able to produce video output at
all, despite having created a VO. (Possibly when only 1 frame could be
decoded, but the video filter chain queues frames. Then a VO would be
created, without sending an actual video frame to the VO.) In these
cases, the VO window will not redraw, not even OSD.
Based on a patch by coax [1].
[1] http://devel.mplayer2.org/ticket/210#comment:4
2012-11-12 23:56:20 +00:00
|
|
|
// As video_pts, but is not reset when seeking away. (For the very short
|
|
|
|
// period of time until a new frame is decoded and shown.)
|
|
|
|
double last_vo_pts;
|
2013-04-03 23:18:19 +00:00
|
|
|
// Video PTS, or audio PTS if video has ended.
|
|
|
|
double playback_pts;
|
2015-10-08 21:08:20 +00:00
|
|
|
// audio stats only
|
|
|
|
int64_t audio_stat_start;
|
|
|
|
double written_audio;
|
2007-03-11 06:16:14 +00:00
|
|
|
|
2014-04-27 20:28:07 +00:00
|
|
|
int last_chapter;
|
|
|
|
|
2016-01-12 22:49:00 +00:00
|
|
|
// Past timestamps etc.
|
player: refactor display-sync frame duration calculations
Get rid of get_past_frame_durations(), which was a bit too messy. Add
a past_frames array, which contains the same information in a more
reasonable way. This also means that we can get the exact current and
past frame durations without going through awful stuff. (The main
problem is that vo_pts_history contains future frames as well, which is
needed for frame backstepping etc., but gets in the way here.)
Also disable the automatic disabling of display-sync if the frame
duration changes, and extend the frame durations allowed for display
sync. To allow arbitrarily high durations, vo.c needs to be changed
to pause and potentially redraw OSD while showing a single frame, so
they're still limited.
In an attempt to deal with VFR, calculate the overall speed using the
average FPS. The frame scheduling itself does not use the average FPS,
but the duration of the current frame. This does not work too well,
but provides a good base for further improvements.
Where this commit actually helps a lot is dealing with rounded
timestamps, e.g. if the container framerate is wrong or unknown, or
if the muxer wrote incorrectly rounded timestamps. While the rounding
errors apparently can't be get rid of completely in the general case,
this is still much better than e.g. disabling display-sync completely
just because some frame durations go out of bounds.
2015-11-13 21:45:40 +00:00
|
|
|
// The newest frame is at index 0.
|
|
|
|
struct frame_info *past_frames;
|
|
|
|
int num_past_frames;
|
core: add backstep support
Allows stepping back one frame via the frame_back_step inout command,
bound to "," by default.
This uses the precise seeking facility, and a perfect frame index built
on the fly. The index is built during playback and precise seeking, and
contains (as of this commit) the last 100 displayed or skipped frames.
This index is used to find the PTS of the previous frame, which is then
used as target for a precise seek. If no PTS is found, the core attempts
to do a seek before the current frame, and skip decoded frames until the
current frame is reached; this will create a sufficient index and the
normal backstep algorithm can be applied.
This can be rather slow. The worst case for backstepping is about the
same as the worst case for precise seeking if the previous frame can be
deduced from the index. If not, the worst case will be twice as slow.
There's also some minor danger that the index is incorrect in case
framedropping is involved. For framedropping due to --framedrop, this
problem is ignored (use of --framedrop is discouraged anyway). For
framedropping during precise seeking (done to make it faster), we try
to not add frames to the index that are produced when this can happen.
I'm not sure how well that works (or if the logic is sane), and it's
sure to break with some video filters. In the worst case, backstepping
might silently skip frames if you backstep after a user-initiated
precise seek. (Precise seeks to do indexing are not affected.)
Likewise, video filters that somehow change timing of frames and do not
do this in a deterministic way (i.e. if you seek to a position, frames
with different timings are produced than when the position is reached
during normal playback) will make backstepping silently jump to the
wrong frame. Enabling/disabling filters during playback (like for
example deinterlacing) will have similar bad effects.
2013-04-24 17:31:48 +00:00
|
|
|
|
2014-07-18 13:04:46 +00:00
|
|
|
double next_heartbeat;
|
2014-03-01 20:27:37 +00:00
|
|
|
double last_idle_tick;
|
2014-07-31 02:19:41 +00:00
|
|
|
double next_cache_update;
|
2013-05-16 21:17:46 +00:00
|
|
|
|
2014-07-18 13:04:46 +00:00
|
|
|
double sleeptime; // number of seconds to sleep before next iteration
|
|
|
|
|
2013-05-25 16:31:06 +00:00
|
|
|
double mouse_timer;
|
|
|
|
unsigned int mouse_event_ts;
|
2013-09-08 00:46:19 +00:00
|
|
|
bool mouse_cursor_visible;
|
2013-05-16 21:17:46 +00:00
|
|
|
|
2010-12-14 23:02:14 +00:00
|
|
|
// used to prevent hanging in some error cases
|
2013-05-25 16:31:06 +00:00
|
|
|
double start_timestamp;
|
2007-03-11 06:16:14 +00:00
|
|
|
|
2008-04-28 09:09:31 +00:00
|
|
|
// Timestamp from the last time some timing functions read the
|
video: display last frame, drain frames on video reconfig
Until now, the player didn't care to drain frames on video reconfig.
Instead, the VO was reconfigured (i.e. resized) before the queued frames
finished displaying. This can for example be observed by passing
multiple images with different size as mf:// filename. Then the window
would resize one frame before image with the new size is displayed. With
--vo=vdpau, the effect is worse, because this VO queues more than 1
frame internally.
Fix this by explicitly draining buffered frames before video reconfig.
Raise the display time of the last frame. Otherwise, the last frame
would be shown for a very short time only. This usually doesn't matter,
but helps when playing image files. This is a byproduct of frame
draining, because normally, video timing is based on the frames queued
to the VO, and we can't do that with frames of different size or format.
So we pretend that the frame before the change is the last frame in
order to time it. This code is incorrect though: it tries to use the
framerate, which often doesn't make sense. But it's good enough to test
this code with mf://.
2013-12-10 18:33:11 +00:00
|
|
|
// current time, in microseconds.
|
|
|
|
// Used to turn a new time value to a delta from last time.
|
2013-05-25 16:31:06 +00:00
|
|
|
int64_t last_time;
|
2008-04-28 09:09:31 +00:00
|
|
|
|
2008-04-21 03:17:22 +00:00
|
|
|
// Used to communicate the parameters of a seek between parts
|
2010-12-18 08:13:45 +00:00
|
|
|
struct seek_params {
|
2013-08-19 20:29:55 +00:00
|
|
|
enum seek_type type;
|
2015-03-04 16:21:05 +00:00
|
|
|
enum seek_precision exact;
|
2010-12-18 08:13:45 +00:00
|
|
|
double amount;
|
player: handle seek delays differently
The code removed from handle_input_and_seek_coalesce() did two things:
1. If there's a queued seek, stop accepting non-seek commands, and delay
them to the next playloop iteration.
2. If a seek is executing (i.e. the seek was unqueued, and now it's
trying to decode and display the first video frame), stop accepting
seek commands (and in fact all commands that were queued after the
first seek command). This logic is disabled if seeking started longer
than 300ms ago. (To avoid starvation.)
I'm not sure why 1. would be needed. It's still possible that a command
immediately executed after a seek command sees a "seeking in progress"
state, because it affects queued seeks only, and not seeks in progress.
Drop this code, since it can easily lead to input starvation, and I'm
not aware of any disadvantages.
The logic in 2. is good to make seeking behave much better, as it
guarantees that the video display is updated frequently. Keep the core
idea, but implement it differently. Now this logic is applied to seeks
only. Commands after the seek can execute freely, and like with 1., I
don't see a reason why they couldn't. However, in some cases, seeks are
supposed to be executed instantly, so queue_seek() needs an additional
parameter to signal the need for immediate update.
One nice thing is that commands like sub_seek automatically profit from
the seek delay logic. On the other hand, hitting chapter seek multiple
times still does not update the video on chapter boundaries (as it
should be).
Note that the main goal of this commit is actually simplification of the
input processing logic and to allow all commands to be executed
immediately.
2014-02-07 21:29:50 +00:00
|
|
|
bool immediate; // disable seek delay logic
|
2010-12-18 08:13:45 +00:00
|
|
|
} seek;
|
2008-04-21 03:17:22 +00:00
|
|
|
|
2010-04-25 20:20:34 +00:00
|
|
|
/* Heuristic for relative chapter seeks: keep track which chapter
|
|
|
|
* the user wanted to go to, even if we aren't exactly within the
|
|
|
|
* boundaries of that chapter due to an inaccurate seek. */
|
|
|
|
int last_chapter_seek;
|
|
|
|
double last_chapter_pts;
|
|
|
|
|
2013-04-25 18:38:22 +00:00
|
|
|
bool paused;
|
2008-11-29 06:09:57 +00:00
|
|
|
// step this many frames, then pause
|
|
|
|
int step_frames;
|
2013-03-08 01:08:02 +00:00
|
|
|
// Counted down each frame, stop playback if 0 is reached. (-1 = disable)
|
|
|
|
int max_frames;
|
2013-03-25 22:44:32 +00:00
|
|
|
bool playing_msg_shown;
|
2008-01-26 11:51:34 +00:00
|
|
|
|
2013-04-25 18:38:22 +00:00
|
|
|
bool paused_for_cache;
|
2014-08-27 21:12:24 +00:00
|
|
|
double cache_stop_time, cache_wait_time;
|
2012-12-01 23:22:54 +00:00
|
|
|
|
2008-12-08 18:04:08 +00:00
|
|
|
// Set after showing warning about decoding being too slow for realtime
|
|
|
|
// playback rate. Used to avoid showing it multiple times.
|
|
|
|
bool drop_message_shown;
|
|
|
|
|
2015-05-09 14:21:44 +00:00
|
|
|
char *cached_watch_later_configdir;
|
|
|
|
|
2011-10-06 18:46:01 +00:00
|
|
|
struct screenshot_ctx *screenshot_ctx;
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
struct command_ctx *command_ctx;
|
2012-09-14 15:51:26 +00:00
|
|
|
struct encode_lavc_context *encode_lavc_ctx;
|
2014-10-16 09:48:18 +00:00
|
|
|
|
2014-10-19 14:44:33 +00:00
|
|
|
struct mp_ipc_ctx *ipc_ctx;
|
2014-12-09 16:47:02 +00:00
|
|
|
|
|
|
|
struct mpv_opengl_cb_context *gl_cb_ctx;
|
2007-02-21 00:49:24 +00:00
|
|
|
} MPContext;
|
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// audio.c
|
2014-07-30 21:01:55 +00:00
|
|
|
void reset_audio_state(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
void reinit_audio_chain(struct MPContext *mpctx);
|
2016-02-05 20:50:37 +00:00
|
|
|
int init_audio_decoder(struct MPContext *mpctx, struct track *track);
|
2013-10-30 20:38:30 +00:00
|
|
|
int reinit_audio_filters(struct MPContext *mpctx);
|
|
|
|
double playing_audio_pts(struct MPContext *mpctx);
|
2016-02-27 19:02:51 +00:00
|
|
|
void fill_audio_out_buffers(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
double written_audio_pts(struct MPContext *mpctx);
|
2013-11-08 19:02:09 +00:00
|
|
|
void clear_audio_output_buffers(struct MPContext *mpctx);
|
2015-08-10 16:40:16 +00:00
|
|
|
void update_playback_speed(struct MPContext *mpctx);
|
2014-10-03 17:57:49 +00:00
|
|
|
void uninit_audio_out(struct MPContext *mpctx);
|
|
|
|
void uninit_audio_chain(struct MPContext *mpctx);
|
2016-02-05 22:19:56 +00:00
|
|
|
int init_audio_decoder(struct MPContext *mpctx, struct track *track);
|
|
|
|
void reinit_audio_chain_src(struct MPContext *mpctx, struct lavfi_pad *src);
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// configfiles.c
|
2014-06-26 15:56:47 +00:00
|
|
|
void mp_parse_cfgfiles(struct MPContext *mpctx);
|
2013-12-21 19:45:19 +00:00
|
|
|
void mp_load_auto_profiles(struct MPContext *mpctx);
|
2014-02-25 21:34:32 +00:00
|
|
|
void mp_get_resume_defaults(struct MPContext *mpctx);
|
2013-12-21 19:45:19 +00:00
|
|
|
void mp_load_playback_resume(struct MPContext *mpctx, const char *file);
|
2013-10-30 20:38:30 +00:00
|
|
|
void mp_write_watch_later_conf(struct MPContext *mpctx);
|
2013-12-21 19:45:19 +00:00
|
|
|
struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx,
|
|
|
|
struct playlist *playlist);
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// loadfile.c
|
2008-04-21 03:07:22 +00:00
|
|
|
void uninit_player(struct MPContext *mpctx, unsigned int mask);
|
2015-02-03 08:15:14 +00:00
|
|
|
struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
|
|
|
|
enum stream_type filter);
|
2015-05-26 12:01:23 +00:00
|
|
|
#define FLAG_MARK_SELECTION 1
|
2013-10-30 20:38:30 +00:00
|
|
|
void mp_switch_track(struct MPContext *mpctx, enum stream_type type,
|
2015-05-26 12:01:23 +00:00
|
|
|
struct track *track, int flags);
|
2013-12-24 16:46:08 +00:00
|
|
|
void mp_switch_track_n(struct MPContext *mpctx, int order,
|
2015-05-26 12:01:23 +00:00
|
|
|
enum stream_type type, struct track *track, int flags);
|
2013-12-23 19:14:54 +00:00
|
|
|
void mp_deselect_track(struct MPContext *mpctx, struct track *track);
|
2013-10-30 20:38:30 +00:00
|
|
|
struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type,
|
|
|
|
int tid);
|
|
|
|
void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer);
|
|
|
|
bool mp_remove_track(struct MPContext *mpctx, struct track *track);
|
|
|
|
struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
|
|
|
|
bool force);
|
|
|
|
void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e);
|
|
|
|
void mp_play_files(struct MPContext *mpctx);
|
2014-07-16 20:40:21 +00:00
|
|
|
void update_demuxer_properties(struct MPContext *mpctx);
|
2015-06-03 19:50:37 +00:00
|
|
|
void print_track_list(struct MPContext *mpctx, const char *msg);
|
2016-02-25 21:44:50 +00:00
|
|
|
void reselect_demux_stream(struct MPContext *mpctx, struct track *track);
|
2014-12-29 21:08:22 +00:00
|
|
|
void prepare_playlist(struct MPContext *mpctx, struct playlist *pl);
|
2015-02-16 21:06:41 +00:00
|
|
|
void autoload_external_files(struct MPContext *mpctx);
|
2015-05-22 19:00:24 +00:00
|
|
|
struct track *select_default_track(struct MPContext *mpctx, int order,
|
|
|
|
enum stream_type type);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// main.c
|
2015-03-05 10:17:22 +00:00
|
|
|
int mp_initialize(struct MPContext *mpctx, char **argv);
|
2014-02-10 20:01:35 +00:00
|
|
|
struct MPContext *mp_create(void);
|
|
|
|
void mp_destroy(struct MPContext *mpctx);
|
2013-12-21 18:45:42 +00:00
|
|
|
void mp_print_version(struct mp_log *log, int always);
|
2015-01-03 02:01:58 +00:00
|
|
|
void wakeup_playloop(void *ctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// misc.c
|
2014-03-25 01:32:24 +00:00
|
|
|
double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t);
|
2013-10-30 20:38:30 +00:00
|
|
|
double get_play_end_pts(struct MPContext *mpctx);
|
2013-11-19 21:36:33 +00:00
|
|
|
void merge_playlist_files(struct playlist *pl);
|
2014-07-01 22:14:30 +00:00
|
|
|
float mp_get_cache_percent(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
bool mp_get_cache_idle(struct MPContext *mpctx);
|
2015-11-15 22:03:48 +00:00
|
|
|
void update_vo_playback_state(struct MPContext *mpctx);
|
2013-11-09 23:49:13 +00:00
|
|
|
void update_window_title(struct MPContext *mpctx, bool force);
|
2014-10-23 16:31:43 +00:00
|
|
|
void error_on_track(struct MPContext *mpctx, struct track *track);
|
2015-07-02 12:02:32 +00:00
|
|
|
int stream_dump(struct MPContext *mpctx, const char *source_filename);
|
2015-02-20 19:06:43 +00:00
|
|
|
int mpctx_run_reentrant(struct MPContext *mpctx, void (*thread_fn)(void *arg),
|
|
|
|
void *thread_arg);
|
2014-10-06 19:20:38 +00:00
|
|
|
struct mpv_global *create_sub_global(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// osd.c
|
2014-09-21 21:40:45 +00:00
|
|
|
void set_osd_bar(struct MPContext *mpctx, int type,
|
2014-06-08 21:52:58 +00:00
|
|
|
double min, double max, double neutral, double val);
|
2014-09-25 19:14:00 +00:00
|
|
|
bool set_osd_msg(struct MPContext *mpctx, int level, int time,
|
2014-01-17 21:34:47 +00:00
|
|
|
const char* fmt, ...) PRINTF_ATTRIBUTE(4,5);
|
2013-10-30 20:47:14 +00:00
|
|
|
void set_osd_function(struct MPContext *mpctx, int osd_function);
|
2015-11-17 00:54:02 +00:00
|
|
|
void term_osd_set_subs(struct MPContext *mpctx, const char *text);
|
2014-09-17 22:12:59 +00:00
|
|
|
void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size);
|
2014-11-18 19:28:54 +00:00
|
|
|
void set_osd_bar_chapters(struct MPContext *mpctx, int type);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// playloop.c
|
2014-09-06 14:57:46 +00:00
|
|
|
void mp_wait_events(struct MPContext *mpctx, double sleeptime);
|
|
|
|
void mp_process_input(struct MPContext *mpctx);
|
Relicense some non-MPlayer source files to LGPL 2.1 or later
This covers source files which were added in mplayer2 and mpv times
only, and where all code is covered by LGPL relicensing agreements.
There are probably more files to which this applies, but I'm being
conservative here.
A file named ao_sdl.c exists in MPlayer too, but the mpv one is a
complete rewrite, and was added some time after the original ao_sdl.c
was removed. The same applies to vo_sdl.c, for which the SDL2 API is
radically different in addition (MPlayer supports SDL 1.2 only).
common.c contains only code written by me. But common.h is a strange
case: although it originally was named mp_common.h and exists in MPlayer
too, by now it contains only definitions written by uau and me. The
exceptions are the CONTROL_ defines - thus not changing the license of
common.h yet.
codec_tags.c contained once large tables generated from MPlayer's
codecs.conf, but all of these tables were removed.
From demux_playlist.c I'm removing a code fragment from someone who was
not asked; this probably could be done later (see commit 15dccc37).
misc.c is a bit complicated to reason about (it was split off mplayer.c
and thus contains random functions out of this file), but actually all
functions have been added post-MPlayer. Except get_relative_time(),
which was written by uau, but looks similar to 3 different versions of
something similar in each of the Unix/win32/OSX timer source files. I'm
not sure what that means in regards to copyright, so I've just moved it
into another still-GPL source file for now.
screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but
they're all gone.
2016-01-19 17:36:06 +00:00
|
|
|
double get_relative_time(struct MPContext *mpctx);
|
2014-07-30 21:01:55 +00:00
|
|
|
void reset_playback_state(struct MPContext *mpctx);
|
2014-04-14 20:33:41 +00:00
|
|
|
void pause_player(struct MPContext *mpctx);
|
|
|
|
void unpause_player(struct MPContext *mpctx);
|
core: add backstep support
Allows stepping back one frame via the frame_back_step inout command,
bound to "," by default.
This uses the precise seeking facility, and a perfect frame index built
on the fly. The index is built during playback and precise seeking, and
contains (as of this commit) the last 100 displayed or skipped frames.
This index is used to find the PTS of the previous frame, which is then
used as target for a precise seek. If no PTS is found, the core attempts
to do a seek before the current frame, and skip decoded frames until the
current frame is reached; this will create a sufficient index and the
normal backstep algorithm can be applied.
This can be rather slow. The worst case for backstepping is about the
same as the worst case for precise seeking if the previous frame can be
deduced from the index. If not, the worst case will be twice as slow.
There's also some minor danger that the index is incorrect in case
framedropping is involved. For framedropping due to --framedrop, this
problem is ignored (use of --framedrop is discouraged anyway). For
framedropping during precise seeking (done to make it faster), we try
to not add frames to the index that are produced when this can happen.
I'm not sure how well that works (or if the logic is sane), and it's
sure to break with some video filters. In the worst case, backstepping
might silently skip frames if you backstep after a user-initiated
precise seek. (Precise seeks to do indexing are not affected.)
Likewise, video filters that somehow change timing of frames and do not
do this in a deterministic way (i.e. if you seek to a position, frames
with different timings are produced than when the position is reached
during normal playback) will make backstepping silently jump to the
wrong frame. Enabling/disabling filters during playback (like for
example deinterlacing) will have similar bad effects.
2013-04-24 17:31:48 +00:00
|
|
|
void add_step_frame(struct MPContext *mpctx, int dir);
|
2010-12-18 08:13:45 +00:00
|
|
|
void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount,
|
2015-03-04 16:21:05 +00:00
|
|
|
enum seek_precision exact, bool immediate);
|
2010-11-07 22:54:32 +00:00
|
|
|
double get_time_length(struct MPContext *mpctx);
|
|
|
|
double get_current_time(struct MPContext *mpctx);
|
2014-06-29 17:27:46 +00:00
|
|
|
double get_playback_time(struct MPContext *mpctx);
|
2010-11-07 22:54:32 +00:00
|
|
|
int get_percent_pos(struct MPContext *mpctx);
|
2013-06-20 10:15:36 +00:00
|
|
|
double get_current_pos_ratio(struct MPContext *mpctx, bool use_range);
|
2009-04-02 02:00:22 +00:00
|
|
|
int get_current_chapter(struct MPContext *mpctx);
|
|
|
|
char *chapter_display_name(struct MPContext *mpctx, int chapter);
|
2011-10-23 02:51:44 +00:00
|
|
|
char *chapter_name(struct MPContext *mpctx, int chapter);
|
|
|
|
double chapter_start_time(struct MPContext *mpctx, int chapter);
|
|
|
|
int get_chapter_count(struct MPContext *mpctx);
|
2014-10-07 20:07:07 +00:00
|
|
|
double get_cache_buffering_percentage(struct MPContext *mpctx);
|
2013-10-29 21:38:29 +00:00
|
|
|
void execute_queued_seek(struct MPContext *mpctx);
|
|
|
|
void run_playloop(struct MPContext *mpctx);
|
2014-10-06 19:20:38 +00:00
|
|
|
void mp_idle(struct MPContext *mpctx);
|
2013-10-29 21:38:29 +00:00
|
|
|
void idle_loop(struct MPContext *mpctx);
|
2015-09-21 19:22:20 +00:00
|
|
|
int handle_force_window(struct MPContext *mpctx, bool force);
|
2014-12-08 16:27:07 +00:00
|
|
|
void seek_to_last_frame(struct MPContext *mpctx);
|
2011-02-14 07:34:39 +00:00
|
|
|
|
2014-05-12 23:14:07 +00:00
|
|
|
// scripting.c
|
|
|
|
struct mp_scripting {
|
|
|
|
const char *file_ext; // e.g. "lua"
|
|
|
|
int (*load)(struct mpv_handle *client, const char *filename);
|
|
|
|
};
|
|
|
|
void mp_load_scripts(struct MPContext *mpctx);
|
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// sub.c
|
2014-07-30 21:01:55 +00:00
|
|
|
void reset_subtitle_state(struct MPContext *mpctx);
|
2016-01-17 15:56:32 +00:00
|
|
|
void reinit_sub(struct MPContext *mpctx, struct track *track);
|
|
|
|
void reinit_sub_all(struct MPContext *mpctx);
|
|
|
|
void uninit_sub(struct MPContext *mpctx, struct track *track);
|
2014-10-03 17:57:49 +00:00
|
|
|
void uninit_sub_all(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
void update_osd_msg(struct MPContext *mpctx);
|
2015-12-29 00:35:52 +00:00
|
|
|
bool update_subtitles(struct MPContext *mpctx, double video_pts);
|
2013-06-07 20:57:00 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// video.c
|
2016-01-13 23:18:48 +00:00
|
|
|
int video_get_colors(struct vo_chain *vo_c, const char *item, int *value);
|
|
|
|
int video_set_colors(struct vo_chain *vo_c, const char *item, int value);
|
|
|
|
int video_vf_vo_control(struct vo_chain *vo_c, int vf_cmd, void *data);
|
2014-07-30 21:01:55 +00:00
|
|
|
void reset_video_state(struct MPContext *mpctx);
|
2016-02-05 20:50:37 +00:00
|
|
|
int init_video_decoder(struct MPContext *mpctx, struct track *track);
|
2013-10-30 20:38:30 +00:00
|
|
|
int reinit_video_chain(struct MPContext *mpctx);
|
2016-02-05 22:19:56 +00:00
|
|
|
int reinit_video_chain_src(struct MPContext *mpctx, struct lavfi_pad *src);
|
2013-10-30 20:38:30 +00:00
|
|
|
int reinit_video_filters(struct MPContext *mpctx);
|
2016-02-27 19:02:51 +00:00
|
|
|
void write_video(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
void mp_force_video_refresh(struct MPContext *mpctx);
|
2014-10-03 17:57:49 +00:00
|
|
|
void uninit_video_out(struct MPContext *mpctx);
|
|
|
|
void uninit_video_chain(struct MPContext *mpctx);
|
player: refactor display-sync frame duration calculations
Get rid of get_past_frame_durations(), which was a bit too messy. Add
a past_frames array, which contains the same information in a more
reasonable way. This also means that we can get the exact current and
past frame durations without going through awful stuff. (The main
problem is that vo_pts_history contains future frames as well, which is
needed for frame backstepping etc., but gets in the way here.)
Also disable the automatic disabling of display-sync if the frame
duration changes, and extend the frame durations allowed for display
sync. To allow arbitrarily high durations, vo.c needs to be changed
to pause and potentially redraw OSD while showing a single frame, so
they're still limited.
In an attempt to deal with VFR, calculate the overall speed using the
average FPS. The frame scheduling itself does not use the average FPS,
but the duration of the current frame. This does not work too well,
but provides a good base for further improvements.
Where this commit actually helps a lot is dealing with rounded
timestamps, e.g. if the container framerate is wrong or unknown, or
if the muxer wrote incorrectly rounded timestamps. While the rounding
errors apparently can't be get rid of completely in the general case,
this is still much better than e.g. disabling display-sync completely
just because some frame durations go out of bounds.
2015-11-13 21:45:40 +00:00
|
|
|
double calc_average_frame_duration(struct MPContext *mpctx);
|
2016-02-05 22:19:56 +00:00
|
|
|
int init_video_decoder(struct MPContext *mpctx, struct track *track);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_MP_CORE_H */
|