From bc1d61cf4296ab41564adb896e454e48c292e451 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 2 Aug 2013 17:02:34 +0200 Subject: stream: redo URL parsing, replace m_struct usage with m_config Move the URL parsing code from m_option.c to stream.c, and simplify it dramatically. This code originates from times when http code used this, but now it's just relict from other stream implementations reusing this code. Remove the unused bits and simplify the rest. stream_vcd is insane, and the priv struct is different on every platform, so drop the URL parsing. This means you can't specify a track anymore, only the device. (Does anyone use stream_vcd? Not like this couldn't be fixed, but it doesn't seem worth the effort, especially because it'd require potentially touching platform specific code.) --- stream/stream_tv.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'stream/stream_tv.c') diff --git a/stream/stream_tv.c b/stream/stream_tv.c index d9a4636b00..5a01d967e9 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -28,7 +28,6 @@ #include "stream.h" #include "core/m_option.h" -#include "core/m_struct.h" #include "tv.h" #include @@ -75,33 +74,22 @@ tv_param_t stream_tv_defaults = { 0.5, //scan_period }; -#define ST_OFF(f) M_ST_OFF(tv_param_t,f) +#define OPT_BASE_STRUCT tv_param_t static const m_option_t stream_opts_fields[] = { - {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL}, - {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL}, - { NULL, NULL, 0, 0, 0, 0, NULL } -}; - -static const struct m_struct_st stream_opts = { - "tv", - sizeof(tv_param_t), - &stream_tv_defaults, - stream_opts_fields + OPT_STRING("channel", channel, 0), + OPT_INT("input", input, 0), + {0} }; static void tv_stream_close (stream_t *stream) { - if(stream->priv) - m_struct_free(&stream_opts,stream->priv); - stream->priv=NULL; } static int -tv_stream_open (stream_t *stream, int mode, void *opts) +tv_stream_open (stream_t *stream, int mode) { stream->type = STREAMTYPE_TV; - stream->priv = opts; stream->close=tv_stream_close; stream->demuxer = "tv"; @@ -112,6 +100,12 @@ const stream_info_t stream_info_tv = { "tv", tv_stream_open, { "tv", NULL }, - &stream_opts, - 1 + .priv_size = sizeof(tv_param_t), + .priv_defaults = &stream_tv_defaults, + .options = stream_opts_fields, + .url_options = { + {"hostname", "channel"}, + {"filename", "input"}, + {0} + }, }; -- cgit v1.2.3