Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: content/common/gpu/media/v4l2_video_device.h

Issue 839523002: V4L2VDA: Generalize EGLImage import and query driver for output formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/base/video_decoder_config.h" 12 #include "media/base/video_decoder_config.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 #include "ui/gl/gl_bindings.h" 15 #include "ui/gl/gl_bindings.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class V4L2Device { 19 class V4L2Device {
20 public: 20 public:
21 // Utility format conversion functions 21 // Utility format conversion functions
22 static media::VideoFrame::Format V4L2PixFmtToVideoFrameFormat(uint32 format); 22 static media::VideoFrame::Format V4L2PixFmtToVideoFrameFormat(uint32 format);
23 static uint32 VideoFrameFormatToV4L2PixFmt(media::VideoFrame::Format format); 23 static uint32 VideoFrameFormatToV4L2PixFmt(media::VideoFrame::Format format);
24 static uint32 VideoCodecProfileToV4L2PixFmt(media::VideoCodecProfile profile); 24 static uint32 VideoCodecProfileToV4L2PixFmt(media::VideoCodecProfile profile);
25 static uint32_t V4L2PixFmtToDrmFormat(uint32_t format);
25 // Convert format requirements requested by a V4L2 device to gfx::Size. 26 // Convert format requirements requested by a V4L2 device to gfx::Size.
26 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); 27 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format);
27 28
28 virtual ~V4L2Device(); 29 virtual ~V4L2Device();
29 30
30 enum Type { 31 enum Type {
31 kDecoder, 32 kDecoder,
32 kEncoder, 33 kEncoder,
33 kImageProcessor, 34 kImageProcessor,
34 }; 35 };
(...skipping 29 matching lines...) Expand all
64 unsigned int len, 65 unsigned int len,
65 int prot, 66 int prot,
66 int flags, 67 int flags,
67 unsigned int offset) = 0; 68 unsigned int offset) = 0;
68 virtual void Munmap(void* addr, unsigned int len) = 0; 69 virtual void Munmap(void* addr, unsigned int len) = 0;
69 70
70 // Initializes the V4L2Device to operate as a device of |type|. 71 // Initializes the V4L2Device to operate as a device of |type|.
71 // Returns true on success. 72 // Returns true on success.
72 virtual bool Initialize() = 0; 73 virtual bool Initialize() = 0;
73 74
75 // Return true if the given V4L2 pixfmt can be used in CreateEGLImage()
76 // for the current platform.
77 virtual bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) = 0;
78
74 // Creates an EGLImageKHR since each V4L2Device may use a different method of 79 // Creates an EGLImageKHR since each V4L2Device may use a different method of
75 // acquiring one and associating it to the given texture. The texture_id is 80 // acquiring one and associating it to the given texture. The texture_id is
76 // used to bind the texture to the returned EGLImageKHR. buffer_index can be 81 // used to bind the texture to the returned EGLImageKHR. buffer_index can be
77 // used to associate the returned EGLImageKHR by the underlying V4L2Device 82 // used to associate the returned EGLImageKHR by the underlying V4L2Device
78 // implementation. 83 // implementation.
79 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, 84 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display,
80 EGLContext egl_context, 85 EGLContext egl_context,
81 GLuint texture_id, 86 GLuint texture_id,
82 gfx::Size frame_buffer_size, 87 gfx::Size frame_buffer_size,
83 unsigned int buffer_index, 88 unsigned int buffer_index,
84 size_t planes_count) = 0; 89 uint32_t v4l2_pixfmt,
90 size_t num_v4l2_planes) = 0;
85 91
86 // Destroys the EGLImageKHR. 92 // Destroys the EGLImageKHR.
87 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, 93 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display,
88 EGLImageKHR egl_image) = 0; 94 EGLImageKHR egl_image) = 0;
89 95
90 // Returns the supported texture target for the V4L2Device. 96 // Returns the supported texture target for the V4L2Device.
91 virtual GLenum GetTextureTarget() = 0; 97 virtual GLenum GetTextureTarget() = 0;
92 98
93 // Returns the preferred V4L2 input format or 0 if don't care. 99 // Returns the preferred V4L2 input format or 0 if don't care.
94 virtual uint32 PreferredInputFormat() = 0; 100 virtual uint32 PreferredInputFormat() = 0;
95
96 // Returns the preferred V4L2 output format or 0 if don't care.
97 virtual uint32 PreferredOutputFormat() = 0;
98 }; 101 };
99 102
100 } // namespace content 103 } // namespace content
101 104
102 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_ 105 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698