diff options
author | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 16:29:07 +0000 |
---|---|---|
committer | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 16:29:07 +0000 |
commit | 6ceb1207c32f4ecdd9d693e77c4e9ec5eda5efa2 (patch) | |
tree | 32cf752999123875fac24b27da13d2d78cd4eddc /ppapi | |
parent | 5818639c6c590be2290e72706064a6ab4b3b6aad (diff) | |
download | chromium_src-6ceb1207c32f4ecdd9d693e77c4e9ec5eda5efa2.zip chromium_src-6ceb1207c32f4ecdd9d693e77c4e9ec5eda5efa2.tar.gz chromium_src-6ceb1207c32f4ecdd9d693e77c4e9ec5eda5efa2.tar.bz2 |
Remove redundant size and type information from VideoDecode PPAPI
The visible size of the video frame is determined at Create stage.
The type of buffer (from system memory or texture-backed via GLES)
is decided by the plugin when it calls AssignGLESBuffers or
AssignSysmemBuffers in response to ProvidePictureBuffers.
The decoded size will be the same as the size requested in
ProvidePictureBuffers.
Thus these values specified anywhere else is redundant, and introduces
a place to have inconsistency.
BUG=NONE
TEST=ovda unittest passes; gles2 runs w/o crashing
Review URL: http://codereview.chromium.org/7021020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/c/dev/pp_video_dev.h | 44 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_decoder_dev.h | 11 | ||||
-rw-r--r-- | ppapi/c/dev/ppp_video_decoder_dev.h | 5 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_client_dev.cc | 5 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_client_dev.h | 3 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_dev.cc | 6 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_dev.h | 2 | ||||
-rw-r--r-- | ppapi/examples/gles2/gles2.cc | 22 | ||||
-rw-r--r-- | ppapi/tests/arch_dependent_sizes_32.h | 2 | ||||
-rw-r--r-- | ppapi/tests/arch_dependent_sizes_64.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_video_decoder_api.h | 4 | ||||
-rw-r--r-- | ppapi/thunk/ppb_video_decoder_thunk.cc | 10 |
12 files changed, 36 insertions, 80 deletions
diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h index 8833818..49867b0 100644 --- a/ppapi/c/dev/pp_video_dev.h +++ b/ppapi/c/dev/pp_video_dev.h @@ -165,16 +165,6 @@ enum PP_ColorFormat_Dev { }; PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ColorFormat_Dev, 4); -// Enumeration to determine which type of memory for buffer is used. -enum PP_PictureBufferType_Dev { - PP_PICTUREBUFFERTYPE_NONE = 0, - // System memory a.k.a. RAM. - PP_PICTUREBUFFERTYPE_SYSTEM = 1, - // GLES texture allocated using OpenGL ES APIs. - PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1 -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4); - // The data structure for video bitstream buffer. struct PP_VideoBitstreamBuffer_Dev { // Client-specified identifier for the bitstream buffer. @@ -188,8 +178,8 @@ struct PP_VideoBitstreamBuffer_Dev { int32_t size; }; -// Struct for specifying data about buffer. -struct PP_BufferInfo_Dev { +// Struct for specifying texture-backed picture data. +struct PP_PictureBuffer_Dev { // Client-specified id for the picture buffer. By using this value client can // keep track of the buffers it has assigned to the video decoder and how they // are passed back to it. @@ -197,48 +187,18 @@ struct PP_BufferInfo_Dev { // Dimensions of the buffer. struct PP_Size size; -}; -// Struct for specifying texture-backed picture data. -struct PP_GLESBuffer_Dev { // Texture ID in the given context where picture is stored. GLuint texture_id; - - // Information about the buffer. - struct PP_BufferInfo_Dev info; -}; - -// Struct for specifying sysmem-backed picture data. -struct PP_SysmemBuffer_Dev { - // Resource representing system memory from shared memory address space. - // Use PPB_Buffer_Dev interface to handle this resource. - PP_Resource data; - - // Information about the buffer. - struct PP_BufferInfo_Dev info; }; // Structure to describe a decoded output frame. -// The decoded pixels will always begin flush with the upper left-hand corner -// of the buffer (0, 0). struct PP_Picture_Dev { // ID of the picture buffer where the picture is stored. int32_t picture_buffer_id; // ID of the bitstream from which this data was decoded. int32_t bitstream_buffer_id; - - // Visible size of the picture. - // This describes the dimensions of the picture that is intended to be - // displayed from the decoded output. - struct PP_Size visible_size; - - // Decoded size of the picture. - // This describes the dimensions of the decoded output. This may be slightly - // larger than the visible size because the stride is sometimes larger than - // the width of the output. The plugin should handle rendering the frame - // appropriately with respect to the sizes. - struct PP_Size decoded_size; }; // Enumeration for error events that may be reported through diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index 5b8f0d4..881f098 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -9,8 +9,8 @@ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_var.h" -#define PPB_VIDEODECODER_DEV_INTERFACE_0_12 "PPB_VideoDecoder(Dev);0.12" -#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_12 +#define PPB_VIDEODECODER_DEV_INTERFACE_0_13 "PPB_VideoDecoder(Dev);0.13" +#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_13 // Video decoder interface. // @@ -20,7 +20,7 @@ // configure the decoder there. // - Call Decode() to decode some video data. // - Receive ProvidePictureBuffers callback -// - Supply the decoder with textures using AssignGLESBuffers. +// - Supply the decoder with textures using AssignPictureBuffers. // - Receive PictureReady callbacks // - Hand the textures back to the decoder using ReusePictureBuffer. // - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone @@ -90,8 +90,9 @@ struct PPB_VideoDecoder_Dev { // |no_of_buffers| how many buffers are behind picture buffer pointer. // |buffers| contains the reference to the picture buffer that was // allocated. - void (*AssignGLESBuffers)(PP_Resource video_decoder, uint32_t no_of_buffers, - const struct PP_GLESBuffer_Dev* buffers); + void (*AssignPictureBuffers)( + PP_Resource video_decoder, uint32_t no_of_buffers, + const struct PP_PictureBuffer_Dev* buffers); // Tells the decoder to reuse the given picture buffer. Typical use of this // function is to call from PictureReady callback to recycle picture buffer diff --git a/ppapi/c/dev/ppp_video_decoder_dev.h b/ppapi/c/dev/ppp_video_decoder_dev.h index cc9c721..b4c64b9 100644 --- a/ppapi/c/dev/ppp_video_decoder_dev.h +++ b/ppapi/c/dev/ppp_video_decoder_dev.h @@ -9,7 +9,7 @@ #include "ppapi/c/pp_resource.h" #include "ppapi/c/dev/pp_video_dev.h" -#define PPP_VIDEODECODER_DEV_INTERFACE "PPP_VideoDecoder(Dev);0.5" +#define PPP_VIDEODECODER_DEV_INTERFACE "PPP_VideoDecoder(Dev);0.6" // PPP_VideoDecoder_Dev structure contains the function pointers that the // plugin MUST implement to provide services needed by the video decoder @@ -31,8 +31,7 @@ struct PPP_VideoDecoder_Dev { void (*ProvidePictureBuffers)( PP_Instance instance, uint32_t req_num_of_bufs, - struct PP_Size dimensions, - enum PP_PictureBufferType_Dev type); + struct PP_Size dimensions); // Callback function for decoder to deliver unneeded picture buffers back to // the plugin. diff --git a/ppapi/cpp/dev/video_decoder_client_dev.cc b/ppapi/cpp/dev/video_decoder_client_dev.cc index e0c174c..90596ba 100644 --- a/ppapi/cpp/dev/video_decoder_client_dev.cc +++ b/ppapi/cpp/dev/video_decoder_client_dev.cc @@ -19,14 +19,13 @@ const char kPPPVideoDecoderInterface[] = PPP_VIDEODECODER_DEV_INTERFACE; // Callback to provide buffers for the decoded output pictures. void ProvidePictureBuffers(PP_Instance instance, uint32_t req_num_of_bufs, - struct PP_Size dimensions, - enum PP_PictureBufferType_Dev type) { + struct PP_Size dimensions) { void* object = pp::Instance::GetPerInstanceObject( instance, kPPPVideoDecoderInterface); if (!object) return; static_cast<VideoDecoderClient_Dev*>(object)->ProvidePictureBuffers( - req_num_of_bufs, dimensions, type); + req_num_of_bufs, dimensions); } void DismissPictureBuffer(PP_Instance instance, diff --git a/ppapi/cpp/dev/video_decoder_client_dev.h b/ppapi/cpp/dev/video_decoder_client_dev.h index d1c5742..3d1a96b 100644 --- a/ppapi/cpp/dev/video_decoder_client_dev.h +++ b/ppapi/cpp/dev/video_decoder_client_dev.h @@ -25,8 +25,7 @@ class VideoDecoderClient_Dev { // Callback to provide buffers for the decoded output pictures. virtual void ProvidePictureBuffers( uint32_t req_num_of_bufs, - struct PP_Size dimensions, - enum PP_PictureBufferType_Dev type) = 0; + struct PP_Size dimensions) = 0; // Callback for decoder to deliver unneeded picture buffers back to the // plugin. diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc index 2ef19fc..5f8ce40 100644 --- a/ppapi/cpp/dev/video_decoder_dev.cc +++ b/ppapi/cpp/dev/video_decoder_dev.cc @@ -47,11 +47,11 @@ int32_t VideoDecoder_Dev::Initialize(const PP_VideoConfigElement* config, callback.pp_completion_callback()); } -void VideoDecoder_Dev::AssignGLESBuffers( - const std::vector<PP_GLESBuffer_Dev>& buffers) { +void VideoDecoder_Dev::AssignPictureBuffers( + const std::vector<PP_PictureBuffer_Dev>& buffers) { if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) return; - get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers( + get_interface<PPB_VideoDecoder_Dev>()->AssignPictureBuffers( pp_resource(), buffers.size(), &buffers[0]); } diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h index 3d6f2b9..d1dee6a 100644 --- a/ppapi/cpp/dev/video_decoder_dev.h +++ b/ppapi/cpp/dev/video_decoder_dev.h @@ -36,7 +36,7 @@ class VideoDecoder_Dev : public Resource { int32_t Initialize(const PP_VideoConfigElement* config, const Context3D_Dev& context, CompletionCallback callback); - void AssignGLESBuffers(const std::vector<PP_GLESBuffer_Dev>& buffers); + void AssignPictureBuffers(const std::vector<PP_PictureBuffer_Dev>& buffers); int32_t Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, CompletionCallback callback); void ReusePictureBuffer(int32_t picture_buffer_id); diff --git a/ppapi/examples/gles2/gles2.cc b/ppapi/examples/gles2/gles2.cc index a7e076e..6a0f925 100644 --- a/ppapi/examples/gles2/gles2.cc +++ b/ppapi/examples/gles2/gles2.cc @@ -58,8 +58,7 @@ class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, // pp::VideoDecoderClient_Dev implementation. virtual void ProvidePictureBuffers( - uint32_t req_num_of_bufs, PP_Size dimensions, - PP_PictureBufferType_Dev type); + uint32_t req_num_of_bufs, PP_Size dimensions); virtual void DismissPictureBuffer(int32_t picture_buffer_id); virtual void PictureReady(const PP_Picture_Dev& picture); virtual void EndOfStream(); @@ -80,7 +79,7 @@ class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, void DecodeNextNALUs(); void DecodeNextNALU(); void GetNextNALUBoundary(size_t start_pos, size_t* end_pos); - void Render(const PP_GLESBuffer_Dev& buffer); + void Render(const PP_PictureBuffer_Dev& buffer); // GL-related functions. void InitGL(); @@ -103,7 +102,7 @@ class GLES2DemoInstance : public pp::Instance, public pp::Graphics3DClient_Dev, int num_frames_rendered_; // Map of texture buffers indexed by buffer id. - typedef std::map<int, PP_GLESBuffer_Dev> PictureBufferMap; + typedef std::map<int, PP_PictureBuffer_Dev> PictureBufferMap; PictureBufferMap buffers_by_id_; // Map of bitstream buffers indexed by id. typedef std::map<int, pp::Buffer_Dev*> BitstreamBufferMap; @@ -251,18 +250,17 @@ void GLES2DemoInstance::DecodeNextNALU() { } void GLES2DemoInstance::ProvidePictureBuffers( - uint32_t req_num_of_bufs, PP_Size dimensions, - PP_PictureBufferType_Dev type) { - std::vector<PP_GLESBuffer_Dev> buffers; + uint32_t req_num_of_bufs, PP_Size dimensions) { + std::vector<PP_PictureBuffer_Dev> buffers; for (uint32_t i = 0; i < req_num_of_bufs; i++) { - PP_GLESBuffer_Dev buffer; + PP_PictureBuffer_Dev buffer; buffer.texture_id = CreateTexture(dimensions.width, dimensions.height); int id = ++next_picture_buffer_id_; - buffer.info.id= id; + buffer.id = id; buffers.push_back(buffer); assert(buffers_by_id_.insert(std::make_pair(id, buffer)).second); } - video_decoder_->AssignGLESBuffers(buffers); + video_decoder_->AssignPictureBuffers(buffers); } void GLES2DemoInstance::DismissPictureBuffer(int32_t picture_buffer_id) { @@ -332,7 +330,7 @@ void GLES2DemoInstance::InitGL() { CreateGLObjects(); } -void GLES2DemoInstance::Render(const PP_GLESBuffer_Dev& buffer) { +void GLES2DemoInstance::Render(const PP_PictureBuffer_Dev& buffer) { assert(!is_painting_); is_painting_ = true; gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); @@ -341,7 +339,7 @@ void GLES2DemoInstance::Render(const PP_GLESBuffer_Dev& buffer) { gles2_if_->DrawArrays(context_->pp_resource(), GL_TRIANGLE_STRIP, 0, 4); pp::CompletionCallback cb = callback_factory_.NewCallback( - &GLES2DemoInstance::PaintFinished, buffer.info.id); + &GLES2DemoInstance::PaintFinished, buffer.id); last_swap_request_ticks_ = core_if_->GetTimeTicks(); assert(surface_->SwapBuffers(cb) == PP_OK_COMPLETIONPENDING); } diff --git a/ppapi/tests/arch_dependent_sizes_32.h b/ppapi/tests/arch_dependent_sizes_32.h index c2b657b..1e9260a 100644 --- a/ppapi/tests/arch_dependent_sizes_32.h +++ b/ppapi/tests/arch_dependent_sizes_32.h @@ -17,7 +17,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 4); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 4); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 12); 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_Picture_Dev, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 36); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 20); diff --git a/ppapi/tests/arch_dependent_sizes_64.h b/ppapi/tests/arch_dependent_sizes_64.h index b49b41e..23d9c01 100644 --- a/ppapi/tests/arch_dependent_sizes_64.h +++ b/ppapi/tests/arch_dependent_sizes_64.h @@ -17,7 +17,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24); 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_Picture_Dev, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 72); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 40); diff --git a/ppapi/thunk/ppb_video_decoder_api.h b/ppapi/thunk/ppb_video_decoder_api.h index 15c540a..5f8063c 100644 --- a/ppapi/thunk/ppb_video_decoder_api.h +++ b/ppapi/thunk/ppb_video_decoder_api.h @@ -19,8 +19,8 @@ class PPB_VideoDecoder_API { PP_CompletionCallback callback) = 0; virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, PP_CompletionCallback callback) = 0; - virtual void AssignGLESBuffers(uint32_t no_of_buffers, - const PP_GLESBuffer_Dev* buffers) = 0; + virtual void AssignPictureBuffers(uint32_t no_of_buffers, + const PP_PictureBuffer_Dev* buffers) = 0; virtual void ReusePictureBuffer(int32_t picture_buffer_id) = 0; virtual int32_t Flush(PP_CompletionCallback callback) = 0; virtual int32_t Reset(PP_CompletionCallback callback) = 0; diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc index afc3bde..f1b7c44 100644 --- a/ppapi/thunk/ppb_video_decoder_thunk.cc +++ b/ppapi/thunk/ppb_video_decoder_thunk.cc @@ -50,12 +50,12 @@ int32_t Decode(PP_Resource video_decoder, return MayForceCallback(callback, result); } -void AssignGLESBuffers(PP_Resource video_decoder, - uint32_t no_of_buffers, - const PP_GLESBuffer_Dev* buffers) { +void AssignPictureBuffers(PP_Resource video_decoder, + uint32_t no_of_buffers, + const PP_PictureBuffer_Dev* buffers) { EnterVideoDecoder enter(video_decoder, true); if (enter.succeeded()) - enter.object()->AssignGLESBuffers(no_of_buffers, buffers); + enter.object()->AssignPictureBuffers(no_of_buffers, buffers); } void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) { @@ -92,7 +92,7 @@ const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = { &IsVideoDecoder, &Initialize, &Decode, - &AssignGLESBuffers, + &AssignPictureBuffers, &ReusePictureBuffer, &Flush, &Reset, |