mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
added infrastucture for getting audio format etc from client at connection
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* Copyright (C) 2018 Juho Vähä-Herttua
|
||||
*
|
||||
@@ -432,7 +433,37 @@ raop_handler_setup(raop_conn_t *conn,
|
||||
} case 96: {
|
||||
// Audio
|
||||
|
||||
unsigned short cport = conn->raop->control_lport, dport = conn->raop->data_lport;
|
||||
unsigned short cport = conn->raop->control_lport, dport = conn->raop->data_lport;
|
||||
audio_format_t audio_format = AAC_ELD;
|
||||
bool using_screen = true;
|
||||
|
||||
/* get audio parameter of connection */
|
||||
uint64_t audioFormat;
|
||||
plist_t audio_format_node = plist_dict_get_item(req_stream_node, "audioFormat");
|
||||
plist_get_uint_val(audio_format_node, &audioFormat);
|
||||
audio_format = get_audio_format( (int) audioFormat);
|
||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "audioFormat = 0X%X %s", audioFormat, audio_format_name(audio_format));
|
||||
|
||||
|
||||
uint8_t usingScreen;
|
||||
plist_t using_screen_node = plist_dict_get_item(req_stream_node, "usingScreen");
|
||||
plist_get_bool_val(using_screen_node, &usingScreen);
|
||||
using_screen = (usingScreen == 0) ? false : true;
|
||||
|
||||
uint64_t latencyMax, redundantAudio, latencyMin, ct, spf;
|
||||
plist_t latency_max_node = plist_dict_get_item(req_stream_node, "latencyMax");
|
||||
plist_get_uint_val(latency_max_node, &latencyMax);
|
||||
plist_t redundant_audio_node = plist_dict_get_item(req_stream_node, "redundantAudio");
|
||||
plist_get_uint_val(redundant_audio_node, &redundantAudio);
|
||||
plist_t latency_min_node = plist_dict_get_item(req_stream_node, "latencyMin");
|
||||
plist_get_uint_val(latency_min_node, &latencyMin);
|
||||
plist_t ct_node = plist_dict_get_item(req_stream_node, "ct");
|
||||
plist_get_uint_val(ct_node, &ct);
|
||||
plist_t spf_node = plist_dict_get_item(req_stream_node, "spf");
|
||||
plist_get_uint_val(spf_node, &spf);
|
||||
|
||||
|
||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "%d %d %d %d %d %d %d", latencyMax, redundantAudio, latencyMin, ct, spf, using_screen);
|
||||
|
||||
if (conn->raop_rtp) {
|
||||
raop_rtp_start_audio(conn->raop_rtp, use_udp, remote_cport, &cport, &dport);
|
||||
|
||||
@@ -703,3 +703,53 @@ raop_rtp_is_running(raop_rtp_t *raop_rtp)
|
||||
return running;
|
||||
}
|
||||
|
||||
const char* audio_format_name(audio_format_t audio_format) {
|
||||
const char * aac_eld = "AAC_ELD";
|
||||
const char * alac = "ALAC";
|
||||
const char * aac = "AAC";
|
||||
const char * pcm = "PCM";
|
||||
const char * unknown = "UNKNOWN";
|
||||
const char * invalid = "";
|
||||
|
||||
switch (audio_format) {
|
||||
case AAC_ELD:
|
||||
return aac_eld;
|
||||
break;
|
||||
case ALAC:
|
||||
return alac;
|
||||
break;
|
||||
case AAC:
|
||||
return aac;
|
||||
break;
|
||||
case PCM:
|
||||
return pcm;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
return unknown;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
|
||||
|
||||
audio_format_t get_audio_format(int format) {
|
||||
switch (format) {
|
||||
case (AAC_ELD):
|
||||
return AAC_ELD;
|
||||
break;
|
||||
case (ALAC):
|
||||
return ALAC;
|
||||
break;
|
||||
case (AAC):
|
||||
return AAC;
|
||||
break;
|
||||
case (PCM):
|
||||
return PCM;
|
||||
break;
|
||||
default:
|
||||
return UNKNOWN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,17 @@
|
||||
|
||||
typedef struct raop_rtp_s raop_rtp_t;
|
||||
|
||||
typedef enum audio_format_e {
|
||||
AAC_ELD = 0x1000000,
|
||||
ALAC = 0x400000,
|
||||
AAC = 0x40000,
|
||||
PCM = 0x0,
|
||||
UNKNOWN
|
||||
} audio_format_t ;
|
||||
const char * audio_format_name(audio_format_t audio_format);
|
||||
audio_format_t get_audio_format(int format);
|
||||
|
||||
|
||||
raop_rtp_t *raop_rtp_init(logger_t *logger, raop_callbacks_t *callbacks, raop_ntp_t *ntp, const unsigned char *remote, int remotelen,
|
||||
const unsigned char *aeskey, const unsigned char *aesiv, const unsigned char *ecdh_secret);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user