| 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_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ |
| 6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "media/base/decryptor.h" | 10 #include "media/base/decryptor.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // All public APIs and callbacks are trampolined to the |message_loop_| so | 25 // All public APIs and callbacks are trampolined to the |message_loop_| so |
| 26 // that no locks are required for thread safety. | 26 // that no locks are required for thread safety. |
| 27 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { | 27 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { |
| 28 public: | 28 public: |
| 29 DecryptingVideoDecoder( | 29 DecryptingVideoDecoder( |
| 30 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 30 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 31 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 31 const SetDecryptorReadyCB& set_decryptor_ready_cb); |
| 32 virtual ~DecryptingVideoDecoder(); | 32 virtual ~DecryptingVideoDecoder(); |
| 33 | 33 |
| 34 // VideoDecoder implementation. | 34 // VideoDecoder implementation. |
| 35 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 35 virtual void Initialize(DemuxerStream* stream, |
| 36 const PipelineStatusCB& status_cb, | 36 const PipelineStatusCB& status_cb, |
| 37 const StatisticsCB& statistics_cb) OVERRIDE; | 37 const StatisticsCB& statistics_cb) OVERRIDE; |
| 38 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 38 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 39 virtual void Reset(const base::Closure& closure) OVERRIDE; | 39 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| 40 virtual void Stop(const base::Closure& closure) OVERRIDE; | 40 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // For a detailed state diagram please see this link: http://goo.gl/8jAok | 43 // For a detailed state diagram please see this link: http://goo.gl/8jAok |
| 44 // TODO(xhwang): Add a ASCII state diagram in this file after this class | 44 // TODO(xhwang): Add a ASCII state diagram in this file after this class |
| 45 // stabilizes. | 45 // stabilizes. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 base::WeakPtr<DecryptingVideoDecoder> weak_this_; | 94 base::WeakPtr<DecryptingVideoDecoder> weak_this_; |
| 95 | 95 |
| 96 State state_; | 96 State state_; |
| 97 | 97 |
| 98 PipelineStatusCB init_cb_; | 98 PipelineStatusCB init_cb_; |
| 99 StatisticsCB statistics_cb_; | 99 StatisticsCB statistics_cb_; |
| 100 ReadCB read_cb_; | 100 ReadCB read_cb_; |
| 101 base::Closure reset_cb_; | 101 base::Closure reset_cb_; |
| 102 | 102 |
| 103 // Pointer to the demuxer stream that will feed us compressed buffers. | 103 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 104 scoped_refptr<DemuxerStream> demuxer_stream_; | 104 DemuxerStream* demuxer_stream_; |
| 105 | 105 |
| 106 // Callback to request/cancel decryptor creation notification. | 106 // Callback to request/cancel decryptor creation notification. |
| 107 SetDecryptorReadyCB set_decryptor_ready_cb_; | 107 SetDecryptorReadyCB set_decryptor_ready_cb_; |
| 108 | 108 |
| 109 Decryptor* decryptor_; | 109 Decryptor* decryptor_; |
| 110 | 110 |
| 111 // The buffer returned by the demuxer that needs decrypting/decoding. | 111 // The buffer returned by the demuxer that needs decrypting/decoding. |
| 112 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; | 112 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; |
| 113 | 113 |
| 114 // Indicates the situation where new key is added during pending decode | 114 // Indicates the situation where new key is added during pending decode |
| 115 // (in other words, this variable can only be set in state kPendingDecode). | 115 // (in other words, this variable can only be set in state kPendingDecode). |
| 116 // If this variable is true and kNoKey is returned then we need to try | 116 // If this variable is true and kNoKey is returned then we need to try |
| 117 // decrypting/decoding again in case the newly added key is the correct | 117 // decrypting/decoding again in case the newly added key is the correct |
| 118 // decryption key. | 118 // decryption key. |
| 119 bool key_added_while_decode_pending_; | 119 bool key_added_while_decode_pending_; |
| 120 | 120 |
| 121 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the | 121 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the |
| 122 // matching DecryptCB call (in DoDeliverFrame()). | 122 // matching DecryptCB call (in DoDeliverFrame()). |
| 123 uint32 trace_id_; | 123 uint32 trace_id_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); | 125 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace media | 128 } // namespace media |
| 129 | 129 |
| 130 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ | 130 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ |
| OLD | NEW |