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

Unified Diff: ppapi/cpp/video_encoder_client.cc

Issue 365153003: Pepper: add PPB_VideoEncoder interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update API to prevent the user from dealing with buffer management Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/video_encoder_client.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/video_encoder_client.cc
diff --git a/ppapi/cpp/video_encoder_client.cc b/ppapi/cpp/video_encoder_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c93580860bb8139f691b3ac6821c2d6ffadaeb86
--- /dev/null
+++ b/ppapi/cpp/video_encoder_client.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/video_encoder_client.h"
+
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/video_encoder.h"
+
+namespace pp {
+
+namespace {
+
+const char kPPPVideoEncoderInterface[] = PPP_VIDEOENCODER_INTERFACE_0_1;
+
+void HandleBitstreamBuffer(PP_Instance instance,
+ PP_Resource encoder,
+ const PP_VideoEncoderBitstreamBuffer* buffer) {
+ void* object = Instance::GetPerInstanceObject(instance,
+ kPPPVideoEncoderInterface);
+ if (!object)
+ return;
+ static_cast<VideoEncoderClient*>(object)->HandleBitstreamBuffer(
+ VideoEncoder(encoder), *buffer);
+}
+
+static PPP_VideoEncoder_0_1 videoencoder_interface = {
+ &HandleBitstreamBuffer,
+};
+
+} // namespace
+
+VideoEncoderClient::VideoEncoderClient(Instance* instance)
+ : associated_instance_(instance) {
+ Module::Get()->AddPluginInterface(kPPPVideoEncoderInterface,
+ &videoencoder_interface);
+ instance->AddPerInstanceObject(kPPPVideoEncoderInterface, this);
+}
+
+VideoEncoderClient::~VideoEncoderClient() {
+ Instance::RemovePerInstanceObject(associated_instance_,
+ kPPPVideoEncoderInterface, this);
+}
+
+} // namespace pp
« no previous file with comments | « ppapi/cpp/video_encoder_client.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698