Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: media/filters/decrypting_video_decoder.h

Issue 11492003: Encrypted Media: Support Audio Decrypt-Only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments mostly resolved (I believe); need to add/update tests if this looks good Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
(...skipping 13 matching lines...) Expand all
24 // encrypted video buffers and return decrypted and decompressed video frames. 24 // encrypted video buffers and return decrypted and decompressed video frames.
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 // 27 //
28 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do 28 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do
29 // both decryption and video decoding. Add the path to use the decryptor for 29 // both decryption and video decoding. Add the path to use the decryptor for
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 // Callback to notify decryptor creation.
35 typedef base::Callback<void(Decryptor*)> DecryptorNotificationCB;
36 // Callback to request/cancel decryptor creation notification.
37 // Calling this callback with a non-null callback registers decryptor creation
38 // notification. When the decryptor is created, notification will be sent
39 // through the provided callback.
40 // Calling this callback with a null callback cancels previously registered
41 // decryptor creation notification. Any previously provided callback will be
42 // fired immediately with NULL.
43 typedef base::Callback<void(const DecryptorNotificationCB&)>
44 RequestDecryptorNotificationCB;
45
46 DecryptingVideoDecoder( 34 DecryptingVideoDecoder(
47 const scoped_refptr<base::MessageLoopProxy>& message_loop, 35 const scoped_refptr<base::MessageLoopProxy>& message_loop,
48 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); 36 const SetDecryptorReadyCB& set_decryptor_ready_cb);
49 37
50 // VideoDecoder implementation. 38 // VideoDecoder implementation.
51 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 39 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
52 const PipelineStatusCB& status_cb, 40 const PipelineStatusCB& status_cb,
53 const StatisticsCB& statistics_cb) OVERRIDE; 41 const StatisticsCB& statistics_cb) OVERRIDE;
54 virtual void Read(const ReadCB& read_cb) OVERRIDE; 42 virtual void Read(const ReadCB& read_cb) OVERRIDE;
55 virtual void Reset(const base::Closure& closure) OVERRIDE; 43 virtual void Reset(const base::Closure& closure) OVERRIDE;
56 virtual void Stop(const base::Closure& closure) OVERRIDE; 44 virtual void Stop(const base::Closure& closure) OVERRIDE;
57 45
58 protected: 46 protected:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 97
110 PipelineStatusCB init_cb_; 98 PipelineStatusCB init_cb_;
111 StatisticsCB statistics_cb_; 99 StatisticsCB statistics_cb_;
112 ReadCB read_cb_; 100 ReadCB read_cb_;
113 base::Closure reset_cb_; 101 base::Closure reset_cb_;
114 102
115 // Pointer to the demuxer stream that will feed us compressed buffers. 103 // Pointer to the demuxer stream that will feed us compressed buffers.
116 scoped_refptr<DemuxerStream> demuxer_stream_; 104 scoped_refptr<DemuxerStream> demuxer_stream_;
117 105
118 // Callback to request/cancel decryptor creation notification. 106 // Callback to request/cancel decryptor creation notification.
119 RequestDecryptorNotificationCB request_decryptor_notification_cb_; 107 SetDecryptorReadyCB set_decryptor_ready_cb_;
120 108
121 Decryptor* decryptor_; 109 Decryptor* decryptor_;
122 110
123 // The buffer returned by the demuxer that needs decrypting/decoding. 111 // The buffer returned by the demuxer that needs decrypting/decoding.
124 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; 112 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_;
125 113
126 // Indicates the situation where new key is added during pending decode 114 // Indicates the situation where new key is added during pending decode
127 // (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).
128 // 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
129 // 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
130 // decryption key. 118 // decryption key.
131 bool key_added_while_decode_pending_; 119 bool key_added_while_decode_pending_;
132 120
133 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the 121 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the
134 // matching DecryptCB call (in DoDeliverFrame()). 122 // matching DecryptCB call (in DoDeliverFrame()).
135 uint32 trace_id_; 123 uint32 trace_id_;
136 124
137 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); 125 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
138 }; 126 };
139 127
140 } // namespace media 128 } // namespace media
141 129
142 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 130 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698