| 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_FILTERS_DECODER_SELECTOR_H_ | 5 #ifndef MEDIA_FILTERS_DECODER_SELECTOR_H_ |
| 6 #define MEDIA_FILTERS_DECODER_SELECTOR_H_ | 6 #define MEDIA_FILTERS_DECODER_SELECTOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 SelectDecoderCB; | 50 SelectDecoderCB; |
| 51 | 51 |
| 52 // |decoders| contains the Decoders to use when initializing. | 52 // |decoders| contains the Decoders to use when initializing. |
| 53 // | 53 // |
| 54 // |set_decryptor_ready_cb| is optional. If |set_decryptor_ready_cb| is null, | 54 // |set_decryptor_ready_cb| is optional. If |set_decryptor_ready_cb| is null, |
| 55 // no decryptor will be available to perform decryption. | 55 // no decryptor will be available to perform decryption. |
| 56 DecoderSelector( | 56 DecoderSelector( |
| 57 const scoped_refptr<base::SingleThreadTaskRunner>& message_loop, | 57 const scoped_refptr<base::SingleThreadTaskRunner>& message_loop, |
| 58 ScopedVector<Decoder> decoders, | 58 ScopedVector<Decoder> decoders, |
| 59 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 59 const SetDecryptorReadyCB& set_decryptor_ready_cb); |
| 60 |
| 61 // Aborts pending Decoder selection and fires |select_decoder_cb| with |
| 62 // NULL and NULL immediately if it's pending. |
| 60 ~DecoderSelector(); | 63 ~DecoderSelector(); |
| 61 | 64 |
| 62 // Initializes and selects a Decoder that can decode the |stream|. | 65 // Initializes and selects a Decoder that can decode the |stream|. |
| 63 // Selected Decoder (and DecryptingDemuxerStream) is returned via | 66 // Selected Decoder (and DecryptingDemuxerStream) is returned via |
| 64 // the |select_decoder_cb|. | 67 // the |select_decoder_cb|. |
| 65 void SelectDecoder(DemuxerStream* stream, | 68 void SelectDecoder(DemuxerStream* stream, |
| 66 bool low_delay, | 69 bool low_delay, |
| 67 const SelectDecoderCB& select_decoder_cb, | 70 const SelectDecoderCB& select_decoder_cb, |
| 68 const typename Decoder::OutputCB& output_cb); | 71 const typename Decoder::OutputCB& output_cb); |
| 69 | 72 |
| 70 // Aborts pending Decoder selection and fires |select_decoder_cb| with | |
| 71 // NULL and NULL immediately if it's pending. | |
| 72 void Abort(); | |
| 73 | |
| 74 private: | 73 private: |
| 75 void DecryptingDecoderInitDone(PipelineStatus status); | 74 void DecryptingDecoderInitDone(PipelineStatus status); |
| 76 void DecryptingDemuxerStreamInitDone(PipelineStatus status); | 75 void DecryptingDemuxerStreamInitDone(PipelineStatus status); |
| 77 void InitializeDecoder(); | 76 void InitializeDecoder(); |
| 78 void DecoderInitDone(PipelineStatus status); | 77 void DecoderInitDone(PipelineStatus status); |
| 79 void ReturnNullDecoder(); | 78 void ReturnNullDecoder(); |
| 80 | 79 |
| 81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 82 ScopedVector<Decoder> decoders_; | 81 ScopedVector<Decoder> decoders_; |
| 83 SetDecryptorReadyCB set_decryptor_ready_cb_; | 82 SetDecryptorReadyCB set_decryptor_ready_cb_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 95 | 94 |
| 96 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderSelector); | 95 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderSelector); |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 typedef DecoderSelector<DemuxerStream::VIDEO> VideoDecoderSelector; | 98 typedef DecoderSelector<DemuxerStream::VIDEO> VideoDecoderSelector; |
| 100 typedef DecoderSelector<DemuxerStream::AUDIO> AudioDecoderSelector; | 99 typedef DecoderSelector<DemuxerStream::AUDIO> AudioDecoderSelector; |
| 101 | 100 |
| 102 } // namespace media | 101 } // namespace media |
| 103 | 102 |
| 104 #endif // MEDIA_FILTERS_DECODER_SELECTOR_H_ | 103 #endif // MEDIA_FILTERS_DECODER_SELECTOR_H_ |
| OLD | NEW |