Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "media/gpu/v4l2_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
| (...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2031 fmtdesc.pixelformat) != processor_input_formats.end()) { | 2031 fmtdesc.pixelformat) != processor_input_formats.end()) { |
| 2032 DVLOGF(1) << "Image processor input format=" << fmtdesc.pixelformat; | 2032 DVLOGF(1) << "Image processor input format=" << fmtdesc.pixelformat; |
| 2033 return fmtdesc.pixelformat; | 2033 return fmtdesc.pixelformat; |
| 2034 } | 2034 } |
| 2035 ++fmtdesc.index; | 2035 ++fmtdesc.index; |
| 2036 } | 2036 } |
| 2037 return 0; | 2037 return 0; |
| 2038 } | 2038 } |
| 2039 | 2039 |
| 2040 uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() { | 2040 uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() { |
| 2041 const uint32_t kPreferredEGLImageFormat = V4L2_PIX_FMT_YVU420; | |
|
kcwu
2016/08/19 06:27:33
could you add comment here or in commit log, why t
wuchengli
2016/08/21 08:14:42
Done.
| |
| 2041 V4L2ImageProcessor image_processor(image_processor_device_); | 2042 V4L2ImageProcessor image_processor(image_processor_device_); |
| 2042 std::vector<uint32_t> processor_output_formats = | 2043 std::vector<uint32_t> processor_output_formats = |
| 2043 image_processor.GetSupportedOutputFormats(); | 2044 image_processor.GetSupportedOutputFormats(); |
| 2045 | |
| 2046 // Move the preferred format to the front. | |
| 2047 std::vector<uint32_t>::iterator it = | |
|
kcwu
2016/08/19 06:27:33
how about use "auto" type?
wuchengli
2016/08/21 08:14:42
Done.
| |
| 2048 std::find(processor_output_formats.begin(), | |
| 2049 processor_output_formats.end(), kPreferredEGLImageFormat); | |
| 2050 if (it != processor_output_formats.end()) | |
| 2051 std::iter_swap(it, processor_output_formats.begin()); | |
| 2052 | |
| 2044 for (uint32_t processor_output_format : processor_output_formats) { | 2053 for (uint32_t processor_output_format : processor_output_formats) { |
| 2045 if (device_->CanCreateEGLImageFrom(processor_output_format)) { | 2054 if (device_->CanCreateEGLImageFrom(processor_output_format)) { |
| 2046 DVLOGF(1) << "Image processor output format=" << processor_output_format; | 2055 DVLOGF(1) << "Image processor output format=" << processor_output_format; |
| 2047 return processor_output_format; | 2056 return processor_output_format; |
| 2048 } | 2057 } |
| 2049 } | 2058 } |
| 2050 | 2059 |
| 2051 return 0; | 2060 return 0; |
| 2052 } | 2061 } |
| 2053 | 2062 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2271 Enqueue(); | 2280 Enqueue(); |
| 2272 } | 2281 } |
| 2273 } | 2282 } |
| 2274 | 2283 |
| 2275 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2284 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
| 2276 LOGF(ERROR) << "Image processor error"; | 2285 LOGF(ERROR) << "Image processor error"; |
| 2277 NOTIFY_ERROR(PLATFORM_FAILURE); | 2286 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 2278 } | 2287 } |
| 2279 | 2288 |
| 2280 } // namespace media | 2289 } // namespace media |
| OLD | NEW |