audio_output: added function audio_output_is_pending()
The function audio_output_is_pending() returns whether there is a pending command. This is useful for output plugins as a break condition for longer loops.
This commit is contained in:
		| @@ -31,3 +31,7 @@ void audio_output_closed(struct audio_output *ao) | |||||||
| 	ao->open = 0; | 	ao->open = 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool audio_output_is_pending(const struct audio_output *ao) | ||||||
|  | { | ||||||
|  | 	return ao->command != AO_COMMAND_NONE; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -27,6 +27,8 @@ | |||||||
| #include "log.h" | #include "log.h" | ||||||
| #include "os_compat.h" | #include "os_compat.h" | ||||||
|  |  | ||||||
|  | #include <stdbool.h> | ||||||
|  |  | ||||||
| #define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) const struct audio_output_plugin plugin; | #define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) const struct audio_output_plugin plugin; | ||||||
|  |  | ||||||
| struct audio_output; | struct audio_output; | ||||||
| @@ -113,4 +115,9 @@ const char *audio_output_get_name(const struct audio_output *ao); | |||||||
|  |  | ||||||
| void audio_output_closed(struct audio_output *ao); | void audio_output_closed(struct audio_output *ao); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Returns true if there is a command pending. | ||||||
|  |  */ | ||||||
|  | bool audio_output_is_pending(const struct audio_output *ao); | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann