OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // This file contains an implementation of picture allocation for |
| 6 // different window system (X11/Ozone) used by |
| 7 // VaapiVideoDecodeAccelerator to produce output pictures. |
| 8 |
| 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ |
| 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ |
| 11 |
| 12 #include "base/callback.h" |
| 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "third_party/libva/va/va.h" |
| 16 #include "ui/gfx/size.h" |
| 17 |
| 18 namespace gfx { |
| 19 class GLContext; |
| 20 }; // namespace gfx |
| 21 |
| 22 namespace content { |
| 23 |
| 24 // VaapiPictureProvider is in charge of allocating pictures for the |
| 25 // window system and bind them to gl textures. |
| 26 class VaapiPictureProvider { |
| 27 public: |
| 28 |
| 29 // Picture is native pixmap abstraction (X11/Ozone) |
| 30 class Picture { |
| 31 public: |
| 32 virtual ~Picture() {} |
| 33 |
| 34 int32 picture_buffer_id() const { |
| 35 return picture_buffer_id_; |
| 36 }; |
| 37 |
| 38 uint32 texture_id() const { return texture_id_; } |
| 39 const gfx::Size& size() const { return size_; } |
| 40 |
| 41 protected: |
| 42 Picture(int32 picture_buffer_id, uint32 texture_id, const gfx::Size& size) |
| 43 : picture_buffer_id_(picture_buffer_id), |
| 44 texture_id_(texture_id), |
| 45 size_(size) {} |
| 46 |
| 47 private: |
| 48 int32 picture_buffer_id_; |
| 49 uint32 texture_id_; |
| 50 gfx::Size size_; |
| 51 }; |
| 52 |
| 53 virtual ~VaapiPictureProvider() {} |
| 54 |
| 55 static scoped_ptr<VaapiPictureProvider> Create( |
| 56 VADisplay va_display, |
| 57 gfx::GLContext* gl_context, |
| 58 const base::Callback<bool(void)> make_context_current); |
| 59 |
| 60 virtual scoped_ptr<Picture> CreatePicture(int32 picture_buffer_id, |
| 61 uint32 texture_id, |
| 62 const gfx::Size& size) = 0; |
| 63 |
| 64 virtual bool PutSurfaceIntoPicture(VASurfaceID va_surface_id, |
| 65 Picture* picture) = 0; |
| 66 |
| 67 virtual bool SetCodedSurfacesSize(const gfx::Size& size) { return true; } |
| 68 |
| 69 virtual bool Initialize() = 0; |
| 70 }; |
| 71 |
| 72 } // namespace content |
| 73 |
| 74 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ |
OLD | NEW |