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