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 // This file defines the V4L2Device interface which is used by the | 5 // This file defines the V4L2Device interface which is used by the |
6 // V4L2DecodeAccelerator class to delegate/pass the device specific | 6 // V4L2DecodeAccelerator class to delegate/pass the device specific |
7 // handling of any of the functionalities. | 7 // handling of any of the functionalities. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // The caller is responsible for closing the file descriptors after use. | 96 // The caller is responsible for closing the file descriptors after use. |
97 virtual std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( | 97 virtual std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( |
98 int index, | 98 int index, |
99 size_t num_planes, | 99 size_t num_planes, |
100 enum v4l2_buf_type type) = 0; | 100 enum v4l2_buf_type type) = 0; |
101 | 101 |
102 // Return true if the given V4L2 pixfmt can be used in CreateEGLImage() | 102 // Return true if the given V4L2 pixfmt can be used in CreateEGLImage() |
103 // for the current platform. | 103 // for the current platform. |
104 virtual bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) = 0; | 104 virtual bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) = 0; |
105 | 105 |
106 // Creates an EGLImageKHR since each V4L2Device may use a different method of | 106 // Create an EGLImage from provided |dmabuf_fds| and bind |texture_id| to it. |
107 // acquiring one and associating it to the given texture. The texture_id is | 107 // Some implementations may also require the V4L2 |buffer_index| of the buffer |
108 // used to bind the texture to the returned EGLImageKHR. buffer_index can be | 108 // for which |dmabuf_fds| have been exported. |
109 // used to associate the returned EGLImageKHR by the underlying V4L2Device | 109 // The caller may choose to close the file descriptors after this method |
110 // implementation. | 110 // returns, and may expect the buffers to remain valid for the lifetime of |
111 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, | 111 // the created EGLImage. |
112 EGLContext egl_context, | 112 // Return EGL_NO_IMAGE_KHR on failure. |
113 GLuint texture_id, | 113 virtual EGLImageKHR CreateEGLImage( |
114 gfx::Size frame_buffer_size, | 114 EGLDisplay egl_display, |
115 unsigned int buffer_index, | 115 EGLContext egl_context, |
116 uint32_t v4l2_pixfmt, | 116 GLuint texture_id, |
117 size_t num_v4l2_planes) = 0; | 117 const gfx::Size& size, |
| 118 unsigned int buffer_index, |
| 119 uint32_t v4l2_pixfmt, |
| 120 const std::vector<base::ScopedFD>& dmabuf_fds) = 0; |
118 | 121 |
119 // Destroys the EGLImageKHR. | 122 // Destroys the EGLImageKHR. |
120 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, | 123 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, |
121 EGLImageKHR egl_image) = 0; | 124 EGLImageKHR egl_image) = 0; |
122 | 125 |
123 // Returns the supported texture target for the V4L2Device. | 126 // Returns the supported texture target for the V4L2Device. |
124 virtual GLenum GetTextureTarget() = 0; | 127 virtual GLenum GetTextureTarget() = 0; |
125 | 128 |
126 // Returns the preferred V4L2 input format or 0 if don't care. | 129 // Returns the preferred V4L2 input format or 0 if don't care. |
127 virtual uint32_t PreferredInputFormat() = 0; | 130 virtual uint32_t PreferredInputFormat() = 0; |
(...skipping 19 matching lines...) Expand all Loading... |
147 friend class base::RefCountedThreadSafe<V4L2Device>; | 150 friend class base::RefCountedThreadSafe<V4L2Device>; |
148 explicit V4L2Device(Type type); | 151 explicit V4L2Device(Type type); |
149 virtual ~V4L2Device(); | 152 virtual ~V4L2Device(); |
150 | 153 |
151 const Type type_; | 154 const Type type_; |
152 }; | 155 }; |
153 | 156 |
154 } // namespace content | 157 } // namespace content |
155 | 158 |
156 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 159 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
OLD | NEW |