| 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 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 DecryptingDemuxerStream( | 31 DecryptingDemuxerStream( |
| 32 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 32 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 33 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 33 const SetDecryptorReadyCB& set_decryptor_ready_cb); |
| 34 virtual ~DecryptingDemuxerStream(); | 34 virtual ~DecryptingDemuxerStream(); |
| 35 | 35 |
| 36 void Initialize(DemuxerStream* stream, | 36 void Initialize(DemuxerStream* stream, |
| 37 const PipelineStatusCB& status_cb); | 37 const PipelineStatusCB& status_cb); |
| 38 void Reset(const base::Closure& closure); | 38 void Reset(const base::Closure& closure); |
| 39 | 39 |
| 40 // Creates and initializes either |audio_config_| or |video_config_| based on | |
| 41 // |demuxer_stream_|. | |
| 42 // TODO(xhwang): Make this private after the hack in VideoFrameStream is | |
| 43 // removed. | |
| 44 void InitializeDecoderConfig(); | |
| 45 | |
| 46 // DemuxerStream implementation. | 40 // DemuxerStream implementation. |
| 47 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 41 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 48 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; | 42 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; |
| 49 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; | 43 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; |
| 50 virtual Type type() OVERRIDE; | 44 virtual Type type() OVERRIDE; |
| 51 virtual void EnableBitstreamConverter() OVERRIDE; | 45 virtual void EnableBitstreamConverter() OVERRIDE; |
| 52 | 46 |
| 53 private: | 47 private: |
| 54 // 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 |
| 55 // 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 // Callback for the |decryptor_| to notify this object that a new key has been | 74 // Callback for the |decryptor_| to notify this object that a new key has been |
| 81 // added. | 75 // added. |
| 82 void OnKeyAdded(); | 76 void OnKeyAdded(); |
| 83 | 77 |
| 84 // Resets decoder and calls |reset_cb_|. | 78 // Resets decoder and calls |reset_cb_|. |
| 85 void DoReset(); | 79 void DoReset(); |
| 86 | 80 |
| 87 // Returns Decryptor::StreamType converted from |stream_type_|. | 81 // Returns Decryptor::StreamType converted from |stream_type_|. |
| 88 Decryptor::StreamType GetDecryptorStreamType() const; | 82 Decryptor::StreamType GetDecryptorStreamType() const; |
| 89 | 83 |
| 84 // Creates and initializes either |audio_config_| or |video_config_| based on |
| 85 // |demuxer_stream_|. |
| 86 void InitializeDecoderConfig(); |
| 87 |
| 90 scoped_refptr<base::MessageLoopProxy> message_loop_; | 88 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 91 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_; | 89 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_; |
| 92 base::WeakPtr<DecryptingDemuxerStream> weak_this_; | 90 base::WeakPtr<DecryptingDemuxerStream> weak_this_; |
| 93 | 91 |
| 94 State state_; | 92 State state_; |
| 95 | 93 |
| 96 PipelineStatusCB init_cb_; | 94 PipelineStatusCB init_cb_; |
| 97 ReadCB read_cb_; | 95 ReadCB read_cb_; |
| 98 base::Closure reset_cb_; | 96 base::Closure reset_cb_; |
| 99 | 97 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 116 // If this variable is true and kNoKey is returned then we need to try | 114 // If this variable is true and kNoKey is returned then we need to try |
| 117 // decrypting again in case the newly added key is the correct decryption key. | 115 // decrypting again in case the newly added key is the correct decryption key. |
| 118 bool key_added_while_decrypt_pending_; | 116 bool key_added_while_decrypt_pending_; |
| 119 | 117 |
| 120 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); | 118 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); |
| 121 }; | 119 }; |
| 122 | 120 |
| 123 } // namespace media | 121 } // namespace media |
| 124 | 122 |
| 125 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ | 123 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ |
| OLD | NEW |