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