| OLD | NEW |
| 1 /* Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * Defines the <code>PPB_AudioFrame</code> interface. | 7 * Defines the <code>PPB_AudioBuffer</code> interface. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 [generate_thunk] | 10 [generate_thunk] |
| 11 | 11 |
| 12 label Chrome { | 12 label Chrome { |
| 13 [channel=dev] M34 = 0.1 | 13 [channel=dev] M34 = 0.1 |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * PP_AudioFrame_SampleRate is an enumeration of the different audio sample | 17 * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample |
| 18 * rates. | 18 * rates. |
| 19 */ | 19 */ |
| 20 enum PP_AudioFrame_SampleRate { | 20 enum PP_AudioBuffer_SampleRate { |
| 21 PP_AUDIOFRAME_SAMPLERATE_UNKNOWN = 0, | 21 PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0, |
| 22 PP_AUDIOFRAME_SAMPLERATE_8000 = 8000, | 22 PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000, |
| 23 PP_AUDIOFRAME_SAMPLERATE_44100 = 44100 | 23 PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100 |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * PP_AudioFrame_SampleSize is an enumeration of the different audio sample | 27 * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample |
| 28 * sizes. | 28 * sizes. |
| 29 */ | 29 */ |
| 30 enum PP_AudioFrame_SampleSize { | 30 enum PP_AudioBuffer_SampleSize { |
| 31 PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN = 0, | 31 PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0, |
| 32 PP_AUDIOFRAME_SAMPLESIZE_16_BITS = 2 | 32 PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2 |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 interface PPB_AudioFrame { | 35 interface PPB_AudioBuffer { |
| 36 /** | 36 /** |
| 37 * Determines if a resource is an AudioFrame resource. | 37 * Determines if a resource is an AudioBuffer resource. |
| 38 * | 38 * |
| 39 * @param[in] resource The <code>PP_Resource</code> to test. | 39 * @param[in] resource The <code>PP_Resource</code> to test. |
| 40 * | 40 * |
| 41 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 41 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 42 * resource is an AudioFrame resource or <code>PP_FALSE</code> otherwise. | 42 * resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise. |
| 43 */ | 43 */ |
| 44 PP_Bool IsAudioFrame([in] PP_Resource resource); | 44 PP_Bool IsAudioBuffer([in] PP_Resource resource); |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Gets the timestamp of the audio frame. | 47 * Gets the timestamp of the audio buffer. |
| 48 * | 48 * |
| 49 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 49 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 50 * resource. | 50 * buffer resource. |
| 51 * | 51 * |
| 52 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio | 52 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio |
| 53 * frame. Given in seconds since the start of the containing audio stream. | 53 * buffer. Given in seconds since the start of the containing audio stream. |
| 54 */ | 54 */ |
| 55 [on_failure=0.0] | 55 [on_failure=0.0] |
| 56 PP_TimeDelta GetTimestamp([in] PP_Resource frame); | 56 PP_TimeDelta GetTimestamp([in] PP_Resource buffer); |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Sets the timestamp of the audio frame. | 59 * Sets the timestamp of the audio buffer. |
| 60 * | 60 * |
| 61 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 61 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 62 * resource. | 62 * buffer resource. |
| 63 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp | 63 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp |
| 64 * of the audio frame. Given in seconds since the start of the containing | 64 * of the audio buffer. Given in seconds since the start of the containing |
| 65 * audio stream. | 65 * audio stream. |
| 66 */ | 66 */ |
| 67 void SetTimestamp([in] PP_Resource frame, [in] PP_TimeDelta timestamp); | 67 void SetTimestamp([in] PP_Resource buffer, [in] PP_TimeDelta timestamp); |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Gets the sample rate of the audio frame. | 70 * Gets the sample rate of the audio buffer. |
| 71 * | 71 * |
| 72 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 72 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 73 * resource. | 73 * buffer resource. |
| 74 * | 74 * |
| 75 * @return The sample rate of the audio frame. | 75 * @return The sample rate of the audio buffer. |
| 76 */ | 76 */ |
| 77 [on_failure=PP_AUDIOFRAME_SAMPLERATE_UNKNOWN] | 77 [on_failure=PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN] |
| 78 PP_AudioFrame_SampleRate GetSampleRate([in] PP_Resource frame); | 78 PP_AudioBuffer_SampleRate GetSampleRate([in] PP_Resource buffer); |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Gets the sample size of the audio frame. | 81 * Gets the sample size of the audio buffer. |
| 82 * | 82 * |
| 83 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 83 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 84 * resource. | 84 * buffer resource. |
| 85 * | 85 * |
| 86 * @return The sample size of the audio frame. | 86 * @return The sample size of the audio buffer. |
| 87 */ | 87 */ |
| 88 [on_failure=PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN] | 88 [on_failure=PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN] |
| 89 PP_AudioFrame_SampleSize GetSampleSize([in] PP_Resource frame); | 89 PP_AudioBuffer_SampleSize GetSampleSize([in] PP_Resource buffer); |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * Gets the number of channels in the audio frame. | 92 * Gets the number of channels in the audio buffer. |
| 93 * | 93 * |
| 94 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 94 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 95 * resource. | 95 * buffer resource. |
| 96 * | 96 * |
| 97 * @return The number of channels in the audio frame. | 97 * @return The number of channels in the audio buffer. |
| 98 */ | 98 */ |
| 99 uint32_t GetNumberOfChannels([in] PP_Resource frame); | 99 uint32_t GetNumberOfChannels([in] PP_Resource buffer); |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * Gets the number of samples in the audio frame. | 102 * Gets the number of samples in the audio buffer. |
| 103 * | 103 * |
| 104 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 104 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 105 * resource. | 105 * buffer resource. |
| 106 * | 106 * |
| 107 * @return The number of samples in the audio frame. | 107 * @return The number of samples in the audio buffer. |
| 108 * For example, at a sampling rate of 44,100 Hz in stereo audio, a frame | 108 * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer |
| 109 * containing 4410 * 2 samples would have a duration of 100 milliseconds. | 109 * containing 4410 * 2 samples would have a duration of 100 milliseconds. |
| 110 */ | 110 */ |
| 111 uint32_t GetNumberOfSamples([in] PP_Resource frame); | 111 uint32_t GetNumberOfSamples([in] PP_Resource buffer); |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * Gets the data buffer containing the audio frame samples. | 114 * Gets the data buffer containing the audio samples. |
| 115 * | 115 * |
| 116 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 116 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 117 * resource. | 117 * buffer resource. |
| 118 * | 118 * |
| 119 * @return A pointer to the beginning of the data buffer. | 119 * @return A pointer to the beginning of the data buffer. |
| 120 */ | 120 */ |
| 121 mem_t GetDataBuffer([in] PP_Resource frame); | 121 mem_t GetDataBuffer([in] PP_Resource buffer); |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Gets the size of the data buffer in bytes. | 124 * Gets the size of the data buffer in bytes. |
| 125 * | 125 * |
| 126 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame | 126 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio |
| 127 * resource. | 127 * buffer resource. |
| 128 * | 128 * |
| 129 * @return The size of the data buffer in bytes. | 129 * @return The size of the data buffer in bytes. |
| 130 */ | 130 */ |
| 131 uint32_t GetDataBufferSize([in] PP_Resource frame); | 131 uint32_t GetDataBufferSize([in] PP_Resource buffer); |
| 132 }; | 132 }; |
| OLD | NEW |