| Index: ppapi/thunk/ppb_video_writer_thunk.cc
|
| diff --git a/ppapi/thunk/ppb_video_writer_thunk.cc b/ppapi/thunk/ppb_video_writer_thunk.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..850a195015d7192ad2da9206a600d9e4b668f491
|
| --- /dev/null
|
| +++ b/ppapi/thunk/ppb_video_writer_thunk.cc
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2013 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/c/pp_completion_callback.h"
|
| +#include "ppapi/c/pp_errors.h"
|
| +#include "ppapi/c/pp_video_frame.h"
|
| +#include "ppapi/c/ppb_video_writer.h"
|
| +#include "ppapi/shared_impl/tracked_callback.h"
|
| +#include "ppapi/thunk/enter.h"
|
| +#include "ppapi/thunk/ppb_instance_api.h"
|
| +#include "ppapi/thunk/ppb_video_writer_api.h"
|
| +#include "ppapi/thunk/resource_creation_api.h"
|
| +#include "ppapi/thunk/thunk.h"
|
| +
|
| +namespace ppapi {
|
| +namespace thunk {
|
| +
|
| +namespace {
|
| +
|
| +PP_Resource Create(PP_Instance instance) {
|
| + EnterResourceCreation enter(instance);
|
| + if (enter.failed())
|
| + return 0;
|
| + return enter.functions()->CreateVideoWriter(instance);
|
| +}
|
| +
|
| +PP_Bool IsVideoWriter(PP_Resource resource) {
|
| + EnterResource<PPB_VideoWriter_API> enter(resource, false);
|
| + return PP_FromBool(enter.succeeded());
|
| +}
|
| +
|
| +int32_t Open(PP_Resource writer,
|
| + PP_Var* stream_id,
|
| + PP_CompletionCallback callback) {
|
| + EnterResource<PPB_VideoWriter_API> enter(writer, callback, true);
|
| + if (enter.failed())
|
| + return enter.retval();
|
| + return enter.SetResult(enter.object()->Open(stream_id, enter.callback()));
|
| +}
|
| +
|
| +int32_t PutFrame(PP_Resource writer,
|
| + const PP_VideoFrame* frame) {
|
| + EnterResource<PPB_VideoWriter_API> enter(writer, true);
|
| + if (enter.failed())
|
| + return enter.retval();
|
| + return enter.SetResult(enter.object()->PutFrame(*frame));
|
| +}
|
| +
|
| +void Close(PP_Resource writer) {
|
| + EnterResource<PPB_VideoWriter_API> enter(writer, true);
|
| + if (enter.succeeded())
|
| + enter.object()->Close();
|
| +}
|
| +
|
| +const PPB_VideoWriter_0_1 g_ppb_video_writer_thunk_0_1 = {
|
| + &Create,
|
| + &IsVideoWriter,
|
| + &Open,
|
| + &PutFrame,
|
| + &Close
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +const PPB_VideoWriter_0_1* GetPPB_VideoWriter_0_1_Thunk() {
|
| + return &g_ppb_video_writer_thunk_0_1;
|
| +}
|
| +
|
| +} // namespace thunk
|
| +} // namespace ppapi
|
|
|