summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-29 10:18:38 +0000
committervoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-29 10:18:38 +0000
commit7cdc5ad4fe61b7fd8cc6648256ab952409fd6846 (patch)
tree1fd3222bfd5b1252c3daadd2bd34f6f4283e7f98
parentb7adae655fe83b1b6609ba1f699b6e61c9a7bf12 (diff)
downloadmpv-7cdc5ad4fe61b7fd8cc6648256ab952409fd6846.tar.bz2
mpv-7cdc5ad4fe61b7fd8cc6648256ab952409fd6846.tar.xz
Removing global variables from tv://
Step 2: fixing tv subdrivers initialization. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23903 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--stream/tv.c13
-rw-r--r--stream/tv.h2
-rw-r--r--stream/tvi_bsdbt848.c18
-rw-r--r--stream/tvi_dummy.c4
-rw-r--r--stream/tvi_v4l.c14
-rw-r--r--stream/tvi_v4l2.c13
6 files changed, 36 insertions, 28 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 7258d7ff19..9605921151 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -505,11 +505,11 @@ done:
return 1;
}
-static tvi_handle_t *tv_begin(void)
+static tvi_handle_t *tv_begin(tv_param_t* tv_param)
{
int i;
tvi_handle_t* h;
- if(!strcmp(tv_param_driver,"help")){
+ if(!strcmp(tv_param->driver,"help")){
mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers);
for(i=0;tvi_driver_list[i];i++){
mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
@@ -521,10 +521,11 @@ static tvi_handle_t *tv_begin(void)
}
for(i=0;tvi_driver_list[i];i++){
- if (!strcmp(tvi_driver_list[i]->short_name, tv_param_driver)){
- h=tvi_driver_list[i]->tvi_init(tv_param_device,tv_param_adevice);
+ if (!strcmp(tvi_driver_list[i]->short_name, tv_param->driver)){
+ h=tvi_driver_list[i]->tvi_init(tv_param);
if(!h) return NULL;
+ h->tv_param=tv_param;
mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name,
tvi_driver_list[i]->name,
tvi_driver_list[i]->author,
@@ -533,7 +534,7 @@ static tvi_handle_t *tv_begin(void)
}
}
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param_driver);
+ mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver);
return(NULL);
}
@@ -555,7 +556,7 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
tvi_functions_t *funcs;
demuxer->priv=NULL;
- if(!(tvh=tv_begin())) return NULL;
+ if(!(tvh=tv_begin(demuxer->stream->priv))) return NULL;
if (!tvh->functions->init(tvh->priv)) return NULL;
if (!open_tv(tvh)){
tv_uninit(tvh);
diff --git a/stream/tv.h b/stream/tv.h
index 2b3e2e52a1..277eb815cb 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -95,7 +95,7 @@ extern tv_param_t stream_tv_defaults;
typedef struct tvi_info_s
{
- struct tvi_handle_s * (*tvi_init)(char *device,char *adevice);
+ struct tvi_handle_s * (*tvi_init)(tv_param_t* tv_param);
const char *name;
const char *short_name;
const char *author;
diff --git a/stream/tvi_bsdbt848.c b/stream/tvi_bsdbt848.c
index 409af95f7a..05248e8e6a 100644
--- a/stream/tvi_bsdbt848.c
+++ b/stream/tvi_bsdbt848.c
@@ -64,7 +64,7 @@
#include "libmpcodecs/img_format.h"
#include "tv.h"
-static tvi_handle_t *tvi_init_bsdbt848(char *device, char *adevice);
+static tvi_handle_t *tvi_init_bsdbt848(tv_param_t* tv_param);
/* information about this file */
tvi_info_t tvi_info_bsdbt848 = {
tvi_init_bsdbt848,
@@ -134,6 +134,7 @@ typedef struct {
int immediatemode;
double starttime;
+ tv_param_t *tv_param;
} priv_t;
#include "tvi_def.h"
@@ -169,7 +170,7 @@ return;
}
/* handler creator - entry point ! */
-static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice)
+static tvi_handle_t *tvi_init_bsdbt848(tv_param_t* tv_param)
{
char* sep ;
tvi_handle_t* tvh;
@@ -185,31 +186,32 @@ static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice)
*/
/* set video device name */
- if (!device){
+ if (!tv_param->device){
priv->btdev = strdup("/dev/bktr0");
priv->tunerdev = strdup("/dev/tuner0");
}else{
- sep = strchr(device,',');
- priv->btdev = strdup(device);
+ sep = strchr(tv_param->device,',');
+ priv->btdev = strdup(tv_param->device);
if(sep){
// tuner device is also passed
priv->tunerdev = strdup(sep+1);
- priv->btdev[sep - device] = 0;
+ priv->btdev[sep - tv_param->device] = 0;
}else{
priv->tunerdev = strdup("/dev/tuner0");
}
}
/* set audio device name */
- if (!adevice)
+ if (!tv_param->adevice)
#ifdef USE_SUN_AUDIO
priv->dspdev = strdup("/dev/sound");
#else
priv->dspdev = strdup("/dev/dsp");
#endif
else
- priv->dspdev = strdup(adevice);
+ priv->dspdev = strdup(tv_param->adevice);
+ tvh->tv_param=tv_param;
return tvh;
}
diff --git a/stream/tvi_dummy.c b/stream/tvi_dummy.c
index cf37cd6871..54c525f5e4 100644
--- a/stream/tvi_dummy.c
+++ b/stream/tvi_dummy.c
@@ -8,7 +8,7 @@
#include "libmpcodecs/img_format.h"
#include "tv.h"
-static tvi_handle_t *tvi_init_dummy(char *device,char *adevice);
+static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param);
/* information about this file */
tvi_info_t tvi_info_dummy = {
tvi_init_dummy,
@@ -27,7 +27,7 @@ typedef struct {
#include "tvi_def.h"
/* handler creator - entry point ! */
-static tvi_handle_t *tvi_init_dummy(char *device,char *adevice)
+static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param)
{
return(new_handle());
}
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c
index aaf3aab1dc..1a190fd9ff 100644
--- a/stream/tvi_v4l.c
+++ b/stream/tvi_v4l.c
@@ -48,7 +48,7 @@
#include "audio_in.h"
-static tvi_handle_t *tvi_init_v4l(char *device, char *adevice);
+static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param);
tvi_info_t tvi_info_v4l = {
tvi_init_v4l,
@@ -143,6 +143,7 @@ typedef struct {
long audio_sent_blocks_total;
long mjpeg_bufsize;
+ tv_param_t *tv_param;
} priv_t;
#include "tvi_def.h"
@@ -269,7 +270,7 @@ static void setup_audio_buffer_sizes(priv_t *priv)
priv->audio_buffer_size, priv->audio_in.blocksize, priv->aud_skew_cnt);
}
-static tvi_handle_t *tvi_init_v4l(char *device, char *adevice)
+static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param)
{
tvi_handle_t *h;
priv_t *priv;
@@ -281,16 +282,16 @@ static tvi_handle_t *tvi_init_v4l(char *device, char *adevice)
priv = h->priv;
/* set video device name */
- if (!device)
+ if (!tv_param->device)
priv->video_device = strdup("/dev/video0");
else
- priv->video_device = strdup(device);
+ priv->video_device = strdup(tv_param->device);
/* set video device name */
- if (!adevice)
+ if (!tv_param->adevice)
priv->audio_device = NULL;
else {
- priv->audio_device = strdup(adevice);
+ priv->audio_device = strdup(tv_param->adevice);
}
/* allocation failed */
@@ -299,6 +300,7 @@ static tvi_handle_t *tvi_init_v4l(char *device, char *adevice)
return(NULL);
}
+ h->tv_param=tv_param;
return(h);
}
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 32cc1d2fa0..48a7c7bd07 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -47,7 +47,7 @@ known issues:
#include "audio_in.h"
#define info tvi_info_v4l2
-static tvi_handle_t *tvi_init_v4l2(char *video_dev, char *audio_dev);
+static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param);
/* information about this file */
tvi_info_t tvi_info_v4l2 = {
tvi_init_v4l2,
@@ -137,6 +137,8 @@ typedef struct {
volatile long audio_null_blocks_inserted;
volatile long long dropped_frames_timeshift;
long long dropped_frames_compensated;
+
+ tv_param_t *tv_param;
} priv_t;
#include "tvi_def.h"
@@ -826,7 +828,7 @@ static int control(priv_t *priv, int cmd, void *arg)
#define PRIV ((priv_t *) (tvi_handle->priv))
/* handler creator - entry point ! */
-static tvi_handle_t *tvi_init_v4l2(char *video_dev, char *audio_dev)
+static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param)
{
tvi_handle_t *tvi_handle;
@@ -837,14 +839,14 @@ static tvi_handle_t *tvi_init_v4l2(char *video_dev, char *audio_dev)
}
PRIV->video_fd = -1;
- PRIV->video_dev = strdup(video_dev? video_dev: "/dev/video0");
+ PRIV->video_dev = strdup(tv_param->device? tv_param->device: "/dev/video0");
if (!PRIV->video_dev) {
free_handle(tvi_handle);
return NULL;
}
- if (audio_dev) {
- PRIV->audio_dev = strdup(audio_dev);
+ if (tv_param->adevice) {
+ PRIV->audio_dev = strdup(tv_param->adevice);
if (!PRIV->audio_dev) {
free(PRIV->video_dev);
free_handle(tvi_handle);
@@ -852,6 +854,7 @@ static tvi_handle_t *tvi_init_v4l2(char *video_dev, char *audio_dev)
}
}
+ PRIV->tv_param=tv_param;
return tvi_handle;
}