summaryrefslogtreecommitdiffstats
path: root/core/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-11 22:19:33 +0200
committerwm4 <wm4@nowhere>2013-05-12 21:51:57 +0200
commitfaad40aad92d51290ef2fc4d94277eca89863873 (patch)
tree48979e16495ec04765f8e684610750821b80332a /core/command.c
parente6e5a7b221ef2fcdd5a1982d6fdcb627100447d2 (diff)
downloadmpv-faad40aad92d51290ef2fc4d94277eca89863873.tar.bz2
mpv-faad40aad92d51290ef2fc4d94277eca89863873.tar.xz
core: add --stream-capture
This is a partial revert of commit 7059c15, and basically re-adds --capture, just with different option names and slightly different semantics.
Diffstat (limited to 'core/command.c')
-rw-r--r--core/command.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/command.c b/core/command.c
index d8a8882c26..e9d3d0d679 100644
--- a/core/command.c
+++ b/core/command.c
@@ -197,6 +197,20 @@ static int mp_property_stream_path(m_option_t *prop, int action, void *arg,
return m_property_strdup_ro(prop, action, arg, stream->url);
}
+static int mp_property_stream_capture(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
+{
+ if (!mpctx->stream)
+ return M_PROPERTY_UNAVAILABLE;
+
+ if (action == M_PROPERTY_SET) {
+ char *filename = *(char **)arg;
+ stream_set_capture_file(mpctx->stream, filename);
+ // fall through to mp_property_generic_option
+ }
+ return mp_property_generic_option(prop, action, arg, mpctx);
+}
+
/// Demuxer name (RO)
static int mp_property_demuxer(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -1357,6 +1371,7 @@ static const m_option_t mp_properties[] = {
0, 0, 0, NULL },
{ "stream-path", mp_property_stream_path, CONF_TYPE_STRING,
0, 0, 0, NULL },
+ M_OPTION_PROPERTY_CUSTOM("stream-capture", mp_property_stream_capture),
{ "demuxer", mp_property_demuxer, CONF_TYPE_STRING,
0, 0, 0, NULL },
{ "stream-pos", mp_property_stream_pos, CONF_TYPE_INT64,