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

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.h

Issue 26956002: Plumb support for audio sample formats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cast. Created 7 years, 2 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
« no previous file with comments | « no previous file | content/renderer/pepper/content_decryptor_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
6 #define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ 6 #define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, 96 void DecoderInitializeDone(PP_DecryptorStreamType decoder_type,
97 uint32_t request_id, 97 uint32_t request_id,
98 PP_Bool success); 98 PP_Bool success);
99 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type, 99 void DecoderDeinitializeDone(PP_DecryptorStreamType decoder_type,
100 uint32_t request_id); 100 uint32_t request_id);
101 void DecoderResetDone(PP_DecryptorStreamType decoder_type, 101 void DecoderResetDone(PP_DecryptorStreamType decoder_type,
102 uint32_t request_id); 102 uint32_t request_id);
103 void DeliverFrame(PP_Resource decrypted_frame, 103 void DeliverFrame(PP_Resource decrypted_frame,
104 const PP_DecryptedFrameInfo* frame_info); 104 const PP_DecryptedFrameInfo* frame_info);
105 void DeliverSamples(PP_Resource audio_frames, 105 void DeliverSamples(PP_Resource audio_frames,
106 const PP_DecryptedBlockInfo* block_info); 106 const PP_DecryptedSampleInfo* sample_info);
107 107
108 private: 108 private:
109 // Cancels the pending decrypt-and-decode callback for |stream_type|. 109 // Cancels the pending decrypt-and-decode callback for |stream_type|.
110 void CancelDecode(media::Decryptor::StreamType stream_type); 110 void CancelDecode(media::Decryptor::StreamType stream_type);
111 111
112 // Fills |resource| with a PPB_Buffer_Impl and copies the data from 112 // Fills |resource| with a PPB_Buffer_Impl and copies the data from
113 // |encrypted_buffer| into the buffer resource. This method reuses 113 // |encrypted_buffer| into the buffer resource. This method reuses
114 // |audio_input_resource_| and |video_input_resource_| to reduce the latency 114 // |audio_input_resource_| and |video_input_resource_| to reduce the latency
115 // in requesting new PPB_Buffer_Impl resources. The caller must make sure that 115 // in requesting new PPB_Buffer_Impl resources. The caller must make sure that
116 // |audio_input_resource_| or |video_input_resource_| is available before 116 // |audio_input_resource_| or |video_input_resource_| is available before
117 // calling this method. 117 // calling this method.
118 // 118 //
119 // An end of stream |encrypted_buffer| is represented as a null |resource|. 119 // An end of stream |encrypted_buffer| is represented as a null |resource|.
120 // 120 //
121 // Returns true upon success and false if any error happened. 121 // Returns true upon success and false if any error happened.
122 bool MakeMediaBufferResource( 122 bool MakeMediaBufferResource(
123 media::Decryptor::StreamType stream_type, 123 media::Decryptor::StreamType stream_type,
124 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 124 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
125 scoped_refptr<PPB_Buffer_Impl>* resource); 125 scoped_refptr<PPB_Buffer_Impl>* resource);
126 126
127 void FreeBuffer(uint32_t buffer_id); 127 void FreeBuffer(uint32_t buffer_id);
128 128
129 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); 129 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info);
130 130
131 // Deserializes audio data stored in |audio_frames| into individual audio 131 // Deserializes audio data stored in |audio_frames| into individual audio
132 // buffers in |frames|. Returns true upon success. 132 // buffers in |frames|. Returns true upon success.
133 bool DeserializeAudioFrames(PP_Resource audio_frames, 133 bool DeserializeAudioFrames(PP_Resource audio_frames,
134 size_t data_size, 134 size_t data_size,
135 media::SampleFormat sample_format,
135 media::Decryptor::AudioBuffers* frames); 136 media::Decryptor::AudioBuffers* frames);
136 137
137 const PP_Instance pp_instance_; 138 const PP_Instance pp_instance_;
138 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; 139 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_;
139 140
140 // TODO(ddorwin): Remove after updating the Pepper API to not use key system. 141 // TODO(ddorwin): Remove after updating the Pepper API to not use key system.
141 std::string key_system_; 142 std::string key_system_;
142 143
143 // Callbacks for firing key events. 144 // Callbacks for firing key events.
144 media::KeyAddedCB key_added_cb_; 145 media::KeyAddedCB key_added_cb_;
(...skipping 26 matching lines...) Expand all
171 uint32_t pending_video_decode_request_id_; 172 uint32_t pending_video_decode_request_id_;
172 media::Decryptor::VideoDecodeCB pending_video_decode_cb_; 173 media::Decryptor::VideoDecodeCB pending_video_decode_cb_;
173 174
174 // Cached audio and video input buffers. See MakeMediaBufferResource. 175 // Cached audio and video input buffers. See MakeMediaBufferResource.
175 scoped_refptr<PPB_Buffer_Impl> audio_input_resource_; 176 scoped_refptr<PPB_Buffer_Impl> audio_input_resource_;
176 scoped_refptr<PPB_Buffer_Impl> video_input_resource_; 177 scoped_refptr<PPB_Buffer_Impl> video_input_resource_;
177 178
178 std::queue<uint32_t> free_buffers_; 179 std::queue<uint32_t> free_buffers_;
179 180
180 // Keep track of audio parameters. 181 // Keep track of audio parameters.
181 media::SampleFormat audio_sample_format_;
182 int audio_samples_per_second_; 182 int audio_samples_per_second_;
183 int audio_channel_count_; 183 int audio_channel_count_;
184 int audio_bytes_per_frame_;
185 184
186 base::WeakPtr<ContentDecryptorDelegate> weak_this_; 185 base::WeakPtr<ContentDecryptorDelegate> weak_this_;
187 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; 186 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_;
188 187
189 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); 188 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate);
190 }; 189 };
191 190
192 } // namespace content 191 } // namespace content
193 192
194 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_ 193 #endif // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/content_decryptor_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698