| 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_VIDEO_DEVICE_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ |
| 10 | 10 |
| 11 #include "content/common/gpu/media/v4l2_video_device.h" | 11 #include "content/common/gpu/media/v4l2_video_device.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class GenericV4L2Device : public V4L2Device { | 15 class GenericV4L2Device : public V4L2Device { |
| 16 public: | 16 public: |
| 17 explicit GenericV4L2Device(Type type); | 17 explicit GenericV4L2Device(Type type); |
| 18 virtual ~GenericV4L2Device(); | 18 virtual ~GenericV4L2Device(); |
| 19 | 19 |
| 20 // V4L2Device implementation. | 20 // V4L2Device implementation. |
| 21 int Ioctl(int request, void* arg) override; | 21 virtual int Ioctl(int request, void* arg) override; |
| 22 bool Poll(bool poll_device, bool* event_pending) override; | 22 virtual bool Poll(bool poll_device, bool* event_pending) override; |
| 23 bool SetDevicePollInterrupt() override; | 23 virtual bool SetDevicePollInterrupt() override; |
| 24 bool ClearDevicePollInterrupt() override; | 24 virtual bool ClearDevicePollInterrupt() override; |
| 25 void* Mmap(void* addr, | 25 virtual void* Mmap(void* addr, |
| 26 unsigned int len, | 26 unsigned int len, |
| 27 int prot, | 27 int prot, |
| 28 int flags, | 28 int flags, |
| 29 unsigned int offset) override; | 29 unsigned int offset) override; |
| 30 void Munmap(void* addr, unsigned int len) override; | 30 virtual void Munmap(void* addr, unsigned int len) override; |
| 31 bool Initialize() override; | 31 virtual bool Initialize() override; |
| 32 bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) override; | 32 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, |
| 33 EGLImageKHR CreateEGLImage(EGLDisplay egl_display, | 33 EGLContext egl_context, |
| 34 EGLContext egl_context, | 34 GLuint texture_id, |
| 35 GLuint texture_id, | 35 gfx::Size frame_buffer_size, |
| 36 gfx::Size frame_buffer_size, | 36 unsigned int buffer_index, |
| 37 unsigned int buffer_index, | 37 size_t planes_count) override; |
| 38 uint32_t v4l2_pixfmt, | 38 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, |
| 39 size_t num_v4l2_planes); | 39 EGLImageKHR egl_image) override; |
| 40 EGLBoolean DestroyEGLImage(EGLDisplay egl_display, | 40 virtual GLenum GetTextureTarget() override; |
| 41 EGLImageKHR egl_image) override; | 41 virtual uint32 PreferredInputFormat() override; |
| 42 GLenum GetTextureTarget() override; | 42 virtual uint32 PreferredOutputFormat() override; |
| 43 uint32 PreferredInputFormat() override; | |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 const Type type_; | 45 const Type type_; |
| 47 | 46 |
| 48 // The actual device fd. | 47 // The actual device fd. |
| 49 int device_fd_; | 48 int device_fd_; |
| 50 | 49 |
| 51 // eventfd fd to signal device poll thread when its poll() should be | 50 // eventfd fd to signal device poll thread when its poll() should be |
| 52 // interrupted. | 51 // interrupted. |
| 53 int device_poll_interrupt_fd_; | 52 int device_poll_interrupt_fd_; |
| 54 | 53 |
| 55 DISALLOW_COPY_AND_ASSIGN(GenericV4L2Device); | 54 DISALLOW_COPY_AND_ASSIGN(GenericV4L2Device); |
| 56 }; | 55 }; |
| 57 } // namespace content | 56 } // namespace content |
| 58 | 57 |
| 59 #endif // CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ | 58 #endif // CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ |
| OLD | NEW |