Mercurial > mplayer.hg
changeset 23883:d65439444b75
Removing global variables from tv://
Step 2: fixing tv subdrivers initialization.
author | voroshil |
---|---|
date | Sun, 29 Jul 2007 10:18:38 +0000 |
parents | d5be90343fac |
children | b341311b8b21 |
files | stream/tv.c stream/tv.h stream/tvi_bsdbt848.c stream/tvi_dummy.c stream/tvi_v4l.c stream/tvi_v4l2.c |
diffstat | 6 files changed, 36 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/tv.c Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tv.c Sun Jul 29 10:18:38 2007 +0000 @@ -505,11 +505,11 @@ 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 @@ } 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 @@ } } - 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 @@ 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);
--- a/stream/tv.h Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tv.h Sun Jul 29 10:18:38 2007 +0000 @@ -95,7 +95,7 @@ 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;
--- a/stream/tvi_bsdbt848.c Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tvi_bsdbt848.c Sun Jul 29 10:18:38 2007 +0000 @@ -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 @@ int immediatemode; double starttime; + tv_param_t *tv_param; } priv_t; #include "tvi_def.h" @@ -169,7 +170,7 @@ } /* 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 @@ */ /* 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; }
--- a/stream/tvi_dummy.c Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tvi_dummy.c Sun Jul 29 10:18:38 2007 +0000 @@ -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 @@ #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()); }
--- a/stream/tvi_v4l.c Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tvi_v4l.c Sun Jul 29 10:18:38 2007 +0000 @@ -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 @@ long audio_sent_blocks_total; long mjpeg_bufsize; + tv_param_t *tv_param; } priv_t; #include "tvi_def.h" @@ -269,7 +270,7 @@ 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 @@ 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 @@ return(NULL); } + h->tv_param=tv_param; return(h); }
--- a/stream/tvi_v4l2.c Sun Jul 29 10:11:24 2007 +0000 +++ b/stream/tvi_v4l2.c Sun Jul 29 10:18:38 2007 +0000 @@ -47,7 +47,7 @@ #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 @@ 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 @@ #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 @@ } 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 @@ } } + PRIV->tv_param=tv_param; return tvi_handle; }