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

Unified Diff: ppapi/cpp/video_encoder.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.h ('k') | ppapi/cpp/video_encoder_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/video_encoder.cc
diff --git a/ppapi/cpp/video_encoder.cc b/ppapi/cpp/video_encoder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..17256addab27b3f7181b4f90dd4a4a6fa4ed2660
--- /dev/null
+++ b/ppapi/cpp/video_encoder.cc
@@ -0,0 +1,78 @@
+// Copyright (c) 2014 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.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
+#include "ppapi/c/ppb_video_encoder.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/module_impl.h"
+
+
+namespace pp {
+
+namespace {
+
+template <>
+const char* interface_name<PPB_VideoEncoder_0_1>() {
+ return PPB_VIDEOENCODER_INTERFACE_0_1;
+}
+
+} // namespace
+
+VideoEncoder::VideoEncoder() {
+}
+
+VideoEncoder::VideoEncoder(const InstanceHandle& instance) {
+ if (has_interface<PPB_VideoEncoder_0_1>()) {
+ PassRefFromConstructor(
+ get_interface<PPB_VideoEncoder_0_1>()->Create(instance.pp_instance()));
+ }
+}
+
+VideoEncoder::VideoEncoder(PP_Resource resource)
+ : Resource(resource) {
+}
+
+VideoEncoder::VideoEncoder(const VideoEncoder& other)
+ : Resource(other) {
+}
+
+int32_t VideoEncoder::Initialize(
+ const Graphics3D& context,
+ const PP_VideoEncoderParams& params,
+ void* user_data,
+ PPB_VideoEncoder_Ready_Func callback) {
+ if (has_interface<PPB_VideoEncoder_0_1>()) {
+ return get_interface<PPB_VideoEncoder_0_1>()->Initialize(
+ pp_resource(), context.pp_resource(), &params, user_data, callback);
+ }
+ return PP_ERROR_NOINTERFACE;
+}
+
+int32_t VideoEncoder::Encode(uint32_t encode_id,
+ const PP_VideoEncoderPicture& picture,
+ const PP_Bool force_keyframe,
+ const CompletionCallback& callback) {
+ if (has_interface<PPB_VideoEncoder_0_1>()) {
+ return get_interface<PPB_VideoEncoder_0_1>()->Encode(
+ pp_resource(), encode_id, &picture, force_keyframe,
+ callback.pp_completion_callback());
+ }
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+int32_t VideoEncoder::Reset(const CompletionCallback& callback) {
+ if (has_interface<PPB_VideoEncoder_0_1>()) {
+ return get_interface<PPB_VideoEncoder_0_1>()->Reset(
+ pp_resource(), callback.pp_completion_callback());
+ }
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+}
+
+} // namespace pp
« no previous file with comments | « ppapi/cpp/video_encoder.h ('k') | ppapi/cpp/video_encoder_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698