| 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 contains the implementation of GenericV4L2Device used on | 5 // This file contains the implementation of GenericV4L2Device used on |
| 6 // platforms, which provide generic V4L2 video codec devices. | 6 // platforms, which provide generic V4L2 video codec devices. |
| 7 | 7 |
| 8 #ifndef CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 bool Poll(bool poll_device, bool* event_pending) override; | 26 bool Poll(bool poll_device, bool* event_pending) override; |
| 27 bool SetDevicePollInterrupt() override; | 27 bool SetDevicePollInterrupt() override; |
| 28 bool ClearDevicePollInterrupt() override; | 28 bool ClearDevicePollInterrupt() override; |
| 29 void* Mmap(void* addr, | 29 void* Mmap(void* addr, |
| 30 unsigned int len, | 30 unsigned int len, |
| 31 int prot, | 31 int prot, |
| 32 int flags, | 32 int flags, |
| 33 unsigned int offset) override; | 33 unsigned int offset) override; |
| 34 void Munmap(void* addr, unsigned int len) override; | 34 void Munmap(void* addr, unsigned int len) override; |
| 35 bool Initialize() override; | 35 bool Initialize() override; |
| 36 |
| 37 std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( |
| 38 int index, |
| 39 size_t num_planes, |
| 40 enum v4l2_buf_type type) override; |
| 41 |
| 36 bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) override; | 42 bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) override; |
| 37 EGLImageKHR CreateEGLImage(EGLDisplay egl_display, | 43 EGLImageKHR CreateEGLImage( |
| 38 EGLContext egl_context, | 44 EGLDisplay egl_display, |
| 39 GLuint texture_id, | 45 EGLContext egl_context, |
| 40 gfx::Size frame_buffer_size, | 46 GLuint texture_id, |
| 41 unsigned int buffer_index, | 47 const gfx::Size& size, |
| 42 uint32_t v4l2_pixfmt, | 48 unsigned int buffer_index, |
| 43 size_t num_v4l2_planes) override; | 49 uint32_t v4l2_pixfmt, |
| 50 const std::vector<base::ScopedFD>& dmabuf_fds) override; |
| 51 |
| 44 EGLBoolean DestroyEGLImage(EGLDisplay egl_display, | 52 EGLBoolean DestroyEGLImage(EGLDisplay egl_display, |
| 45 EGLImageKHR egl_image) override; | 53 EGLImageKHR egl_image) override; |
| 46 GLenum GetTextureTarget() override; | 54 GLenum GetTextureTarget() override; |
| 47 uint32_t PreferredInputFormat() override; | 55 uint32_t PreferredInputFormat() override; |
| 48 | 56 |
| 49 private: | 57 private: |
| 50 ~GenericV4L2Device() override; | 58 ~GenericV4L2Device() override; |
| 51 | 59 |
| 52 // The actual device fd. | 60 // The actual device fd. |
| 53 base::ScopedFD device_fd_; | 61 base::ScopedFD device_fd_; |
| 54 | 62 |
| 55 // eventfd fd to signal device poll thread when its poll() should be | 63 // eventfd fd to signal device poll thread when its poll() should be |
| 56 // interrupted. | 64 // interrupted. |
| 57 base::ScopedFD device_poll_interrupt_fd_; | 65 base::ScopedFD device_poll_interrupt_fd_; |
| 58 | 66 |
| 59 // Use libv4l2 when operating |device_fd_|. | 67 // Use libv4l2 when operating |device_fd_|. |
| 60 bool use_libv4l2_; | 68 bool use_libv4l2_; |
| 61 | 69 |
| 62 DISALLOW_COPY_AND_ASSIGN(GenericV4L2Device); | 70 DISALLOW_COPY_AND_ASSIGN(GenericV4L2Device); |
| 63 | 71 |
| 64 // Lazily initialize static data after sandbox is enabled. Return false on | 72 // Lazily initialize static data after sandbox is enabled. Return false on |
| 65 // init failure. | 73 // init failure. |
| 66 static bool PostSandboxInitialization(); | 74 static bool PostSandboxInitialization(); |
| 67 }; | 75 }; |
| 68 } // namespace content | 76 } // namespace content |
| 69 | 77 |
| 70 #endif // CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ | 78 #endif // CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_DEVICE_H_ |
| OLD | NEW |