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