]> git.ipfire.org Git - thirdparty/shairport-sync.git/blobdiff - audio.h
Update RELEASENOTES-DEVELOPMENT.md
[thirdparty/shairport-sync.git] / audio.h
diff --git a/audio.h b/audio.h
index 3413250ceaab4c30ebdcffd4b5dfe0ddf33510a6..583b2bbbb2f97192a9f2235d891acb358d4d3ca2 100644 (file)
--- a/audio.h
+++ b/audio.h
@@ -4,6 +4,19 @@
 #include <libconfig.h>
 #include <stdint.h>
 
+// clang-format off
+// Play samples provided may be from the source, in which case they will be timed
+// or they may be generated by Shairport Sync, in which case they will not be timed.
+
+// Typically these would be samples of silence, which may be dithered, sent during the lead-in to 
+// the start of the material, or inserted instead of a missing frame, or after a flush.
+// clang-format on
+
+typedef enum {
+  play_samples_are_untimed = 0, // typically the samples are (possibly dithered) silence
+  play_samples_are_timed,       // timed and numbered.
+} play_samples_type;
+
 typedef struct {
   double current_volume_dB;
   int32_t minimum_volume_dB;
@@ -24,7 +37,7 @@ typedef struct {
   void (*start)(int sample_rate, int sample_format);
 
   // block of samples
-  int (*play)(void *buf, int samples);
+  int (*play)(void *buf, int samples, int sample_type, uint32_t timestamp, uint64_t playtime);
   void (*stop)(void);
 
   // may be null if no implemented
@@ -39,8 +52,9 @@ typedef struct {
   // will change dynamically, so keep watching it. Implemented in ALSA only.
   // returns a negative error code if there's a problem
   int (*delay)(long *the_delay); // snd_pcm_sframes_t is a signed long
-  int (*rate_info)(uint64_t *elapsed_time,
-                   uint64_t *frames_played); // use this to get the true rate of the DAC
+  int (*stats)(uint64_t *raw_measurement_time, uint64_t *corrected_measurement_time,
+               uint64_t *delay,
+               uint64_t *frames_sent_to_dac); // use this to get the true rate of the DAC
 
   // may be NULL, in which case soft volume is applied
   void (*volume)(double vol);