OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
7 #include <poll.h> | 7 #include <poll.h> |
8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2470 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 2470 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); |
2471 DCHECK_GT(picture_clearing_count_, 0); | 2471 DCHECK_GT(picture_clearing_count_, 0); |
2472 picture_clearing_count_--; | 2472 picture_clearing_count_--; |
2473 SendPictureReady(); | 2473 SendPictureReady(); |
2474 } | 2474 } |
2475 | 2475 |
2476 bool V4L2SliceVideoDecodeAccelerator::CanDecodeOnIOThread() { | 2476 bool V4L2SliceVideoDecodeAccelerator::CanDecodeOnIOThread() { |
2477 return true; | 2477 return true; |
2478 } | 2478 } |
2479 | 2479 |
2480 // static | |
2481 std::vector<media::VideoDecodeAccelerator::SupportedProfile> | |
2482 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | |
2483 std::vector<SupportedProfile> profiles; | |
2484 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
2485 if (!device) | |
2486 return profiles; | |
2487 | |
2488 SupportedProfile profile; | |
2489 profile.min_resolution.SetSize(16, 16); | |
2490 // NOTE: additional autodetection logic may require updating input buffer size | |
2491 // selection. | |
2492 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
2493 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode)) | |
2494 profile.max_resolution.SetSize(4096, 2160); | |
2495 else | |
2496 profile.max_resolution.SetSize(1920, 1088); | |
2497 | |
2498 v4l2_fmtdesc fmtdesc; | |
2499 memset(&fmtdesc, 0, sizeof(fmtdesc)); | |
2500 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | |
2501 for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { | |
2502 switch (fmtdesc.pixelformat) { | |
2503 case V4L2_PIX_FMT_H264_SLICE: | |
2504 profile.profile = media::H264PROFILE_MAIN; | |
Pawel Osciak
2015/03/26 08:36:40
We need more, at least:
H264PROFILE_BASELINE
H264P
henryhsu_tw
2015/03/26 09:38:34
Done.
| |
2505 profiles.push_back(profile); | |
2506 break; | |
2507 case V4L2_PIX_FMT_VP8_FRAME: | |
2508 profile.profile = media::VP8PROFILE_ANY; | |
2509 profiles.push_back(profile); | |
2510 break; | |
2511 } | |
2512 } | |
2513 | |
2514 return profiles; | |
2515 } | |
2516 | |
2480 } // namespace content | 2517 } // namespace content |
OLD | NEW |