Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / ppapi / c / ppb_audio_frame.h
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_frame.idl modified Wed Jan 22 21:25:31 2014. */
7
8 #ifndef PPAPI_C_PPB_AUDIO_FRAME_H_
9 #define PPAPI_C_PPB_AUDIO_FRAME_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_AUDIOFRAME_INTERFACE_0_1 "PPB_AudioFrame;0.1" /* dev */
18 /**
19  * @file
20  * Defines the <code>PPB_AudioFrame</code> interface.
21  */
22
23
24 /**
25  * @addtogroup Enums
26  * @{
27  */
28 /**
29  * PP_AudioFrame_SampleRate is an enumeration of the different audio sample
30  * rates.
31  */
32 typedef enum {
33   PP_AUDIOFRAME_SAMPLERATE_UNKNOWN = 0,
34   PP_AUDIOFRAME_SAMPLERATE_44100 = 44100
35 } PP_AudioFrame_SampleRate;
36
37 /**
38  * PP_AudioFrame_SampleSize is an enumeration of the different audio sample
39  * sizes.
40  */
41 typedef enum {
42   PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN = 0,
43   PP_AUDIOFRAME_SAMPLESIZE_16_BITS = 2
44 } PP_AudioFrame_SampleSize;
45 /**
46  * @}
47  */
48
49 /**
50  * @addtogroup Interfaces
51  * @{
52  */
53 struct PPB_AudioFrame_0_1 { /* dev */
54   /**
55    * Determines if a resource is an AudioFrame resource.
56    *
57    * @param[in] resource The <code>PP_Resource</code> to test.
58    *
59    * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
60    * resource is an AudioFrame resource or <code>PP_FALSE</code> otherwise.
61    */
62   PP_Bool (*IsAudioFrame)(PP_Resource resource);
63   /**
64    * Gets the timestamp of the audio frame.
65    *
66    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
67    * resource.
68    *
69    * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
70    * frame. Given in seconds since the start of the containing audio stream.
71    */
72   PP_TimeDelta (*GetTimestamp)(PP_Resource frame);
73   /**
74    * Sets the timestamp of the audio frame.
75    *
76    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
77    * resource.
78    * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
79    * of the audio frame. Given in seconds since the start of the containing
80    * audio stream.
81    */
82   void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp);
83   /**
84    * Gets the sample size of the audio frame.
85    *
86    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
87    * resource.
88    *
89    * @return The sample size of the audio frame.
90    */
91   PP_AudioFrame_SampleSize (*GetSampleSize)(PP_Resource frame);
92   /**
93    * Gets the number of channels in the audio frame.
94    *
95    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
96    * resource.
97    *
98    * @return The number of channels in the audio frame.
99    */
100   uint32_t (*GetNumberOfChannels)(PP_Resource frame);
101   /**
102    * Gets the number of samples in the audio frame.
103    *
104    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
105    * resource.
106    *
107    * @return The number of samples in the audio frame.
108    * For example, at a sampling rate of 44,100 Hz in stereo audio, a frame
109    * containing 4410 * 2 samples would have a duration of 100 milliseconds.
110    */
111   uint32_t (*GetNumberOfSamples)(PP_Resource frame);
112   /**
113    * Gets the data buffer containing the audio frame samples.
114    *
115    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
116    * resource.
117    *
118    * @return A pointer to the beginning of the data buffer.
119    */
120   void* (*GetDataBuffer)(PP_Resource frame);
121   /**
122    * Gets the size of the data buffer in bytes.
123    *
124    * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame
125    * resource.
126    *
127    * @return The size of the data buffer in bytes.
128    */
129   uint32_t (*GetDataBufferSize)(PP_Resource frame);
130 };
131 /**
132  * @}
133  */
134
135 #endif  /* PPAPI_C_PPB_AUDIO_FRAME_H_ */
136