Modified version of TvTime that reads sound from tv capture card and pipes it to the soundcard while watching tv. I used the alsa api. Capture card's sound device can be specified using "-B hw:2,0" e.g., defaults to "hw:1,0".
You can download it here:
http://www.ba-horb.de/~i06015/tvtime-1.0.1-sb.tar.gz
I can't find it anywhere (the link is dead). I don't know ALSA any good
so just hacked starting of sox as an audio router:
From: Alex Riesen <raa@blimp.localhost>
Date: Tue, 10 Mar 2009 21:18:54 +0100
Subject: [PATCH] Hack in the sox as a kind of audio router
Signed-off-by: Alex Riesen <raa@blimp.localhost>
---
src/videoinput.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/videoinput.c b/src/videoinput.c
index 783bff8..6af42c0 100644
--- a/src/videoinput.c
+++ b/src/videoinput.c
@@ -232,6 +232,8 @@ struct videoinput_s
/* V4L1 read-mode state. */
int grab_size;
uint8_t *grab_data;
+
+ pid_t audiorouter;
};
const char *videoinput_get_audio_mode_name( videoinput_t *vidin, int mode )
@@ -478,6 +480,7 @@ videoinput_t *videoinput_new( const char *v4l_device, int capwidth,
vidin->curinput = 0;
vidin->have_mmap = 0;
vidin->is_streaming = 0;
+ vidin->audiorouter = -1;
memset( vidin->inputname, 0, sizeof( vidin->inputname ) );
memset( vidin->drivername, 0, sizeof( vidin->drivername ) );
@@ -930,6 +933,21 @@ videoinput_t *videoinput_new( const char *v4l_device, int capwidth,
vidin->numframes = 2;
}
+ vidin->audiorouter = fork();
+ switch (vidin->audiorouter)
+ {
+ case 0:
+ execlp("sox", "sox", "-q",
+ "-t", "alsa", "hw:1", "-t", "alsa", "hw:0",
+ NULL);
+ exit(-1);
+ break;
+ case -1:
+ fprintf(stderr, "failed to fork for audiorouter %s\n",
+ strerror(errno));
+ default:
+ break;
+ }
return vidin;
}
@@ -956,6 +974,10 @@ void videoinput_delete( videoinput_t *vidin )
}
}
+ if ( vidin->audiorouter > 0 ) {
+ kill(vidin->audiorouter, SIGTERM);
+ vidin->audiorouter = -1;
+ }
close( vidin->grab_fd );
free( vidin );
}
--
1.6.2.133.g76830