| 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 "media/base/decryptor.h" | 10 #include "media/base/decryptor.h" |
| 11 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class MessageLoopProxy; | 14 class MessageLoopProxy; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 class DecoderBuffer; | 19 class DecoderBuffer; |
| 20 | 20 |
| 21 // Decryptor-based DemuxerStream implementation that converts a potentially | 21 // Decryptor-based DemuxerStream implementation that converts a potentially |
| 22 // encrypted demuxer stream to a clear demuxer stream. | 22 // encrypted demuxer stream to a clear demuxer stream. |
| 23 // All public APIs and callbacks are trampolined to the |message_loop_| so | 23 // All public APIs and callbacks are trampolined to the |message_loop_| so |
| 24 // that no locks are required for thread safety. | 24 // that no locks are required for thread safety. |
| 25 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream { | 25 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream { |
| 26 public: | 26 public: |
| 27 // Callback to notify decryptor creation. | |
| 28 typedef base::Callback<void(Decryptor*)> DecryptorNotificationCB; | |
| 29 | |
| 30 // Callback to request/cancel decryptor creation notification. | |
| 31 // Calling this callback with a non-null callback registers decryptor creation | |
| 32 // notification. When the decryptor is created, notification will be sent | |
| 33 // through the provided callback. | |
| 34 // Calling this callback with a null callback cancels previously registered | |
| 35 // decryptor creation notification. Any previously provided callback will be | |
| 36 // fired immediately with NULL. | |
| 37 typedef base::Callback<void(const DecryptorNotificationCB&)> | |
| 38 RequestDecryptorNotificationCB; | |
| 39 | |
| 40 DecryptingDemuxerStream( | 27 DecryptingDemuxerStream( |
| 41 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 28 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 42 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); | 29 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); |
| 43 | 30 |
| 44 void Initialize(const scoped_refptr<DemuxerStream>& stream, | 31 void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 45 const PipelineStatusCB& status_cb); | 32 const PipelineStatusCB& status_cb); |
| 46 void Reset(const base::Closure& closure); | 33 void Reset(const base::Closure& closure); |
| 47 | 34 |
| 48 // DemuxerStream implementation. | 35 // DemuxerStream implementation. |
| 49 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 36 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // If this variable is true and kNoKey is returned then we need to try | 119 // If this variable is true and kNoKey is returned then we need to try |
| 133 // decrypting again in case the newly added key is the correct decryption key. | 120 // decrypting again in case the newly added key is the correct decryption key. |
| 134 bool key_added_while_decrypt_pending_; | 121 bool key_added_while_decrypt_pending_; |
| 135 | 122 |
| 136 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); | 123 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); |
| 137 }; | 124 }; |
| 138 | 125 |
| 139 } // namespace media | 126 } // namespace media |
| 140 | 127 |
| 141 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ | 128 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ |
| OLD | NEW |