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 MEDIA_GPU_V4L2_DEVICE_H_ | 9 #ifndef MEDIA_GPU_V4L2_DEVICE_H_ |
10 #define MEDIA_GPU_V4L2_DEVICE_H_ | 10 #define MEDIA_GPU_V4L2_DEVICE_H_ |
(...skipping 17 matching lines...) Expand all Loading... |
28 #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') | 28 #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') |
29 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') | 29 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') |
30 #define V4L2_PIX_FMT_MT21 v4l2_fourcc('M', 'T', '2', '1') | 30 #define V4L2_PIX_FMT_MT21 v4l2_fourcc('M', 'T', '2', '1') |
31 | 31 |
32 namespace media { | 32 namespace media { |
33 | 33 |
34 class MEDIA_GPU_EXPORT V4L2Device | 34 class MEDIA_GPU_EXPORT V4L2Device |
35 : public base::RefCountedThreadSafe<V4L2Device> { | 35 : public base::RefCountedThreadSafe<V4L2Device> { |
36 public: | 36 public: |
37 // Utility format conversion functions | 37 // Utility format conversion functions |
38 static media::VideoPixelFormat V4L2PixFmtToVideoPixelFormat(uint32_t format); | 38 static VideoPixelFormat V4L2PixFmtToVideoPixelFormat(uint32_t format); |
39 static uint32_t VideoPixelFormatToV4L2PixFmt(media::VideoPixelFormat format); | 39 static uint32_t VideoPixelFormatToV4L2PixFmt(VideoPixelFormat format); |
40 static uint32_t VideoCodecProfileToV4L2PixFmt( | 40 static uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, |
41 media::VideoCodecProfile profile, | 41 bool slice_based); |
42 bool slice_based); | |
43 static uint32_t V4L2PixFmtToDrmFormat(uint32_t format); | 42 static uint32_t V4L2PixFmtToDrmFormat(uint32_t format); |
44 // Convert format requirements requested by a V4L2 device to gfx::Size. | 43 // Convert format requirements requested by a V4L2 device to gfx::Size. |
45 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); | 44 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); |
46 | 45 |
47 enum Type { | 46 enum Type { |
48 kDecoder, | 47 kDecoder, |
49 kEncoder, | 48 kEncoder, |
50 kImageProcessor, | 49 kImageProcessor, |
51 kJpegDecoder, | 50 kJpegDecoder, |
52 }; | 51 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual uint32_t PreferredInputFormat() = 0; | 129 virtual uint32_t PreferredInputFormat() = 0; |
131 | 130 |
132 // Get minimum and maximum resolution for fourcc |pixelformat| and store to | 131 // Get minimum and maximum resolution for fourcc |pixelformat| and store to |
133 // |min_resolution| and |max_resolution|. | 132 // |min_resolution| and |max_resolution|. |
134 void GetSupportedResolution(uint32_t pixelformat, | 133 void GetSupportedResolution(uint32_t pixelformat, |
135 gfx::Size* min_resolution, | 134 gfx::Size* min_resolution, |
136 gfx::Size* max_resolution); | 135 gfx::Size* max_resolution); |
137 | 136 |
138 // Return supported profiles for decoder, including only profiles for given | 137 // Return supported profiles for decoder, including only profiles for given |
139 // fourcc |pixelformats|. | 138 // fourcc |pixelformats|. |
140 media::VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( | 139 VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( |
141 const size_t num_formats, | 140 const size_t num_formats, |
142 const uint32_t pixelformats[]); | 141 const uint32_t pixelformats[]); |
143 | 142 |
144 // Return true if the device supports |profile|, taking into account only | 143 // Return true if the device supports |profile|, taking into account only |
145 // fourccs from the given array of |pixelformats| of size |num_formats|. | 144 // fourccs from the given array of |pixelformats| of size |num_formats|. |
146 bool SupportsDecodeProfileForV4L2PixelFormats( | 145 bool SupportsDecodeProfileForV4L2PixelFormats(VideoCodecProfile profile, |
147 media::VideoCodecProfile profile, | 146 const size_t num_formats, |
148 const size_t num_formats, | 147 const uint32_t pixelformats[]); |
149 const uint32_t pixelformats[]); | |
150 | 148 |
151 protected: | 149 protected: |
152 friend class base::RefCountedThreadSafe<V4L2Device>; | 150 friend class base::RefCountedThreadSafe<V4L2Device>; |
153 explicit V4L2Device(Type type); | 151 explicit V4L2Device(Type type); |
154 virtual ~V4L2Device(); | 152 virtual ~V4L2Device(); |
155 | 153 |
156 const Type type_; | 154 const Type type_; |
157 }; | 155 }; |
158 | 156 |
159 } // namespace media | 157 } // namespace media |
160 | 158 |
161 #endif // MEDIA_GPU_V4L2_DEVICE_H_ | 159 #endif // MEDIA_GPU_V4L2_DEVICE_H_ |
OLD | NEW |