| 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_H_ | 5 #ifndef MEDIA_BASE_AUDIO_DECODER_H_ |
| 6 #define MEDIA_BASE_AUDIO_DECODER_H_ | 6 #define MEDIA_BASE_AUDIO_DECODER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "media/base/audio_decoder_config.h" | 13 #include "media/base/audio_decoder_config.h" |
| 14 #include "media/base/channel_layout.h" | 14 #include "media/base/channel_layout.h" |
| 15 #include "media/base/decode_status.h" |
| 15 #include "media/base/decoder_buffer.h" | 16 #include "media/base/decoder_buffer.h" |
| 16 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
| 17 #include "media/base/pipeline_status.h" | 18 #include "media/base/pipeline_status.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 class AudioBuffer; | 22 class AudioBuffer; |
| 22 class CdmContext; | 23 class CdmContext; |
| 23 class DemuxerStream; | 24 class DemuxerStream; |
| 24 | 25 |
| 25 class MEDIA_EXPORT AudioDecoder { | 26 class MEDIA_EXPORT AudioDecoder { |
| 26 public: | 27 public: |
| 27 // Status codes for decode operations. | |
| 28 // TODO(rileya): Now that both AudioDecoder and VideoDecoder Status enums | |
| 29 // match, break them into a decoder_status.h. | |
| 30 enum Status { | |
| 31 kOk, // We're all good. | |
| 32 kAborted, // We aborted as a result of Reset() or destruction. | |
| 33 kDecodeError // A decoding error occurred. | |
| 34 }; | |
| 35 | |
| 36 // Callback for VideoDecoder initialization. | 28 // Callback for VideoDecoder initialization. |
| 37 typedef base::Callback<void(bool success)> InitCB; | 29 typedef base::Callback<void(bool success)> InitCB; |
| 38 | 30 |
| 39 // Callback for AudioDecoder to return a decoded frame whenever it becomes | 31 // Callback for AudioDecoder to return a decoded frame whenever it becomes |
| 40 // available. Only non-EOS frames should be returned via this callback. | 32 // available. Only non-EOS frames should be returned via this callback. |
| 41 typedef base::Callback<void(const scoped_refptr<AudioBuffer>&)> OutputCB; | 33 typedef base::Callback<void(const scoped_refptr<AudioBuffer>&)> OutputCB; |
| 42 | 34 |
| 43 // Callback for Decode(). Called after the decoder has accepted corresponding | 35 // Callback for Decode(). Called after the decoder has accepted corresponding |
| 44 // DecoderBuffer, indicating that the pipeline can send next buffer to decode. | 36 // DecoderBuffer, indicating that the pipeline can send next buffer to decode. |
| 45 typedef base::Callback<void(Status)> DecodeCB; | 37 typedef base::Callback<void(DecodeStatus)> DecodeCB; |
| 46 | 38 |
| 47 AudioDecoder(); | 39 AudioDecoder(); |
| 48 | 40 |
| 49 // Fires any pending callbacks, stops and destroys the decoder. | 41 // Fires any pending callbacks, stops and destroys the decoder. |
| 50 // Note: Since this is a destructor, |this| will be destroyed after this call. | 42 // Note: Since this is a destructor, |this| will be destroyed after this call. |
| 51 // Make sure the callbacks fired from this call doesn't post any task that | 43 // Make sure the callbacks fired from this call doesn't post any task that |
| 52 // depends on |this|. | 44 // depends on |this|. |
| 53 virtual ~AudioDecoder(); | 45 virtual ~AudioDecoder(); |
| 54 | 46 |
| 55 // Returns the name of the decoder for logging purpose. | 47 // Returns the name of the decoder for logging purpose. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Returns true if the decoder needs bitstream conversion before decoding. | 80 // Returns true if the decoder needs bitstream conversion before decoding. |
| 89 virtual bool NeedsBitstreamConversion() const; | 81 virtual bool NeedsBitstreamConversion() const; |
| 90 | 82 |
| 91 private: | 83 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 84 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
| 93 }; | 85 }; |
| 94 | 86 |
| 95 } // namespace media | 87 } // namespace media |
| 96 | 88 |
| 97 #endif // MEDIA_BASE_AUDIO_DECODER_H_ | 89 #endif // MEDIA_BASE_AUDIO_DECODER_H_ |
| OLD | NEW |