summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk/ppb_video_layer_thunk.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-18 22:07:03 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-18 22:07:03 +0000
commit5b3af0d88a56073513a88e7ba311107a26e367cc (patch)
treec9f447bdae7714ee2ed5c4434c5f17617689ad71 /ppapi/thunk/ppb_video_layer_thunk.cc
parentdfe9ac84eae9b1beb904ba71e3542f9ee888de0f (diff)
downloadchromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.zip
chromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.tar.gz
chromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.tar.bz2
Move the video decoder and video layer to the new API/thunk system.
This changes the video decoder API to make GetConfigs be a resource member function so it can be routed with the rest of the resource functions. This patch also removes the font_list_dev API which was never implemented and has been replaced with a function on the Font interface. TEST=manual BUG=none Review URL: http://codereview.chromium.org/7193018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_video_layer_thunk.cc')
-rw-r--r--ppapi/thunk/ppb_video_layer_thunk.cc81
1 files changed, 81 insertions, 0 deletions
diff --git a/ppapi/thunk/ppb_video_layer_thunk.cc b/ppapi/thunk/ppb_video_layer_thunk.cc
new file mode 100644
index 0000000..4a1a258
--- /dev/null
+++ b/ppapi/thunk/ppb_video_layer_thunk.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2011 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/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_video_layer_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_VideoLayer_API> EnterVideoLayer;
+
+PP_Resource Create(PP_Instance instance, PP_VideoLayerMode_Dev mode) {
+ EnterFunction<ResourceCreationAPI> enter(instance, true);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoLayer(instance, mode);
+}
+
+PP_Bool IsVideoLayer(PP_Resource resource) {
+ EnterVideoLayer enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+void SetPixelFormat(PP_Resource resource,
+ PP_VideoLayerPixelFormat_Dev pixel_format) {
+ EnterVideoLayer enter(resource, true);
+ if (enter.succeeded())
+ enter.object()->SetPixelFormat(pixel_format);
+}
+
+void SetNativeSize(PP_Resource resource, const struct PP_Size* size) {
+ EnterVideoLayer enter(resource, true);
+ if (enter.succeeded())
+ enter.object()->SetNativeSize(size);
+}
+
+void SetClipRect(PP_Resource resource, const struct PP_Rect* clip_rect) {
+ EnterVideoLayer enter(resource, true);
+ if (enter.succeeded())
+ enter.object()->SetClipRect(clip_rect);
+}
+
+PP_Bool IsReady(PP_Resource resource) {
+ EnterVideoLayer enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->IsReady();
+}
+
+PP_Bool UpdateContent(PP_Resource resource,
+ uint32_t no_of_planes,
+ const void** planes) {
+ EnterVideoLayer enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->UpdateContent(no_of_planes, planes);
+}
+
+const PPB_VideoLayer_Dev g_ppb_videolayer_thunk = {
+ &Create,
+ &IsVideoLayer,
+ &SetPixelFormat,
+ &SetNativeSize,
+ &SetClipRect,
+ &IsReady,
+ &UpdateContent
+};
+
+} // namespace
+
+const PPB_VideoLayer_Dev* GetPPB_VideoLayer_Thunk() {
+ return &g_ppb_videolayer_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi