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 TegraV4L2Device used on | 5 // This file contains the implementation of TegraV4L2Device used on |
6 // Tegra platform. | 6 // Tegra platform. |
7 | 7 |
8 #ifndef MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ | 8 #ifndef MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ |
9 #define MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ | 9 #define MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ |
10 | 10 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "media/gpu/v4l2_device.h" | 15 #include "media/gpu/v4l2_device.h" |
16 #include "ui/gl/gl_bindings.h" | 16 #include "ui/gl/gl_bindings.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 // This class implements the V4L2Device interface for Tegra platform. | 20 // This class implements the V4L2Device interface for Tegra platform. |
21 // It interfaces with libtegrav4l2 library which provides API that exhibit the | 21 // It interfaces with libtegrav4l2 library which provides API that exhibit the |
22 // V4L2 specification via the library API instead of system calls. | 22 // V4L2 specification via the library API instead of system calls. |
23 class TegraV4L2Device : public V4L2Device { | 23 class TegraV4L2Device : public V4L2Device { |
24 public: | 24 public: |
25 explicit TegraV4L2Device(Type type); | 25 TegraV4L2Device(); |
26 | 26 |
27 // V4L2Device implementation. | |
28 bool Initialize() override; | |
kcwu
2016/10/07 11:19:04
This method is not expected call by users. I guess
Pawel Osciak
2016/10/11 06:13:45
Done.
| |
29 bool Open(Type type, uint32_t v4l2_pixfmt) override; | |
27 int Ioctl(int flags, void* arg) override; | 30 int Ioctl(int flags, void* arg) override; |
28 bool Poll(bool poll_device, bool* event_pending) override; | 31 bool Poll(bool poll_device, bool* event_pending) override; |
29 bool SetDevicePollInterrupt() override; | 32 bool SetDevicePollInterrupt() override; |
30 bool ClearDevicePollInterrupt() override; | 33 bool ClearDevicePollInterrupt() override; |
31 void* Mmap(void* addr, | 34 void* Mmap(void* addr, |
32 unsigned int len, | 35 unsigned int len, |
33 int prot, | 36 int prot, |
34 int flags, | 37 int flags, |
35 unsigned int offset) override; | 38 unsigned int offset) override; |
36 void Munmap(void* addr, unsigned int len) override; | 39 void Munmap(void* addr, unsigned int len) override; |
37 bool Initialize() override; | |
38 std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( | 40 std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( |
39 int index, | 41 int index, |
40 size_t num_planes, | 42 size_t num_planes, |
41 enum v4l2_buf_type type) override; | 43 enum v4l2_buf_type buf_type) override; |
42 bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) override; | 44 bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) override; |
43 EGLImageKHR CreateEGLImage( | 45 EGLImageKHR CreateEGLImage( |
44 EGLDisplay egl_display, | 46 EGLDisplay egl_display, |
45 EGLContext egl_context, | 47 EGLContext egl_context, |
46 GLuint texture_id, | 48 GLuint texture_id, |
47 const gfx::Size& size, | 49 const gfx::Size& size, |
48 unsigned int buffer_index, | 50 unsigned int buffer_index, |
49 uint32_t v4l2_pixfmt, | 51 uint32_t v4l2_pixfmt, |
50 const std::vector<base::ScopedFD>& dmabuf_fds) override; | 52 const std::vector<base::ScopedFD>& dmabuf_fds) override; |
51 EGLBoolean DestroyEGLImage(EGLDisplay egl_display, | 53 EGLBoolean DestroyEGLImage(EGLDisplay egl_display, |
52 EGLImageKHR egl_image) override; | 54 EGLImageKHR egl_image) override; |
53 GLenum GetTextureTarget() override; | 55 GLenum GetTextureTarget() override; |
54 uint32_t PreferredInputFormat() override; | 56 uint32_t PreferredInputFormat(Type type) override; |
57 | |
58 std::vector<uint32_t> GetSupportedImageProcessorPixelformats( | |
59 v4l2_buf_type buf_type) override; | |
60 | |
61 VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( | |
62 const size_t num_formats, | |
63 const uint32_t pixelformats[]) override; | |
64 | |
65 VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles() | |
66 override; | |
67 | |
68 bool IsImageProcessingSupported() override; | |
69 | |
70 bool IsJpegDecodingSupported() override; | |
55 | 71 |
56 private: | 72 private: |
57 ~TegraV4L2Device() override; | 73 ~TegraV4L2Device() override; |
58 | 74 |
75 bool OpenInternal(Type type); | |
76 | |
59 // The actual device fd. | 77 // The actual device fd. |
60 int device_fd_; | 78 int device_fd_ = -1; |
61 | 79 |
62 DISALLOW_COPY_AND_ASSIGN(TegraV4L2Device); | 80 DISALLOW_COPY_AND_ASSIGN(TegraV4L2Device); |
63 }; | 81 }; |
64 | 82 |
65 } // namespace media | 83 } // namespace media |
66 | 84 |
67 #endif // MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ | 85 #endif // MEDIA_GPU_TEGRA_V4L2_DEVICE_H_ |
OLD | NEW |