Chromium Code Reviews| Index: content/common/gpu/media/v4l2_video_decode_accelerator.cc |
| diff --git a/content/common/gpu/media/v4l2_video_decode_accelerator.cc b/content/common/gpu/media/v4l2_video_decode_accelerator.cc |
| index 41b11e3064f3b7c65999bd72538e45c521b586d4..86dd9729643799395a49b95b7078d66d81e5211d 100644 |
| --- a/content/common/gpu/media/v4l2_video_decode_accelerator.cc |
| +++ b/content/common/gpu/media/v4l2_video_decode_accelerator.cc |
| @@ -206,6 +206,47 @@ V4L2VideoDecodeAccelerator::~V4L2VideoDecodeAccelerator() { |
| DCHECK(output_buffer_map_.empty()); |
| } |
| +// static |
| +std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| +V4L2VideoDecodeAccelerator::GetSupportedProfiles() { |
|
wuchengli
2015/03/19 06:19:25
Move this after CanDecodeOnIOThread to be consiste
henryhsu
2015/03/19 10:00:32
Done.
|
| + std::vector<SupportedProfile> profiles; |
| + scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| + if (!device) |
| + return profiles; |
| + |
| + SupportedProfile profile; |
| + profile.min_resolution.SetSize(16, 16); |
| + // NOTE: additional autodetection logic may require updating input buffer size |
| + // selection. |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode)) |
| + profile.max_resolution.SetSize(4096, 2160); |
| + else |
| + profile.max_resolution.SetSize(1920, 1088); |
| + |
| + v4l2_fmtdesc fmtdesc; |
| + memset(&fmtdesc, 0, sizeof(fmtdesc)); |
| + fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| + for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { |
| + switch (fmtdesc.pixelformat) { |
| + case V4L2_PIX_FMT_H264: |
| + profile.profile = media::H264PROFILE_MAIN; |
| + profiles.push_back(profile); |
| + break; |
| + case V4L2_PIX_FMT_VP8: |
| + profile.profile = media::VP8PROFILE_ANY; |
| + profiles.push_back(profile); |
| + break; |
| + case V4L2_PIX_FMT_VP9: |
| + profile.profile = media::VP9PROFILE_ANY; |
| + profiles.push_back(profile); |
| + break; |
| + } |
| + } |
| + |
| + return profiles; |
| +} |
| + |
| bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| Client* client) { |
| DVLOG(3) << "Initialize()"; |