| 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 #ifndef PPAPI_CPP_AUDIO_FRAME_H_ | 5 #ifndef PPAPI_CPP_AUDIO_BUFFER_H_ |
| 6 #define PPAPI_CPP_AUDIO_FRAME_H_ | 6 #define PPAPI_CPP_AUDIO_BUFFER_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/ppb_audio_frame.h" | 8 #include "ppapi/c/ppb_audio_buffer.h" |
| 9 #include "ppapi/cpp/resource.h" | 9 #include "ppapi/cpp/resource.h" |
| 10 | 10 |
| 11 namespace pp { | 11 namespace pp { |
| 12 | 12 |
| 13 class AudioFrame : public Resource { | 13 class AudioBuffer : public Resource { |
| 14 public: | 14 public: |
| 15 /// Default constructor for creating an is_null() | 15 /// Default constructor for creating an is_null() |
| 16 /// <code>AudioFrame</code> object. | 16 /// <code>AudioBuffer</code> object. |
| 17 AudioFrame(); | 17 AudioBuffer(); |
| 18 | 18 |
| 19 /// The copy constructor for <code>AudioFrame</code>. | 19 /// The copy constructor for <code>AudioBuffer</code>. |
| 20 /// | 20 /// |
| 21 /// @param[in] other A reference to an <code>AudioFrame</code>. | 21 /// @param[in] other A reference to an <code>AudioBuffer</code>. |
| 22 AudioFrame(const AudioFrame& other); | 22 AudioBuffer(const AudioBuffer& other); |
| 23 | 23 |
| 24 /// Constructs an <code>AudioFrame</code> from a <code>Resource</code>. | 24 /// Constructs an <code>AudioBuffer</code> from a <code>Resource</code>. |
| 25 /// | 25 /// |
| 26 /// @param[in] resource A <code>PPB_AudioFrame</code> resource. | 26 /// @param[in] resource A <code>PPB_AudioBuffer</code> resource. |
| 27 explicit AudioFrame(const Resource& resource); | 27 explicit AudioBuffer(const Resource& resource); |
| 28 | 28 |
| 29 /// A constructor used when you have received a <code>PP_Resource</code> as a | 29 /// A constructor used when you have received a <code>PP_Resource</code> as a |
| 30 /// return value that has had 1 ref added for you. | 30 /// return value that has had 1 ref added for you. |
| 31 /// | 31 /// |
| 32 /// @param[in] resource A <code>PPB_AudioFrame</code> resource. | 32 /// @param[in] resource A <code>PPB_AudioBuffer</code> resource. |
| 33 AudioFrame(PassRef, PP_Resource resource); | 33 AudioBuffer(PassRef, PP_Resource resource); |
| 34 | 34 |
| 35 virtual ~AudioFrame(); | 35 virtual ~AudioBuffer(); |
| 36 | 36 |
| 37 /// Gets the timestamp of the audio frame. | 37 /// Gets the timestamp of the audio buffer. |
| 38 /// | 38 /// |
| 39 /// @return A <code>PP_TimeDelta</code> containing the timestamp of the audio | 39 /// @return A <code>PP_TimeDelta</code> containing the timestamp of the audio |
| 40 /// frame. Given in seconds since the start of the containing audio stream. | 40 /// buffer. Given in seconds since the start of the containing audio stream. |
| 41 PP_TimeDelta GetTimestamp() const; | 41 PP_TimeDelta GetTimestamp() const; |
| 42 | 42 |
| 43 /// Sets the timestamp of the audio frame. | 43 /// Sets the timestamp of the audio buffer. |
| 44 /// | 44 /// |
| 45 /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp | 45 /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp |
| 46 /// of the audio frame. Given in seconds since the start of the containing | 46 /// of the audio buffer. Given in seconds since the start of the containing |
| 47 /// audio stream. | 47 /// audio stream. |
| 48 void SetTimestamp(PP_TimeDelta timestamp); | 48 void SetTimestamp(PP_TimeDelta timestamp); |
| 49 | 49 |
| 50 /// Gets the sample rate of the audio frame. | 50 /// Gets the sample rate of the audio buffer. |
| 51 /// | 51 /// |
| 52 /// @return The sample rate of the audio frame. | 52 /// @return The sample rate of the audio buffer. |
| 53 PP_AudioFrame_SampleRate GetSampleRate() const; | 53 PP_AudioBuffer_SampleRate GetSampleRate() const; |
| 54 | 54 |
| 55 /// Gets the sample size of the audio frame in bytes. | 55 /// Gets the sample size of the audio buffer in bytes. |
| 56 /// | 56 /// |
| 57 /// @return The sample size of the audio frame in bytes. | 57 /// @return The sample size of the audio buffer in bytes. |
| 58 PP_AudioFrame_SampleSize GetSampleSize() const; | 58 PP_AudioBuffer_SampleSize GetSampleSize() const; |
| 59 | 59 |
| 60 /// Gets the number of channels in the audio frame. | 60 /// Gets the number of channels in the audio buffer. |
| 61 /// | 61 /// |
| 62 /// @return The number of channels in the audio frame. | 62 /// @return The number of channels in the audio buffer. |
| 63 uint32_t GetNumberOfChannels() const; | 63 uint32_t GetNumberOfChannels() const; |
| 64 | 64 |
| 65 /// Gets the number of samples in the audio frame. | 65 /// Gets the number of samples in the audio buffer. |
| 66 /// | 66 /// |
| 67 /// @return The number of samples in the audio frame. | 67 /// @return The number of samples in the audio buffer. |
| 68 /// For example, at a sampling rate of 44,100 Hz in stereo audio, a frame | 68 /// For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer |
| 69 /// containing 4,410 * 2 samples would have a duration of 100 milliseconds. | 69 /// containing 4,410 * 2 samples would have a duration of 100 milliseconds. |
| 70 uint32_t GetNumberOfSamples() const; | 70 uint32_t GetNumberOfSamples() const; |
| 71 | 71 |
| 72 /// Gets the data buffer containing the audio frame samples. | 72 /// Gets the data buffer containing the audio buffer samples. |
| 73 /// | 73 /// |
| 74 /// @return A pointer to the beginning of the data buffer. | 74 /// @return A pointer to the beginning of the data buffer. |
| 75 void* GetDataBuffer(); | 75 void* GetDataBuffer(); |
| 76 | 76 |
| 77 /// Gets the size of data buffer in bytes. | 77 /// Gets the size of data buffer in bytes. |
| 78 /// | 78 /// |
| 79 /// @return The size of the data buffer in bytes. | 79 /// @return The size of the data buffer in bytes. |
| 80 uint32_t GetDataBufferSize() const; | 80 uint32_t GetDataBufferSize() const; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace pp | 83 } // namespace pp |
| 84 | 84 |
| 85 #endif // PPAPI_CPP_AUDIO_FRAME_H_ | 85 #endif // PPAPI_CPP_AUDIO_BUFFER_H_ |
| OLD | NEW |