From b7adae655fe83b1b6609ba1f699b6e61c9a7bf12 Mon Sep 17 00:00:00 2001 From: voroshil Date: Sun, 29 Jul 2007 10:11:24 +0000 Subject: Removing global variables from tv:// Step 1: introducing new structure, fixing tv:// stream git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23902 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_tv.c | 74 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 19 deletions(-) (limited to 'stream/stream_tv.c') diff --git a/stream/stream_tv.c b/stream/stream_tv.c index fe47beabfa..126c35d8f2 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -26,19 +26,55 @@ #include "libmpdemux/demuxer.h" #include "m_option.h" #include "m_struct.h" +#include "tv.h" #include -static struct stream_priv_s { - /* if channels parameter exist here will be channel number otherwise - frequency */ - int input; - char* channel; -} stream_priv_dflts = { - -1, - NULL +tv_param_t stream_tv_defaults = { + NULL, //freq + NULL, //channel + "europe-east", //chanlist + "pal", //norm + 0, //automute +#ifdef HAVE_TV_V4L2 + -1, //normid +#endif + NULL, //device + "dummy", //driver + -1, //width + -1, //height + 0, //input, used in v4l and bttv + -1, //outfmt + -1.0, //fps + NULL, //channels + 0, //noaudio; + 0, //immediate; + 44100, //audiorate; + 0, //audio_id +#if defined(HAVE_TV_V4L) + -1, //amode + -1, //volume + -1, //bass + -1, //treble + -1, //balance + -1, //forcechan + 0, //force_audio + -1, //buffer_size + 0, //mjpeg + 2, //decimation + 90, //quality +#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X) + 0, //alsa +#endif + NULL, //adevice +#endif + 0, //brightness + 0, //contrast + 0, //hue + 0, //saturation }; -#define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) +#define ST_OFF(f) M_ST_OFF(tv_param_t,f) static 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}, @@ -47,27 +83,27 @@ static m_option_t stream_opts_fields[] = { static struct m_struct_st stream_opts = { "tv", - sizeof(struct stream_priv_s), - &stream_priv_dflts, + sizeof(tv_param_t), + &stream_tv_defaults, stream_opts_fields }; +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, int *file_format) { - extern char* tv_param_channel; - extern int tv_param_input; - struct stream_priv_s* p=(struct stream_priv_s*)opts; stream->type = STREAMTYPE_TV; + stream->priv = opts; + stream->close=tv_stream_close; *file_format = DEMUXER_TYPE_TV; - /* don't override input= option value if no input id is - passed in tv:// url */ - if(p->input!=-1) - tv_param_input=p->input; - if (p->channel) - tv_param_channel=strdup (p->channel); return STREAM_OK; } -- cgit v1.2.3