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 media::VideoDecodeAccelerator::SupportedProfiles |
| 2482 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
| 2483 SupportedProfiles 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 for (uint32 media_profile = media::H264PROFILE_MIN; |
| 2505 media_profile <= media::H264PROFILE_MAX; ++media_profile) { |
| 2506 profile.profile = |
| 2507 static_cast<media::VideoCodecProfile>(media_profile); |
| 2508 profiles.push_back(profile); |
| 2509 } |
| 2510 break; |
| 2511 case V4L2_PIX_FMT_VP8_FRAME: |
| 2512 profile.profile = media::VP8PROFILE_ANY; |
| 2513 profiles.push_back(profile); |
| 2514 break; |
| 2515 } |
| 2516 } |
| 2517 |
| 2518 return profiles; |
| 2519 } |
| 2520 |
2480 } // namespace content | 2521 } // namespace content |
OLD | NEW |