mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
improve audio progress report with 1 sec updating
This commit is contained in:
@@ -84,7 +84,7 @@ struct raop_callbacks_s {
|
||||
void (*audio_set_coverart)(void *cls, const void *buffer, int buflen);
|
||||
void (*audio_stop_coverart_rendering) (void* cls);
|
||||
void (*audio_remote_control_id)(void *cls, const char *dacp_id, const char *active_remote_header);
|
||||
void (*audio_set_progress)(void *cls, unsigned int start, unsigned int curr, unsigned int end);
|
||||
void (*audio_set_progress)(void *cls, uint32_t *start, uint32_t *curr, uint32_t *end);
|
||||
void (*audio_get_format)(void *cls, unsigned char *ct, unsigned short *spf, bool *usingScreen, bool *isMedia, uint64_t *audioFormat);
|
||||
void (*video_report_size)(void *cls, float *width_source, float *height_source, float *width, float *height);
|
||||
void (*mirror_video_activity)(void *cls, double *txusage);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "utils.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <plist/plist.h>
|
||||
#define AUDIO_SAMPLE_RATE 44100 /* all supported AirPlay audio format use this sample rate */
|
||||
#define SECOND_IN_USECS 1000000
|
||||
@@ -1091,8 +1092,8 @@ raop_handler_set_parameter(raop_conn_t *conn,
|
||||
sscanf(datastr+8, "%f", &vol);
|
||||
raop_rtp_set_volume(conn->raop_rtp, vol);
|
||||
} else if ((datalen >= 10) && !strncmp(datastr, "progress: ", 10)) {
|
||||
unsigned int start, curr, end;
|
||||
sscanf(datastr+10, "%u/%u/%u", &start, &curr, &end);
|
||||
uint32_t start, curr, end;
|
||||
sscanf(datastr+10, "%"PRIu32"/%"PRIu32"/%"PRIu32, &start, &curr, &end);
|
||||
raop_rtp_set_progress(conn->raop_rtp, start, curr, end);
|
||||
}
|
||||
} else if (!conn->raop_rtp) {
|
||||
|
||||
@@ -93,9 +93,9 @@ struct raop_rtp_s {
|
||||
int coverart_len;
|
||||
char *dacp_id;
|
||||
char *active_remote_header;
|
||||
unsigned int progress_start;
|
||||
unsigned int progress_curr;
|
||||
unsigned int progress_end;
|
||||
uint32_t progress_start;
|
||||
uint32_t progress_curr;
|
||||
uint32_t progress_end;
|
||||
int progress_changed;
|
||||
|
||||
int flush;
|
||||
@@ -287,9 +287,9 @@ raop_rtp_process_events(raop_rtp_t *raop_rtp, void *cb_data)
|
||||
int coverart_len;
|
||||
char *dacp_id;
|
||||
char *active_remote_header;
|
||||
unsigned int progress_start;
|
||||
unsigned int progress_curr;
|
||||
unsigned int progress_end;
|
||||
uint32_t progress_start;
|
||||
uint32_t progress_curr;
|
||||
uint32_t progress_end;
|
||||
int progress_changed;
|
||||
|
||||
assert(raop_rtp);
|
||||
@@ -378,7 +378,7 @@ raop_rtp_process_events(raop_rtp_t *raop_rtp, void *cb_data)
|
||||
|
||||
if (progress_changed) {
|
||||
if (raop_rtp->callbacks.audio_set_progress) {
|
||||
raop_rtp->callbacks.audio_set_progress(raop_rtp->callbacks.cls, progress_start, progress_curr, progress_end);
|
||||
raop_rtp->callbacks.audio_set_progress(raop_rtp->callbacks.cls, &progress_start, &progress_curr, &progress_end);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -805,7 +805,7 @@ raop_rtp_remote_control_id(raop_rtp_t *raop_rtp, const char *dacp_id, const char
|
||||
}
|
||||
|
||||
void
|
||||
raop_rtp_set_progress(raop_rtp_t *raop_rtp, unsigned int start, unsigned int curr, unsigned int end)
|
||||
raop_rtp_set_progress(raop_rtp_t *raop_rtp, uint32_t start, uint32_t curr, uint32_t end)
|
||||
{
|
||||
assert(raop_rtp);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void raop_rtp_set_volume(raop_rtp_t *raop_rtp, float volume);
|
||||
void raop_rtp_set_metadata(raop_rtp_t *raop_rtp, const char *data, int datalen);
|
||||
void raop_rtp_set_coverart(raop_rtp_t *raop_rtp, const char *data, int datalen);
|
||||
void raop_rtp_remote_control_id(raop_rtp_t *raop_rtp, const char *dacp_id, const char *active_remote_header);
|
||||
void raop_rtp_set_progress(raop_rtp_t *raop_rtp, unsigned int start, unsigned int curr, unsigned int end);
|
||||
void raop_rtp_set_progress(raop_rtp_t *raop_rtp, uint32_t start, uint32_t curr, uint32_t end);
|
||||
void raop_rtp_flush(raop_rtp_t *raop_rtp, int next_seq);
|
||||
void raop_rtp_stop(raop_rtp_t *raop_rtp);
|
||||
int raop_rtp_is_running(raop_rtp_t *raop_rtp);
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct {
|
||||
int sync_status;
|
||||
uint64_t ntp_time_local;
|
||||
uint64_t ntp_time_remote;
|
||||
uint64_t rtp_time;
|
||||
uint32_t rtp_time;
|
||||
unsigned short seqnum;
|
||||
} audio_decode_struct;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user