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_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ |
6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ | 6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_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/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class DecoderBuffer; | 23 class DecoderBuffer; |
24 | 24 |
25 // Decryptor-based DemuxerStream implementation that converts a potentially | 25 // Decryptor-based DemuxerStream implementation that converts a potentially |
26 // encrypted demuxer stream to a clear demuxer stream. | 26 // encrypted demuxer stream to a clear demuxer stream. |
27 // All public APIs and callbacks are trampolined to the |task_runner_| so | 27 // All public APIs and callbacks are trampolined to the |task_runner_| so |
28 // that no locks are required for thread safety. | 28 // that no locks are required for thread safety. |
29 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream { | 29 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream { |
30 public: | 30 public: |
31 DecryptingDemuxerStream( | 31 DecryptingDemuxerStream( |
32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
33 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 33 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
| 34 const base::Closure& waiting_for_decryption_key_cb); |
34 | 35 |
35 // Cancels all pending operations immediately and fires all pending callbacks. | 36 // Cancels all pending operations immediately and fires all pending callbacks. |
36 ~DecryptingDemuxerStream() override; | 37 ~DecryptingDemuxerStream() override; |
37 | 38 |
38 void Initialize(DemuxerStream* stream, | 39 void Initialize(DemuxerStream* stream, |
39 const PipelineStatusCB& status_cb); | 40 const PipelineStatusCB& status_cb); |
40 | 41 |
41 // Cancels all pending operations and fires all pending callbacks. If in | 42 // Cancels all pending operations and fires all pending callbacks. If in |
42 // kPendingDemuxerRead or kPendingDecrypt state, waits for the pending | 43 // kPendingDemuxerRead or kPendingDecrypt state, waits for the pending |
43 // operation to finish before satisfying |closure|. Sets the state to | 44 // operation to finish before satisfying |closure|. Sets the state to |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // |demuxer_stream_|. | 98 // |demuxer_stream_|. |
98 void InitializeDecoderConfig(); | 99 void InitializeDecoderConfig(); |
99 | 100 |
100 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
101 | 102 |
102 State state_; | 103 State state_; |
103 | 104 |
104 PipelineStatusCB init_cb_; | 105 PipelineStatusCB init_cb_; |
105 ReadCB read_cb_; | 106 ReadCB read_cb_; |
106 base::Closure reset_cb_; | 107 base::Closure reset_cb_; |
| 108 base::Closure waiting_for_decryption_key_cb_; |
107 | 109 |
108 // Pointer to the input demuxer stream that will feed us encrypted buffers. | 110 // Pointer to the input demuxer stream that will feed us encrypted buffers. |
109 DemuxerStream* demuxer_stream_; | 111 DemuxerStream* demuxer_stream_; |
110 | 112 |
111 AudioDecoderConfig audio_config_; | 113 AudioDecoderConfig audio_config_; |
112 VideoDecoderConfig video_config_; | 114 VideoDecoderConfig video_config_; |
113 | 115 |
114 // Callback to request/cancel decryptor creation notification. | 116 // Callback to request/cancel decryptor creation notification. |
115 SetDecryptorReadyCB set_decryptor_ready_cb_; | 117 SetDecryptorReadyCB set_decryptor_ready_cb_; |
116 | 118 |
(...skipping 10 matching lines...) Expand all Loading... |
127 | 129 |
128 base::WeakPtr<DecryptingDemuxerStream> weak_this_; | 130 base::WeakPtr<DecryptingDemuxerStream> weak_this_; |
129 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_; | 131 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_; |
130 | 132 |
131 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); | 133 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); |
132 }; | 134 }; |
133 | 135 |
134 } // namespace media | 136 } // namespace media |
135 | 137 |
136 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ | 138 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ |
OLD | NEW |