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

Side by Side Diff: content/common/gpu/media/v4l2_device.cc

Issue 1566533003: V4L2(S)VDA: Check if device handles profile for supported fourccs on init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 #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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 &profile.max_resolution); 295 &profile.max_resolution);
296 for (int media_profile = min_profile; media_profile <= max_profile; 296 for (int media_profile = min_profile; media_profile <= max_profile;
297 ++media_profile) { 297 ++media_profile) {
298 profile.profile = static_cast<media::VideoCodecProfile>(media_profile); 298 profile.profile = static_cast<media::VideoCodecProfile>(media_profile);
299 profiles.push_back(profile); 299 profiles.push_back(profile);
300 } 300 }
301 } 301 }
302 return profiles; 302 return profiles;
303 } 303 }
304 304
305 bool V4L2Device::SupportsDecodeProfileForV4L2PixelFormats(
306 media::VideoCodecProfile profile,
307 const size_t num_formats,
308 const uint32_t pixelformats[]) {
309 // Get all supported profiles by this device, taking into account only fourccs
310 // in pixelformats.
311 const auto supported_profiles =
312 GetSupportedDecodeProfiles(num_formats, pixelformats);
313
314 // Try to find requested profile among the returned supported_profiles.
315 const auto iter = std::find_if(
316 supported_profiles.begin(), supported_profiles.end(),
317 [profile](const media::VideoDecodeAccelerator::SupportedProfile& p) {
318 return profile == p.profile;
319 });
320
321 return iter != supported_profiles.end();
322 }
323
305 } // namespace content 324 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_device.h ('k') | content/common/gpu/media/v4l2_slice_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698