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_VIDEO_DEVICE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ |
11 | 11 |
| 12 #include "ui/gl/gl_bindings.h" |
| 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 class V4L2Device { | 16 class V4L2Device { |
15 public: | 17 public: |
16 V4L2Device(); | 18 V4L2Device(); |
17 virtual ~V4L2Device(); | 19 virtual ~V4L2Device(); |
18 | 20 |
19 // Tries to create and initialize an appropriate V4L2Device object for the | 21 // Tries to create and initialize an appropriate V4L2Device object for the |
20 // current platform and returns a scoped_ptr<V4L2Device> on success else | 22 // current platform and returns a scoped_ptr<V4L2Device> on success else |
21 // returns NULL. | 23 // returns NULL. |
22 static scoped_ptr<V4L2Device> Create(); | 24 static scoped_ptr<V4L2Device> Create(EGLContext egl_context); |
23 | 25 |
24 // Parameters and return value are the same as for the standard ioctl() system | 26 // Parameters and return value are the same as for the standard ioctl() system |
25 // call. | 27 // call. |
26 virtual int Ioctl(int request, void* arg) = 0; | 28 virtual int Ioctl(int request, void* arg) = 0; |
27 | 29 |
28 // This method sleeps until either: | 30 // This method sleeps until either: |
29 // - SetDevicePollInterrupt() is called (on another thread), | 31 // - SetDevicePollInterrupt() is called (on another thread), |
30 // - |poll_device| is true, and there is new data to be read from the device, | 32 // - |poll_device| is true, and there is new data to be read from the device, |
31 // or an event from the device has arrived; in the latter case | 33 // or an event from the device has arrived; in the latter case |
32 // |*event_pending| will be set to true. | 34 // |*event_pending| will be set to true. |
(...skipping 10 matching lines...) Expand all Loading... |
43 virtual bool SetDevicePollInterrupt() = 0; | 45 virtual bool SetDevicePollInterrupt() = 0; |
44 virtual bool ClearDevicePollInterrupt() = 0; | 46 virtual bool ClearDevicePollInterrupt() = 0; |
45 | 47 |
46 // Wrappers for standard mmap/munmap system calls. | 48 // Wrappers for standard mmap/munmap system calls. |
47 virtual void* Mmap(void* addr, | 49 virtual void* Mmap(void* addr, |
48 unsigned int len, | 50 unsigned int len, |
49 int prot, | 51 int prot, |
50 int flags, | 52 int flags, |
51 unsigned int offset) = 0; | 53 unsigned int offset) = 0; |
52 virtual void Munmap(void* addr, unsigned int len) = 0; | 54 virtual void Munmap(void* addr, unsigned int len) = 0; |
| 55 |
| 56 // Does all the initialization of V4L2Device, returns true on success. |
| 57 virtual bool Initialize() = 0; |
| 58 |
| 59 // This method is used to create the EglImage since each V4L2Device |
| 60 // may have its own format. The texture_id is used to bind the |
| 61 // texture to the created eglImage. buffer_index can be used to associate |
| 62 // the created EglImage by the underlying V4L2Device implementation. |
| 63 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, |
| 64 const EGLint* attrib, |
| 65 GLuint texture_id, |
| 66 unsigned int buffer_index) = 0; |
| 67 |
| 68 // This method returns the supported texture target for the V4L2Device. |
| 69 virtual GLenum GetTextureTarget() = 0; |
53 }; | 70 }; |
| 71 |
54 } // namespace content | 72 } // namespace content |
55 | 73 |
56 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ | 74 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ |
OLD | NEW |