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