| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" |
| 13 #include "ppapi/c/dev/ppb_video_decoder_dev.h" | 15 #include "ppapi/c/dev/ppb_video_decoder_dev.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 16 #include "ppapi/shared_impl/resource.h" |
| 15 #include "ppapi/shared_impl/tracked_callback.h" | 17 #include "ppapi/shared_impl/tracked_callback.h" |
| 16 #include "ppapi/thunk/ppb_video_decoder_dev_api.h" | 18 #include "ppapi/thunk/ppb_video_decoder_dev_api.h" |
| 17 | 19 |
| 18 namespace gpu { | 20 namespace gpu { |
| 19 namespace gles2 { | 21 namespace gles2 { |
| 20 class GLES2Implementation; | 22 class GLES2Implementation; |
| 21 } // namespace gles2 | 23 } // namespace gles2 |
| 22 } // namespace gpu | 24 } // namespace gpu |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 | 37 |
| 36 // Resource overrides. | 38 // Resource overrides. |
| 37 thunk::PPB_VideoDecoder_Dev_API* AsPPB_VideoDecoder_Dev_API() override; | 39 thunk::PPB_VideoDecoder_Dev_API* AsPPB_VideoDecoder_Dev_API() override; |
| 38 | 40 |
| 39 // PPB_VideoDecoder_Dev_API implementation. | 41 // PPB_VideoDecoder_Dev_API implementation. |
| 40 void Destroy() override; | 42 void Destroy() override; |
| 41 | 43 |
| 42 protected: | 44 protected: |
| 43 bool SetFlushCallback(scoped_refptr<TrackedCallback> callback); | 45 bool SetFlushCallback(scoped_refptr<TrackedCallback> callback); |
| 44 bool SetResetCallback(scoped_refptr<TrackedCallback> callback); | 46 bool SetResetCallback(scoped_refptr<TrackedCallback> callback); |
| 45 bool SetBitstreamBufferCallback(int32 bitstream_buffer_id, | 47 bool SetBitstreamBufferCallback(int32_t bitstream_buffer_id, |
| 46 scoped_refptr<TrackedCallback> callback); | 48 scoped_refptr<TrackedCallback> callback); |
| 47 | 49 |
| 48 void RunFlushCallback(int32 result); | 50 void RunFlushCallback(int32_t result); |
| 49 void RunResetCallback(int32 result); | 51 void RunResetCallback(int32_t result); |
| 50 void RunBitstreamBufferCallback(int32 bitstream_buffer_id, int32 result); | 52 void RunBitstreamBufferCallback(int32_t bitstream_buffer_id, int32_t result); |
| 51 | 53 |
| 52 // Tell command buffer to process all commands it has received so far. | 54 // Tell command buffer to process all commands it has received so far. |
| 53 void FlushCommandBuffer(); | 55 void FlushCommandBuffer(); |
| 54 | 56 |
| 55 // Initialize the underlying decoder. | 57 // Initialize the underlying decoder. |
| 56 void InitCommon(PP_Resource graphics_context, | 58 void InitCommon(PP_Resource graphics_context, |
| 57 gpu::gles2::GLES2Implementation* gles2_impl); | 59 gpu::gles2::GLES2Implementation* gles2_impl); |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is | 62 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is |
| 61 // done. | 63 // done. |
| 62 typedef std::map<int32, scoped_refptr<TrackedCallback> > CallbackById; | 64 typedef std::map<int32_t, scoped_refptr<TrackedCallback>> CallbackById; |
| 63 | 65 |
| 64 scoped_refptr<TrackedCallback> flush_callback_; | 66 scoped_refptr<TrackedCallback> flush_callback_; |
| 65 scoped_refptr<TrackedCallback> reset_callback_; | 67 scoped_refptr<TrackedCallback> reset_callback_; |
| 66 CallbackById bitstream_buffer_callbacks_; | 68 CallbackById bitstream_buffer_callbacks_; |
| 67 | 69 |
| 68 // The resource ID of the underlying Graphics3D object being used. Used only | 70 // The resource ID of the underlying Graphics3D object being used. Used only |
| 69 // for reference counting to keep it alive for the lifetime of |*this|. | 71 // for reference counting to keep it alive for the lifetime of |*this|. |
| 70 PP_Resource graphics_context_; | 72 PP_Resource graphics_context_; |
| 71 | 73 |
| 72 // Reference to the GLES2Implementation owned by |graphics_context_|. | 74 // Reference to the GLES2Implementation owned by |graphics_context_|. |
| 73 // Graphics3D is guaranteed to be alive for the lifetime of this class. | 75 // Graphics3D is guaranteed to be alive for the lifetime of this class. |
| 74 // In the out-of-process case, Graphics3D's gles2_impl() exists in the plugin | 76 // In the out-of-process case, Graphics3D's gles2_impl() exists in the plugin |
| 75 // process only, so gles2_impl_ is NULL in that case. | 77 // process only, so gles2_impl_ is NULL in that case. |
| 76 gpu::gles2::GLES2Implementation* gles2_impl_; | 78 gpu::gles2::GLES2Implementation* gles2_impl_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Shared); | 80 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Shared); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace ppapi | 83 } // namespace ppapi |
| 82 | 84 |
| 83 #endif // PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ | 85 #endif // PPAPI_SHARED_IMPL_PPB_VIDEO_DECODER_SHARED_H_ |
| OLD | NEW |