58using Playback_dev_uniq = std::unique_ptr<state_audio_playback, Playback_dev_deleter>;
75 printf(
"Plays audio using an UltraGrid playback device:\n\n");
76 printf(
"playback usage:\n");
77 printf(
"\tplayback:<playback dev>:<dev config>\n\n");
82 if(tok.empty() || tok ==
"help"){
87 auto dev = std::string(tok);
88 auto dev_cfg = std::string(
tokenize(cfg,
':'));
96 auto s = std::make_unique<state_playback>(
parent);
100 *
state = s.release();
106 int in_bps,
int in_ch_count,
int in_sample_rate)
111 s->ch_count = in_ch_count;
112 s->sample_rate = in_sample_rate;
116 s->sample_rate) !=
TRUE) {
134 if(bps) *bps = s->
bps;
135 if(ch_count) *ch_count = s->ch_count;
155 if(f->bps != s->bps || f->ch_count != s->ch_count || f->sample_rate != s->sample_rate){
struct video_frame * frame
This file contains definition of some common audio types.
#define AUDIO_FILTER_ABI_VERSION
bool audio_playback_reconfigure(struct state_audio_playback *s, int quant_samples, int channels, int sample_rate)
int audio_playback_init(const char *device, const char *cfg, struct state_audio_playback **state)
void audio_playback_put_frame(struct state_audio_playback *s, const struct audio_frame *frame)
void audio_playback_done(struct state_audio_playback *s)
@ LIBRARY_CLASS_AUDIO_FILTER
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
void free_message(struct message *msg, struct response *r)
struct response * new_response(int status, const char *text)
struct message * check_message(struct module *mod)
#define RESPONSE_BAD_REQUEST
static af_result_code filter(void *state, struct audio_frame **frame)
static void get_configured(void *state, int *bps, int *ch_count, int *sample_rate)
static const struct audio_filter_info audio_filter_playback
static af_result_code init(struct module *parent, const char *cfg, void **state)
static af_result_code configure(void *state, int in_bps, int in_ch_count, int in_sample_rate)
static void done(void *state)
static af_result_code parse_cfg(state_playback *s, std::string_view cfg)
std::string_view tokenize(std::string_view &str, char delim, char quot)
Tokenizer for string_view.
struct used to comunicate with audio capture/playback device
state_playback(struct module *mod)
Playback_dev_uniq playback_dev