summaryrefslogtreecommitdiffstats
path: root/m_config.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-31 21:33:26 +0200
committerwm4 <wm4@nowhere>2012-07-31 21:33:26 +0200
commit89a17bcda6c166e98861723b8adc9989f2724c34 (patch)
treef89e05ea12d48c92b04c90c5d447521d29db711c /m_config.h
parent6e020e66e0e454e8c7f1eeb17e85b90262e95386 (diff)
downloadmpv-89a17bcda6c166e98861723b8adc9989f2724c34.tar.bz2
mpv-89a17bcda6c166e98861723b8adc9989f2724c34.tar.xz
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.
Diffstat (limited to 'm_config.h')
-rw-r--r--m_config.h43
1 files changed, 13 insertions, 30 deletions
diff --git a/m_config.h b/m_config.h
index 623b754718..56413b60a4 100644
--- a/m_config.h
+++ b/m_config.h
@@ -31,17 +31,6 @@ typedef struct m_profile m_profile_t;
struct m_option;
struct m_option_type;
-// Config option save slot
-struct m_config_save_slot {
- // Previous level slot.
- struct m_config_save_slot *prev;
- // Level at which the save was made.
- int lvl;
- // We have to store other datatypes in this as well,
- // so make sure we get properly aligned addresses.
- unsigned char data[0] __attribute__ ((aligned(8)));
-};
-
// Config option
struct m_config_option {
struct m_config_option *next;
@@ -51,8 +40,8 @@ struct m_config_option {
char *disabled_feature;
// Option description.
const struct m_option *opt;
- // Save slot stack.
- struct m_config_save_slot *slots;
+ // Raw value of the backup of the global value (or NULL).
+ void *global_backup;
// See \ref ConfigOptionFlags.
unsigned int flags;
};
@@ -86,9 +75,12 @@ typedef struct m_config {
/** This contains all options and suboptions.
*/
struct m_config_option *opts;
- // Current stack level.
- int lvl;
enum option_source mode;
+ // When options are set (via m_config_set_option or m_config_set_profile),
+ // back up the old value (unless it's already backed up). Used for restoring
+ // global options when per-file options are set.
+ bool file_local_mode;
+
// List of defined profiles.
struct m_profile *profiles;
// Depth when recursively including profiles.
@@ -96,7 +88,6 @@ typedef struct m_config {
void *optstruct; // struct mpopts or other
int (*includefunc)(struct m_config *conf, char *filename);
- bool full; // main config with save slot handling etc
} m_config_t;
@@ -111,22 +102,14 @@ struct m_config *
m_config_new(void *optstruct,
int includefunc(struct m_config *conf, char *filename));
-struct m_config *m_config_simple(const struct m_option *options);
-
-void m_config_initialize(struct m_config *conf, void *optstruct);
+struct m_config *m_config_simple(const struct m_option *options,
+ void *optstruct);
// Free a config object.
void m_config_free(struct m_config *config);
-/* Push a new context.
- * \param config The config object.
- */
-void m_config_push(struct m_config *config);
-
-/* Pop the current context restoring the previous context state.
- * \param config The config object.
- */
-void m_config_pop(struct m_config *config);
+void m_config_enter_file_local(struct m_config *config);
+void m_config_leave_file_local(struct m_config *config);
/* Register some options to be used.
* \param config The config object.
@@ -167,8 +150,8 @@ static inline int m_config_check_option0(struct m_config *config,
return m_config_check_option(config, bstr0(name), bstr0(param), ambiguous);
}
-int m_config_parse_suboptions(struct m_config *config, void *optstruct,
- char *name, char *subopts);
+int m_config_parse_suboptions(struct m_config *config, char *name,
+ char *subopts);
/* Get the option matching the given name.