summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-07 17:05:17 +0100
committerwm4 <wm4@nowhere>2017-02-07 17:05:17 +0100
commit96a45a16af5594900ca94e7d4abb18d1e6d5ed4a (patch)
treed08473b07adfa7963ce6735c72af1e5d220930a9 /player/command.c
parent061b752217d15d41496ca6e4777835fcd945e237 (diff)
downloadmpv-96a45a16af5594900ca94e7d4abb18d1e6d5ed4a.tar.bz2
mpv-96a45a16af5594900ca94e7d4abb18d1e6d5ed4a.tar.xz
player: add experimental stream recording feature
This is basically a WIP, but it can't remain in a branch forever. A warning is print when using it as it's still a bit "shaky".
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 6d335e535a..cde67ebe51 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3549,6 +3549,26 @@ static int mp_property_cwd(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
+static int mp_property_record_file(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ struct MPContext *mpctx = ctx;
+ struct MPOpts *opts = mpctx->opts;
+ if (action == M_PROPERTY_SET) {
+ char *new = *(char **)arg;
+ if (!bstr_equals(bstr0(new), bstr0(opts->record_file))) {
+ talloc_free(opts->record_file);
+ opts->record_file = talloc_strdup(NULL, new);
+ open_recorder(mpctx, false);
+ // open_recorder() unsets it on failure.
+ if (new && !opts->record_file)
+ return M_PROPERTY_ERROR;
+ }
+ return M_PROPERTY_OK;
+ }
+ return mp_property_generic_option(mpctx, prop, action, arg);
+}
+
static int mp_property_protocols(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -4020,6 +4040,8 @@ static const struct m_property mp_properties_base[] = {
{"working-directory", mp_property_cwd},
+ {"record-file", mp_property_record_file},
+
{"protocol-list", mp_property_protocols},
{"decoder-list", mp_property_decoders},
{"encoder-list", mp_property_encoders},