summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-10 20:46:07 +0200
committerwm4 <wm4@nowhere>2014-06-11 00:34:46 +0200
commit7689f5f7cedcafe30d8ede3609cf4f2a3314a1d8 (patch)
treed46cb5666c5dcdd6582ff13e7973787fbdbf49a9 /stream/stream.h
parent73ac34b220d168e0f9c3399aedfb73f78e5fa455 (diff)
downloadmpv-7689f5f7cedcafe30d8ede3609cf4f2a3314a1d8.tar.bz2
mpv-7689f5f7cedcafe30d8ede3609cf4f2a3314a1d8.tar.xz
stream: add a generic way to setup stream priv defaults
Usually, each stream driver declares the size and option list of its private data. This was pretty natural for when most streams still used global variables to setup their defaults. They did by pointing priv_defaults to the (mutable) struct containing the option values. But falls short when storing the option values in MPOpts. So provide a somewhat inelegant but simple way to let the stream implementation setup the priv struct at initialization time. This is done with the get_defaults callback. It should return a copy of the struct used in MPOpts. (A copy, because if MPOpts is changed, string fields might be deallocated, and if that field is not described by stream_info.options, it won't be copied on init.)
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/stream/stream.h b/stream/stream.h
index ba3f6a4fe0..4561ec3cdc 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -132,6 +132,7 @@ typedef struct stream_info_st {
const char **protocols;
int priv_size;
const void *priv_defaults;
+ void *(*get_defaults)(struct stream *st);
const struct m_option *options;
const char **url_options;
bool stream_filter;