| 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 MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ |
| 6 #define MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ | 6 #define MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "media/base/media_log.h" | 14 #include "media/base/media_log.h" |
| 15 #include "media/formats/webm/webm_parser.h" | 15 #include "media/formats/webm/webm_parser.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 class AudioDecoderConfig; | 18 class AudioDecoderConfig; |
| 19 class EncryptionScheme; | 19 class EncryptionScheme; |
| 20 | 20 |
| 21 // Helper class used to parse an Audio element inside a TrackEntry element. | 21 // Helper class used to parse an Audio element inside a TrackEntry element. |
| 22 class WebMAudioClient : public WebMParserClient { | 22 class WebMAudioClient : public WebMParserClient { |
| 23 public: | 23 public: |
| 24 explicit WebMAudioClient(const scoped_refptr<MediaLog>& media_log); | 24 explicit WebMAudioClient(MediaLog* media_log); |
| 25 ~WebMAudioClient() override; | 25 ~WebMAudioClient() override; |
| 26 | 26 |
| 27 // Reset this object's state so it can process a new audio track element. | 27 // Reset this object's state so it can process a new audio track element. |
| 28 void Reset(); | 28 void Reset(); |
| 29 | 29 |
| 30 // Initialize |config| with the data in |codec_id|, |codec_private|, | 30 // Initialize |config| with the data in |codec_id|, |codec_private|, |
| 31 // |encryption_scheme| and the fields parsed from the last audio track element | 31 // |encryption_scheme| and the fields parsed from the last audio track element |
| 32 // this object was used to parse. | 32 // this object was used to parse. |
| 33 // Returns true if |config| was successfully initialized. | 33 // Returns true if |config| was successfully initialized. |
| 34 // Returns false if there was unexpected values in the provided parameters or | 34 // Returns false if there was unexpected values in the provided parameters or |
| 35 // audio track element fields. | 35 // audio track element fields. |
| 36 bool InitializeConfig(const std::string& codec_id, | 36 bool InitializeConfig(const std::string& codec_id, |
| 37 const std::vector<uint8_t>& codec_private, | 37 const std::vector<uint8_t>& codec_private, |
| 38 const int64_t seek_preroll, | 38 const int64_t seek_preroll, |
| 39 const int64_t codec_delay, | 39 const int64_t codec_delay, |
| 40 const EncryptionScheme& encryption_scheme, | 40 const EncryptionScheme& encryption_scheme, |
| 41 AudioDecoderConfig* config); | 41 AudioDecoderConfig* config); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // WebMParserClient implementation. | 44 // WebMParserClient implementation. |
| 45 bool OnUInt(int id, int64_t val) override; | 45 bool OnUInt(int id, int64_t val) override; |
| 46 bool OnFloat(int id, double val) override; | 46 bool OnFloat(int id, double val) override; |
| 47 | 47 |
| 48 scoped_refptr<MediaLog> media_log_; | 48 MediaLog* media_log_; |
| 49 int channels_; | 49 int channels_; |
| 50 double samples_per_second_; | 50 double samples_per_second_; |
| 51 double output_samples_per_second_; | 51 double output_samples_per_second_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebMAudioClient); | 53 DISALLOW_COPY_AND_ASSIGN(WebMAudioClient); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace media | 56 } // namespace media |
| 57 | 57 |
| 58 #endif // MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ | 58 #endif // MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_ |
| OLD | NEW |