chiark / gitweb /
Source code reorganization:
[disorder] / clients / playrtp-coreaudio.c
index a22c8af8c24c0ccaabd53bd242fc3e8ff1473290..f490a0f28731ba244960ce310062b6138c942adb 100644 (file)
  * @brief RTP player - Core Audio support
  */
 
  * @brief RTP player - Core Audio support
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
-#include "types.h"
-
-#include <assert.h>
 #include <pthread.h>
 #include <CoreAudio/AudioHardware.h>
 
 #include <pthread.h>
 #include <CoreAudio/AudioHardware.h>
 
@@ -67,6 +64,14 @@ static OSStatus adioproc
           samples_available = samplesOutLeft;
         next_timestamp += samples_available;
         samplesOutLeft -= samples_available;
           samples_available = samplesOutLeft;
         next_timestamp += samples_available;
         samplesOutLeft -= samples_available;
+        if(dump_buffer) {
+          size_t n;
+
+          for(n = 0; n < samples_available; ++n) {
+            dump_buffer[dump_index++] = (int16_t)ntohs(ptr[n]);
+            dump_index %= dump_size;
+          }
+        }
         while(samples_available-- > 0)
           *samplesOut++ = (int16_t)ntohs(*ptr++) * (0.5 / 32767);
         /* We don't bother junking the packet - that'll be dealt with next time
         while(samples_available-- > 0)
           *samplesOut++ = (int16_t)ntohs(*ptr++) * (0.5 / 32767);
         /* We don't bother junking the packet - that'll be dealt with next time
@@ -82,6 +87,14 @@ static OSStatus adioproc
         next_timestamp += samples_available;
         samplesOut += samples_available;
         samplesOutLeft -= samples_available;
         next_timestamp += samples_available;
         samplesOut += samples_available;
         samplesOutLeft -= samples_available;
+        if(dump_buffer) {
+          size_t n;
+
+          for(n = 0; n < samples_available; ++n) {
+            dump_buffer[dump_index++] = 0;
+            dump_index %= dump_size;
+          }
+        }
       }
     }
     ++ab;
       }
     }
     ++ab;