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

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

Issue 14232017: Clean up media::DecryptingDemuxerStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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_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 "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // TODO(xhwang): Update this diagram for DecryptingDemuxerStream. 49 // TODO(xhwang): Update this diagram for DecryptingDemuxerStream.
50 enum State { 50 enum State {
51 kUninitialized = 0, 51 kUninitialized = 0,
52 kDecryptorRequested, 52 kDecryptorRequested,
53 kIdle, 53 kIdle,
54 kPendingDemuxerRead, 54 kPendingDemuxerRead,
55 kPendingDecrypt, 55 kPendingDecrypt,
56 kWaitingForKey, 56 kWaitingForKey,
57 }; 57 };
58 58
59 // Carries out the initialization operation scheduled by Initialize().
60 void DoInitialize(const scoped_refptr<DemuxerStream>& stream,
61 const PipelineStatusCB& status_cb);
62
63 // Callback for DecryptorHost::RequestDecryptor(). 59 // Callback for DecryptorHost::RequestDecryptor().
64 void SetDecryptor(Decryptor* decryptor); 60 void SetDecryptor(Decryptor* decryptor);
65 61
66 // Callback for DemuxerStream::Read(). 62 // Callback for DemuxerStream::Read().
67 void DecryptBuffer(DemuxerStream::Status status, 63 void DecryptBuffer(DemuxerStream::Status status,
68 const scoped_refptr<DecoderBuffer>& buffer); 64 const scoped_refptr<DecoderBuffer>& buffer);
69 65
70 // Carries out the buffer decryption operation scheduled by DecryptBuffer().
71 void DoDecryptBuffer(DemuxerStream::Status status,
72 const scoped_refptr<DecoderBuffer>& buffer);
73
74 void DecryptPendingBuffer(); 66 void DecryptPendingBuffer();
75 67
76 // Callback for Decryptor::Decrypt(). 68 // Callback for Decryptor::Decrypt().
77 void DeliverBuffer(Decryptor::Status status, 69 void DeliverBuffer(Decryptor::Status status,
78 const scoped_refptr<DecoderBuffer>& decrypted_buffer); 70 const scoped_refptr<DecoderBuffer>& decrypted_buffer);
79 71
80 // Carries out the frame delivery operation scheduled by DeliverBuffer().
81 void DoDeliverBuffer(Decryptor::Status status,
82 const scoped_refptr<DecoderBuffer>& decrypted_buffer);
83
84 // Callback for the |decryptor_| to notify this object that a new key has been 72 // Callback for the |decryptor_| to notify this object that a new key has been
85 // added. 73 // added.
86 void OnKeyAdded(); 74 void OnKeyAdded();
87 75
88 // Resets decoder and calls |reset_cb_|. 76 // Resets decoder and calls |reset_cb_|.
89 void DoReset(); 77 void DoReset();
90 78
91 // Returns Decryptor::StreamType converted from |stream_type_|. 79 // Returns Decryptor::StreamType converted from |stream_type_|.
92 Decryptor::StreamType GetDecryptorStreamType() const; 80 Decryptor::StreamType GetDecryptorStreamType() const;
93 81
94 // Sets |{audio|video}_config_| from |stream|. 82 // Creates and initializes either |audio_config_| or |video_config_| based on
95 void SetDecoderConfig(const scoped_refptr<DemuxerStream>& stream); 83 // |demuxer_stream_|.
84 void InitializeDecoderConfig();
96 85
97 scoped_refptr<base::MessageLoopProxy> message_loop_; 86 scoped_refptr<base::MessageLoopProxy> message_loop_;
98 87
99 State state_; 88 State state_;
100 89
101 PipelineStatusCB init_cb_; 90 PipelineStatusCB init_cb_;
102 ReadCB read_cb_; 91 ReadCB read_cb_;
103 base::Closure reset_cb_; 92 base::Closure reset_cb_;
104 93
105 // Pointer to the input demuxer stream that will feed us encrypted buffers. 94 // Pointer to the input demuxer stream that will feed us encrypted buffers.
106 scoped_refptr<DemuxerStream> demuxer_stream_; 95 scoped_refptr<DemuxerStream> demuxer_stream_;
107 96
108 Type stream_type_;
109 scoped_ptr<AudioDecoderConfig> audio_config_; 97 scoped_ptr<AudioDecoderConfig> audio_config_;
110 scoped_ptr<VideoDecoderConfig> video_config_; 98 scoped_ptr<VideoDecoderConfig> video_config_;
111 99
112 // Callback to request/cancel decryptor creation notification. 100 // Callback to request/cancel decryptor creation notification.
113 SetDecryptorReadyCB set_decryptor_ready_cb_; 101 SetDecryptorReadyCB set_decryptor_ready_cb_;
114 102
115 Decryptor* decryptor_; 103 Decryptor* decryptor_;
116 104
117 // The buffer returned by the demuxer that needs to be decrypted. 105 // The buffer returned by the demuxer that needs to be decrypted.
118 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decrypt_; 106 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decrypt_;
119 107
120 // Indicates the situation where new key is added during pending decryption 108 // Indicates the situation where new key is added during pending decryption
121 // (in other words, this variable can only be set in state kPendingDecrypt). 109 // (in other words, this variable can only be set in state kPendingDecrypt).
122 // If this variable is true and kNoKey is returned then we need to try 110 // If this variable is true and kNoKey is returned then we need to try
123 // decrypting again in case the newly added key is the correct decryption key. 111 // decrypting again in case the newly added key is the correct decryption key.
124 bool key_added_while_decrypt_pending_; 112 bool key_added_while_decrypt_pending_;
125 113
126 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); 114 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream);
127 }; 115 };
128 116
129 } // namespace media 117 } // namespace media
130 118
131 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 119 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/decrypting_demuxer_stream.cc » ('j') | media/filters/decrypting_demuxer_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698