OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ |
6 #define CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ | 6 #define CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
15 } // namespace base | 16 } // namespace base |
16 | 17 |
17 namespace chromecast { | 18 namespace chromecast { |
18 namespace media { | 19 namespace media { |
19 struct AudioConfig; | 20 struct AudioConfig; |
20 class DecoderBufferBase; | 21 class DecoderBufferBase; |
21 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
36 // |success| is true if initialization was successful; if |success| is false | 37 // |success| is true if initialization was successful; if |success| is false |
37 // then the CastAudioDecoder instance is unusable and should be destroyed. | 38 // then the CastAudioDecoder instance is unusable and should be destroyed. |
38 typedef base::Callback<void(bool success)> InitializedCallback; | 39 typedef base::Callback<void(bool success)> InitializedCallback; |
39 typedef base::Callback<void( | 40 typedef base::Callback<void( |
40 Status status, | 41 Status status, |
41 const scoped_refptr<media::DecoderBufferBase>& decoded)> DecodeCallback; | 42 const scoped_refptr<media::DecoderBufferBase>& decoded)> DecodeCallback; |
42 | 43 |
43 // Creates a CastAudioDecoder instance for the given |config|. Decoding must | 44 // Creates a CastAudioDecoder instance for the given |config|. Decoding must |
44 // occur on the same thread as |task_runner|. Returns an empty scoped_ptr if | 45 // occur on the same thread as |task_runner|. Returns an empty scoped_ptr if |
45 // the decoder could not be created. | 46 // the decoder could not be created. |
46 static scoped_ptr<CastAudioDecoder> Create( | 47 static std::unique_ptr<CastAudioDecoder> Create( |
47 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
48 const media::AudioConfig& config, | 49 const media::AudioConfig& config, |
49 OutputFormat output_format, | 50 OutputFormat output_format, |
50 const InitializedCallback& initialized_callback); | 51 const InitializedCallback& initialized_callback); |
51 | 52 |
52 // Given a CastAudioDecoder::OutputFormat, return the size of each sample in | 53 // Given a CastAudioDecoder::OutputFormat, return the size of each sample in |
53 // that OutputFormat in bytes. | 54 // that OutputFormat in bytes. |
54 static int OutputFormatSizeInBytes(CastAudioDecoder::OutputFormat format); | 55 static int OutputFormatSizeInBytes(CastAudioDecoder::OutputFormat format); |
55 | 56 |
56 CastAudioDecoder() {} | 57 CastAudioDecoder() {} |
(...skipping 11 matching lines...) Expand all Loading... |
68 const DecodeCallback& decode_callback) = 0; | 69 const DecodeCallback& decode_callback) = 0; |
69 | 70 |
70 private: | 71 private: |
71 DISALLOW_COPY_AND_ASSIGN(CastAudioDecoder); | 72 DISALLOW_COPY_AND_ASSIGN(CastAudioDecoder); |
72 }; | 73 }; |
73 | 74 |
74 } // namespace media | 75 } // namespace media |
75 } // namespace chromecast | 76 } // namespace chromecast |
76 | 77 |
77 #endif // CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ | 78 #endif // CHROMECAST_MEDIA_CMA_DECODER_CAST_AUDIO_DECODER_H_ |
OLD | NEW |