summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-29 10:11:24 +0000
committervoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-29 10:11:24 +0000
commitb7adae655fe83b1b6609ba1f699b6e61c9a7bf12 (patch)
treeb68bb9eb20c5334239fd2b173ca4d1d35dd1bcbf
parent487d4927e2562ea937c455184506134240ba36a4 (diff)
downloadmpv-b7adae655fe83b1b6609ba1f699b6e61c9a7bf12.tar.bz2
mpv-b7adae655fe83b1b6609ba1f699b6e61c9a7bf12.tar.xz
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
-rw-r--r--stream/stream_tv.c74
-rw-r--r--stream/tv.h47
2 files changed, 102 insertions, 19 deletions
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 <stdio.h>
-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;
}
diff --git a/stream/tv.h b/stream/tv.h
index 2f43820eb4..2b3e2e52a1 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -47,6 +47,52 @@ extern int tv_param_contrast;
extern int tv_param_hue;
extern int tv_param_saturation;
+typedef struct tv_param_s {
+ char *freq;
+ char *channel;
+ char *chanlist;
+ char *norm;
+ int automute;
+#ifdef HAVE_TV_V4L2
+ int normid;
+#endif
+ char *device;
+ char *driver;
+ int width;
+ int height;
+ int input;
+ int outfmt;
+ float fps;
+ char **channels;
+ int noaudio;
+ int immediate;
+ int audiorate;
+ int audio_id;
+#if defined(HAVE_TV_V4L)
+ int amode;
+ int volume;
+ int bass;
+ int treble;
+ int balance;
+ int forcechan;
+ int force_audio;
+ int buffer_size;
+ int mjpeg;
+ int decimation;
+ int quality;
+#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
+ int alsa;
+#endif
+ char* adevice;
+#endif
+ int brightness;
+ int contrast;
+ int hue;
+ int saturation;
+} tv_param_t;
+
+extern tv_param_t stream_tv_defaults;
+
typedef struct tvi_info_s
{
struct tvi_handle_s * (*tvi_init)(char *device,char *adevice);
@@ -78,6 +124,7 @@ typedef struct tvi_handle_s {
int chanlist;
const struct CHANLIST *chanlist_s;
int channel;
+ tv_param_t * tv_param;
} tvi_handle_t;
typedef struct tv_channels_s {