From faad40aad92d51290ef2fc4d94277eca89863873 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 11 May 2013 22:19:33 +0200 Subject: 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. --- core/cfg-mplayer.h | 2 ++ core/command.c | 15 +++++++++++++++ core/mplayer.c | 2 ++ core/options.h | 1 + 4 files changed, 20 insertions(+) (limited to 'core') diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index baf0820f48..9feb82f9cd 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -634,6 +634,8 @@ const m_option_t mplayer_opts[]={ OPT_FLAG("untimed", untimed, 0), + OPT_STRING("stream-capture", stream_capture, 0), + #ifdef CONFIG_LIRC {"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, #endif 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, diff --git a/core/mplayer.c b/core/mplayer.c index 361d3d5466..ed8de9eb36 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -4233,6 +4233,8 @@ goto_enable_cache: ; if (demux_was_interrupted(mpctx)) goto terminate_playback; + stream_set_capture_file(mpctx->stream, opts->stream_capture); + //============ Open DEMUXERS --- DETECT file type ======================= mpctx->audio_delay = opts->audio_delay; diff --git a/core/options.h b/core/options.h index 11286bf883..09cf20c852 100644 --- a/core/options.h +++ b/core/options.h @@ -85,6 +85,7 @@ typedef struct MPOpts { int osd_fractions; char *vobsub_name; int untimed; + char *stream_capture; int loop_times; int ordered_chapters; int chapter_merge_threshold; -- cgit v1.2.3