summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/c/dev/ppb_layer_compositor_dev.h4
-rw-r--r--ppapi/c/dev/ppb_video_decoder_dev.h50
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.cc54
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.h22
-rw-r--r--ppapi/tests/arch_dependent_sizes_32.h2
-rw-r--r--ppapi/tests/arch_dependent_sizes_64.h2
-rw-r--r--ppapi/tests/test_video_decoder.cc19
-rw-r--r--ppapi/tests/test_video_decoder.h2
-rw-r--r--webkit/plugins/ppapi/ppb_layer_compositor_impl.cc11
-rw-r--r--webkit/plugins/ppapi/ppb_layer_compositor_impl.h2
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc93
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h12
12 files changed, 111 insertions, 162 deletions
diff --git a/ppapi/c/dev/ppb_layer_compositor_dev.h b/ppapi/c/dev/ppb_layer_compositor_dev.h
index 1ee4594..b07431e21 100644
--- a/ppapi/c/dev/ppb_layer_compositor_dev.h
+++ b/ppapi/c/dev/ppb_layer_compositor_dev.h
@@ -68,8 +68,8 @@ struct PPB_LayerCompositor_Dev {
// Since this is an asynchronous operation, |callback| will be called when
// this operation is done.
//
- // Returns an error code from pp_errors.h.
- int32_t (*SwapBuffers)(PP_Resource compositor,
+ // Returns PP_TRUE if the operation was successful. PP_FALSE otherwise.
+ PP_Bool (*SwapBuffers)(PP_Resource compositor,
struct PP_CompletionCallback callback);
};
diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h
index 4ec65df..12f6d5f 100644
--- a/ppapi/c/dev/ppb_video_decoder_dev.h
+++ b/ppapi/c/dev/ppb_video_decoder_dev.h
@@ -52,7 +52,7 @@
// |###########################|
// | GetConfigs |
// |-------------------------->|
-// | Create + Initialize |
+// | Create |
// |-------------------------->| Decoder will ask for certain number
// | (Decode) | of PictureBuffers. This may happen
// |- - - - - - - - - - - - - >| either directly after constructor or
@@ -121,16 +121,7 @@ struct PPB_VideoDecoder_Dev {
uint32_t matching_configs_size,
uint32_t* num_of_matching_configs);
- // Creates a video decoder. Initialize() must be called afterwards to
- // set its configuration.
- //
- // Parameters:
- // |instance| pointer to the plugin instance.
- //
- // The created decoder is returned as PP_Resource. 0 means failure.
- PP_Resource (*Create)(PP_Instance instance);
-
- // Initializes the video decoder with requested configuration.
+ // Creates a video decoder with requested |decoder_config|.
// |input_format| in |decoder_config| specifies the format of input access
// unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required.
// Plugin has the option to specify codec profile/level and other
@@ -138,13 +129,13 @@ struct PPB_VideoDecoder_Dev {
// the most appropriate decoder.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
- // |decoder_config| the configuration to use to initialize the decoder.
- // |callback| called after initialization is complete.
+ // |instance| pointer to the plugin instance.
+ // |dec_config| the configuration which to use to initialize the decoder.
+ // |callback| called after initialize is complete.
//
- // Returns an error code from pp_errors.h.
- int32_t (*Initialize)(PP_Resource video_decoder,
- const PP_VideoConfigElement* decoder_config,
+ // The created decoder is returned as PP_Resource. NULL means failure.
+ PP_Resource (*Create)(PP_Instance instance,
+ const PP_VideoConfigElement* dec_config,
struct PP_CompletionCallback callback);
// Tests whether |resource| is a video decoder created through Create
@@ -160,13 +151,14 @@ struct PPB_VideoDecoder_Dev {
// non-blocking function.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
+ // |video_decoder| is the previously created handle to the decoder instance.
// |bitstream_buffer| is the bitstream buffer that contains the input data.
// |callback| will be called when |bitstream_buffer| has been processed by
// the decoder.
//
- // Returns an error code from pp_errors.h.
- int32_t (*Decode)(PP_Resource video_decoder,
+ // Returns PP_TRUE on decoder successfully accepting buffer, PP_FALSE
+ // otherwise.
+ PP_Bool (*Decode)(PP_Resource video_decoder,
const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
struct PP_CompletionCallback callback);
@@ -193,7 +185,7 @@ struct PPB_VideoDecoder_Dev {
// PPB API.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
+ // |video_decoder| is the previously created handle to the decoder instance.
// |no_of_buffers| how many buffers are behind picture buffer pointer.
// |buffers| contains the reference to the picture buffer that was
// allocated.
@@ -218,7 +210,7 @@ struct PPB_VideoDecoder_Dev {
// the GL textures for writing output again.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
+ // |video_decoder| is the previously created handle to the decoder instance.
// |picture_buffer_id| contains the id of the picture buffer that was
// processed.
void (*ReusePictureBuffer)(PP_Resource video_decoder,
@@ -231,12 +223,13 @@ struct PPB_VideoDecoder_Dev {
// decode will call the |callback|.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
+ // |video_decoder| is the previously created handle to the decoder instance.
// |callback| is one-time callback that will be called once the flushing
// request has been completed.
//
- // Returns an error code from pp_errors.h.
- int32_t (*Flush)(PP_Resource video_decoder,
+ // Returns PP_TRUE on acceptance of flush request and PP_FALSE if request to
+ // flush is rejected by the decoder.
+ PP_Bool (*Flush)(PP_Resource video_decoder,
struct PP_CompletionCallback callback);
// Dispatches abortion request to the decoder to abort decoding as soon as
@@ -246,12 +239,13 @@ struct PPB_VideoDecoder_Dev {
// to dismiss them.
//
// Parameters:
- // |video_decoder| is the previously created handle to the decoder resource.
+ // |video_decoder| is the previously created handle to the decoder instance.
// |callback| is one-time callback that will be called once the abortion
// request has been completed.
//
- // Returns an error code from pp_errors.h.
- int32_t (*Abort)(PP_Resource video_decoder,
+ // Returns PP_TRUE on acceptance of abort request and PP_FALSE if request to
+ // abort is rejected by the decoder.
+ PP_Bool (*Abort)(PP_Resource video_decoder,
struct PP_CompletionCallback callback);
};
diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc
index b1ebcfb..a6994b5 100644
--- a/ppapi/cpp/dev/video_decoder_dev.cc
+++ b/ppapi/cpp/dev/video_decoder_dev.cc
@@ -22,24 +22,19 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
} // namespace
-VideoDecoder::VideoDecoder(const Instance* instance, Client* client)
+VideoDecoder::VideoDecoder(const Instance* instance,
+ const PP_VideoConfigElement* config,
+ CompletionCallback callback,
+ Client* client)
: client_(client) {
if (!has_interface<PPB_VideoDecoder_Dev>())
return;
PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
- instance->pp_instance()));
+ instance->pp_instance(), config, callback.pp_completion_callback()));
}
VideoDecoder::~VideoDecoder() {}
-int32_t VideoDecoder::Initialize(const PP_VideoConfigElement* config,
- CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>())
- return PP_ERROR_NOINTERFACE;
- return get_interface<PPB_VideoDecoder_Dev>()->Initialize(
- pp_resource(), config, callback.pp_completion_callback());
-}
-
bool VideoDecoder::GetConfigs(Instance* instance,
const PP_VideoConfigElement* prototype_config,
PP_VideoConfigElement* matching_configs,
@@ -68,15 +63,12 @@ void VideoDecoder::AssignSysmemBuffers(
pp_resource(), buffers.size(), &buffers[0]);
}
-int32_t VideoDecoder::Decode(
- const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
- CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>())
- return PP_ERROR_NOINTERFACE;
- if (!pp_resource())
- return PP_ERROR_BADRESOURCE;
- return get_interface<PPB_VideoDecoder_Dev>()->Decode(
- pp_resource(), &bitstream_buffer, callback.pp_completion_callback());
+bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
+ CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
+ return false;
+ return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode(
+ pp_resource(), &bitstream_buffer, callback.pp_completion_callback()));
}
void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
@@ -86,22 +78,18 @@ void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
pp_resource(), picture_buffer_id);
}
-int32_t VideoDecoder::Flush(CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>())
- return PP_ERROR_NOINTERFACE;
- if (!pp_resource())
- return PP_ERROR_BADRESOURCE;
- return get_interface<PPB_VideoDecoder_Dev>()->Flush(
- pp_resource(), callback.pp_completion_callback());
+bool VideoDecoder::Flush(CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
+ return false;
+ return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush(
+ pp_resource(), callback.pp_completion_callback()));
}
-int32_t VideoDecoder::Abort(CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>())
- return PP_ERROR_NOINTERFACE;
- if (!pp_resource())
- return PP_ERROR_BADRESOURCE;
- return get_interface<PPB_VideoDecoder_Dev>()->Abort(
- pp_resource(), callback.pp_completion_callback());
+bool VideoDecoder::Abort(CompletionCallback callback) {
+ if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
+ return false;
+ return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort(
+ pp_resource(), callback.pp_completion_callback()));
}
} // namespace pp
diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h
index e6558b1..51aa594 100644
--- a/ppapi/cpp/dev/video_decoder_dev.h
+++ b/ppapi/cpp/dev/video_decoder_dev.h
@@ -54,21 +54,15 @@ class VideoDecoder : public Resource {
//
// Parameters:
// |instance| is the pointer to the plug-in instance.
+ // |config| is the configuration on which the decoder should be initialized.
// |callback| will be called when decoder is initialized.
// |client| is the pointer to the client object. Ownership of the object is
// not transferred and it must outlive the lifetime of this class.
- VideoDecoder(const Instance* instance, Client* client);
+ VideoDecoder(const Instance* instance,
+ const PP_VideoConfigElement* config,
+ CompletionCallback callback, Client* client);
~VideoDecoder();
- // Initializates the video decoder with a requested configuration.
- // Calls Init() on PPB_VideoDecoder_Dev interface.
- //
- // Parameters:
- // |config| is the configuration on which the decoder should be initialized.
- // |callback| will be called when decoder is initialized.
- int32_t Initialize(const PP_VideoConfigElement* config,
- CompletionCallback callback);
-
// GetConfigs returns supported configurations that are subsets of given
// |prototype_config|.
bool GetConfigs(Instance* instance,
@@ -85,19 +79,19 @@ class VideoDecoder : public Resource {
// Decodes given bitstream buffer. Once decoder is done with processing
// |bitstream_buffer| is will call |callback| with provided user data.
- int32_t Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
- CompletionCallback callback);
+ bool Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
+ CompletionCallback callback);
// Tells the decoder to reuse given picture buffer.
void ReusePictureBuffer(int32_t picture_buffer_id);
// Flushes the decoder. |callback| will be called as soon as Flush has been
// finished.
- int32_t Flush(CompletionCallback callback);
+ bool Flush(CompletionCallback callback);
// Dispatches abortion request to the decoder to abort decoding as soon as
// possible. |callback| will be called as soon as abortion has been finished.
- int32_t Abort(CompletionCallback callback);
+ bool Abort(CompletionCallback callback);
private:
// Pointer to the plugin's video decoder support interface for providing the
diff --git a/ppapi/tests/arch_dependent_sizes_32.h b/ppapi/tests/arch_dependent_sizes_32.h
index f797494..b7661cb 100644
--- a/ppapi/tests/arch_dependent_sizes_32.h
+++ b/ppapi/tests/arch_dependent_sizes_32.h
@@ -19,7 +19,7 @@ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileChooserOptions_Dev, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 24);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12);
-PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 40);
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 36);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 20);
#endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_32_H_ */
diff --git a/ppapi/tests/arch_dependent_sizes_64.h b/ppapi/tests/arch_dependent_sizes_64.h
index 378c5b3..de68721 100644
--- a/ppapi/tests/arch_dependent_sizes_64.h
+++ b/ppapi/tests/arch_dependent_sizes_64.h
@@ -19,7 +19,7 @@ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 16);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileChooserOptions_Dev, 16);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 24);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12);
-PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 80);
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 72);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 40);
#endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
index 82f99c7..db0da55 100644
--- a/ppapi/tests/test_video_decoder.cc
+++ b/ppapi/tests/test_video_decoder.cc
@@ -6,7 +6,6 @@
#include "ppapi/c/dev/ppb_video_decoder_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/tests/testing_instance.h"
@@ -21,24 +20,18 @@ bool TestVideoDecoder::Init() {
}
void TestVideoDecoder::RunTest() {
- RUN_TEST(CreateAndInitialize);
+ instance_->LogTest("Create", TestCreate());
}
void TestVideoDecoder::QuitMessageLoop() {
testing_interface_->QuitMessageLoop(instance_->pp_instance());
}
-std::string TestVideoDecoder::TestCreateAndInitialize() {
+std::string TestVideoDecoder::TestCreate() {
PP_Resource decoder = video_decoder_interface_->Create(
- instance_->pp_instance());
- if (decoder == 0)
- return "Create: error creating the decoder";
-
- int32_t pp_error = video_decoder_interface_->Initialize(
- decoder, NULL, PP_BlockUntilComplete());
- pp::Module::Get()->core()->ReleaseResource(decoder);
- if (pp_error != PP_ERROR_BADARGUMENT)
- return "Initialize: error detecting null callback";
-
+ instance_->pp_instance(), NULL, PP_MakeCompletionCallback(NULL, NULL));
+ if (decoder == 0) {
+ return "Error creating the decoder";
+ }
PASS();
}
diff --git a/ppapi/tests/test_video_decoder.h b/ppapi/tests/test_video_decoder.h
index dbef66f..15e0b39 100644
--- a/ppapi/tests/test_video_decoder.h
+++ b/ppapi/tests/test_video_decoder.h
@@ -22,7 +22,7 @@ class TestVideoDecoder : public TestCase {
void QuitMessageLoop();
private:
- std::string TestCreateAndInitialize();
+ std::string TestCreate();
// Used by the tests that access the C API directly.
const PPB_VideoDecoder_Dev* video_decoder_interface_;
diff --git a/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc
index 93e3032..65e5d10 100644
--- a/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc
+++ b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc
@@ -4,7 +4,6 @@
#include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h"
-#include "ppapi/c/pp_errors.h"
#include "webkit/plugins/ppapi/common.h"
namespace webkit {
@@ -41,9 +40,9 @@ void SetDisplay(PP_Resource compositor, PP_Resource layer,
void MarkAsDirty(PP_Resource compositor, PP_Resource layer) {
}
-int32_t SwapBuffers(PP_Resource compositor,
- struct PP_CompletionCallback callback) {
- return PP_ERROR_FAILED;
+PP_Bool SwapBuffers(PP_Resource compositor,
+ struct PP_CompletionCallback callback) {
+ return PP_FALSE;
}
const PPB_LayerCompositor_Dev ppb_layercompositor = {
@@ -98,9 +97,9 @@ void PPB_LayerCompositor_Impl::SetDisplay(PP_Resource layer,
void PPB_LayerCompositor_Impl::MarkAsDirty(PP_Resource layer) {
}
-int32_t PPB_LayerCompositor_Impl::SwapBuffers(
+PP_Bool PPB_LayerCompositor_Impl::SwapBuffers(
struct PP_CompletionCallback callback) {
- return PP_ERROR_FAILED;
+ return PP_FALSE;
}
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/ppb_layer_compositor_impl.h b/webkit/plugins/ppapi/ppb_layer_compositor_impl.h
index 7d3a023..a84fb27 100644
--- a/webkit/plugins/ppapi/ppb_layer_compositor_impl.h
+++ b/webkit/plugins/ppapi/ppb_layer_compositor_impl.h
@@ -32,7 +32,7 @@ class PPB_LayerCompositor_Impl : public Resource {
void SetRect(PP_Resource layer, const struct PP_Rect* rect);
void SetDisplay(PP_Resource layer, PP_Bool is_displayed);
void MarkAsDirty(PP_Resource layer);
- int32_t SwapBuffers(struct PP_CompletionCallback callback);
+ PP_Bool SwapBuffers(struct PP_CompletionCallback callback);
private:
DISALLOW_COPY_AND_ASSIGN(PPB_LayerCompositor_Impl);
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 5fd318a..6448192 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -44,39 +44,37 @@ PP_Bool GetConfigs(PP_Instance instance_id,
num_of_matching_configs));
}
-PP_Resource Create(PP_Instance instance_id) {
+PP_Resource Create(PP_Instance instance_id,
+ const PP_VideoConfigElement* decoder_config,
+ PP_CompletionCallback callback) {
PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
if (!instance)
return 0;
- PPB_VideoDecoder_Impl* decoder = new PPB_VideoDecoder_Impl(instance);
- return decoder->GetReference();
-}
-
-int32_t Initialize(PP_Resource video_decoder,
- const PP_VideoConfigElement* decoder_config,
- struct PP_CompletionCallback callback) {
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return PP_ERROR_BADRESOURCE;
+ new PPB_VideoDecoder_Impl(instance));
+
+ if (!decoder->Init(
+ const_cast<PP_VideoConfigElement*>(decoder_config), callback)) {
+ return 0;
+ }
- return decoder->Initialize(decoder_config, callback);
+ return decoder->GetReference();
}
PP_Bool IsVideoDecoder(PP_Resource resource) {
return BoolToPPBool(!!Resource::GetAs<PPB_VideoDecoder_Impl>(resource));
}
-int32_t Decode(PP_Resource decoder_id,
+PP_Bool Decode(PP_Resource decoder_id,
const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
PP_CompletionCallback callback) {
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
Resource::GetAs<PPB_VideoDecoder_Impl>(decoder_id));
if (!decoder)
- return PP_ERROR_BADRESOURCE;
+ return PP_FALSE;
- return decoder->Decode(bitstream_buffer, callback);
+ return BoolToPPBool(decoder->Decode(bitstream_buffer, callback));
}
void AssignGLESBuffers(PP_Resource video_decoder,
@@ -110,29 +108,28 @@ void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
decoder->ReusePictureBuffer(picture_buffer_id);
}
-int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
+PP_Bool Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
if (!decoder)
- return PP_ERROR_BADRESOURCE;
+ return PP_FALSE;
- return decoder->Flush(callback);
+ return BoolToPPBool(decoder->Flush(callback));
}
-int32_t Abort(PP_Resource video_decoder,
+PP_Bool Abort(PP_Resource video_decoder,
PP_CompletionCallback callback) {
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
if (!decoder)
- return PP_ERROR_BADRESOURCE;
+ return PP_FALSE;
- return decoder->Abort(callback);
+ return BoolToPPBool(decoder->Abort(callback));
}
const PPB_VideoDecoder_Dev ppb_videodecoder = {
&GetConfigs,
&Create,
- &Initialize,
&IsVideoDecoder,
&Decode,
&AssignGLESBuffers,
@@ -219,41 +216,34 @@ bool PPB_VideoDecoder_Impl::GetConfigs(
return true;
}
-int32_t PPB_VideoDecoder_Impl::Initialize(
- const PP_VideoConfigElement* decoder_config,
- PP_CompletionCallback callback) {
- if (!callback.func)
- return PP_ERROR_BADARGUMENT;
+bool PPB_VideoDecoder_Impl::Init(const PP_VideoConfigElement* decoder_config,
+ PP_CompletionCallback callback) {
if (!instance())
- return PP_ERROR_FAILED;
+ return false;
platform_video_decoder_.reset(
instance()->delegate()->CreateVideoDecoder(this));
- if (!platform_video_decoder_.get())
- return PP_ERROR_FAILED;
-
std::vector<uint32> copied;
// TODO(vrk): Validate configs before copy.
CopyToConfigList(decoder_config, &copied);
- if (platform_video_decoder_->Initialize(copied)) {
- initialization_callback_ = callback;
- return PP_OK_COMPLETIONPENDING;
- } else {
- return PP_ERROR_FAILED;
- }
+ platform_video_decoder_->Initialize(copied);
+
+ initialization_callback_ = callback;
+
+ return platform_video_decoder_.get()? true : false;
}
-int32_t PPB_VideoDecoder_Impl::Decode(
+bool PPB_VideoDecoder_Impl::Decode(
const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
PP_CompletionCallback callback) {
if (!platform_video_decoder_.get())
- return PP_ERROR_BADRESOURCE;
+ return false;
::ppapi::thunk::EnterResourceNoLock< ::ppapi::thunk::PPB_Buffer_API>
enter(bitstream_buffer->data, true);
if (enter.failed())
- return PP_ERROR_FAILED;
+ return false;
PPB_Buffer_Impl* buffer = static_cast<PPB_Buffer_Impl*>(enter.object());
media::BitstreamBuffer decode_buffer(bitstream_buffer->id,
@@ -264,10 +254,7 @@ int32_t PPB_VideoDecoder_Impl::Decode(
// TODO(vmr): handle simultaneous decodes + callbacks.
bitstream_buffer_callback_ = callback;
- if (platform_video_decoder_->Decode(decode_buffer))
- return PP_OK_COMPLETIONPENDING;
- else
- return PP_ERROR_FAILED;
+ return platform_video_decoder_->Decode(decode_buffer);
}
void PPB_VideoDecoder_Impl::AssignGLESBuffers(
@@ -306,32 +293,26 @@ void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) {
platform_video_decoder_->ReusePictureBuffer(picture_buffer_id);
}
-int32_t PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
+bool PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
if (!platform_video_decoder_.get())
- return PP_ERROR_BADRESOURCE;
+ return false;
// Store the callback to be called when Flush() is done.
// TODO(vmr): Check for current flush/abort operations.
flush_callback_ = callback;
- if (platform_video_decoder_->Flush())
- return PP_OK_COMPLETIONPENDING;
- else
- return PP_ERROR_FAILED;
+ return platform_video_decoder_->Flush();
}
-int32_t PPB_VideoDecoder_Impl::Abort(PP_CompletionCallback callback) {
+bool PPB_VideoDecoder_Impl::Abort(PP_CompletionCallback callback) {
if (!platform_video_decoder_.get())
- return PP_ERROR_BADRESOURCE;
+ return false;
// Store the callback to be called when Abort() is done.
// TODO(vmr): Check for current flush/abort operations.
abort_callback_ = callback;
- if (platform_video_decoder_->Abort())
- return PP_OK_COMPLETIONPENDING;
- else
- return PP_ERROR_FAILED;
+ return platform_video_decoder_->Abort();
}
void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index f67aa83..9e4b176 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -46,17 +46,17 @@ class PPB_VideoDecoder_Impl : public Resource,
PP_VideoConfigElement* matching_configs,
uint32_t matching_configs_size,
uint32_t* num_of_matching_configs);
- int32_t Initialize(const PP_VideoConfigElement* dec_config,
- PP_CompletionCallback callback);
- int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
- PP_CompletionCallback callback);
+ bool Init(const PP_VideoConfigElement* dec_config,
+ PP_CompletionCallback callback);
+ bool Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
+ PP_CompletionCallback callback);
void AssignGLESBuffers(uint32_t no_of_buffers,
const PP_GLESBuffer_Dev* buffers);
void AssignSysmemBuffers(uint32_t no_of_buffers,
const PP_SysmemBuffer_Dev* buffers);
void ReusePictureBuffer(int32_t picture_buffer_id);
- int32_t Flush(PP_CompletionCallback callback);
- int32_t Abort(PP_CompletionCallback callback);
+ bool Flush(PP_CompletionCallback callback);
+ bool Abort(PP_CompletionCallback callback);
// media::VideoDecodeAccelerator::Client implementation.
virtual void ProvidePictureBuffers(