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

Side by Side Diff: media/mojo/services/mojo_decryptor.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "media/mojo/services/mojo_decryptor.h" 5 #include "media/mojo/services/mojo_decryptor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (!new_audio_key_cb_.is_null()) 108 if (!new_audio_key_cb_.is_null())
109 new_audio_key_cb_.Run(); 109 new_audio_key_cb_.Run();
110 110
111 if (!new_video_key_cb_.is_null()) 111 if (!new_video_key_cb_.is_null())
112 new_video_key_cb_.Run(); 112 new_video_key_cb_.Run();
113 } 113 }
114 114
115 void MojoDecryptor::OnBufferDecrypted(const DecryptCB& decrypt_cb, 115 void MojoDecryptor::OnBufferDecrypted(const DecryptCB& decrypt_cb,
116 interfaces::Decryptor::Status status, 116 interfaces::Decryptor::Status status,
117 interfaces::DecoderBufferPtr buffer) { 117 interfaces::DecoderBufferPtr buffer) {
118 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) 118 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS)
119 << __FUNCTION__ << "(" << status << ")"; 119 << __FUNCTION__ << "(" << status << ")";
120 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; 120 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__;
121 121
122 if (buffer.is_null()) { 122 if (buffer.is_null()) {
123 decrypt_cb.Run(static_cast<Decryptor::Status>(status), nullptr); 123 decrypt_cb.Run(static_cast<Decryptor::Status>(status), nullptr);
124 return; 124 return;
125 } 125 }
126 126
127 decrypt_cb.Run(static_cast<Decryptor::Status>(status), 127 decrypt_cb.Run(static_cast<Decryptor::Status>(status),
128 ReadDecoderBuffer(std::move(buffer))); 128 ReadDecoderBuffer(std::move(buffer)));
129 } 129 }
130 130
131 void MojoDecryptor::OnAudioDecoded( 131 void MojoDecryptor::OnAudioDecoded(
132 const AudioDecodeCB& audio_decode_cb, 132 const AudioDecodeCB& audio_decode_cb,
133 interfaces::Decryptor::Status status, 133 interfaces::Decryptor::Status status,
134 mojo::Array<interfaces::AudioBufferPtr> audio_buffers) { 134 mojo::Array<interfaces::AudioBufferPtr> audio_buffers) {
135 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) 135 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS)
136 << __FUNCTION__ << "(" << status << ")"; 136 << __FUNCTION__ << "(" << status << ")";
137 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; 137 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__;
138 138
139 Decryptor::AudioFrames audio_frames; 139 Decryptor::AudioFrames audio_frames;
140 for (size_t i = 0; i < audio_buffers.size(); ++i) 140 for (size_t i = 0; i < audio_buffers.size(); ++i)
141 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>()); 141 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>());
142 142
143 audio_decode_cb.Run(static_cast<Decryptor::Status>(status), audio_frames); 143 audio_decode_cb.Run(static_cast<Decryptor::Status>(status), audio_frames);
144 } 144 }
145 145
146 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb, 146 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb,
147 interfaces::Decryptor::Status status, 147 interfaces::Decryptor::Status status,
148 interfaces::VideoFramePtr video_frame) { 148 interfaces::VideoFramePtr video_frame) {
149 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) 149 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS)
150 << __FUNCTION__ << "(" << status << ")"; 150 << __FUNCTION__ << "(" << status << ")";
151 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; 151 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__;
152 if (video_frame.is_null()) { 152 if (video_frame.is_null()) {
153 video_decode_cb.Run(static_cast<Decryptor::Status>(status), nullptr); 153 video_decode_cb.Run(static_cast<Decryptor::Status>(status), nullptr);
154 return; 154 return;
155 } 155 }
156 156
157 scoped_refptr<VideoFrame> frame(video_frame.To<scoped_refptr<VideoFrame>>()); 157 scoped_refptr<VideoFrame> frame(video_frame.To<scoped_refptr<VideoFrame>>());
158 video_decode_cb.Run(static_cast<Decryptor::Status>(status), frame); 158 video_decode_cb.Run(static_cast<Decryptor::Status>(status), frame);
159 } 159 }
160 160
161 void MojoDecryptor::CreateDataPipes() { 161 void MojoDecryptor::CreateDataPipes() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 uint32_t num_bytes = media_buffer->data_size(); 209 uint32_t num_bytes = media_buffer->data_size();
210 DCHECK_GT(num_bytes, 0u); 210 DCHECK_GT(num_bytes, 0u);
211 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), 211 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(),
212 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE), 212 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE),
213 MOJO_RESULT_OK); 213 MOJO_RESULT_OK);
214 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size())); 214 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size()));
215 return media_buffer; 215 return media_buffer;
216 } 216 }
217 217
218 } // namespace media 218 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698