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

Side by Side Diff: ppapi/examples/video_capture/video_capture.cc

Issue 11274036: Refactor video capture to new design (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: export Created 8 years, 1 month 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 (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 #include <assert.h> 5 #include <assert.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 void VCDemoInstance::HandleMessage(const pp::Var& message_data) { 191 void VCDemoInstance::HandleMessage(const pp::Var& message_data) {
192 if (message_data.is_string()) { 192 if (message_data.is_string()) {
193 std::string event = message_data.AsString(); 193 std::string event = message_data.AsString();
194 if (event == "PageInitialized") { 194 if (event == "PageInitialized") {
195 pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> > 195 pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> >
196 callback = callback_factory_.NewCallbackWithOutput( 196 callback = callback_factory_.NewCallbackWithOutput(
197 &VCDemoInstance::EnumerateDevicesFinished); 197 &VCDemoInstance::EnumerateDevicesFinished);
198 video_capture_.EnumerateDevices(callback); 198 video_capture_.EnumerateDevices(callback);
199 } else if (event == "UseDefault") { 199 } else if (event == "UseDefault") {
200 Open(pp::DeviceRef_Dev()); 200 Open(pp::DeviceRef_Dev());
201 } else if (event == "UseDefault(v0.1)") {
202 const PPB_VideoCapture_Dev_0_1* video_capture_0_1 =
203 static_cast<const PPB_VideoCapture_Dev_0_1*>(
204 pp::Module::Get()->GetBrowserInterface(
205 PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1));
206 video_capture_0_1->StartCapture(video_capture_.pp_resource(),
207 &capture_info_, 4);
208 } else if (event == "Stop") { 201 } else if (event == "Stop") {
209 video_capture_.StopCapture(); 202 video_capture_.StopCapture();
210 } 203 }
211 } else if (message_data.is_number()) { 204 } else if (message_data.is_number()) {
212 int index = message_data.AsInt(); 205 int index = message_data.AsInt();
213 if (index >= 0 && index < static_cast<int>(devices_.size())) { 206 if (index >= 0 && index < static_cast<int>(devices_.size())) {
214 Open(devices_[index]); 207 Open(devices_[index]);
215 } else { 208 } else {
216 assert(false); 209 assert(false);
217 } 210 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 439 }
447 440
448 } // anonymous namespace 441 } // anonymous namespace
449 442
450 namespace pp { 443 namespace pp {
451 // Factory function for your specialization of the Module object. 444 // Factory function for your specialization of the Module object.
452 Module* CreateModule() { 445 Module* CreateModule() {
453 return new VCDemoModule(); 446 return new VCDemoModule();
454 } 447 }
455 } // namespace pp 448 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/examples/enumerate_devices/enumerate_devices.html ('k') | ppapi/examples/video_capture/video_capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698