From 7689f5f7cedcafe30d8ede3609cf4f2a3314a1d8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Jun 2014 20:46:07 +0200 Subject: 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.) --- stream/stream.h | 1 + 1 file changed, 1 insertion(+) (limited to 'stream/stream.h') 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; -- cgit v1.2.3