Add an extension override bubble and warning box for proxy extensions.
[chromium-blink-merge.git] / ppapi / cpp / video_decoder.cc
blob3277a213b2a39536d6c82efa6e5bcabb5b9c296c
1 // Copyright (c) 2014 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.
5 #include "ppapi/cpp/video_decoder.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_video_decoder.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h"
14 namespace pp {
16 namespace {
18 template <>
19 const char* interface_name<PPB_VideoDecoder_0_1>() {
20 return PPB_VIDEODECODER_INTERFACE_0_1;
23 } // namespace
25 VideoDecoder::VideoDecoder() {
28 VideoDecoder::VideoDecoder(const InstanceHandle& instance) {
29 if (has_interface<PPB_VideoDecoder_0_1>()) {
30 PassRefFromConstructor(
31 get_interface<PPB_VideoDecoder_0_1>()->Create(instance.pp_instance()));
35 VideoDecoder::VideoDecoder(const VideoDecoder& other) : Resource(other) {
38 int32_t VideoDecoder::Initialize(const Graphics3D& context,
39 PP_VideoProfile profile,
40 bool allow_software_fallback,
41 const CompletionCallback& cc) {
42 if (has_interface<PPB_VideoDecoder_0_1>()) {
43 return get_interface<PPB_VideoDecoder_0_1>()->Initialize(
44 pp_resource(),
45 context.pp_resource(),
46 profile,
47 PP_FromBool(allow_software_fallback),
48 cc.pp_completion_callback());
50 return cc.MayForce(PP_ERROR_NOINTERFACE);
53 int32_t VideoDecoder::Decode(uint32_t decode_id,
54 uint32_t size,
55 const void* buffer,
56 const CompletionCallback& cc) {
57 if (has_interface<PPB_VideoDecoder_0_1>()) {
58 return get_interface<PPB_VideoDecoder_0_1>()->Decode(
59 pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
61 return cc.MayForce(PP_ERROR_NOINTERFACE);
64 int32_t VideoDecoder::GetPicture(
65 const CompletionCallbackWithOutput<PP_VideoPicture>& cc) {
66 if (has_interface<PPB_VideoDecoder_0_1>()) {
67 return get_interface<PPB_VideoDecoder_0_1>()->GetPicture(
68 pp_resource(), cc.output(), cc.pp_completion_callback());
70 return cc.MayForce(PP_ERROR_NOINTERFACE);
73 void VideoDecoder::RecyclePicture(const PP_VideoPicture& picture) {
74 if (has_interface<PPB_VideoDecoder_0_1>()) {
75 get_interface<PPB_VideoDecoder_0_1>()->RecyclePicture(pp_resource(),
76 &picture);
80 int32_t VideoDecoder::Flush(const CompletionCallback& cc) {
81 if (has_interface<PPB_VideoDecoder_0_1>()) {
82 return get_interface<PPB_VideoDecoder_0_1>()->Flush(
83 pp_resource(), cc.pp_completion_callback());
85 return cc.MayForce(PP_ERROR_NOINTERFACE);
88 int32_t VideoDecoder::Reset(const CompletionCallback& cc) {
89 if (has_interface<PPB_VideoDecoder_0_1>()) {
90 return get_interface<PPB_VideoDecoder_0_1>()->Reset(
91 pp_resource(), cc.pp_completion_callback());
93 return cc.MayForce(PP_ERROR_NOINTERFACE);
96 } // namespace pp