mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-04-09 08:21:21 -04:00
Fix merge
This commit is contained in:
parent
37babc6d1a
commit
dabae72185
1 changed files with 47 additions and 5 deletions
|
|
@ -101,6 +101,8 @@ static void userdata_free(struct userdata *u);
|
||||||
|
|
||||||
static void sink_set_volume_cb(pa_sink *s);
|
static void sink_set_volume_cb(pa_sink *s);
|
||||||
|
|
||||||
|
static pa_volume_t pa_raop_sink_get_hw_volume(pa_sink *s);
|
||||||
|
|
||||||
static void raop_state_cb(pa_raop_state_t state, void *userdata) {
|
static void raop_state_cb(pa_raop_state_t state, void *userdata) {
|
||||||
struct userdata *u = userdata;
|
struct userdata *u = userdata;
|
||||||
|
|
||||||
|
|
@ -158,14 +160,18 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
||||||
}
|
}
|
||||||
|
|
||||||
case PA_RAOP_CONNECTED: {
|
case PA_RAOP_CONNECTED: {
|
||||||
|
pa_volume_t initial_volume;
|
||||||
|
|
||||||
pa_assert(!u->rtpoll_item);
|
pa_assert(!u->rtpoll_item);
|
||||||
|
|
||||||
u->oob = pa_raop_client_register_pollfd(u->raop, u->rtpoll, &u->rtpoll_item);
|
u->oob = pa_raop_client_register_pollfd(u->raop, u->rtpoll, &u->rtpoll_item);
|
||||||
|
initial_volume = pa_raop_sink_get_hw_volume(u->sink);
|
||||||
|
pa_raop_client_set_initial_volume(u->raop, initial_volume);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PA_RAOP_RECORDING: {
|
case PA_RAOP_VOLUME_INIT: {
|
||||||
pa_usec_t now;
|
pa_usec_t now;
|
||||||
|
|
||||||
now = pa_rtclock_now();
|
now = pa_rtclock_now();
|
||||||
|
|
@ -178,13 +184,18 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
||||||
pa_rtpoll_set_timer_disabled(u->rtpoll);
|
pa_rtpoll_set_timer_disabled(u->rtpoll);
|
||||||
pa_raop_client_flush(u->raop);
|
pa_raop_client_flush(u->raop);
|
||||||
} else {
|
} else {
|
||||||
/* Set the initial volume */
|
pa_raop_client_send_progress(u->raop);
|
||||||
sink_set_volume_cb(u->sink);
|
|
||||||
pa_sink_process_msg(o, PA_SINK_MESSAGE_SET_VOLUME, data, offset, chunk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case PA_RAOP_RECORDING: {
|
||||||
|
/* Set the initial volume */
|
||||||
|
sink_set_volume_cb(u->sink);
|
||||||
|
pa_sink_process_msg(o, PA_SINK_MESSAGE_SET_VOLUME, data, offset, chunk);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
case PA_RAOP_INVALID_STATE:
|
case PA_RAOP_INVALID_STATE:
|
||||||
case PA_RAOP_DISCONNECTED: {
|
case PA_RAOP_DISCONNECTED: {
|
||||||
|
|
@ -288,6 +299,25 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pa_volume_t pa_raop_sink_get_hw_volume(pa_sink *s){
|
||||||
|
struct userdata *u = s->userdata;
|
||||||
|
pa_volume_t v, v_orig;
|
||||||
|
|
||||||
|
pa_assert(u);
|
||||||
|
|
||||||
|
/* Calculate the max volume of all channels.
|
||||||
|
* We'll use this as our (single) volume on the APEX device and emulate
|
||||||
|
* any variation in channel volumes in software. */
|
||||||
|
v = pa_cvolume_max(&s->real_volume);
|
||||||
|
|
||||||
|
v_orig = v;
|
||||||
|
v = pa_raop_client_adjust_volume(u->raop, v_orig);
|
||||||
|
|
||||||
|
pa_log_debug("Volume adjusted: orig=%u adjusted=%u", v_orig, v);
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
static void sink_set_volume_cb(pa_sink *s) {
|
static void sink_set_volume_cb(pa_sink *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume hw;
|
pa_cvolume hw;
|
||||||
|
|
@ -394,8 +424,20 @@ static void thread_func(void *userdata) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (pollfd->revents & pollfd->events) {
|
if (pollfd->revents & pollfd->events) {
|
||||||
|
struct sockaddr_in srcaddr;
|
||||||
|
socklen_t addrlen;
|
||||||
|
|
||||||
pollfd->revents = 0;
|
pollfd->revents = 0;
|
||||||
read = pa_read(pollfd->fd, packet, sizeof(packet), NULL);
|
// read = pa_read(pollfd->fd, packet, sizeof(packet), NULL);
|
||||||
|
// Newest Airplay devices does not provide response to SETUP request if we do not respond
|
||||||
|
// to timing request packets immediatly after the setup request
|
||||||
|
// To do this we use the source port of incoming packets
|
||||||
|
// TBD: Code rework (move this in raop client?) + Ipv6 Support
|
||||||
|
addrlen = sizeof(struct sockaddr_in);
|
||||||
|
read = recvfrom(pollfd->fd, packet, sizeof(packet), 0, (struct sockaddr *)&srcaddr, &addrlen);
|
||||||
|
|
||||||
|
pa_raop_client_set_tport(u->raop, htons(srcaddr.sin_port));
|
||||||
|
pa_log_debug("Source: %d", htons(srcaddr.sin_port));
|
||||||
pa_raop_client_handle_oob_packet(u->raop, pollfd->fd, packet, read);
|
pa_raop_client_handle_oob_packet(u->raop, pollfd->fd, packet, read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue