2010-01-30 23:24:23 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
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>
|
|
|
|
|
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"
|
2008-01-30 07:21:05 +00:00
|
|
|
|
2007-02-21 00:49:24 +00:00
|
|
|
// definitions used internally by the core player code
|
|
|
|
|
2008-02-14 14:23:55 +00:00
|
|
|
#define INITIALIZED_VO 1
|
|
|
|
#define INITIALIZED_AO 2
|
2013-09-07 18:03:13 +00:00
|
|
|
#define INITIALIZED_PLAYBACK 16
|
2013-10-28 22:16:00 +00:00
|
|
|
#define INITIALIZED_LIBASS 32
|
2008-02-14 14:23:55 +00:00
|
|
|
#define INITIALIZED_STREAM 64
|
|
|
|
#define INITIALIZED_DEMUXER 512
|
|
|
|
#define INITIALIZED_ACODEC 1024
|
|
|
|
#define INITIALIZED_VCODEC 2048
|
2011-01-16 18:03:08 +00:00
|
|
|
#define INITIALIZED_SUB 4096
|
2013-12-24 16:46:14 +00:00
|
|
|
#define INITIALIZED_SUB2 8192
|
2008-02-14 14:23:55 +00:00
|
|
|
#define INITIALIZED_ALL 0xFFFF
|
2007-02-21 00:49:24 +00:00
|
|
|
|
|
|
|
|
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
|
2012-08-25 23:19:42 +00:00
|
|
|
PT_RESTART, // restart previous file
|
Add prelimimary (basic, possibly broken) dvdnav support
This readds a more or less completely new dvdnav implementation, though
it's based on the code from before commit 41fbcee. Note that this is
rather basic, and might be broken or not quite usable in many cases.
Most importantly, navigation highlights are not correctly implemented.
This would require changes in the FFmpeg dvdsub decoder (to apply a
different internal CLUT), so supporting it is not really possible right
now. And in fact, I don't think I ever want to support it, because it's
a very small gain for a lot of work. Instead, mpv will display fake
highlights, which are an approximate bounding box around the real
highlights.
Some things like mouse input or switching audio/subtitles stream using
the dvdnav VM are not supported.
Might be quite fragile on transitions: if dvdnav initiates a transition,
and doesn't give us enough mpeg data to initialize video playback, the
player will just quit.
This is added only because some users seem to want it. I don't intend to
make mpv a good DVD player, so the very basic minimum will have to do.
How about you just convert your DVD to proper video files?
2013-12-12 00:44:28 +00:00
|
|
|
PT_RELOAD_DEMUXER, // restart playback, but keep stream open
|
2012-08-04 01:46:11 +00:00
|
|
|
PT_QUIT, // stop playback, quit player
|
2008-08-13 05:06:26 +00:00
|
|
|
};
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2010-02-14 11:02:05 +00:00
|
|
|
enum exit_reason {
|
2008-12-02 19:53:41 +00:00
|
|
|
EXIT_NONE,
|
|
|
|
EXIT_QUIT,
|
2013-08-02 08:32:38 +00:00
|
|
|
EXIT_PLAYED,
|
|
|
|
EXIT_ERROR,
|
|
|
|
EXIT_NOTPLAYED,
|
|
|
|
EXIT_SOMENOTPLAYED
|
2010-02-14 11:02:05 +00:00
|
|
|
};
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2009-03-29 19:45:06 +00:00
|
|
|
struct timeline_part {
|
|
|
|
double start;
|
|
|
|
double source_start;
|
2012-08-19 15:58:58 +00:00
|
|
|
struct demuxer *source;
|
2009-03-29 19:45:06 +00:00
|
|
|
};
|
|
|
|
|
2009-04-02 02:00:22 +00:00
|
|
|
struct chapter {
|
|
|
|
double start;
|
|
|
|
char *name;
|
|
|
|
};
|
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2013-10-30 20:47:14 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
// other constants
|
|
|
|
MAX_OSD_LEVEL = 3,
|
|
|
|
MAX_TERM_OSD_LEVEL = 1,
|
|
|
|
OSD_LEVEL_INVISIBLE = 4,
|
|
|
|
OSD_BAR_SEEK = 256,
|
|
|
|
};
|
|
|
|
|
2013-08-19 20:29:55 +00:00
|
|
|
enum seek_type {
|
|
|
|
MPSEEK_NONE = 0,
|
|
|
|
MPSEEK_RELATIVE,
|
|
|
|
MPSEEK_ABSOLUTE,
|
|
|
|
MPSEEK_FACTOR,
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
// Same as stream->demuxer_id. -1 if not set.
|
|
|
|
int demuxer_id;
|
|
|
|
|
|
|
|
char *title;
|
|
|
|
bool default_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
|
|
|
|
|
|
|
// If the track's stream changes with the timeline (ordered chapters).
|
|
|
|
bool under_timeline;
|
|
|
|
|
|
|
|
// Value can change if under_timeline==true.
|
|
|
|
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;
|
|
|
|
|
2013-06-01 17:43:11 +00:00
|
|
|
// For external subtitles, which are read fully on init. Do not attempt
|
|
|
|
// to read packets from them.
|
|
|
|
bool preloaded;
|
2012-08-19 16:01:30 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
enum {
|
|
|
|
MAX_NUM_VO_PTS = 100,
|
|
|
|
};
|
|
|
|
|
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-02-11 19:09:44 +00:00
|
|
|
bool is_cplayer;
|
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;
|
|
|
|
|
|
|
|
struct mp_log *statusline;
|
2008-06-23 22:53:58 +00:00
|
|
|
struct osd_state *osd;
|
2012-08-04 01:50:23 +00:00
|
|
|
struct mp_osd_msg *osd_msg_stack;
|
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;
|
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;
|
|
|
|
double osd_last_update;
|
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;
|
2008-04-26 12:17:51 +00:00
|
|
|
char *filename; // currently playing file
|
2012-10-13 15:09:35 +00:00
|
|
|
struct mp_resolve_result *resolve_result;
|
2008-08-13 05:06:26 +00:00
|
|
|
enum stop_play_reason stop_play;
|
2008-04-26 12:31:39 +00:00
|
|
|
unsigned int initialized_flags; // which subsystems have been initialized
|
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
|
|
|
enum exit_reason quit_player_rc;
|
|
|
|
int quit_custom_rc;
|
|
|
|
bool has_quit_custom_rc;
|
|
|
|
bool error_playing;
|
2014-02-25 21:34:32 +00:00
|
|
|
char **resume_defaults;
|
2012-08-04 01:46:11 +00:00
|
|
|
|
2013-09-29 19:10:36 +00:00
|
|
|
int64_t shown_vframes, shown_aframes;
|
|
|
|
|
2012-08-19 15:58:58 +00:00
|
|
|
struct demuxer **sources;
|
2009-03-29 19:45:06 +00:00
|
|
|
int num_sources;
|
2012-08-19 16:01:30 +00:00
|
|
|
|
2009-03-29 19:45:06 +00:00
|
|
|
struct timeline_part *timeline;
|
|
|
|
int num_timeline_parts;
|
|
|
|
int timeline_part;
|
2009-07-06 23:26:13 +00:00
|
|
|
struct chapter *chapters;
|
2009-04-02 02:00:22 +00:00
|
|
|
int num_chapters;
|
2009-03-29 19:45:06 +00:00
|
|
|
double video_offset;
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
struct stream *stream;
|
|
|
|
struct demuxer *demuxer;
|
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
|
|
|
|
2013-11-23 20:36:20 +00:00
|
|
|
struct dec_video *d_video;
|
2013-11-23 20:22:17 +00:00
|
|
|
struct dec_audio *d_audio;
|
2013-12-24 16:46:14 +00:00
|
|
|
struct dec_sub *d_sub[2];
|
2013-11-23 20:22:17 +00:00
|
|
|
|
2012-08-19 16:07:06 +00:00
|
|
|
// Uses: accessing metadata (consider ordered chapters case, where the main
|
|
|
|
// demuxer defines metadata), or special purpose demuxers like TV.
|
|
|
|
struct demuxer *master_demuxer;
|
|
|
|
|
2013-09-19 12:33:26 +00:00
|
|
|
struct mixer *mixer;
|
2011-04-09 00:03:22 +00:00
|
|
|
struct ao *ao;
|
2014-03-07 14:24:32 +00:00
|
|
|
double ao_pts;
|
|
|
|
struct mp_audio_buffer *ao_buffer; // queued audio; passed to ao_play() later
|
|
|
|
|
2008-04-03 03:25:41 +00:00
|
|
|
struct vo *video_out;
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2010-11-11 10:29:14 +00:00
|
|
|
/* We're starting playback from scratch or after a seek. Show first
|
|
|
|
* video frame immediately and reinitialize sync. */
|
|
|
|
bool restart_playback;
|
core: completely change handling of attached picture pseudo video
Before this commit, we tried to play along with libavformat and tried
to pretend that attached pictures are video streams with a single
frame, and that the frame magically appeared at the seek position when
seeking. The playback core would then switch to a mode where the video
has ended, and the "remaining" audio is played.
This didn't work very well:
- we needed a hack in demux.c, because we tried to read more packets in
order to find the "next" video frame (libavformat doesn't tell us if
a stream has ended)
- switching the video stream didn't work, because we can't tell
libavformat to send the packet again
- seeking and resuming after was hacky (for some reason libavformat sets
the returned packet's PTS to that of the previously returned audio
packet in generic code not related to attached pictures, and this
happened to work)
- if the user did something stupid and e.g. inserted a deinterlacer by
default, a picture was never displayed, only an inactive VO window)
- same when using a command that reconfigured the VO (like switching
aspect or video filters)
- hr-seek didn't work
For this reason, handle attached pictures as separate case with a
separate video decoding function, which doesn't read packets. Also,
do not synchronize audio to video start in this case.
2013-07-11 17:23:56 +00:00
|
|
|
/* Set if audio should be timed to start with video frame after seeking,
|
|
|
|
* not set when e.g. playing cover art */
|
|
|
|
bool sync_audio_to_video;
|
2010-11-13 17:27:01 +00:00
|
|
|
/* After playback restart (above) or audio stream change, adjust audio
|
|
|
|
* stream by cutting samples or adding silence at the beginning to make
|
|
|
|
* audio playback position match video position. */
|
|
|
|
bool syncing_audio;
|
2010-12-14 23:09:47 +00:00
|
|
|
bool hrseek_active;
|
|
|
|
bool hrseek_framedrop;
|
|
|
|
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
|
|
|
|
// written to the ao, decreased when moving to the next frame.
|
|
|
|
// In the audio-only case used as a timer since the last seek
|
|
|
|
// by the audio CPU usage meter.
|
|
|
|
double delay;
|
2008-11-29 06:09:57 +00:00
|
|
|
// AV sync: time 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 long the last vo flip() call took. Used to adjust timing with
|
|
|
|
// the goal of making flip() calls finish (rather than start) at the
|
|
|
|
// specified time.
|
2013-05-25 16:31:06 +00:00
|
|
|
double last_vo_flip_duration;
|
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
|
|
|
// Display duration (as "intended") of the last flipped frame.
|
|
|
|
double last_frame_duration;
|
|
|
|
// Set to true some time after a new frame has been shown, and it turns out
|
|
|
|
// that this frame was the last one before video ends.
|
|
|
|
bool playing_last_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;
|
2013-03-08 01:08:02 +00:00
|
|
|
// Total number of dropped frames that were "approved" to be dropped.
|
|
|
|
// Actual dropping depends on --framedrop and decoder internals.
|
|
|
|
int drop_frame_cnt;
|
|
|
|
// Number of frames dropped in a row.
|
|
|
|
int dropped_frames;
|
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;
|
2013-11-27 19:57:08 +00:00
|
|
|
/* Timestamp of the latest image that was queued on the VO, but not yet
|
|
|
|
* to be flipped. */
|
|
|
|
double video_next_pts;
|
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;
|
2007-03-11 06:16:14 +00:00
|
|
|
|
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
|
|
|
// History of video frames timestamps that were queued in the VO
|
|
|
|
// This includes even skipped frames during hr-seek
|
|
|
|
double vo_pts_history_pts[MAX_NUM_VO_PTS];
|
|
|
|
// Whether the PTS at vo_pts_history[n] is after a seek reset
|
|
|
|
uint64_t vo_pts_history_seek[MAX_NUM_VO_PTS];
|
|
|
|
uint64_t vo_pts_history_seek_ts;
|
|
|
|
uint64_t backstep_start_seek_ts;
|
|
|
|
bool backstep_active;
|
|
|
|
|
2013-05-25 16:31:06 +00:00
|
|
|
double audio_delay;
|
2013-03-08 01:08:02 +00:00
|
|
|
|
2013-05-25 16:31:06 +00:00
|
|
|
double last_heartbeat;
|
2013-07-02 10:18:04 +00:00
|
|
|
double last_metadata_update;
|
2014-03-01 20:27:37 +00:00
|
|
|
double last_idle_tick;
|
2013-05-16 21:17:46 +00:00
|
|
|
|
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;
|
2010-12-18 08:13:45 +00:00
|
|
|
double amount;
|
|
|
|
int exact; // -1 = disable, 0 = default, 1 = enable
|
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
|
|
|
// currently not set by commands, only used internally by seek()
|
|
|
|
int direction; // -1 = backward, 0 = default, 1 = forward
|
|
|
|
} 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-12-15 12:43:26 +00:00
|
|
|
/* Subtitle renderer. This is separate, because we want to keep fonts
|
|
|
|
* loaded across ordered chapters, instead of reloading and rescanning
|
|
|
|
* them on each transition. (Both of these objects contain this state.)
|
|
|
|
*/
|
|
|
|
struct ass_renderer *ass_renderer;
|
2011-07-22 22:55:13 +00:00
|
|
|
struct ass_library *ass_library;
|
2013-12-21 18:06:37 +00:00
|
|
|
struct mp_log *ass_log;
|
2007-02-21 00:49:24 +00:00
|
|
|
|
|
|
|
int last_dvb_step;
|
|
|
|
|
2013-04-25 18:38:22 +00:00
|
|
|
bool paused;
|
2014-04-14 20:19:07 +00:00
|
|
|
bool eof_reached;
|
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;
|
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;
|
|
|
|
|
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;
|
Add prelimimary (basic, possibly broken) dvdnav support
This readds a more or less completely new dvdnav implementation, though
it's based on the code from before commit 41fbcee. Note that this is
rather basic, and might be broken or not quite usable in many cases.
Most importantly, navigation highlights are not correctly implemented.
This would require changes in the FFmpeg dvdsub decoder (to apply a
different internal CLUT), so supporting it is not really possible right
now. And in fact, I don't think I ever want to support it, because it's
a very small gain for a lot of work. Instead, mpv will display fake
highlights, which are an approximate bounding box around the real
highlights.
Some things like mouse input or switching audio/subtitles stream using
the dvdnav VM are not supported.
Might be quite fragile on transitions: if dvdnav initiates a transition,
and doesn't give us enough mpeg data to initialize video playback, the
player will just quit.
This is added only because some users seem to want it. I don't intend to
make mpv a good DVD player, so the very basic minimum will have to do.
How about you just convert your DVD to proper video files?
2013-12-12 00:44:28 +00:00
|
|
|
struct mp_nav_state *nav_state;
|
2007-02-21 00:49:24 +00:00
|
|
|
} MPContext;
|
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// audio.c
|
|
|
|
void reinit_audio_chain(struct MPContext *mpctx);
|
|
|
|
int reinit_audio_filters(struct MPContext *mpctx);
|
|
|
|
double playing_audio_pts(struct MPContext *mpctx);
|
|
|
|
int fill_audio_out_buffers(struct MPContext *mpctx, double endpts);
|
|
|
|
double written_audio_pts(struct MPContext *mpctx);
|
2013-11-08 19:02:09 +00:00
|
|
|
void clear_audio_output_buffers(struct MPContext *mpctx);
|
|
|
|
void clear_audio_decode_buffers(struct MPContext *mpctx);
|
2007-02-21 00:49:24 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// configfiles.c
|
|
|
|
bool 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
|
|
|
|
2014-03-30 02:42:49 +00:00
|
|
|
// discnav.c
|
Add prelimimary (basic, possibly broken) dvdnav support
This readds a more or less completely new dvdnav implementation, though
it's based on the code from before commit 41fbcee. Note that this is
rather basic, and might be broken or not quite usable in many cases.
Most importantly, navigation highlights are not correctly implemented.
This would require changes in the FFmpeg dvdsub decoder (to apply a
different internal CLUT), so supporting it is not really possible right
now. And in fact, I don't think I ever want to support it, because it's
a very small gain for a lot of work. Instead, mpv will display fake
highlights, which are an approximate bounding box around the real
highlights.
Some things like mouse input or switching audio/subtitles stream using
the dvdnav VM are not supported.
Might be quite fragile on transitions: if dvdnav initiates a transition,
and doesn't give us enough mpeg data to initialize video playback, the
player will just quit.
This is added only because some users seem to want it. I don't intend to
make mpv a good DVD player, so the very basic minimum will have to do.
How about you just convert your DVD to proper video files?
2013-12-12 00:44:28 +00:00
|
|
|
void mp_nav_init(struct MPContext *mpctx);
|
|
|
|
void mp_nav_reset(struct MPContext *mpctx);
|
|
|
|
void mp_nav_destroy(struct MPContext *mpctx);
|
|
|
|
void mp_nav_user_input(struct MPContext *mpctx, char *command);
|
|
|
|
void mp_handle_nav(struct MPContext *mpctx);
|
|
|
|
|
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);
|
2013-09-07 18:19:57 +00:00
|
|
|
struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename);
|
2013-10-30 20:38:30 +00:00
|
|
|
void mp_switch_track(struct MPContext *mpctx, enum stream_type type,
|
|
|
|
struct track *track);
|
2013-12-24 16:46:08 +00:00
|
|
|
void mp_switch_track_n(struct MPContext *mpctx, int order,
|
|
|
|
enum stream_type type, struct track *track);
|
2013-12-23 19:14:54 +00:00
|
|
|
void mp_deselect_track(struct MPContext *mpctx, struct track *track);
|
2014-03-03 22:53:12 +00:00
|
|
|
void mp_mark_user_track_selection(struct MPContext *mpctx, int order,
|
|
|
|
enum stream_type type);
|
2013-10-30 20:38:30 +00:00
|
|
|
struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type,
|
|
|
|
int tid);
|
|
|
|
bool timeline_set_part(struct MPContext *mpctx, int i, bool force);
|
|
|
|
double timeline_set_from_time(struct MPContext *mpctx, double pts, bool *need_reset);
|
2013-12-23 19:14:54 +00:00
|
|
|
struct sh_stream *init_demux_stream(struct MPContext *mpctx, struct track *track);
|
|
|
|
void reselect_demux_streams(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
// main.c
|
2014-02-10 20:25:22 +00:00
|
|
|
int mpv_main(int argc, char *argv[]);
|
2014-02-10 20:01:35 +00:00
|
|
|
int mp_initialize(struct MPContext *mpctx);
|
|
|
|
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);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// misc.c
|
|
|
|
double get_start_time(struct MPContext *mpctx);
|
|
|
|
double get_main_demux_pts(struct MPContext *mpctx);
|
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);
|
|
|
|
double get_relative_time(struct MPContext *mpctx);
|
2013-11-19 21:36:33 +00:00
|
|
|
void merge_playlist_files(struct playlist *pl);
|
2013-10-30 20:38:30 +00:00
|
|
|
int mp_get_cache_percent(struct MPContext *mpctx);
|
|
|
|
bool mp_get_cache_idle(struct MPContext *mpctx);
|
2013-11-09 23:49:13 +00:00
|
|
|
void update_window_title(struct MPContext *mpctx, bool force);
|
2013-10-30 20:38:30 +00:00
|
|
|
void stream_dump(struct MPContext *mpctx);
|
|
|
|
|
|
|
|
// osd.c
|
|
|
|
void print_status(struct MPContext *mpctx);
|
2013-10-30 20:47:14 +00:00
|
|
|
void set_osd_bar(struct MPContext *mpctx, int type, const char* name,
|
|
|
|
double min, double max, double val);
|
2014-01-17 21:34:47 +00:00
|
|
|
void set_osd_msg(struct MPContext *mpctx, int level, int time,
|
|
|
|
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);
|
|
|
|
void set_osd_subtitle(struct MPContext *mpctx, const char *text);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
|
|
|
// playloop.c
|
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,
|
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
|
|
|
int exact, bool immediate);
|
2013-05-03 22:36:53 +00:00
|
|
|
bool mp_seek_chapter(struct MPContext *mpctx, int chapter);
|
2010-11-07 22:54:32 +00:00
|
|
|
double get_time_length(struct MPContext *mpctx);
|
|
|
|
double get_current_time(struct MPContext *mpctx);
|
|
|
|
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);
|
2013-10-29 21:38:29 +00:00
|
|
|
void execute_queued_seek(struct MPContext *mpctx);
|
|
|
|
void run_playloop(struct MPContext *mpctx);
|
|
|
|
void idle_loop(struct MPContext *mpctx);
|
|
|
|
void handle_force_window(struct MPContext *mpctx, bool reconfig);
|
|
|
|
void add_frame_pts(struct MPContext *mpctx, double pts);
|
2011-02-14 07:34:39 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// sub.c
|
2013-12-24 16:46:14 +00:00
|
|
|
void reset_subtitles(struct MPContext *mpctx, int order);
|
2013-10-30 20:38:30 +00:00
|
|
|
void uninit_subs(struct demuxer *demuxer);
|
2013-12-24 16:46:14 +00:00
|
|
|
void reinit_subs(struct MPContext *mpctx, int order);
|
2013-10-30 20:38:30 +00:00
|
|
|
void update_osd_msg(struct MPContext *mpctx);
|
|
|
|
void update_subtitles(struct MPContext *mpctx);
|
2013-06-07 20:57:00 +00:00
|
|
|
|
2011-02-14 07:34:39 +00:00
|
|
|
// timeline/tl_matroska.c
|
|
|
|
void build_ordered_chapter_timeline(struct MPContext *mpctx);
|
2013-11-19 21:23:41 +00:00
|
|
|
// timeline/tl_mpv_edl.c
|
|
|
|
void build_mpv_edl_timeline(struct MPContext *mpctx);
|
2012-01-01 16:45:24 +00:00
|
|
|
// timeline/tl_cue.c
|
|
|
|
void build_cue_timeline(struct MPContext *mpctx);
|
2011-02-14 07:34:39 +00:00
|
|
|
|
2013-10-30 20:38:30 +00:00
|
|
|
// video.c
|
|
|
|
int reinit_video_chain(struct MPContext *mpctx);
|
|
|
|
int reinit_video_filters(struct MPContext *mpctx);
|
|
|
|
double update_video(struct MPContext *mpctx, double endpts);
|
|
|
|
void mp_force_video_refresh(struct MPContext *mpctx);
|
|
|
|
void update_fps(struct MPContext *mpctx);
|
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
|
|
|
void video_execute_format_change(struct MPContext *mpctx);
|
2013-10-30 20:38:30 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_MP_CORE_H */
|