changeset 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 82a108d63c2a
children 515545f81186
files DOCS/man/en/mplayer.1 stream/tvi_bsdbt848.c
diffstat 2 files changed, 44 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Wed Apr 04 12:38:08 2007 +0000
+++ b/DOCS/man/en/mplayer.1	Thu Apr 05 16:33:54 2007 +0000
@@ -1719,6 +1719,10 @@
 available: dummy, v4l, v4l2, bsdbt848
 .IPs device=<value>
 Specify TV device (default: /dev/\:video0).
+.I NOTE: 
+For bsdbt848 driver you can provide both bktr and tuner device names
+separating them with comma, tuner after 
+bktr (e.g.\& -tv device=/dev/bktr1,/dev/tuner1)
 .IPs input=<value>
 Specify input (default: 0 (TV), see console output for available inputs).
 .IPs freq=<value>
--- a/stream/tvi_bsdbt848.c	Wed Apr 04 12:38:08 2007 +0000
+++ b/stream/tvi_bsdbt848.c	Thu Apr 05 16:33:54 2007 +0000
@@ -173,7 +173,46 @@
 /* handler creator - entry point ! */
 static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice)
 {
-    return(new_handle());
+    char* sep ;
+    tvi_handle_t* tvh;
+    priv_t* priv;
+
+    tvh=new_handle();
+    if(!tvh)
+        return NULL;
+    priv=(priv_t*)tvh->priv;
+    /* 
+    if user needs to specify both /dev/bktr<n> and /dev/tuner<n>
+    it can do this with "-tv device=/dev/bktr1,/dev/tuner1"
+    */
+
+    /* set video device name */
+    if (!device){
+        priv->btdev = strdup("/dev/bktr0");
+        priv->tunerdev = strdup("/dev/tuner0");
+    }else{
+        sep = strchr(device,',');
+        if(sep){
+            // tuner device is also passed
+            priv->tunerdev = strdup(sep+1);
+            priv->btdev = strndup(device,sep-device);
+        }else{
+            priv->tunerdev = strdup("/dev/tuner0");
+            priv->btdev = strdup(device);
+        }
+    }
+
+    /* set audio device name */
+    if (!adevice)
+#ifdef __NetBSD__
+        priv->dspdev = strdup("/dev/sound");
+#else
+        priv->dspdev = strdup("/dev/dsp");
+#endif
+    else
+        priv->dspdev = strdup(adevice);
+
+    return tvh;
 }
 
 static int control(priv_t *priv, int cmd, void *arg)
@@ -479,7 +518,6 @@
 /* Video Configuration */
 
 priv->videoready = TRUE;
-priv->btdev = strdup("/dev/bktr0");
 priv->immediatemode = FALSE;
 priv->iformat = METEOR_FMT_PAL;
 priv->maxheight = PAL_HEIGHT;
@@ -561,7 +599,6 @@
 
 /* Tuner Configuration */
 
-priv->tunerdev = strdup("/dev/tuner0");
 priv->tunerready = TRUE;
 
 priv->tunerfd = open(priv->tunerdev, O_RDONLY);
@@ -575,11 +612,6 @@
 /* Audio Configuration */
 
 priv->dspready = TRUE;
-#ifdef __NetBSD__
-priv->dspdev = strdup("/dev/sound");
-#else
-priv->dspdev = strdup("/dev/dsp");
-#endif
 priv->dspsamplesize = 16;
 priv->dspstereo = 1;
 priv->dspspeed = 44100;