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 // Tries to create and initialize 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 // This method is used to create the EglImage since each V4L2Device | |
61 // may have its own format. The texture_id is used to bind the | |
62 // texture to the created eglImage. buffer_index can be used to associate | |
63 // the created EglImage by the underlying V4L2Device implementation. | |
64 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, | |
65 GLuint texture_id, | |
66 gfx::Size frame_buffer_size, | |
67 unsigned int buffer_index, | |
68 unsigned int total_buffers) = 0; | |
69 | |
70 virtual void DestroyEGLImage(unsigned int buffer_index) = 0; | |
Pawel Osciak
2014/03/27 05:18:06
Documentation please. This should also state who i
shivdasp
2014/03/27 05:40:37
This method is not required, since we will close t
Pawel Osciak
2014/03/27 05:58:35
I still feel we should have it even if only to cal
sheu
2014/03/27 07:08:49
IMO we could call it CreateEGLImageForBuffer(...,
| |
71 | |
72 // This method returns the supported texture target for the V4L2Device. | |
73 virtual GLenum GetTextureTarget() = 0; | |
74 | |
75 // Returns the pixel format supported by this V4L2Device. | |
76 virtual uint32 GetCapturePixelFormat() = 0; | |
Pawel Osciak
2014/03/27 05:18:06
Why do we need this? G_FMT tells us this.
shivdasp
2014/03/27 05:40:37
My understanding is that we call S_FMT() in VDA wi
Pawel Osciak
2014/03/27 05:58:35
This is because we prefer that format for performa
shivdasp
2014/03/27 06:51:46
Sorry I didn't get it.
I thought this method would
Pawel Osciak
2014/03/27 06:59:56
Yeah sorry please ignore the static part.
As I me
sheu
2014/03/27 07:08:49
That's right actually. All we use the plane numbe
shivdasp
2014/03/27 07:40:07
Apart from DCHECK , we use the plane count in Enqu
Pawel Osciak
2014/03/27 07:45:06
The number of planes should come from v4l2_pix_for
shivdasp
2014/03/27 07:54:55
It does come from G_FMT but we have a CHECK_EQ in
| |
77 | |
78 // Returns the number of planes on CAPTURE PLANE for this V4L2Device. | |
79 virtual uint8 GetNumberOfPlanes() = 0; | |
sheu
2014/03/27 02:00:23
GetCapturePlaneCount()? (Something with "Capture"
shivdasp
2014/03/27 02:41:04
Alright will "Capture" this in my next patchset.
O
Pawel Osciak
2014/03/27 05:18:06
G_FMT can also tell us this.
| |
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 |