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 // This has to be included first. | 5 // This has to be included first. |
6 // See http://code.google.com/p/googletest/issues/detail?id=371 | 6 // See http://code.google.com/p/googletest/issues/detail?id=371 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ClientStateNotification<ClientState>* note) | 130 ClientStateNotification<ClientState>* note) |
131 : test_image_files_(test_image_files), state_(CS_CREATED), note_(note) {} | 131 : test_image_files_(test_image_files), state_(CS_CREATED), note_(note) {} |
132 | 132 |
133 JpegClient::~JpegClient() {} | 133 JpegClient::~JpegClient() {} |
134 | 134 |
135 void JpegClient::CreateJpegDecoder() { | 135 void JpegClient::CreateJpegDecoder() { |
136 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 136 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
137 decoder_.reset( | 137 decoder_.reset( |
138 new VaapiJpegDecodeAccelerator(base::ThreadTaskRunnerHandle::Get())); | 138 new VaapiJpegDecodeAccelerator(base::ThreadTaskRunnerHandle::Get())); |
139 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 139 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
140 scoped_refptr<V4L2Device> device = | 140 scoped_refptr<V4L2Device> device = V4L2Device::Create(); |
141 V4L2Device::Create(V4L2Device::kJpegDecoder); | |
142 if (!device.get()) { | 141 if (!device.get()) { |
143 LOG(ERROR) << "V4L2Device::Create failed"; | 142 LOG(ERROR) << "V4L2Device::Create failed"; |
144 SetState(CS_ERROR); | 143 SetState(CS_ERROR); |
145 return; | 144 return; |
146 } | 145 } |
147 decoder_.reset(new V4L2JpegDecodeAccelerator( | 146 decoder_.reset(new V4L2JpegDecodeAccelerator( |
148 device, base::ThreadTaskRunnerHandle::Get())); | 147 device, base::ThreadTaskRunnerHandle::Get())); |
149 #else | 148 #else |
150 #error The JpegDecodeAccelerator is not supported on this platform. | 149 #error The JpegDecodeAccelerator is not supported on this platform. |
151 #endif | 150 #endif |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 if (it->first == "jpeg_filenames") { | 554 if (it->first == "jpeg_filenames") { |
556 jpeg_filenames = it->second.c_str(); | 555 jpeg_filenames = it->second.c_str(); |
557 continue; | 556 continue; |
558 } | 557 } |
559 if (it->first == "save_to_file") { | 558 if (it->first == "save_to_file") { |
560 media::g_save_to_file = true; | 559 media::g_save_to_file = true; |
561 continue; | 560 continue; |
562 } | 561 } |
563 if (it->first == "v" || it->first == "vmodule") | 562 if (it->first == "v" || it->first == "vmodule") |
564 continue; | 563 continue; |
565 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 564 if (it->first == "h" || it->first == "help") |
| 565 continue; |
| 566 LOG(ERROR) << "Unexpected switch: " << it->first << ":" << it->second; |
| 567 return -EINVAL; |
566 } | 568 } |
567 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 569 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
568 media::VaapiWrapper::PreSandboxInitialization(); | 570 media::VaapiWrapper::PreSandboxInitialization(); |
569 #endif | 571 #endif |
570 | 572 |
571 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( | 573 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( |
572 testing::AddGlobalTestEnvironment( | 574 testing::AddGlobalTestEnvironment( |
573 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); | 575 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); |
574 | 576 |
575 return RUN_ALL_TESTS(); | 577 return RUN_ALL_TESTS(); |
576 } | 578 } |
OLD | NEW |