pipewire/src/pipewire/main-loop.h

87 lines
2.4 KiB
C

/* PipeWire
*
* Copyright © 2018 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef PIPEWIRE_MAIN_LOOP_H
#define PIPEWIRE_MAIN_LOOP_H
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup pw_main_loop PipeWire Main-Loop Interface
*
* A main loop object
*/
/**
* \addtogroup pw_main_loop
* \{
*/
/** A main loop object */
struct pw_main_loop;
#include <pipewire/loop.h>
/** Events of the main loop */
struct pw_main_loop_events {
#define PW_VERSION_MAIN_LOOP_EVENTS 0
uint32_t version;
/** Emitted when the main loop is destroyed */
void (*destroy) (void *data);
};
/** Create a new main loop. */
struct pw_main_loop *
pw_main_loop_new(const struct spa_dict *props);
/** Add an event listener */
void pw_main_loop_add_listener(struct pw_main_loop *loop,
struct spa_hook *listener,
const struct pw_main_loop_events *events,
void *data);
/** Get the loop implementation */
struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop);
/** Destroy a loop */
void pw_main_loop_destroy(struct pw_main_loop *loop);
/** Run a main loop. This blocks until \ref pw_main_loop_quit is called */
int pw_main_loop_run(struct pw_main_loop *loop);
/** Quit a main loop */
int pw_main_loop_quit(struct pw_main_loop *loop);
/**
* \}
*/
#ifdef __cplusplus
}
#endif
#endif /* PIPEWIRE_MAIN_LOOP_H */