OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "cc/resources/texture_mailbox.h" |
| 14 |
| 15 namespace media { |
| 16 class SkCanvasVideoRenderer; |
| 17 class VideoFrame; |
| 18 } |
| 19 |
| 20 namespace cc { |
| 21 class ResourceProvider; |
| 22 |
| 23 class VideoFrameExternalResources { |
| 24 public: |
| 25 // Specifies what type of data is contained in the mailboxes, as well as how |
| 26 // many mailboxes will be present. |
| 27 enum ResourceType { |
| 28 NONE, |
| 29 YUV_RESOURCE, |
| 30 RGB_RESOURCE, |
| 31 STREAM_TEXTURE_RESOURCE, |
| 32 IO_SURFACE, |
| 33 |
| 34 #if defined(GOOGLE_TV) |
| 35 // TODO(danakj): Implement this with a solid color layer instead of a video |
| 36 // frame and video layer. |
| 37 HOLE, |
| 38 #endif |
| 39 |
| 40 // TODO(danakj): Remove this and abstract TextureMailbox into |
| 41 // "ExternalResource" that can hold a hardware or software backing. |
| 42 SOFTWARE_RESOURCE |
| 43 }; |
| 44 |
| 45 ResourceType type; |
| 46 std::vector<TextureMailbox> mailboxes; |
| 47 |
| 48 // TODO(danakj): Remove these too. |
| 49 std::vector<unsigned> software_resources; |
| 50 TextureMailbox::ReleaseCallback software_release_callback; |
| 51 |
| 52 VideoFrameExternalResources(); |
| 53 ~VideoFrameExternalResources(); |
| 54 }; |
| 55 |
| 56 // VideoResourceUpdater is by the video system to produce frame content as |
| 57 // resources consumable by the compositor. |
| 58 class VideoResourceUpdater { |
| 59 public: |
| 60 explicit VideoResourceUpdater(ResourceProvider* resource_provider); |
| 61 ~VideoResourceUpdater(); |
| 62 |
| 63 VideoFrameExternalResources CreateForHardwarePlanes( |
| 64 const scoped_refptr<media::VideoFrame>& video_frame, |
| 65 const TextureMailbox::ReleaseCallback& release_callback); |
| 66 |
| 67 VideoFrameExternalResources CreateForSoftwarePlanes( |
| 68 const scoped_refptr<media::VideoFrame>& video_frame); |
| 69 |
| 70 private: |
| 71 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); |
| 72 |
| 73 static void ReturnTexture(ResourceProvider* resource_provider, |
| 74 TextureMailbox::ReleaseCallback callback, |
| 75 unsigned texture_id, |
| 76 gpu::Mailbox mailbox, |
| 77 unsigned sync_point); |
| 78 |
| 79 ResourceProvider* resource_provider_; |
| 80 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 83 }; |
| 84 |
| 85 } // namespace cc |
| 86 |
| 87 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |