event: make events dynamic

Use uri for the events.
This commit is contained in:
Wim Taymans 2017-03-21 20:39:20 +01:00
parent 5bccb1aeea
commit 4d9f2c5161
23 changed files with 299 additions and 285 deletions

View file

@ -43,6 +43,7 @@ typedef struct {
SpaMediaSubtypes media_subtypes;
SpaPropAudio prop_audio;
SpaAudioFormats audio_formats;
SpaNodeEvents node_events;
} URI;
typedef struct _SpaAudioTestSrc SpaAudioTestSrc;
@ -215,7 +216,7 @@ send_have_output (SpaAudioTestSrc *this)
{
if (this->event_cb) {
SpaNodeEvent event = SPA_NODE_EVENT_INIT (SPA_NODE_EVENT_HAVE_OUTPUT);
SpaEvent event = SPA_EVENT_INIT (this->uri.node_events.HaveOutput);
this->event_cb (&this->node, &event, this->user_data);
}
@ -960,6 +961,7 @@ audiotestsrc_init (const SpaHandleFactory *factory,
spa_media_subtypes_map (this->map, &this->uri.media_subtypes);
spa_prop_audio_map (this->map, &this->uri.prop_audio);
spa_audio_formats_map (this->map, &this->uri.audio_formats);
spa_node_events_map (this->map, &this->uri.node_events);
this->node = audiotestsrc_node;
this->clock = audiotestsrc_clock;