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

Unified Diff: ppapi/cpp/video_decoder.cc

Issue 496203002: Pepper: PPB_VideoDecoder software-only mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 4 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_decoder.h ('k') | ppapi/examples/video_decode/video_decode.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/video_decoder.cc
diff --git a/ppapi/cpp/video_decoder.cc b/ppapi/cpp/video_decoder.cc
index 3277a213b2a39536d6c82efa6e5bcabb5b9c296c..85654c1edefe18157e9faf7cb7c521b2eb477086 100644
--- a/ppapi/cpp/video_decoder.cc
+++ b/ppapi/cpp/video_decoder.cc
@@ -20,6 +20,11 @@ const char* interface_name<PPB_VideoDecoder_0_1>() {
return PPB_VIDEODECODER_INTERFACE_0_1;
}
+template <>
+const char* interface_name<PPB_VideoDecoder_0_2>() {
+ return PPB_VIDEODECODER_INTERFACE_0_2;
+}
+
} // namespace
VideoDecoder::VideoDecoder() {
@@ -37,14 +42,26 @@ VideoDecoder::VideoDecoder(const VideoDecoder& other) : Resource(other) {
int32_t VideoDecoder::Initialize(const Graphics3D& context,
PP_VideoProfile profile,
- bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Initialize(
+ pp_resource(),
+ context.pp_resource(),
+ profile,
+ acceleration,
+ cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
+ if (acceleration == PP_HARDWAREACCELERATION_NONE)
+ return cc.MayForce(PP_ERROR_NOTSUPPORTED);
return get_interface<PPB_VideoDecoder_0_1>()->Initialize(
pp_resource(),
context.pp_resource(),
profile,
- PP_FromBool(allow_software_fallback),
+ acceleration == PP_HARDWAREACCELERATION_WITHFALLBACK
+ ? PP_TRUE
+ : PP_FALSE,
cc.pp_completion_callback());
}
return cc.MayForce(PP_ERROR_NOINTERFACE);
@@ -54,6 +71,10 @@ int32_t VideoDecoder::Decode(uint32_t decode_id,
uint32_t size,
const void* buffer,
const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Decode(
+ pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Decode(
pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
@@ -63,6 +84,10 @@ int32_t VideoDecoder::Decode(uint32_t decode_id,
int32_t VideoDecoder::GetPicture(
const CompletionCallbackWithOutput<PP_VideoPicture>& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->GetPicture(
+ pp_resource(), cc.output(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->GetPicture(
pp_resource(), cc.output(), cc.pp_completion_callback());
@@ -71,13 +96,20 @@ int32_t VideoDecoder::GetPicture(
}
void VideoDecoder::RecyclePicture(const PP_VideoPicture& picture) {
- if (has_interface<PPB_VideoDecoder_0_1>()) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ get_interface<PPB_VideoDecoder_0_2>()->RecyclePicture(pp_resource(),
+ &picture);
+ } else if (has_interface<PPB_VideoDecoder_0_1>()) {
get_interface<PPB_VideoDecoder_0_1>()->RecyclePicture(pp_resource(),
&picture);
}
}
int32_t VideoDecoder::Flush(const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Flush(
+ pp_resource(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Flush(
pp_resource(), cc.pp_completion_callback());
@@ -86,6 +118,10 @@ int32_t VideoDecoder::Flush(const CompletionCallback& cc) {
}
int32_t VideoDecoder::Reset(const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Reset(
+ pp_resource(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Reset(
pp_resource(), cc.pp_completion_callback());
« no previous file with comments | « ppapi/cpp/video_decoder.h ('k') | ppapi/examples/video_decode/video_decode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698