Lot of changes here.
1. check_classic_mac_basic.yml — update to latest macOS-latest 2. docker-on-push-tag-or-pr — dependant updates 3. FFTConvolver — fix a compilation warning when the DEBUG flag is turned off 4. Reorganise some source files — e.g. move most of the metadata stuff into a subdirectory 5. Remove unused special-purpose AirPlay 2 RC event handler. 6. Reorganise source files and source code relating to the standard event handler. 7. Check configuration settings a little more carefully to offer more meaningful diagnostics. 8. Add password to AirPlay 2 and reorganise initialisation to set AirPlay 2 flags accordingly. Also, remove redundant airplay_pin. 9. Remove redundant debug facility definitions from common.h 10. Make it possible to omit all the dacp stuff from a build. 11. Make it possible to omit metadata multicast from a build. 12. Add AP2-native metadata by setting bit 50 of features to true. 13. Improve stability when pre-empting an existing play session. 14. Fix a few compiler warnings in the pair_ap library. 15. Ensure that the audio format is known before starting synchronisation. 16. Improve handle_configure to set/clear a new config setting. Doesn’t seem to do anything… 17. Experimentally turn off bit 46 of AirPlay 2 features — seems to stop failing pair-verify attempts.
This commit is contained in:
+95
-26
@@ -23,6 +23,7 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <ctype.h> // for isprint()
|
||||
#include <inttypes.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
@@ -64,13 +65,9 @@ void debug_init(int level, int show_elapsed_time, int show_relative_time, int sh
|
||||
debugger_show_file_and_line = show_file_and_line;
|
||||
}
|
||||
|
||||
int debug_level() {
|
||||
return debuglev;
|
||||
};
|
||||
int debug_level() { return debuglev; };
|
||||
|
||||
void set_debug_level(int level) {
|
||||
debuglev = level;
|
||||
}
|
||||
void set_debug_level(int level) { debuglev = level; }
|
||||
|
||||
void increase_debug_level() {
|
||||
if (debuglev < 3)
|
||||
@@ -82,28 +79,15 @@ void decrease_debug_level() {
|
||||
debuglev--;
|
||||
}
|
||||
|
||||
int get_show_elapsed_time() {
|
||||
return debugger_show_elapsed_time;
|
||||
|
||||
}
|
||||
void set_show_elapsed_time(int setting) {
|
||||
debugger_show_elapsed_time = setting;
|
||||
}
|
||||
int get_show_relative_timel() {
|
||||
return debugger_show_relative_time;
|
||||
}
|
||||
int get_show_elapsed_time() { return debugger_show_elapsed_time; }
|
||||
void set_show_elapsed_time(int setting) { debugger_show_elapsed_time = setting; }
|
||||
int get_show_relative_timel() { return debugger_show_relative_time; }
|
||||
|
||||
void set_show_relative_time(int setting) {
|
||||
debugger_show_relative_time = setting;
|
||||
}
|
||||
void set_show_relative_time(int setting) { debugger_show_relative_time = setting; }
|
||||
|
||||
int get_show_file_and_line() {
|
||||
return debugger_show_file_and_line;
|
||||
}
|
||||
int get_show_file_and_line() { return debugger_show_file_and_line; }
|
||||
|
||||
void set_show_file_and_line(int setting) {
|
||||
debugger_show_file_and_line = setting;
|
||||
}
|
||||
void set_show_file_and_line(int setting) { debugger_show_file_and_line = setting; }
|
||||
|
||||
char *generate_preliminary_string(char *buffer, size_t buffer_length, double tss, double tsl,
|
||||
const char *filename, const int linenumber, const char *prefix) {
|
||||
@@ -244,10 +228,94 @@ void _inform(const char *filename, const int linenumber, const char *format, ...
|
||||
pthread_setcancelstate(oldState, NULL);
|
||||
}
|
||||
|
||||
|
||||
void _debug_print_buffer(const char *thefilename, const int linenumber, int level, void *ibuf,
|
||||
size_t buf_len) {
|
||||
|
||||
if (level > debuglev)
|
||||
return;
|
||||
|
||||
char *vbuf = (char *)ibuf; // this to stop the compiler complaining about indexing through a void
|
||||
unsigned int i;
|
||||
unsigned int hexdump_cols = 16;
|
||||
|
||||
// 0x123456: <hexdump_cols * 3> <hexdump_cols>\n
|
||||
const size_t buffer_size = 2 + 6 + 2 + hexdump_cols * 3 + hexdump_cols + 1;
|
||||
char *buf = malloc(buffer_size);
|
||||
if (buf) {
|
||||
//char *bufp = buf;
|
||||
// *buf = '\0';
|
||||
|
||||
// if (msg)
|
||||
// printf("%s", msg);
|
||||
|
||||
#define ADDR_PREFIX_LEN 10 // "0x000000: "
|
||||
|
||||
// each complete row
|
||||
for (i = 0; i < (buf_len / hexdump_cols); i++) {
|
||||
char *bufp = buf;
|
||||
*buf = '\0';
|
||||
snprintf(bufp, ADDR_PREFIX_LEN + 1,"0x%06x ", (i * hexdump_cols) & 0xFFFFFF);
|
||||
bufp += ADDR_PREFIX_LEN;
|
||||
|
||||
unsigned int j;
|
||||
for (j = 0; j < hexdump_cols; j++) {
|
||||
snprintf(bufp, strlen("12 ") + 1, "%02x ", 0xFF & vbuf[i * hexdump_cols + j]);
|
||||
bufp += strlen("12 ");
|
||||
}
|
||||
|
||||
for (j = 0; j < hexdump_cols; j++) {
|
||||
if (isprint(vbuf[i * hexdump_cols + j])) {
|
||||
*bufp = 0xFF & vbuf[i * hexdump_cols + j];
|
||||
} else {
|
||||
*bufp = '.';
|
||||
}
|
||||
bufp++;
|
||||
}
|
||||
*bufp = '\0';
|
||||
_debug(thefilename, linenumber, level, "%s", buf);
|
||||
}
|
||||
|
||||
size_t remaining = buf_len % hexdump_cols;
|
||||
if (remaining != 0) {
|
||||
size_t starting_offset = buf_len - remaining;
|
||||
char *bufp = buf;
|
||||
*buf = '\0';
|
||||
snprintf(bufp, ADDR_PREFIX_LEN + 1,"0x%06zx ", starting_offset & 0xFFFFFF);
|
||||
bufp += ADDR_PREFIX_LEN;
|
||||
|
||||
unsigned int j;
|
||||
for (j = 0; j < hexdump_cols; j++) {
|
||||
if (j < remaining) {
|
||||
snprintf(bufp, strlen("12 ") + 1, "%02x ", 0xFF & vbuf[starting_offset + j]);
|
||||
} else {
|
||||
snprintf(bufp, strlen(" ") + 1, " "); // fille with blanks
|
||||
}
|
||||
bufp += strlen("12 ");
|
||||
}
|
||||
|
||||
for (j = 0; j < remaining; j++) {
|
||||
if (isprint(vbuf[i * hexdump_cols + j])) {
|
||||
*bufp = 0xFF & vbuf[starting_offset + j];
|
||||
} else {
|
||||
*bufp = '.';
|
||||
}
|
||||
bufp++;
|
||||
}
|
||||
*bufp = '\0';
|
||||
_debug(thefilename, linenumber, level, "%s", buf);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void _debug_print_buffer(const char *thefilename, const int linenumber, int level, void *vbuf,
|
||||
size_t buf_len) {
|
||||
if (level > debuglev)
|
||||
return;
|
||||
new_debug_print_buffer(thefilename, linenumber, level, vbuf, buf_len);
|
||||
char *buf = (char *)vbuf;
|
||||
char *obf =
|
||||
malloc(buf_len * 4 + 1); // to be on the safe side -- 4 characters on average for each byte
|
||||
@@ -274,4 +342,5 @@ void _debug_print_buffer(const char *thefilename, const int linenumber, int leve
|
||||
_debug(thefilename, linenumber, level, "%s", obf);
|
||||
free(obf);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user