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 #include <libdrm/drm_fourcc.h> | 5 #include <libdrm/drm_fourcc.h> |
6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (slice_based) | 85 if (slice_based) |
86 return V4L2_PIX_FMT_H264_SLICE; | 86 return V4L2_PIX_FMT_H264_SLICE; |
87 else | 87 else |
88 return V4L2_PIX_FMT_H264; | 88 return V4L2_PIX_FMT_H264; |
89 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { | 89 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { |
90 if (slice_based) | 90 if (slice_based) |
91 return V4L2_PIX_FMT_VP8_FRAME; | 91 return V4L2_PIX_FMT_VP8_FRAME; |
92 else | 92 else |
93 return V4L2_PIX_FMT_VP8; | 93 return V4L2_PIX_FMT_VP8; |
94 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { | 94 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { |
95 return V4L2_PIX_FMT_VP9; | 95 if (slice_based) |
| 96 return V4L2_PIX_FMT_VP9_FRAME; |
| 97 else |
| 98 return V4L2_PIX_FMT_VP9; |
96 } else { | 99 } else { |
97 LOG(FATAL) << "Add more cases as needed"; | 100 LOG(FATAL) << "Add more cases as needed"; |
98 return 0; | 101 return 0; |
99 } | 102 } |
100 } | 103 } |
101 | 104 |
102 // static | 105 // static |
103 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) { | 106 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) { |
104 switch (format) { | 107 switch (format) { |
105 case V4L2_PIX_FMT_NV12: | 108 case V4L2_PIX_FMT_NV12: |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 case V4L2_PIX_FMT_H264_SLICE: | 270 case V4L2_PIX_FMT_H264_SLICE: |
268 min_profile = H264PROFILE_MIN; | 271 min_profile = H264PROFILE_MIN; |
269 max_profile = H264PROFILE_MAX; | 272 max_profile = H264PROFILE_MAX; |
270 break; | 273 break; |
271 case V4L2_PIX_FMT_VP8: | 274 case V4L2_PIX_FMT_VP8: |
272 case V4L2_PIX_FMT_VP8_FRAME: | 275 case V4L2_PIX_FMT_VP8_FRAME: |
273 min_profile = VP8PROFILE_MIN; | 276 min_profile = VP8PROFILE_MIN; |
274 max_profile = VP8PROFILE_MAX; | 277 max_profile = VP8PROFILE_MAX; |
275 break; | 278 break; |
276 case V4L2_PIX_FMT_VP9: | 279 case V4L2_PIX_FMT_VP9: |
| 280 case V4L2_PIX_FMT_VP9_FRAME: |
277 min_profile = VP9PROFILE_MIN; | 281 min_profile = VP9PROFILE_MIN; |
278 max_profile = VP9PROFILE_MAX; | 282 max_profile = VP9PROFILE_MAX; |
279 break; | 283 break; |
280 default: | 284 default: |
281 NOTREACHED() << "Unhandled pixelformat " << std::hex | 285 NOTREACHED() << "Unhandled pixelformat " << std::hex |
282 << fmtdesc.pixelformat; | 286 << fmtdesc.pixelformat; |
283 return profiles; | 287 return profiles; |
284 } | 288 } |
285 GetSupportedResolution(fmtdesc.pixelformat, &profile.min_resolution, | 289 GetSupportedResolution(fmtdesc.pixelformat, &profile.min_resolution, |
286 &profile.max_resolution); | 290 &profile.max_resolution); |
(...skipping 19 matching lines...) Expand all Loading... |
306 const auto iter = std::find_if( | 310 const auto iter = std::find_if( |
307 supported_profiles.begin(), supported_profiles.end(), | 311 supported_profiles.begin(), supported_profiles.end(), |
308 [profile](const VideoDecodeAccelerator::SupportedProfile& p) { | 312 [profile](const VideoDecodeAccelerator::SupportedProfile& p) { |
309 return profile == p.profile; | 313 return profile == p.profile; |
310 }); | 314 }); |
311 | 315 |
312 return iter != supported_profiles.end(); | 316 return iter != supported_profiles.end(); |
313 } | 317 } |
314 | 318 |
315 } // namespace media | 319 } // namespace media |
OLD | NEW |