diff options
Diffstat (limited to 'src/libsink')
| -rw-r--r-- | src/libsink/common.h | 2 | ||||
| -rw-r--r-- | src/libsink/sink.c | 26 | ||||
| -rw-r--r-- | src/libsink/sink.h | 1 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/libsink/common.h b/src/libsink/common.h index deae228..f8dd9fa 100644 --- a/src/libsink/common.h +++ b/src/libsink/common.h @@ -1,6 +1,6 @@ #pragma once -#define CAMU_SINK_LOCAL 0 +#define CAMU_SINK_LOCAL 1 enum { CAMU_SINK_SET = 0, diff --git a/src/libsink/sink.c b/src/libsink/sink.c index 859b717..990cd69 100644 --- a/src/libsink/sink.c +++ b/src/libsink/sink.c @@ -210,7 +210,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) case SKIP: { if (!sink->conn) return; struct aki_packet *packet = aki_rpc_get_packet(&sink->client, CAMU_SERVER_LIST_ACTION); - aki_packet_write_str(packet, al_str_c("default")); + aki_packet_write_str(packet, &sink->default_list); aki_packet_write_u8(packet, CAMU_LIST_SKIP); //s32 sequence = sink->current ? sink->current->sequence : LIANA_SEQUENCE_ANY; s32 sequence = LIANA_SEQUENCE_ANY; @@ -222,7 +222,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) case SHUFFLE: { if (!sink->conn) return; struct aki_packet *packet = aki_rpc_get_packet(&sink->client, CAMU_SERVER_LIST_ACTION); - aki_packet_write_str(packet, al_str_c("default")); + aki_packet_write_str(packet, &sink->default_list); aki_packet_write_u8(packet, CAMU_LIST_SHUFFLE); aki_rpc_connection_command(sink->conn, packet, NULL, NULL); break; @@ -233,7 +233,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) #else if (!sink->conn) return; struct aki_packet *packet = aki_rpc_get_packet(&sink->client, CAMU_SERVER_LIST_ACTION); - aki_packet_write_str(packet, al_str_c("default")); + aki_packet_write_str(packet, &sink->default_list); aki_packet_write_u8(packet, CAMU_LIST_TOGGLE_PAUSE); s32 sequence = sink->current ? sink->current->sequence : LIANA_SEQUENCE_ANY; aki_packet_write_s32(packet, sequence); @@ -245,7 +245,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) case SEEK: { if (!sink->conn) return; struct aki_packet *packet = aki_rpc_get_packet(&sink->client, CAMU_SERVER_LIST_ACTION); - aki_packet_write_str(packet, al_str_c("default")); + aki_packet_write_str(packet, &sink->default_list); aki_packet_write_u8(packet, CAMU_LIST_SEEK); s32 sequence = sink->current ? sink->current->sequence : LIANA_SEQUENCE_ANY; aki_packet_write_s32(packet, sequence); @@ -256,7 +256,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) case END: { if (!sink->conn) return; struct aki_packet *packet = aki_rpc_get_packet(&sink->client, CAMU_SERVER_LIST_ACTION); - aki_packet_write_str(packet, al_str_c("default")); + aki_packet_write_str(packet, &sink->default_list); aki_packet_write_u8(packet, CAMU_LIST_END); aki_packet_write_s32(packet, cmd->value.i); aki_rpc_connection_command(sink->conn, packet, NULL, NULL); @@ -546,6 +546,12 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str camu_audio_buffer_reset(&entry->audio.buf); break; } + case LIANA_CLIENT_RESUME_AT: { + struct lia_timing *time = (struct lia_timing *)opaque; + camu_clock_set(&entry->clock, time->seek_pos / 1000000.0); + camu_clock_resume(&entry->clock, time->at); + break; + } case LIANA_CLIENT_EOF: { switch (stream->type) { case CAMU_STREAM_AUDIO: { @@ -917,10 +923,12 @@ static bool seek_command_callback(void *userdata, struct aki_rpc_connection *con struct camu_sink_entry *current = sink->current; aki_mutex_unlock(&sink->mutex); if (current->sequence == sequence) { - // TODO: Thread-safety here. - lia_client_seek(¤t->client, pos); - camu_clock_set(¤t->clock, pos / 1000000.0); - camu_clock_resume(¤t->clock, at); +#if CAMU_SINK_LOCAL + (void)at; + lia_client_seek(¤t->client, pos, 0); +#else + lia_client_seek(¤t->client, pos, at); +#endif } aki_packet_free(packet); diff --git a/src/libsink/sink.h b/src/libsink/sink.h index b9249cd..6d560f6 100644 --- a/src/libsink/sink.h +++ b/src/libsink/sink.h @@ -72,6 +72,7 @@ struct camu_sink { struct aki_signal signal; queue(struct camu_sink_cmd) queue; struct aki_mutex mutex; + str default_list; struct camu_sink_entry *current; struct camu_sink_entry *queued; struct camu_sink_entry *target; |