diff options
author | wm4 <wm4@nowhere> | 2013-08-02 17:02:34 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-02 17:02:34 +0200 |
commit | bc1d61cf4296ab41564adb896e454e48c292e451 (patch) | |
tree | 461dfa0cb61af73b62838608aa8fbb3dd99d3642 /stream/stream_tv.c | |
parent | 964194b55bf86d7c8b76febe8bf54c49648e79c1 (diff) | |
download | mpv-bc1d61cf4296ab41564adb896e454e48c292e451.tar.bz2 mpv-bc1d61cf4296ab41564adb896e454e48c292e451.tar.xz |
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.)
Diffstat (limited to 'stream/stream_tv.c')
-rw-r--r-- | stream/stream_tv.c | 32 |
1 files changed, 13 insertions, 19 deletions
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 <stdio.h> @@ -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} + }, }; |