From 96a45a16af5594900ca94e7d4abb18d1e6d5ed4a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 7 Feb 2017 17:05:17 +0100 Subject: 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". --- player/command.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'player/command.c') 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}, -- cgit v1.2.3