| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 base::WeakPtr<DecryptingVideoDecoder> weak_this_; | 93 base::WeakPtr<DecryptingVideoDecoder> weak_this_; |
| 94 | 94 |
| 95 State state_; | 95 State state_; |
| 96 | 96 |
| 97 PipelineStatusCB init_cb_; | 97 PipelineStatusCB init_cb_; |
| 98 StatisticsCB statistics_cb_; | 98 StatisticsCB statistics_cb_; |
| 99 ReadCB read_cb_; | 99 ReadCB read_cb_; |
| 100 base::Closure reset_cb_; | 100 base::Closure reset_cb_; |
| 101 | 101 |
| 102 // Pointer to the demuxer stream that will feed us compressed buffers. | 102 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 103 scoped_refptr<DemuxerStream> demuxer_stream_; | 103 DemuxerStream* demuxer_stream_; |
| 104 | 104 |
| 105 // Callback to request/cancel decryptor creation notification. | 105 // Callback to request/cancel decryptor creation notification. |
| 106 SetDecryptorReadyCB set_decryptor_ready_cb_; | 106 SetDecryptorReadyCB set_decryptor_ready_cb_; |
| 107 | 107 |
| 108 Decryptor* decryptor_; | 108 Decryptor* decryptor_; |
| 109 | 109 |
| 110 // The buffer returned by the demuxer that needs decrypting/decoding. | 110 // The buffer returned by the demuxer that needs decrypting/decoding. |
| 111 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; | 111 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; |
| 112 | 112 |
| 113 // Indicates the situation where new key is added during pending decode | 113 // Indicates the situation where new key is added during pending decode |
| 114 // (in other words, this variable can only be set in state kPendingDecode). | 114 // (in other words, this variable can only be set in state kPendingDecode). |
| 115 // If this variable is true and kNoKey is returned then we need to try | 115 // If this variable is true and kNoKey is returned then we need to try |
| 116 // decrypting/decoding again in case the newly added key is the correct | 116 // decrypting/decoding again in case the newly added key is the correct |
| 117 // decryption key. | 117 // decryption key. |
| 118 bool key_added_while_decode_pending_; | 118 bool key_added_while_decode_pending_; |
| 119 | 119 |
| 120 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the | 120 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the |
| 121 // matching DecryptCB call (in DoDeliverFrame()). | 121 // matching DecryptCB call (in DoDeliverFrame()). |
| 122 uint32 trace_id_; | 122 uint32 trace_id_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); | 124 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace media | 127 } // namespace media |
| 128 | 128 |
| 129 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ | 129 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ |
| OLD | NEW |