Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
    Add three parameters to the backend play() function call -- (1) a flag indicating whether the samples are timed or not. If timed, (2) the timestamp and (3) the local time at which the first frame should be heard.
    Update missing pipewire library message.
    Makefile.am fix.
    Update the SHM version and fix the SHM name so that it works with FreeBSD.
    Remove redundant (?) AC_HEADER_STDC check.
    Fix compilation and installation under FreeBSD -- changes to allow building in a separate directory broke the FreeBSD build process.
    Add AC_CHECK_LIB for gcrypt in case PKG_CHECK_MODULES fails to find it.
    Find gcrypt using pkg-config
    Add code to detect when the RTSP channel goes idle for a period, and use it to reset clocks and timings, etc. so that SPS resumes correctly where the source has gone to sleep while playing a realtime stream and has subsequently woken up.
    Don't exit if a UDP Clock Control packet is empty. Also check minimum packet size.
    Remove some very experimental code which may cause memory and port leaks.
    Strip file path from the filename used in debug messages, information messages, warnings and fatal error messages.
    BB fix to Makefile.am -- overwriting the DBUS stuff with MPRIS definitions, duh.
    Fix some problems building on FreeBSD and tidy up the use of the "sed" editor.
    Fix some problems building on picore.
    Fix an uninitialised variable
    start using the "nqptp" SMI
  • Loading branch information
mikebrady committed Sep 12, 2022
1 parent b178e0e commit fd88005
Show file tree
Hide file tree
Showing 28 changed files with 1,275 additions and 1,135 deletions.
13 changes: 6 additions & 7 deletions activity_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ pthread_mutex_t activity_monitor_mutex;
pthread_cond_t activity_monitor_cv;

void going_active(int block) {
// debug(1, "activity_monitor: state transitioning to \"active\" with%s blocking", block ? "" : "out");
// debug(1, "activity_monitor: state transitioning to \"active\" with%s blocking", block ? "" :
// "out");
if (config.cmd_active_start)
command_execute(config.cmd_active_start, "", block);
#ifdef CONFIG_METADATA
Expand Down Expand Up @@ -121,18 +122,16 @@ void activity_monitor_signify_activity(int active) {

// So, if the active end procedure is on a timer, it will be executed when the
// timeout occurs and the "blocking" status is ignored.

if ((state == am_inactive) && (player_state == ps_active)) {
state = am_active;
pthread_mutex_unlock(&activity_monitor_mutex);
going_active(
config.cmd_blocking);
going_active(config.cmd_blocking);
} else if ((state == am_active) && (player_state == ps_inactive) &&
(config.active_state_timeout == 0.0)) {
state = am_inactive;
pthread_mutex_unlock(&activity_monitor_mutex);
going_inactive(
config.cmd_blocking);
going_inactive(config.cmd_blocking);
} else {
pthread_mutex_unlock(&activity_monitor_mutex);
}
Expand Down Expand Up @@ -179,7 +178,7 @@ void *activity_monitor_thread_code(void *arg) {
// debug(1,"am_state: am_active");
while (player_state != ps_inactive)
pthread_cond_wait(&activity_monitor_cv, &activity_monitor_mutex);

// if it's not already am_inactive, the it should be beginning to time out...
if (state != am_inactive) {
state = am_timing_out;
Expand Down
15 changes: 14 additions & 1 deletion audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Loading

0 comments on commit fd88005

Please sign in to comment.