11 static bool is_acceptable_input_format(struct graphnode
*node
, struct graphpin
*pin
, const struct aformat
*af
)
13 return af
->media
== MT_AUDIO_16I
;
16 static err_t
get_ideal_input_format(struct graphnode
*node
, struct graphpin
*pin
, struct aformat
*af
)
18 af
->media
= MT_AUDIO_16I
;
24 static err_t
set_buffer(struct graphnode
*node
, struct graphpin
*pin
, struct buffer
*buf
)
26 struct playsink
*ps
= node
->extra
;
29 if (soundout_open(&ps
->so
, &buf
->format
) != 0){
30 return make_error(-1, node
, "cannot open soundout");
37 static err_t
run(struct graphnode
*node
)
39 struct playsink
*ps
= node
->extra
;
41 if (soundout_write(&ps
->so
, ps
->buf
->data
, ps
->buf
->n_samples
* aformat_get_sample_size(&ps
->buf
->format
)) != 0){
42 return make_error(-1, node
, "cannot write to soundout");
47 static const struct graphnode_functab functab
= {
48 is_acceptable_input_format
,
49 get_ideal_input_format
,
50 NULL
, // get_output_format
55 err_t
playsink_create(struct graphnode
**node_out
)
57 struct graphnode
*node
;
62 err
= graphnode_create(&node
, &functab
, sizeof *ps
);
67 err
= graphnode_add_pin(node
, &pin
);