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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/video_encoder_client.h"
6
7 #include "ppapi/cpp/instance.h"
8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/video_encoder.h"
12
13 namespace pp {
14
15 namespace {
16
17 const char kPPPVideoEncoderInterface[] = PPP_VIDEOENCODER_INTERFACE_0_1;
18
19 void HandleBitstreamBuffer(PP_Instance instance,
20 PP_Resource encoder,
21 const PP_VideoEncoderBitstreamBuffer* buffer) {
22 void* object = Instance::GetPerInstanceObject(instance,
23 kPPPVideoEncoderInterface);
24 if (!object)
25 return;
26 static_cast<VideoEncoderClient*>(object)->HandleBitstreamBuffer(
27 VideoEncoder(encoder), *buffer);
28 }
29
30 static PPP_VideoEncoder_0_1 videoencoder_interface = {
31 &HandleBitstreamBuffer,
32 };
33
34 } // namespace
35
36 VideoEncoderClient::VideoEncoderClient(Instance* instance)
37 : associated_instance_(instance) {
38 Module::Get()->AddPluginInterface(kPPPVideoEncoderInterface,
39 &videoencoder_interface);
40 instance->AddPerInstanceObject(kPPPVideoEncoderInterface, this);
41 }
42
43 VideoEncoderClient::~VideoEncoderClient() {
44 Instance::RemovePerInstanceObject(associated_instance_,
45 kPPPVideoEncoderInterface, this);
46 }
47
48 } // namespace pp
OLDNEW
« 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