Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,13 @@ Playback Control
local files, such as special protocols like ``avdevice://`` (which are
inherently unsafe).

``--playlist-inherit-options=<yes|no|current>``
``--playlist-inherit-options=<yes|no|current|auto>``
Whether the per-file options of a playlist file are inherited by its items
when the playlist file is resolved and expanded (default: no). The value
when the playlist file is resolved and expanded (default: auto). The value
``current`` means that for playlists created by ``--autocreate-playlist``,
only the file from which the playlist is created inherits the options.
The value ``auto`` behaves like ``current`` for playlists created by
``--autocreate-playlist``, and behaves like ``yes`` otherwise.

``--chapter-merge-threshold=<number>``
Threshold for merging almost consecutive ordered chapter parts in
Expand Down
3 changes: 2 additions & 1 deletion options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ static const m_option_t mp_opts[] = {
{"playlist-start", OPT_CHOICE(playlist_pos, {"auto", -1}, {"no", -1}),
M_RANGE(0, INT_MAX)},
{"playlist-inherit-options", OPT_CHOICE(playlist_inherit_options,
{"no", 0}, {"yes", 1}, {"current", 2})},
{"no", 0}, {"yes", 1}, {"current", 2}, {"auto", 3})},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto should be 0 by convention, default options are 0 if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto should be 0 by convention

Is it?
Out of 85 "auto" values, 15 are 0.
Out of 70 "no" values, 40 are 0.
Clearly by convention no should be 0, not auto.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default values are 0 because it avoids explicit initializer and is consistent with any structure initialization.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default values are 0 because it avoids explicit initializer and is consistent with any structure initialization.

Yes, but this is not a convention.
--gapless-audio: no - 0, yes - 1, default - -1
--stop-screensaver: no - 0, yes - 1, default - 1
--term-osd: no - 0, auto - 2, default - 2
and so on...


{"pause", OPT_BOOL(pause)},
{"keep-open", OPT_CHOICE(keep_open,
Expand Down Expand Up @@ -1063,6 +1063,7 @@ static const struct MPOpts mp_default_opts = {
.term_osd_bar_chars = "[-+-]",
.consolecontrols = true,
.playlist_pos = -1,
.playlist_inherit_options = 3,
.play_frames = -1,
.rebase_start_time = true,
.keep_open_pause = true,
Expand Down
9 changes: 7 additions & 2 deletions player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,15 @@ static void transfer_playlist(struct MPContext *mpctx, struct playlist *pl,
struct playlist_entry *new = pl->current;
struct playlist_entry *current = mpctx->playlist->current;
*num_new_entries = pl->num_entries;
if (current && mpctx->opts->playlist_inherit_options == 1)
if (current && (mpctx->opts->playlist_inherit_options == 1 ||
(!new && mpctx->opts->playlist_inherit_options == 3)))
{
playlist_set_params(pl, current->params, current->num_params);
else if (current && new && mpctx->opts->playlist_inherit_options == 2)
} else if (current && new && (mpctx->opts->playlist_inherit_options == 2 ||
mpctx->opts->playlist_inherit_options == 3))
{
playlist_entry_add_params(new, current->params, current->num_params);
}
*start_id = playlist_transfer_entries(mpctx->playlist, pl);
// current entry is replaced
if (current)
Expand Down
Loading