changeset 97:265d01c2248f libavformat

the media node now won't connect itself to the default audio input with -ad wait: (allows redirecting another node to it)
author mmu_man
date Thu, 27 Mar 2003 15:08:16 +0000
parents 2d3083edb99f
children cae6ddfadf51
files beosaudio.cpp
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/beosaudio.cpp	Thu Mar 27 14:44:30 2003 +0000
+++ b/beosaudio.cpp	Thu Mar 27 15:08:16 2003 +0000
@@ -181,7 +181,7 @@
 }
 #endif
 
-static int audio_open(AudioData *s, int is_output)
+static int audio_open(AudioData *s, int is_output, const char *audio_device)
 {
     int p[2];
     int ret;
@@ -210,7 +210,13 @@
     set_thread_priority(find_thread(NULL), B_DISPLAY_PRIORITY+1);
 #ifdef HAVE_BSOUNDRECORDER
     if (!is_output) {
-        s->recorder = new BSoundRecorder(&iformat, false, "ffmpeg input", audiorecord_callback);
+        bool wait_for_input = false;
+        if (audio_device && !strcmp(audio_device, "wait:"))
+            wait_for_input = true;
+        s->recorder = new BSoundRecorder(&iformat, wait_for_input, "ffmpeg input", audiorecord_callback);
+        if (wait_for_input && (s->recorder->InitCheck() == B_OK)) {
+            s->recorder->WaitForIncomingConnection(&iformat);
+        }
         if (s->recorder->InitCheck() != B_OK || iformat.format != media_raw_audio_format::B_AUDIO_SHORT) {
             delete s->recorder;
             s->recorder = NULL;
@@ -283,7 +289,7 @@
     st = s1->streams[0];
     s->sample_rate = st->codec.sample_rate;
     s->channels = st->codec.channels;
-    ret = audio_open(s, 1);
+    ret = audio_open(s, 1, NULL);
     if (ret < 0)
         return -EIO;
     return 0;
@@ -345,7 +351,7 @@
     s->sample_rate = ap->sample_rate;
     s->channels = ap->channels;
 
-    ret = audio_open(s, 0);
+    ret = audio_open(s, 0, ap->device);
     if (ret < 0) {
         av_free(st);
         return -EIO;