| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (slice_based) | 91 if (slice_based) |
| 92 return V4L2_PIX_FMT_H264_SLICE; | 92 return V4L2_PIX_FMT_H264_SLICE; |
| 93 else | 93 else |
| 94 return V4L2_PIX_FMT_H264; | 94 return V4L2_PIX_FMT_H264; |
| 95 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { | 95 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { |
| 96 if (slice_based) | 96 if (slice_based) |
| 97 return V4L2_PIX_FMT_VP8_FRAME; | 97 return V4L2_PIX_FMT_VP8_FRAME; |
| 98 else | 98 else |
| 99 return V4L2_PIX_FMT_VP8; | 99 return V4L2_PIX_FMT_VP8; |
| 100 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { | 100 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { |
| 101 return V4L2_PIX_FMT_VP9; | 101 if (slice_based) |
| 102 return V4L2_PIX_FMT_VP9_FRAME; |
| 103 else |
| 104 return V4L2_PIX_FMT_VP9; |
| 102 } else { | 105 } else { |
| 103 LOG(FATAL) << "Add more cases as needed"; | 106 LOG(FATAL) << "Add more cases as needed"; |
| 104 return 0; | 107 return 0; |
| 105 } | 108 } |
| 106 } | 109 } |
| 107 | 110 |
| 108 // static | 111 // static |
| 109 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) { | 112 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) { |
| 110 switch (format) { | 113 switch (format) { |
| 111 case V4L2_PIX_FMT_NV12: | 114 case V4L2_PIX_FMT_NV12: |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 case V4L2_PIX_FMT_H264_SLICE: | 279 case V4L2_PIX_FMT_H264_SLICE: |
| 277 min_profile = H264PROFILE_MIN; | 280 min_profile = H264PROFILE_MIN; |
| 278 max_profile = H264PROFILE_MAX; | 281 max_profile = H264PROFILE_MAX; |
| 279 break; | 282 break; |
| 280 case V4L2_PIX_FMT_VP8: | 283 case V4L2_PIX_FMT_VP8: |
| 281 case V4L2_PIX_FMT_VP8_FRAME: | 284 case V4L2_PIX_FMT_VP8_FRAME: |
| 282 min_profile = VP8PROFILE_MIN; | 285 min_profile = VP8PROFILE_MIN; |
| 283 max_profile = VP8PROFILE_MAX; | 286 max_profile = VP8PROFILE_MAX; |
| 284 break; | 287 break; |
| 285 case V4L2_PIX_FMT_VP9: | 288 case V4L2_PIX_FMT_VP9: |
| 289 case V4L2_PIX_FMT_VP9_FRAME: |
| 286 min_profile = VP9PROFILE_MIN; | 290 min_profile = VP9PROFILE_MIN; |
| 287 max_profile = VP9PROFILE_MAX; | 291 max_profile = VP9PROFILE_MAX; |
| 288 break; | 292 break; |
| 289 default: | 293 default: |
| 290 NOTREACHED() << "Unhandled pixelformat " << std::hex | 294 NOTREACHED() << "Unhandled pixelformat " << std::hex |
| 291 << fmtdesc.pixelformat; | 295 << fmtdesc.pixelformat; |
| 292 return profiles; | 296 return profiles; |
| 293 } | 297 } |
| 294 GetSupportedResolution(fmtdesc.pixelformat, &profile.min_resolution, | 298 GetSupportedResolution(fmtdesc.pixelformat, &profile.min_resolution, |
| 295 &profile.max_resolution); | 299 &profile.max_resolution); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 315 const auto iter = std::find_if( | 319 const auto iter = std::find_if( |
| 316 supported_profiles.begin(), supported_profiles.end(), | 320 supported_profiles.begin(), supported_profiles.end(), |
| 317 [profile](const VideoDecodeAccelerator::SupportedProfile& p) { | 321 [profile](const VideoDecodeAccelerator::SupportedProfile& p) { |
| 318 return profile == p.profile; | 322 return profile == p.profile; |
| 319 }); | 323 }); |
| 320 | 324 |
| 321 return iter != supported_profiles.end(); | 325 return iter != supported_profiles.end(); |
| 322 } | 326 } |
| 323 | 327 |
| 324 } // namespace media | 328 } // namespace media |
| OLD | NEW |