Add git cl format presubmit warning for extension and apps.
[chromium-blink-merge.git] / ppapi / c / ppb_audio_frame.h
blob03265c48973a342163c0c44cc3ffef38083668d5
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 */
6 /* From ppb_audio_frame.idl modified Wed Jan 29 13:24:24 2014. */
8 #ifndef PPAPI_C_PPB_AUDIO_FRAME_H_
9 #define PPAPI_C_PPB_AUDIO_FRAME_H_
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"
17 #define PPB_AUDIOFRAME_INTERFACE_0_1 "PPB_AudioFrame;0.1" /* dev */
18 /**
19 * @file
20 * Defines the <code>PPB_AudioFrame</code> interface.
24 /**
25 * @addtogroup Enums
26 * @{
28 /**
29 * PP_AudioFrame_SampleRate is an enumeration of the different audio sample
30 * rates.
32 typedef enum {
33 PP_AUDIOFRAME_SAMPLERATE_UNKNOWN = 0,
34 PP_AUDIOFRAME_SAMPLERATE_8000 = 8000,
35 PP_AUDIOFRAME_SAMPLERATE_44100 = 44100
36 } PP_AudioFrame_SampleRate;
38 /**
39 * PP_AudioFrame_SampleSize is an enumeration of the different audio sample
40 * sizes.
42 typedef enum {
43 PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN = 0,
44 PP_AUDIOFRAME_SAMPLESIZE_16_BITS = 2
45 } PP_AudioFrame_SampleSize;
46 /**
47 * @}
50 /**
51 * @addtogroup Interfaces
52 * @{
54 struct PPB_AudioFrame_0_1 { /* dev */
55 /**
56 * Determines if a resource is an AudioFrame resource.
58 * @param[in] resource The <code>PP_Resource</code> to test.
60 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
61 * resource is an AudioFrame resource or <code>PP_FALSE</code> otherwise.
63 PP_Bool (*IsAudioFrame)(PP_Resource resource);
64 /**
65 * Gets the timestamp of the audio frame.
67 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
68 * resource.
70 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
71 * frame. Given in seconds since the start of the containing audio stream.
73 PP_TimeDelta (*GetTimestamp)(PP_Resource frame);
74 /**
75 * Sets the timestamp of the audio frame.
77 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
78 * resource.
79 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
80 * of the audio frame. Given in seconds since the start of the containing
81 * audio stream.
83 void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp);
84 /**
85 * Gets the sample rate of the audio frame.
87 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
88 * resource.
90 * @return The sample rate of the audio frame.
92 PP_AudioFrame_SampleRate (*GetSampleRate)(PP_Resource frame);
93 /**
94 * Gets the sample size of the audio frame.
96 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
97 * resource.
99 * @return The sample size of the audio frame.
101 PP_AudioFrame_SampleSize (*GetSampleSize)(PP_Resource frame);
103 * Gets the number of channels in the audio frame.
105 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
106 * resource.
108 * @return The number of channels in the audio frame.
110 uint32_t (*GetNumberOfChannels)(PP_Resource frame);
112 * Gets the number of samples in the audio frame.
114 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
115 * resource.
117 * @return The number of samples in the audio frame.
118 * For example, at a sampling rate of 44,100 Hz in stereo audio, a frame
119 * containing 4410 * 2 samples would have a duration of 100 milliseconds.
121 uint32_t (*GetNumberOfSamples)(PP_Resource frame);
123 * Gets the data buffer containing the audio frame samples.
125 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
126 * resource.
128 * @return A pointer to the beginning of the data buffer.
130 void* (*GetDataBuffer)(PP_Resource frame);
132 * Gets the size of the data buffer in bytes.
134 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
135 * resource.
137 * @return The size of the data buffer in bytes.
139 uint32_t (*GetDataBufferSize)(PP_Resource frame);
142 * @}
145 #endif /* PPAPI_C_PPB_AUDIO_FRAME_H_ */