2022-10-01 16:55:35 -04:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2012-2015 Juho Vähä-Herttua
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
2023-02-09 10:32:36 -05:00
|
|
|
*
|
|
|
|
|
*===================================================================
|
2025-08-11 11:36:03 -04:00
|
|
|
* modified by fduncanh 2021-25
|
2022-10-01 16:55:35 -04:00
|
|
|
*/
|
|
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
#ifndef RAOP_H
|
|
|
|
|
#define RAOP_H
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
#include "dnssd.h"
|
|
|
|
|
#include "stream.h"
|
2020-04-15 16:24:10 +03:00
|
|
|
#include "raop_ntp.h"
|
2024-12-10 01:36:32 -05:00
|
|
|
#include "airplay_video.h"
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2025-11-12 09:40:24 -05:00
|
|
|
#define RAOP_API
|
2025-11-15 14:59:01 -05:00
|
|
|
#define MAX_AIRPLAY_VIDEO 10
|
2025-11-30 13:02:13 -05:00
|
|
|
#define MIN_STORED_AIRPLAY_VIDEO_DURATION_SECONDS 90 //dont store advertisement playlists
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
typedef struct raop_s raop_t;
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
typedef void (*raop_log_callback_t)(void *cls, int level, const char *msg);
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2024-12-10 01:36:32 -05:00
|
|
|
|
|
|
|
|
typedef struct playback_info_s {
|
|
|
|
|
//char * uuid;
|
|
|
|
|
uint32_t stallcount;
|
|
|
|
|
double duration;
|
|
|
|
|
double position;
|
|
|
|
|
float rate;
|
|
|
|
|
bool ready_to_play;
|
|
|
|
|
bool playback_buffer_empty;
|
|
|
|
|
bool playback_buffer_full;
|
|
|
|
|
bool playback_likely_to_keep_up;
|
|
|
|
|
int num_loaded_time_ranges;
|
|
|
|
|
int num_seekable_time_ranges;
|
|
|
|
|
void *loadedTimeRanges;
|
|
|
|
|
void *seekableTimeRanges;
|
|
|
|
|
} playback_info_t;
|
|
|
|
|
|
2024-09-17 18:12:40 -04:00
|
|
|
typedef enum video_codec_e {
|
|
|
|
|
VIDEO_CODEC_UNKNOWN,
|
|
|
|
|
VIDEO_CODEC_H264,
|
|
|
|
|
VIDEO_CODEC_H265
|
|
|
|
|
} video_codec_t;
|
2024-12-10 01:36:32 -05:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
struct raop_callbacks_s {
|
|
|
|
|
void* cls;
|
2020-04-15 16:24:10 +03:00
|
|
|
|
2022-05-01 17:54:37 -04:00
|
|
|
void (*audio_process)(void *cls, raop_ntp_t *ntp, audio_decode_struct *data);
|
2024-09-17 18:12:40 -04:00
|
|
|
void (*video_process)(void *cls, raop_ntp_t *ntp, video_decode_struct *data);
|
2023-09-04 15:12:55 -07:00
|
|
|
void (*video_pause)(void *cls);
|
|
|
|
|
void (*video_resume)(void *cls);
|
2025-01-24 19:18:09 -05:00
|
|
|
void (*conn_feedback) (void *cls);
|
2025-02-02 17:35:05 -05:00
|
|
|
void (*conn_reset) (void *cls, int reason);
|
2025-11-09 17:22:05 -05:00
|
|
|
void (*video_reset) (void *cls, bool hls_shutdown);
|
2025-02-02 17:35:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Optional but recommended callback functions (probably not optional, check this)*/
|
2021-08-10 01:45:01 -04:00
|
|
|
void (*conn_init)(void *cls);
|
|
|
|
|
void (*conn_destroy)(void *cls);
|
2022-01-10 19:08:48 -05:00
|
|
|
void (*conn_teardown)(void *cls, bool *teardown_96, bool *teardown_110 );
|
2021-08-10 01:45:01 -04:00
|
|
|
void (*audio_flush)(void *cls);
|
|
|
|
|
void (*video_flush)(void *cls);
|
2025-04-22 03:47:30 -04:00
|
|
|
double (*audio_set_client_volume)(void *cls);
|
2021-08-10 01:45:01 -04:00
|
|
|
void (*audio_set_volume)(void *cls, float volume);
|
|
|
|
|
void (*audio_set_metadata)(void *cls, const void *buffer, int buflen);
|
|
|
|
|
void (*audio_set_coverart)(void *cls, const void *buffer, int buflen);
|
2025-07-07 20:55:47 -04:00
|
|
|
void (*audio_stop_coverart_rendering) (void* cls);
|
2021-08-10 01:45:01 -04:00
|
|
|
void (*audio_remote_control_id)(void *cls, const char *dacp_id, const char *active_remote_header);
|
2025-08-31 02:22:50 -04:00
|
|
|
void (*audio_set_progress)(void *cls, uint32_t *start, uint32_t *curr, uint32_t *end);
|
2021-11-11 06:27:15 -05:00
|
|
|
void (*audio_get_format)(void *cls, unsigned char *ct, unsigned short *spf, bool *usingScreen, bool *isMedia, uint64_t *audioFormat);
|
2022-01-10 19:08:48 -05:00
|
|
|
void (*video_report_size)(void *cls, float *width_source, float *height_source, float *width, float *height);
|
2025-08-11 11:36:03 -04:00
|
|
|
void (*mirror_video_activity)(void *cls, double *txusage);
|
2023-09-05 14:06:36 -04:00
|
|
|
void (*report_client_request) (void *cls, char *deviceid, char *model, char *name, bool *admit);
|
2023-11-23 19:40:45 -05:00
|
|
|
void (*display_pin) (void *cls, char * pin);
|
2023-12-26 04:57:37 -05:00
|
|
|
void (*register_client) (void *cls, const char *device_id, const char *pk_str, const char *name);
|
2023-12-02 20:50:20 -05:00
|
|
|
bool (*check_register) (void *cls, const char *pk_str);
|
2025-04-22 17:13:13 -04:00
|
|
|
const char* (*passwd) (void *cls, int *len);
|
2023-12-05 12:06:51 -05:00
|
|
|
void (*export_dacp) (void *cls, const char *active_remote, const char *dacp_id);
|
2025-02-17 09:24:47 -05:00
|
|
|
int (*video_set_codec)(void *cls, video_codec_t codec);
|
2024-12-10 01:36:32 -05:00
|
|
|
/* for HLS video player controls */
|
|
|
|
|
void (*on_video_play) (void *cls, const char *location, const float start_position);
|
|
|
|
|
void (*on_video_scrub) (void *cls, const float position);
|
|
|
|
|
void (*on_video_rate) (void *cls, const float rate);
|
|
|
|
|
void (*on_video_stop) (void *cls);
|
|
|
|
|
void (*on_video_acquire_playback_info) (void *cls, playback_info_t *playback_video);
|
2025-11-15 14:59:01 -05:00
|
|
|
void (*on_video_playlist_remove) (void *cls, void *airplay_video);
|
2020-04-15 16:24:10 +03:00
|
|
|
};
|
2025-07-07 20:55:47 -04:00
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
typedef struct raop_callbacks_s raop_callbacks_t;
|
2024-05-12 01:24:38 -04:00
|
|
|
raop_ntp_t *raop_ntp_init(logger_t *logger, raop_callbacks_t *callbacks, const char *remote,
|
2024-12-10 01:36:32 -05:00
|
|
|
int remote_addr_len, unsigned short timing_rport,
|
|
|
|
|
timing_protocol_t *time_protocol);
|
2023-05-30 09:34:41 -04:00
|
|
|
|
2025-11-13 17:00:16 -05:00
|
|
|
airplay_video_t *airplay_video_init(raop_t *raop, unsigned short port, const char *lang, const char *session_id);
|
2025-11-09 17:22:05 -05:00
|
|
|
char *raop_get_lang(raop_t *raop);
|
2025-01-27 03:53:01 -05:00
|
|
|
uint64_t get_local_time();
|
|
|
|
|
|
2024-03-28 00:47:02 -04:00
|
|
|
RAOP_API raop_t *raop_init(raop_callbacks_t *callbacks);
|
2024-05-30 13:08:42 -04:00
|
|
|
RAOP_API int raop_init2(raop_t *raop, int nohold, const char *device_id, const char *keyfile);
|
2021-08-10 01:45:01 -04:00
|
|
|
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);
|
2021-12-04 05:37:59 -05:00
|
|
|
RAOP_API int raop_set_plist(raop_t *raop, const char *plist_item, const int value);
|
2021-08-10 01:45:01 -04:00
|
|
|
RAOP_API void raop_set_port(raop_t *raop, unsigned short port);
|
2025-11-09 17:22:05 -05:00
|
|
|
RAOP_API void raop_set_lang(raop_t *raop, const char *lang);
|
2021-08-10 01:45:01 -04:00
|
|
|
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]);
|
|
|
|
|
RAOP_API unsigned short raop_get_port(raop_t *raop);
|
|
|
|
|
RAOP_API void *raop_get_callback_cls(raop_t *raop);
|
2025-02-16 18:45:35 -05:00
|
|
|
RAOP_API int raop_start_httpd(raop_t *raop, unsigned short *port);
|
2021-08-10 01:45:01 -04:00
|
|
|
RAOP_API int raop_is_running(raop_t *raop);
|
2025-02-16 18:45:35 -05:00
|
|
|
RAOP_API void raop_stop_httpd(raop_t *raop);
|
2021-08-10 01:45:01 -04:00
|
|
|
RAOP_API void raop_set_dnssd(raop_t *raop, dnssd_t *dnssd);
|
|
|
|
|
RAOP_API void raop_destroy(raop_t *raop);
|
2024-09-20 02:32:00 -04:00
|
|
|
RAOP_API void raop_remove_known_connections(raop_t * raop);
|
2025-11-09 17:22:05 -05:00
|
|
|
RAOP_API void raop_remove_hls_connections(raop_t * raop);
|
2025-11-13 17:00:16 -05:00
|
|
|
RAOP_API void raop_destroy_airplay_video(raop_t *raop, int id);
|
2025-11-15 14:59:01 -05:00
|
|
|
RAOP_API int raop_current_playlist_delete(raop_t *raop);
|
|
|
|
|
RAOP_API void raop_playlist_remove(raop_t *raop, void *airplay_video, float position);
|
|
|
|
|
|
2021-08-10 01:45:01 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|