mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
Before adding more tests which will act on the vimc pipeline break out a common base from media_device_link_test.cpp which already acts on vimc. The new common base class will help reduce code duplication. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
36 lines
754 B
C++
36 lines
754 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright (C) 2019, Google Inc.
|
|
*
|
|
* media_device_test.cpp - libcamera media device test base class
|
|
*/
|
|
|
|
#include <iostream>
|
|
|
|
#include "media_device_test.h"
|
|
|
|
using namespace libcamera;
|
|
using namespace std;
|
|
|
|
int MediaDeviceTest::init()
|
|
{
|
|
enumerator_ = unique_ptr<DeviceEnumerator>(DeviceEnumerator::create());
|
|
if (!enumerator_) {
|
|
cerr << "Failed to create device enumerator" << endl;
|
|
return TestFail;
|
|
}
|
|
|
|
if (enumerator_->enumerate()) {
|
|
cerr << "Failed to enumerate media devices" << endl;
|
|
return TestFail;
|
|
}
|
|
|
|
DeviceMatch dm("vimc");
|
|
media_ = enumerator_->search(dm);
|
|
if (!media_) {
|
|
cerr << "No VIMC media device found: skip test" << endl;
|
|
return TestSkip;
|
|
}
|
|
|
|
return TestPass;
|
|
}
|