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

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

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 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"
11 #include "content/common/gpu/media/generic_v4l2_device.h" 11 #include "media/gpu/generic_v4l2_device.h"
12 #if defined(ARCH_CPU_ARMEL) 12 #if defined(ARCH_CPU_ARMEL)
13 #include "content/common/gpu/media/tegra_v4l2_device.h" 13 #include "media/gpu/tegra_v4l2_device.h"
14 #endif 14 #endif
15 15
16 namespace content { 16 namespace media {
17 17
18 V4L2Device::V4L2Device(Type type) : type_(type) { 18 V4L2Device::V4L2Device(Type type) : type_(type) {}
19 }
20 19
21 V4L2Device::~V4L2Device() { 20 V4L2Device::~V4L2Device() {}
22 }
23 21
24 // static 22 // static
25 scoped_refptr<V4L2Device> V4L2Device::Create(Type type) { 23 scoped_refptr<V4L2Device> V4L2Device::Create(Type type) {
26 DVLOG(3) << __PRETTY_FUNCTION__; 24 DVLOG(3) << __PRETTY_FUNCTION__;
27 25
28 scoped_refptr<GenericV4L2Device> generic_device(new GenericV4L2Device(type)); 26 scoped_refptr<GenericV4L2Device> generic_device(new GenericV4L2Device(type));
29 if (generic_device->Initialize()) 27 if (generic_device->Initialize())
30 return generic_device; 28 return generic_device;
31 29
32 #if defined(ARCH_CPU_ARMEL) 30 #if defined(ARCH_CPU_ARMEL)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 default: 74 default:
77 LOG(FATAL) << "Add more cases as needed"; 75 LOG(FATAL) << "Add more cases as needed";
78 return 0; 76 return 0;
79 } 77 }
80 } 78 }
81 79
82 // static 80 // static
83 uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt( 81 uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(
84 media::VideoCodecProfile profile, 82 media::VideoCodecProfile profile,
85 bool slice_based) { 83 bool slice_based) {
86 if (profile >= media::H264PROFILE_MIN && 84 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) {
87 profile <= media::H264PROFILE_MAX) {
88 if (slice_based) 85 if (slice_based)
89 return V4L2_PIX_FMT_H264_SLICE; 86 return V4L2_PIX_FMT_H264_SLICE;
90 else 87 else
91 return V4L2_PIX_FMT_H264; 88 return V4L2_PIX_FMT_H264;
92 } else if (profile >= media::VP8PROFILE_MIN && 89 } else if (profile >= media::VP8PROFILE_MIN &&
93 profile <= media::VP8PROFILE_MAX) { 90 profile <= media::VP8PROFILE_MAX) {
94 if (slice_based) 91 if (slice_based)
95 return V4L2_PIX_FMT_VP8_FRAME; 92 return V4L2_PIX_FMT_VP8_FRAME;
96 else 93 else
97 return V4L2_PIX_FMT_VP8; 94 return V4L2_PIX_FMT_VP8;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 max_resolution->SetSize(frame_size.stepwise.max_width, 235 max_resolution->SetSize(frame_size.stepwise.max_width,
239 frame_size.stepwise.max_height); 236 frame_size.stepwise.max_height);
240 min_resolution->SetSize(frame_size.stepwise.min_width, 237 min_resolution->SetSize(frame_size.stepwise.min_width,
241 frame_size.stepwise.min_height); 238 frame_size.stepwise.min_height);
242 break; 239 break;
243 } 240 }
244 } 241 }
245 if (max_resolution->IsEmpty()) { 242 if (max_resolution->IsEmpty()) {
246 max_resolution->SetSize(1920, 1088); 243 max_resolution->SetSize(1920, 1088);
247 LOG(ERROR) << "GetSupportedResolution failed to get maximum resolution for " 244 LOG(ERROR) << "GetSupportedResolution failed to get maximum resolution for "
248 << "fourcc " << std::hex << pixelformat 245 << "fourcc " << std::hex << pixelformat << ", fall back to "
249 << ", fall back to " << max_resolution->ToString(); 246 << max_resolution->ToString();
250 } 247 }
251 if (min_resolution->IsEmpty()) { 248 if (min_resolution->IsEmpty()) {
252 min_resolution->SetSize(16, 16); 249 min_resolution->SetSize(16, 16);
253 LOG(ERROR) << "GetSupportedResolution failed to get minimum resolution for " 250 LOG(ERROR) << "GetSupportedResolution failed to get minimum resolution for "
254 << "fourcc " << std::hex << pixelformat 251 << "fourcc " << std::hex << pixelformat << ", fall back to "
255 << ", fall back to " << min_resolution->ToString(); 252 << min_resolution->ToString();
256 } 253 }
257 } 254 }
258 255
259 media::VideoDecodeAccelerator::SupportedProfiles 256 media::VideoDecodeAccelerator::SupportedProfiles
260 V4L2Device::GetSupportedDecodeProfiles(const size_t num_formats, 257 V4L2Device::GetSupportedDecodeProfiles(const size_t num_formats,
261 const uint32_t pixelformats[]) { 258 const uint32_t pixelformats[]) {
262 DCHECK_EQ(type_, kDecoder); 259 DCHECK_EQ(type_, kDecoder);
263 media::VideoDecodeAccelerator::SupportedProfiles profiles; 260 media::VideoDecodeAccelerator::SupportedProfiles profiles;
264 media::VideoDecodeAccelerator::SupportedProfile profile; 261 media::VideoDecodeAccelerator::SupportedProfile profile;
265 v4l2_fmtdesc fmtdesc; 262 v4l2_fmtdesc fmtdesc;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // Try to find requested profile among the returned supported_profiles. 311 // Try to find requested profile among the returned supported_profiles.
315 const auto iter = std::find_if( 312 const auto iter = std::find_if(
316 supported_profiles.begin(), supported_profiles.end(), 313 supported_profiles.begin(), supported_profiles.end(),
317 [profile](const media::VideoDecodeAccelerator::SupportedProfile& p) { 314 [profile](const media::VideoDecodeAccelerator::SupportedProfile& p) {
318 return profile == p.profile; 315 return profile == p.profile;
319 }); 316 });
320 317
321 return iter != supported_profiles.end(); 318 return iter != supported_profiles.end();
322 } 319 }
323 320
324 } // namespace content 321 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698