Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_CRYPTO_DECRYPTING_VIDEO_DECODER_H_ | |
| 6 #define MEDIA_CRYPTO_DECRYPTING_VIDEO_DECODER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "media/base/decryptor.h" | |
| 11 #include "media/base/demuxer_stream.h" | |
| 12 #include "media/base/video_decoder.h" | |
|
ddorwin
2012/09/21 00:36:08
And decoder_buffer.h to IWYU.
xhwang
2012/09/25 23:52:32
DecoderBuffer is forward declared on line 20. The
| |
| 13 | |
| 14 namespace base { | |
| 15 class MessageLoopProxy; | |
| 16 } | |
| 17 | |
| 18 namespace media { | |
| 19 | |
| 20 class DecoderBuffer; | |
| 21 class Decryptor; | |
| 22 | |
| 23 // Decryptor powered VideoDecoder implementation that can decrypt and decode | |
|
ddorwin
2012/09/21 00:36:08
Decryptor powered ==>
Decryptor-based? Decryptor-b
xhwang
2012/09/25 23:52:32
Done.
| |
| 24 // encrypted buffers and return unencrypted and uncompressed video frames. | |
|
ddorwin
2012/09/21 00:36:08
s/unencrypted and uncompressed/decrypted decompres
xhwang
2012/09/25 23:52:32
Done.
| |
| 25 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do | |
| 26 // both decryption and video decoding. Add the path to use the decryptor for | |
| 27 // decryption only and use other VideoDecoder implementations within | |
| 28 // DecryptingVideoDecoder for video decoding. | |
| 29 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { | |
| 30 public: | |
| 31 typedef base::Callback< | |
| 32 scoped_refptr<base::MessageLoopProxy>()> MessageLoopFactoryCB; | |
| 33 DecryptingVideoDecoder(const MessageLoopFactoryCB& message_loop_factory_cb, | |
| 34 Decryptor* decryptor); | |
| 35 | |
| 36 // VideoDecoder implementation. | |
| 37 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | |
| 38 const PipelineStatusCB& status_cb, | |
| 39 const StatisticsCB& statistics_cb) OVERRIDE; | |
| 40 virtual void Read(const ReadCB& read_cb) OVERRIDE; | |
| 41 virtual void Reset(const base::Closure& closure) OVERRIDE; | |
| 42 virtual void Stop(const base::Closure& closure) OVERRIDE; | |
| 43 | |
| 44 protected: | |
| 45 virtual ~DecryptingVideoDecoder(); | |
| 46 | |
| 47 private: | |
| 48 enum DecoderState { | |
| 49 kUninitialized, | |
| 50 kNormal, | |
| 51 kDecodeFinished | |
| 52 }; | |
| 53 | |
| 54 void OnDecoderInitDone(bool success); | |
|
ddorwin
2012/09/21 00:36:08
Would OnDecoderInitialized not be accurate?
xhwang
2012/09/25 23:52:32
Done.
| |
| 55 void DoRead(const ReadCB& read_cb); | |
| 56 | |
| 57 // Reads from the demuxer stream with corresponding callback method. | |
|
ddorwin
2012/09/21 00:36:08
I don't understand "corresponding callback method"
xhwang
2012/09/25 23:52:32
"corresponding callback method" is whatever callba
| |
| 58 void ReadFromDemuxerStream(); | |
| 59 void DecryptAndDecodeBuffer(DemuxerStream::Status status, | |
|
ddorwin
2012/09/21 00:36:08
Since there is no white space, I would assume 57 a
xhwang
2012/09/25 23:52:32
Done.
| |
| 60 const scoped_refptr<DecoderBuffer>& buffer); | |
| 61 // Carries out the buffer processing operation scheduled by | |
| 62 // DecryptOrDecodeBuffer(). | |
|
ddorwin
2012/09/21 00:36:08
DecryptAndDecodeBuffer
xhwang
2012/09/25 23:52:32
Done.
| |
| 63 void DoDecryptAndDecodeBuffer(DemuxerStream::Status status, | |
| 64 const scoped_refptr<DecoderBuffer>& buffer); | |
| 65 | |
| 66 void DeliverFrame(int buffer_size, | |
|
ddorwin
2012/09/21 00:36:08
Should this be a Do function as well since it is p
xhwang
2012/09/25 23:52:32
I think we use "Do" for posted tasks, not on norma
| |
| 67 Decryptor::Status status, | |
| 68 const scoped_refptr<VideoFrame>& frame); | |
| 69 | |
| 70 // Reset decoder and call |reset_cb_|. | |
| 71 void DoReset(); | |
| 72 | |
| 73 // Free decoder resources and call |stop_cb_|. | |
| 74 void DoStop(); | |
| 75 | |
| 76 // This is !is_null() iff Initialize() hasn't been called. | |
| 77 MessageLoopFactoryCB message_loop_factory_cb_; | |
| 78 | |
| 79 scoped_refptr<base::MessageLoopProxy> message_loop_; | |
| 80 DecoderState state_; | |
| 81 PipelineStatusCB status_cb_; | |
| 82 StatisticsCB statistics_cb_; | |
| 83 ReadCB read_cb_; | |
| 84 base::Closure reset_cb_; | |
| 85 base::Closure stop_cb_; | |
| 86 | |
| 87 // Pointer to the demuxer stream that will feed us compressed buffers. | |
| 88 scoped_refptr<DemuxerStream> demuxer_stream_; | |
| 89 | |
| 90 // Pointer to a Decryptor that can DecryptAndDecodeVideo() or Decrypt(). | |
| 91 Decryptor* decryptor_; | |
|
ddorwin
2012/09/21 00:36:08
*const
xhwang
2012/09/25 23:52:32
Done.
| |
| 92 | |
| 93 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); | |
| 94 }; | |
| 95 | |
| 96 } // namespace media | |
| 97 | |
| 98 #endif // MEDIA_CRYPTO_DECRYPTING_VIDEO_DECODER_H_ | |
| OLD | NEW |