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_log.h" 12 #include "cubeb_assert.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, 41 cubeb_stream_params params, 42 uint32_t * latency_ms); 43 int (* get_preferred_sample_rate)(cubeb * context, uint32_t * rate); 44 int (* enumerate_devices)(cubeb * context, cubeb_device_type type, 45 cubeb_device_collection * collection); 46 int (* device_collection_destroy)(cubeb * context, 47 cubeb_device_collection * collection); 48 void (* destroy)(cubeb * context); 49 int (* stream_init)(cubeb * context, 50 cubeb_stream ** stream, 51 char const * stream_name, 52 cubeb_devid input_device, 53 cubeb_stream_params * input_stream_params, 54 cubeb_devid output_device, 55 cubeb_stream_params * output_stream_params, 56 unsigned int latency, 57 cubeb_data_callback data_callback, 58 cubeb_state_callback state_callback, 59 void * user_ptr); 60 void (* stream_destroy)(cubeb_stream * stream); 61 int (* stream_start)(cubeb_stream * stream); 62 int (* stream_stop)(cubeb_stream * stream); 63 int (* stream_reset_default_device)(cubeb_stream * stream); 64 int (* stream_get_position)(cubeb_stream * stream, uint64_t * position); 65 int (* stream_get_latency)(cubeb_stream * stream, uint32_t * latency); 66 int (* stream_set_volume)(cubeb_stream * stream, float volumes); 67 int (* stream_set_panning)(cubeb_stream * stream, float panning); 68 int (* stream_get_current_device)(cubeb_stream * stream, 69 cubeb_device ** const device); 70 int (* stream_device_destroy)(cubeb_stream * stream, 71 cubeb_device * device); 72 int (* stream_register_device_changed_callback)(cubeb_stream * stream, 73 cubeb_device_changed_callback device_changed_callback); 74 int (* register_device_collection_changed)(cubeb * context, 75 cubeb_device_type devtype, 76 cubeb_device_collection_changed_callback callback, 77 void * user_ptr); 78 }; 79 80 #endif /* CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5 */ 81