| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_AUDIO_DECODER_CONFIG_H_ | 5 #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
| 6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ | 6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 kCodecAC3 = 16, | 42 kCodecAC3 = 16, |
| 43 // DO NOT ADD RANDOM AUDIO CODECS! | 43 // DO NOT ADD RANDOM AUDIO CODECS! |
| 44 // | 44 // |
| 45 // The only acceptable time to add a new codec is if there is production code | 45 // The only acceptable time to add a new codec is if there is production code |
| 46 // that uses said codec in the same CL. | 46 // that uses said codec in the same CL. |
| 47 | 47 |
| 48 // Must always be equal to the largest entry ever logged. | 48 // Must always be equal to the largest entry ever logged. |
| 49 kAudioCodecMax = kCodecAC3, | 49 kAudioCodecMax = kCodecAC3, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 std::string MEDIA_EXPORT GetCodecName(AudioCodec codec); |
| 53 |
| 52 // TODO(dalecurtis): FFmpeg API uses |bytes_per_channel| instead of | 54 // TODO(dalecurtis): FFmpeg API uses |bytes_per_channel| instead of |
| 53 // |bits_per_channel|, we should switch over since bits are generally confusing | 55 // |bits_per_channel|, we should switch over since bits are generally confusing |
| 54 // to work with. | 56 // to work with. |
| 55 class MEDIA_EXPORT AudioDecoderConfig { | 57 class MEDIA_EXPORT AudioDecoderConfig { |
| 56 public: | 58 public: |
| 57 // Constructs an uninitialized object. Clients should call Initialize() with | 59 // Constructs an uninitialized object. Clients should call Initialize() with |
| 58 // appropriate values before using. | 60 // appropriate values before using. |
| 59 AudioDecoderConfig(); | 61 AudioDecoderConfig(); |
| 60 | 62 |
| 61 // Constructs an initialized object. | 63 // Constructs an initialized object. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 83 bool IsValidConfig() const; | 85 bool IsValidConfig() const; |
| 84 | 86 |
| 85 // Returns true if all fields in |config| match this config. | 87 // Returns true if all fields in |config| match this config. |
| 86 // Note: The contents of |extra_data_| are compared not the raw pointers. | 88 // Note: The contents of |extra_data_| are compared not the raw pointers. |
| 87 bool Matches(const AudioDecoderConfig& config) const; | 89 bool Matches(const AudioDecoderConfig& config) const; |
| 88 | 90 |
| 89 // Returns a human-readable string describing |*this|. For debugging & test | 91 // Returns a human-readable string describing |*this|. For debugging & test |
| 90 // output only. | 92 // output only. |
| 91 std::string AsHumanReadableString() const; | 93 std::string AsHumanReadableString() const; |
| 92 | 94 |
| 93 std::string GetHumanReadableCodecName() const; | |
| 94 | |
| 95 AudioCodec codec() const { return codec_; } | 95 AudioCodec codec() const { return codec_; } |
| 96 int bits_per_channel() const { return bytes_per_channel_ * 8; } | 96 int bits_per_channel() const { return bytes_per_channel_ * 8; } |
| 97 int bytes_per_channel() const { return bytes_per_channel_; } | 97 int bytes_per_channel() const { return bytes_per_channel_; } |
| 98 ChannelLayout channel_layout() const { return channel_layout_; } | 98 ChannelLayout channel_layout() const { return channel_layout_; } |
| 99 int samples_per_second() const { return samples_per_second_; } | 99 int samples_per_second() const { return samples_per_second_; } |
| 100 SampleFormat sample_format() const { return sample_format_; } | 100 SampleFormat sample_format() const { return sample_format_; } |
| 101 int bytes_per_frame() const { return bytes_per_frame_; } | 101 int bytes_per_frame() const { return bytes_per_frame_; } |
| 102 base::TimeDelta seek_preroll() const { return seek_preroll_; } | 102 base::TimeDelta seek_preroll() const { return seek_preroll_; } |
| 103 int codec_delay() const { return codec_delay_; } | 103 int codec_delay() const { return codec_delay_; } |
| 104 | 104 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 131 int codec_delay_; | 131 int codec_delay_; |
| 132 | 132 |
| 133 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler | 133 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
| 134 // generated copy constructor and assignment operator. Since the extra data is | 134 // generated copy constructor and assignment operator. Since the extra data is |
| 135 // typically small, the performance impact is minimal. | 135 // typically small, the performance impact is minimal. |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace media | 138 } // namespace media |
| 139 | 139 |
| 140 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ | 140 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ |
| OLD | NEW |