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 ExynosV4L2Device used on | 5 // This file contains the implementation of ExynosV4L2Device used on |
6 // Exynos platform. | 6 // Exynos platform. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_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 ExynosV4L2Device : public V4L2Device { | 15 class ExynosV4L2Device : public V4L2Device { |
16 public: | 16 public: |
17 ExynosV4L2Device(); | 17 ExynosV4L2Device(); |
18 virtual ~ExynosV4L2Device(); | 18 virtual ~ExynosV4L2Device(); |
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 | 31 virtual bool Initialize() OVERRIDE; |
32 // Does all the initialization of device fds, returns true on success. | 32 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, |
33 bool Initialize(); | 33 GLuint texture_id, |
34 gfx::Size frame_buffer_size, | |
35 unsigned int buffer_index, | |
36 unsigned int total_buffers) OVERRIDE; | |
37 virtual void DestroyEGLImage(unsigned int buffer_index) OVERRIDE; | |
38 virtual GLenum GetTextureTarget() OVERRIDE; | |
39 virtual uint32 GetCapturePixelFormat() OVERRIDE; | |
40 virtual uint8 GetNumberOfPlanes() OVERRIDE; | |
34 | 41 |
35 private: | 42 private: |
43 // Record for output buffer. | |
44 struct DeviceOutputRecord { | |
45 DeviceOutputRecord(); | |
46 ~DeviceOutputRecord(); | |
47 int fds[2]; // file descriptors for each plane. | |
48 EGLImageKHR egl_image; // EGLImageKHR for the output buffer. | |
49 }; | |
sheu
2014/03/27 02:00:23
Since we already have the output buffers being tra
shivdasp
2014/03/27 02:41:04
Ohh I did not know that the fd can be closed immed
Pawel Osciak
2014/03/27 05:18:06
John is right.
To add more detail: the owner of b
| |
50 | |
51 // Mapping of int index to output buffer record. | |
52 std::vector<DeviceOutputRecord> device_output_buffer_map_; | |
53 | |
36 // The actual device fd. | 54 // The actual device fd. |
37 int device_fd_; | 55 int device_fd_; |
38 | 56 |
39 // eventfd fd to signal device poll thread when its poll() should be | 57 // eventfd fd to signal device poll thread when its poll() should be |
40 // interrupted. | 58 // interrupted. |
41 int device_poll_interrupt_fd_; | 59 int device_poll_interrupt_fd_; |
42 | 60 |
43 DISALLOW_COPY_AND_ASSIGN(ExynosV4L2Device); | 61 DISALLOW_COPY_AND_ASSIGN(ExynosV4L2Device); |
44 }; | 62 }; |
45 } // namespace content | 63 } // namespace content |
46 | 64 |
47 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_ | 65 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_ |
OLD | NEW |