mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
new format in API for setting plist variables
This commit is contained in:
31
lib/raop.c
31
lib/raop.c
@@ -401,15 +401,30 @@ raop_set_log_level(raop_t *raop, int level) {
|
||||
logger_set_level(raop->logger, level);
|
||||
}
|
||||
|
||||
void raop_set_display(raop_t *raop, unsigned short width, unsigned short height,
|
||||
unsigned short refreshRate, unsigned short maxFPS, unsigned short overscanned){
|
||||
int raop_set_plist(raop_t *raop, const char *plist_item, const int value) {
|
||||
int retval = 0;
|
||||
assert(raop);
|
||||
|
||||
if (width) raop->width = (uint16_t) width;
|
||||
if (height) raop->height = (uint16_t) height;
|
||||
if (refreshRate && refreshRate < 256) raop->refreshRate = (uint8_t) refreshRate;
|
||||
if (maxFPS && maxFPS < 256) raop->maxFPS = (uint8_t) maxFPS;
|
||||
if (overscanned) raop->overscanned = 1;
|
||||
assert(plist_item);
|
||||
|
||||
if (strcmp(plist_item,"width") == 0) {
|
||||
raop->width = (uint16_t) value;
|
||||
if ((int) raop->width != value) retval = 1;
|
||||
} else if (strcmp(plist_item,"height") == 0) {
|
||||
raop->height = (uint16_t) value;
|
||||
if ((int) raop->height != value) retval = 1;
|
||||
} else if (strcmp(plist_item,"refreshRate") == 0) {
|
||||
raop->refreshRate = (uint8_t) value;
|
||||
if ((int) raop->refreshRate != value) retval = 1;
|
||||
} else if (strcmp(plist_item,"maxFPS") == 0) {
|
||||
raop->maxFPS = (uint8_t) value;
|
||||
if ((int) raop->maxFPS != value) retval = 1;
|
||||
} else if (strcmp(plist_item,"overscanned") == 0) {
|
||||
raop->overscanned = (uint8_t) (value ? 1 : 0);
|
||||
if ((int) raop->overscanned != value) retval = 1;
|
||||
} else {
|
||||
retval = -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -57,8 +57,7 @@ RAOP_API raop_t *raop_init(int max_clients, raop_callbacks_t *callbacks);
|
||||
|
||||
RAOP_API void raop_set_log_level(raop_t *raop, int level);
|
||||
RAOP_API void raop_set_log_callback(raop_t *raop, raop_log_callback_t callback, void *cls);
|
||||
RAOP_API void raop_set_display(raop_t *raop, unsigned short width, unsigned short height,
|
||||
unsigned short refreshRate, unsigned short maxFPS, unsigned short overscanned);
|
||||
RAOP_API int raop_set_plist(raop_t *raop, const char *plist_item, const int value);
|
||||
RAOP_API void raop_set_port(raop_t *raop, unsigned short port);
|
||||
RAOP_API void raop_set_udp_ports(raop_t *raop, unsigned short port[3]);
|
||||
RAOP_API void raop_set_tcp_ports(raop_t *raop, unsigned short port[2]);
|
||||
|
||||
@@ -603,8 +603,12 @@ int start_raop_server (std::vector<char> hw_addr, std::string name, unsigned sho
|
||||
|
||||
/* write desired display pixel width, pixel height, refresh_rate, max_fps, overscanned. */
|
||||
/* use 0 for default values 1920,1080,60,30,0; these are sent to the Airplay client */
|
||||
|
||||
raop_set_display(raop, display[0], display[1], display[2], display[3], display[4]);
|
||||
|
||||
if (display[0]) raop_set_plist(raop, "width", (int) display[0]);
|
||||
if (display[1]) raop_set_plist(raop, "height", (int) display[1]);
|
||||
if (display[2]) raop_set_plist(raop, "refreshRate", (int) display[2]);
|
||||
if (display[3]) raop_set_plist(raop, "maxFPS", (int) display[3]);
|
||||
if (display[4]) raop_set_plist(raop, "overscanned", (int) display[4]);
|
||||
|
||||
/* network port selection (ports listed as "0" will be dynamically assigned) */
|
||||
raop_set_tcp_ports(raop, tcp);
|
||||
|
||||
Reference in New Issue
Block a user