summaryrefslogtreecommitdiffstats
path: root/media/libcubeb/src/cubeb-internal.h
blob: 8357cdc7e18938af634ac05a0186cb27fa97b0e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright © 2013 Mozilla Foundation
 *
 * This program is made available under an ISC-style license.  See the
 * accompanying file LICENSE for details.
 */
#if !defined(CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5)
#define CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5

#include "cubeb/cubeb.h"
#include "cubeb_assert.h"
#include "cubeb_log.h"
#include <stdio.h>
#include <string.h>

#ifdef __clang__
#ifndef CLANG_ANALYZER_NORETURN
#if __has_feature(attribute_analyzer_noreturn)
#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
#else
#define CLANG_ANALYZER_NORETURN
#endif // ifndef CLANG_ANALYZER_NORETURN
#endif // __has_feature(attribute_analyzer_noreturn)
#else  // __clang__
#define CLANG_ANALYZER_NORETURN
#endif

#if defined(__cplusplus)
extern "C" {
#endif

#if defined(__cplusplus)
}
#endif

struct cubeb_ops {
  int (*init)(cubeb ** context, char const * context_name);
  char const * (*get_backend_id)(cubeb * context);
  int (*get_max_channel_count)(cubeb * context, uint32_t * max_channels);
  int (*get_min_latency)(cubeb * context, cubeb_stream_params params,
                         uint32_t * latency_ms);
  int (*get_preferred_sample_rate)(cubeb * context, uint32_t * rate);
  int (*get_supported_input_processing_params)(
      cubeb * context, cubeb_input_processing_params * params);
  int (*enumerate_devices)(cubeb * context, cubeb_device_type type,
                           cubeb_device_collection * collection);
  int (*device_collection_destroy)(cubeb * context,
                                   cubeb_device_collection * collection);
  void (*destroy)(cubeb * context);
  int (*stream_init)(cubeb * context, cubeb_stream ** stream,
                     char const * stream_name, cubeb_devid input_device,
                     cubeb_stream_params * input_stream_params,
                     cubeb_devid output_device,
                     cubeb_stream_params * output_stream_params,
                     unsigned int latency, cubeb_data_callback data_callback,
                     cubeb_state_callback state_callback, void * user_ptr);
  void (*stream_destroy)(cubeb_stream * stream);
  int (*stream_start)(cubeb_stream * stream);
  int (*stream_stop)(cubeb_stream * stream);
  int (*stream_get_position)(cubeb_stream * stream, uint64_t * position);
  int (*stream_get_latency)(cubeb_stream * stream, uint32_t * latency);
  int (*stream_get_input_latency)(cubeb_stream * stream, uint32_t * latency);
  int (*stream_set_volume)(cubeb_stream * stream, float volumes);
  int (*stream_set_name)(cubeb_stream * stream, char const * stream_name);
  int (*stream_get_current_device)(cubeb_stream * stream,
                                   cubeb_device ** const device);
  int (*stream_set_input_mute)(cubeb_stream * stream, int mute);
  int (*stream_set_input_processing_params)(
      cubeb_stream * stream, cubeb_input_processing_params params);
  int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device);
  int (*stream_register_device_changed_callback)(
      cubeb_stream * stream,
      cubeb_device_changed_callback device_changed_callback);
  int (*register_device_collection_changed)(
      cubeb * context, cubeb_device_type devtype,
      cubeb_device_collection_changed_callback callback, void * user_ptr);
};

#endif /* CUBEB_INTERNAL_0eb56756_4e20_4404_a76d_42bf88cd15a5 */