blob: 1411d85227dae135d2094b98722b1c9066735c59 (
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* This file defines the <code>PPB_AudioInput_Dev</code> interface, which
* provides realtime audio input capture.
*/
label Chrome {
M17 = 0.1
};
/**
* <code>PPB_AudioInput_Callback</code> defines the type of an audio callback
* function used to provide the audio buffer with data. This callback will be
* called on a separate thread from the creation thread.
*/
typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer,
[in] uint32_t buffer_size_in_bytes,
[inout] mem_t user_data);
/**
* The <code>PPB_AudioInput_Dev</code> interface contains pointers to several
* functions for handling audio input resources.
*/
[version=0.1, macro="PPB_AUDIO_INPUT_DEV_INTERFACE"]
interface PPB_AudioInput_Dev {
/**
* Create is a pointer to a function that creates an audio input resource.
* No sound will be captured until StartCapture() is called.
*/
PP_Resource Create(
[in] PP_Instance instance,
[in] PP_Resource config,
[in] PPB_AudioInput_Callback audio_input_callback,
[inout] mem_t user_data);
/**
* IsAudioInput is a pointer to a function that determines if the given
* resource is an audio input resource.
*
* @param[in] resource A PP_Resource containing a resource.
*
* @return A PP_BOOL containing containing PP_TRUE if the given resource is
* an audio input resource, otherwise PP_FALSE.
*/
PP_Bool IsAudioInput(
[in] PP_Resource audio_input);
/**
* GetCurrrentConfig() returns an audio config resource for the given audio
* resource.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an audio
* resource.
*
* @return A <code>PP_Resource</code> containing the audio config resource if
* successful.
*/
PP_Resource GetCurrentConfig(
[in] PP_Resource audio_input);
/**
* StartCapture() starts the capture of the audio input resource and begins
* periodically calling the callback.
*
* @param[in] config A <code>PP_Resource</code> corresponding to an audio
* input resource.
*
* @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
* successful, otherwise <code>PP_FALSE</code>. Also returns
* <code>PP_TRUE</code> (and be a no-op) if called while callback is already
* in progress.
*/
PP_Bool StartCapture(
[in] PP_Resource audio_input);
/**
* StopCapture is a pointer to a function that stops the capture of
* the audio input resource.
*
* @param[in] config A PP_Resource containing the audio input resource.
*
* @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE.
* Also returns PP_TRUE (and is a no-op) if called while capture is already
* stopped. If a buffer is being captured, StopCapture will block until the
* call completes.
*/
PP_Bool StopCapture(
[in] PP_Resource audio_input);
};
|