diff options
author | wm4 <wm4@nowhere> | 2017-01-21 17:19:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-21 17:19:01 +0100 |
commit | 73858bb0ccac91b6a529c8dd4b825f47aa28c4b7 (patch) | |
tree | 2baf1e7a267976e51ecbb2a08e02b0c430ea8d59 /demux | |
parent | 085dfdea3246e4d0e984f9f3ccba2959df89842d (diff) | |
download | mpv-73858bb0ccac91b6a529c8dd4b825f47aa28c4b7.tar.bz2 mpv-73858bb0ccac91b6a529c8dd4b825f47aa28c4b7.tar.xz |
player: remove --stream-capture option/property
This was excessively useless, and I want my time back that was needed to
explain users why they don't want to use it.
It captured the byte stream only, and even for types of streams it was
designed for (like transport streams), it was rather questionable.
As part of the removal, un-inline demux_run_on_thread() (which has only
1 call-site now), and sort of reimplement --stream-dump to write the
data directly instead of using the removed capture code.
(--stream-dump is also very useless, and I struggled coming up with an
explanation for it in the manpage.)
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 39 | ||||
-rw-r--r-- | demux/demux.h | 3 |
2 files changed, 13 insertions, 29 deletions
diff --git a/demux/demux.c b/demux/demux.c index 824e20d524..c4173f5965 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1398,12 +1398,6 @@ struct demuxer *demux_open_url(const char *url, cancel, global); if (!s) return NULL; - if (params->allow_capture) { - char *f; - mp_read_option_raw(global, "stream-capture", &m_option_type_string, &f); - stream_set_capture_file(s, f); - talloc_free(f); - } if (!params->disable_cache) stream_enable_cache_defaults(&s); struct demuxer *d = demux_open(s, params, global); @@ -1740,6 +1734,7 @@ static void thread_demux_control(void *p) int demux_control(demuxer_t *demuxer, int cmd, void *arg) { struct demux_internal *in = demuxer->in; + assert(demuxer == in->d_user); if (in->threading) { pthread_mutex_lock(&in->lock); @@ -1751,37 +1746,29 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg) int r = 0; struct demux_control_args args = {demuxer, cmd, arg, &r}; - demux_run_on_thread(demuxer, thread_demux_control, &args); - - return r; -} - -int demux_stream_control(demuxer_t *demuxer, int ctrl, void *arg) -{ - struct demux_ctrl_stream_ctrl c = {ctrl, arg, STREAM_UNSUPPORTED}; - demux_control(demuxer, DEMUXER_CTRL_STREAM_CTRL, &c); - return c.res; -} - -void demux_run_on_thread(struct demuxer *demuxer, void (*fn)(void *), void *ctx) -{ - struct demux_internal *in = demuxer->in; - assert(demuxer == in->d_user); - if (in->threading) { MP_VERBOSE(in, "blocking on demuxer thread\n"); pthread_mutex_lock(&in->lock); while (in->run_fn) pthread_cond_wait(&in->wakeup, &in->lock); - in->run_fn = fn; - in->run_fn_arg = ctx; + in->run_fn = thread_demux_control; + in->run_fn_arg = &args; pthread_cond_signal(&in->wakeup); while (in->run_fn) pthread_cond_wait(&in->wakeup, &in->lock); pthread_mutex_unlock(&in->lock); } else { - fn(ctx); + thread_demux_control(&args); } + + return r; +} + +int demux_stream_control(demuxer_t *demuxer, int ctrl, void *arg) +{ + struct demux_ctrl_stream_ctrl c = {ctrl, arg, STREAM_UNSUPPORTED}; + demux_control(demuxer, DEMUXER_CTRL_STREAM_CTRL, &c); + return c.res; } bool demux_cancel_test(struct demuxer *demuxer) diff --git a/demux/demux.h b/demux/demux.h index f9d98e5cef..44bd2b9766 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -165,7 +165,6 @@ struct demuxer_params { bool initial_readahead; // -- demux_open_url() only int stream_flags; - bool allow_capture; bool disable_cache; // result bool demuxer_failed; @@ -288,8 +287,6 @@ double demuxer_get_time_length(struct demuxer *demuxer); int demux_stream_control(demuxer_t *demuxer, int ctrl, void *arg); -void demux_run_on_thread(struct demuxer *demuxer, void (*fn)(void *), void *ctx); - void demux_changed(demuxer_t *demuxer, int events); void demux_update(demuxer_t *demuxer); |