Pepper_47_C_interfaces
ppb_audio_buffer.h
Go to the documentation of this file.
1 /* Copyright 2014 The Chromium Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 /* From ppb_audio_buffer.idl modified Thu Oct 20 13:57:04 2016. */
7 
8 #ifndef PPAPI_C_PPB_AUDIO_BUFFER_H_
9 #define PPAPI_C_PPB_AUDIO_BUFFER_H_
10 
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_time.h"
16 
17 #define PPB_AUDIOBUFFER_INTERFACE_0_1 "PPB_AudioBuffer;0.1"
18 #define PPB_AUDIOBUFFER_INTERFACE PPB_AUDIOBUFFER_INTERFACE_0_1
19 
20 /**
21  * @file
22  * Defines the <code>PPB_AudioBuffer</code> interface.
23  */
24 
25 
26 /**
27  * @addtogroup Enums
28  * @{
29  */
30 /**
31  * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
32  * rates.
33  */
34 typedef enum {
45 
46 /**
47  * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
48  * sizes.
49  */
50 typedef enum {
54 /**
55  * @}
56  */
57 
58 /**
59  * @addtogroup Interfaces
60  * @{
61  */
63  /**
64  * Determines if a resource is an AudioBuffer resource.
65  *
66  * @param[in] resource The <code>PP_Resource</code> to test.
67  *
68  * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
69  * resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise.
70  */
72  /**
73  * Gets the timestamp of the audio buffer.
74  *
75  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
76  * buffer resource.
77  *
78  * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
79  * buffer. Given in seconds since the start of the containing audio stream.
80  */
82  /**
83  * Sets the timestamp of the audio buffer.
84  *
85  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
86  * buffer resource.
87  * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
88  * of the audio buffer. Given in seconds since the start of the containing
89  * audio stream.
90  */
91  void (*SetTimestamp)(PP_Resource buffer, PP_TimeDelta timestamp);
92  /**
93  * Gets the sample rate of the audio buffer.
94  *
95  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
96  * buffer resource.
97  *
98  * @return The sample rate of the audio buffer.
99  */
101  /**
102  * Gets the sample size of the audio buffer.
103  *
104  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
105  * buffer resource.
106  *
107  * @return The sample size of the audio buffer.
108  */
110  /**
111  * Gets the number of channels in the audio buffer.
112  *
113  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
114  * buffer resource.
115  *
116  * @return The number of channels in the audio buffer.
117  */
118  uint32_t (*GetNumberOfChannels)(PP_Resource buffer);
119  /**
120  * Gets the number of samples in the audio buffer.
121  *
122  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
123  * buffer resource.
124  *
125  * @return The number of samples in the audio buffer.
126  * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer
127  * containing 4410 * 2 samples would have a duration of 100 milliseconds.
128  */
129  uint32_t (*GetNumberOfSamples)(PP_Resource buffer);
130  /**
131  * Gets the data buffer containing the audio samples.
132  *
133  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
134  * buffer resource.
135  *
136  * @return A pointer to the beginning of the data buffer.
137  */
138  void* (*GetDataBuffer)(PP_Resource buffer);
139  /**
140  * Gets the size of the data buffer in bytes.
141  *
142  * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
143  * buffer resource.
144  *
145  * @return The size of the data buffer in bytes.
146  */
147  uint32_t (*GetDataBufferSize)(PP_Resource buffer);
148 };
149 
151 /**
152  * @}
153  */
154 
155 #endif /* PPAPI_C_PPB_AUDIO_BUFFER_H_ */
156 
void(* SetTimestamp)(PP_Resource buffer, PP_TimeDelta timestamp)
uint32_t(* GetNumberOfChannels)(PP_Resource buffer)
uint32_t(* GetDataBufferSize)(PP_Resource buffer)
PP_AudioBuffer_SampleSize
int32_t PP_Resource
Definition: pp_resource.h:40
PP_AudioBuffer_SampleSize(* GetSampleSize)(PP_Resource buffer)
PP_AudioBuffer_SampleRate
PP_AudioBuffer_SampleRate(* GetSampleRate)(PP_Resource buffer)
PP_Bool(* IsAudioBuffer)(PP_Resource resource)
PP_TimeDelta(* GetTimestamp)(PP_Resource buffer)
PP_Bool
Definition: pp_bool.h:30
double PP_TimeDelta
Definition: pp_time.h:49
uint32_t(* GetNumberOfSamples)(PP_Resource buffer)