1 /* 2 * Copyright © 2013 Mozilla Foundation 3 * 4 * This program is made available under an ISC-style license. See the 5 * accompanying file LICENSE for details. 6 */ 7 #if !defined(CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5) 8 #define CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5 9 10 #include "cubeb/cubeb.h" 11 #include "cubeb_assert.h" 12 #include "cubeb_log.h" 13 #include <stdio.h> 14 #include <string.h> 15 16 #ifdef __clang__ 17 #ifndef CLANG_ANALYZER_NORETURN 18 #if __has_feature(attribute_analyzer_noreturn) 19 #define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) 20 #else 21 #define CLANG_ANALYZER_NORETURN 22 #endif // ifndef CLANG_ANALYZER_NORETURN 23 #endif // __has_feature(attribute_analyzer_noreturn) 24 #else // __clang__ 25 #define CLANG_ANALYZER_NORETURN 26 #endif 27 28 #if defined(__cplusplus) 29 extern "C" { 30 #endif 31 32 #if defined(__cplusplus) 33 } 34 #endif 35 36 struct cubeb_ops { 37 int (*init)(cubeb ** context, char const * context_name); 38 char const * (*get_backend_id)(cubeb * context); 39 int (*get_max_channel_count)(cubeb * context, uint32_t * max_channels); 40 int (*get_min_latency)(cubeb * context, cubeb_stream_params params, 41 uint32_t * latency_ms); 42 int (*get_preferred_sample_rate)(cubeb * context, uint32_t * rate); 43 int (*enumerate_devices)(cubeb * context, cubeb_device_type type, 44 cubeb_device_collection * collection); 45 int (*device_collection_destroy)(cubeb * context, 46 cubeb_device_collection * collection); 47 void (*destroy)(cubeb * context); 48 int (*stream_init)(cubeb * context, cubeb_stream ** stream, 49 char const * stream_name, cubeb_devid input_device, 50 cubeb_stream_params * input_stream_params, 51 cubeb_devid output_device, 52 cubeb_stream_params * output_stream_params, 53 unsigned int latency, cubeb_data_callback data_callback, 54 cubeb_state_callback state_callback, void * user_ptr); 55 void (*stream_destroy)(cubeb_stream * stream); 56 int (*stream_start)(cubeb_stream * stream); 57 int (*stream_stop)(cubeb_stream * stream); 58 int (*stream_get_position)(cubeb_stream * stream, uint64_t * position); 59 int (*stream_get_latency)(cubeb_stream * stream, uint32_t * latency); 60 int (*stream_get_input_latency)(cubeb_stream * stream, uint32_t * latency); 61 int (*stream_set_volume)(cubeb_stream * stream, float volumes); 62 int (*stream_set_name)(cubeb_stream * stream, char const * stream_name); 63 int (*stream_get_current_device)(cubeb_stream * stream, 64 cubeb_device ** const device); 65 int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device); 66 int (*stream_register_device_changed_callback)( 67 cubeb_stream * stream, 68 cubeb_device_changed_callback device_changed_callback); 69 int (*register_device_collection_changed)( 70 cubeb * context, cubeb_device_type devtype, 71 cubeb_device_collection_changed_callback callback, void * user_ptr); 72 }; 73 74 #endif /* CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5 */ 75