| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "gpu/command_buffer/common/mailbox.h" | 16 #include "gpu/command_buffer/common/mailbox.h" |
| 17 #include "media/base/video_decoder_config.h" | 17 #include "media/base/video_decoder_config.h" |
| 18 #include "media/video/video_decode_accelerator.h" | 18 #include "media/video/video_decode_accelerator.h" |
| 19 | 19 |
| 20 #include "ppapi/c/pp_codecs.h" | 20 #include "ppapi/c/pp_codecs.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace cc_blink { |
| 27 class ContextProviderWebContext; |
| 28 } |
| 29 |
| 26 namespace gpu { | 30 namespace gpu { |
| 27 namespace gles2 { | 31 namespace gles2 { |
| 28 class GLES2Interface; | 32 class GLES2Interface; |
| 29 } | 33 } |
| 30 } | 34 } |
| 31 | 35 |
| 32 namespace media { | 36 namespace media { |
| 33 class DecoderBuffer; | 37 class DecoderBuffer; |
| 34 } | 38 } |
| 35 | 39 |
| 36 namespace webkit { | |
| 37 namespace gpu { | |
| 38 class ContextProviderWebContext; | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 namespace content { | 40 namespace content { |
| 43 | 41 |
| 44 class PepperVideoDecoderHost; | 42 class PepperVideoDecoderHost; |
| 45 | 43 |
| 46 // This class is a shim to wrap a media::VideoDecoder so that it can be used | 44 // This class is a shim to wrap a media::VideoDecoder so that it can be used |
| 47 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. | 45 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. |
| 48 // This class should be constructed, used, and destructed on the main (render) | 46 // This class should be constructed, used, and destructed on the main (render) |
| 49 // thread. | 47 // thread. |
| 50 class VideoDecoderShim : public media::VideoDecodeAccelerator { | 48 class VideoDecoderShim : public media::VideoDecodeAccelerator { |
| 51 public: | 49 public: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void DeleteTexture(uint32_t texture_id); | 83 void DeleteTexture(uint32_t texture_id); |
| 86 // Call this whenever we change GL state that the plugin relies on, such as | 84 // Call this whenever we change GL state that the plugin relies on, such as |
| 87 // creating picture textures. | 85 // creating picture textures. |
| 88 void FlushCommandBuffer(); | 86 void FlushCommandBuffer(); |
| 89 | 87 |
| 90 scoped_ptr<DecoderImpl> decoder_impl_; | 88 scoped_ptr<DecoderImpl> decoder_impl_; |
| 91 State state_; | 89 State state_; |
| 92 | 90 |
| 93 PepperVideoDecoderHost* host_; | 91 PepperVideoDecoderHost* host_; |
| 94 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 92 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 95 scoped_refptr<webkit::gpu::ContextProviderWebContext> context_provider_; | 93 scoped_refptr<cc_blink::ContextProviderWebContext> context_provider_; |
| 96 | 94 |
| 97 // The current decoded frame size. | 95 // The current decoded frame size. |
| 98 gfx::Size texture_size_; | 96 gfx::Size texture_size_; |
| 99 // Map that takes the plugin's GL texture id to the renderer's GL texture id. | 97 // Map that takes the plugin's GL texture id to the renderer's GL texture id. |
| 100 typedef base::hash_map<uint32_t, uint32_t> TextureIdMap; | 98 typedef base::hash_map<uint32_t, uint32_t> TextureIdMap; |
| 101 TextureIdMap texture_id_map_; | 99 TextureIdMap texture_id_map_; |
| 102 // Available textures (these are plugin ids.) | 100 // Available textures (these are plugin ids.) |
| 103 typedef base::hash_set<uint32_t> TextureIdSet; | 101 typedef base::hash_set<uint32_t> TextureIdSet; |
| 104 TextureIdSet available_textures_; | 102 TextureIdSet available_textures_; |
| 105 // Track textures that are no longer needed (these are plugin ids.) | 103 // Track textures that are no longer needed (these are plugin ids.) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 uint32_t num_pending_decodes_; | 120 uint32_t num_pending_decodes_; |
| 123 | 121 |
| 124 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; | 122 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; |
| 125 | 123 |
| 126 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); | 124 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); |
| 127 }; | 125 }; |
| 128 | 126 |
| 129 } // namespace content | 127 } // namespace content |
| 130 | 128 |
| 131 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 129 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| OLD | NEW |