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