comparison stream/tvi_bsdbt848.c @ 22898:b5b63e82bb3e

Ability to specify video and audio capture device names in *BSD BT848 tv driver.
author voroshil
date Thu, 05 Apr 2007 16:33:54 +0000
parents 6cabac4d35b5
children da61a88adf63
comparison
equal deleted inserted replaced
22897:82a108d63c2a 22898:b5b63e82bb3e
171 } 171 }
172 172
173 /* handler creator - entry point ! */ 173 /* handler creator - entry point ! */
174 static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice) 174 static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice)
175 { 175 {
176 return(new_handle()); 176 char* sep ;
177 tvi_handle_t* tvh;
178 priv_t* priv;
179
180 tvh=new_handle();
181 if(!tvh)
182 return NULL;
183 priv=(priv_t*)tvh->priv;
184 /*
185 if user needs to specify both /dev/bktr<n> and /dev/tuner<n>
186 it can do this with "-tv device=/dev/bktr1,/dev/tuner1"
187 */
188
189 /* set video device name */
190 if (!device){
191 priv->btdev = strdup("/dev/bktr0");
192 priv->tunerdev = strdup("/dev/tuner0");
193 }else{
194 sep = strchr(device,',');
195 if(sep){
196 // tuner device is also passed
197 priv->tunerdev = strdup(sep+1);
198 priv->btdev = strndup(device,sep-device);
199 }else{
200 priv->tunerdev = strdup("/dev/tuner0");
201 priv->btdev = strdup(device);
202 }
203 }
204
205 /* set audio device name */
206 if (!adevice)
207 #ifdef __NetBSD__
208 priv->dspdev = strdup("/dev/sound");
209 #else
210 priv->dspdev = strdup("/dev/dsp");
211 #endif
212 else
213 priv->dspdev = strdup(adevice);
214
215 return tvh;
177 } 216 }
178 217
179 static int control(priv_t *priv, int cmd, void *arg) 218 static int control(priv_t *priv, int cmd, void *arg)
180 { 219 {
181 switch(cmd) 220 switch(cmd)
477 G_private = priv; /* Oooh, sick */ 516 G_private = priv; /* Oooh, sick */
478 517
479 /* Video Configuration */ 518 /* Video Configuration */
480 519
481 priv->videoready = TRUE; 520 priv->videoready = TRUE;
482 priv->btdev = strdup("/dev/bktr0");
483 priv->immediatemode = FALSE; 521 priv->immediatemode = FALSE;
484 priv->iformat = METEOR_FMT_PAL; 522 priv->iformat = METEOR_FMT_PAL;
485 priv->maxheight = PAL_HEIGHT; 523 priv->maxheight = PAL_HEIGHT;
486 priv->maxwidth = PAL_WIDTH; 524 priv->maxwidth = PAL_WIDTH;
487 priv->maxfps = PAL_FPS; 525 priv->maxfps = PAL_FPS;
559 } 597 }
560 } 598 }
561 599
562 /* Tuner Configuration */ 600 /* Tuner Configuration */
563 601
564 priv->tunerdev = strdup("/dev/tuner0");
565 priv->tunerready = TRUE; 602 priv->tunerready = TRUE;
566 603
567 priv->tunerfd = open(priv->tunerdev, O_RDONLY); 604 priv->tunerfd = open(priv->tunerdev, O_RDONLY);
568 605
569 if(priv->tunerfd < 0) 606 if(priv->tunerfd < 0)
573 } 610 }
574 611
575 /* Audio Configuration */ 612 /* Audio Configuration */
576 613
577 priv->dspready = TRUE; 614 priv->dspready = TRUE;
578 #ifdef __NetBSD__
579 priv->dspdev = strdup("/dev/sound");
580 #else
581 priv->dspdev = strdup("/dev/dsp");
582 #endif
583 priv->dspsamplesize = 16; 615 priv->dspsamplesize = 16;
584 priv->dspstereo = 1; 616 priv->dspstereo = 1;
585 priv->dspspeed = 44100; 617 priv->dspspeed = 44100;
586 priv->dspfmt = AFMT_S16_LE; 618 priv->dspfmt = AFMT_S16_LE;
587 priv->dspbytesread = 0; 619 priv->dspbytesread = 0;